Post by mirkosoft on Jun 25, 2016 23:41:21 GMT
Hi!
I'm creating simple text output in true ASCII (few control characters are different).
Everybody knows PRIMM Kernal routine, I found its disassembly and customized, in case of output replaced BSOUT to own character output.
Control characters are not yet finished.
Moving cursor is correct, but PLOT routine retruned values always represents current screen - no matter if VIC or VDC...
After each pressing ESC+X is cursor placed to last location - simple rmembers it.
I found many locations where to get their columns and rows, but really don't understand at what point they're exchanging...
In case of C64 mode is easy to set coordinates to 211 and 214 addresses and call placing.
But really: it must to be easiest way to find last coordinates of both screens separatelly - where to get them? It is possible search in RAM and also in VDC registers, here is all what I found.
I understand not enough - there are processed get/set coordinates by hard way - why? I mean much easier is to find them separately in 4 addresses: 40X, 40Y, 80X, 80Y... if anybody fully understand it, please explain me it.
Here is all:
Thank you for help.
Miro
I'm creating simple text output in true ASCII (few control characters are different).
Everybody knows PRIMM Kernal routine, I found its disassembly and customized, in case of output replaced BSOUT to own character output.
Control characters are not yet finished.
Moving cursor is correct, but PLOT routine retruned values always represents current screen - no matter if VIC or VDC...
After each pressing ESC+X is cursor placed to last location - simple rmembers it.
I found many locations where to get their columns and rows, but really don't understand at what point they're exchanging...
In case of C64 mode is easy to set coordinates to 211 and 214 addresses and call placing.
But really: it must to be easiest way to find last coordinates of both screens separatelly - where to get them? It is possible search in RAM and also in VDC registers, here is all what I found.
I understand not enough - there are processed get/set coordinates by hard way - why? I mean much easier is to find them separately in 4 addresses: 40X, 40Y, 80X, 80Y... if anybody fully understand it, please explain me it.
Here is all:
$FF5F SWAPPER
; Esc-x Switch 40/80 Col
CD2C: 85 F0 STA $F0 ; Previous character printed (For <ESC> Test)
; Switch 40/80 Col
CD2E: A2 1A LDX #$1A
CD30: BC 40 0A LDY $0A40,X
CD33: B5 E0 LDA $E0,X ; Pointer to Current Line (Text)
CD35: 9D 40 0A STA $0A40,X
CD38: 98 TYA
CD39: 95 E0 STA $E0,X ; Pointer to Current Line (Text)
CD3B: CA DEX
CD3C: 10 F2 BPL $CD30
CD3E: A2 0D LDX #$0D
CD40: BC 60 0A LDY $0A60,X
CD43: BD 54 03 LDA $0354,X
CD46: 9D 60 0A STA $0A60,X
CD49: 98 TYA
CD4A: 9D 54 03 STA $0354,X
CD4D: CA DEX
CD4E: 10 F0 BPL $CD40
CD50: A5 D7 LDA $D7 ; 40 / 80 columns: 0 = 40, 128 = 80
CD52: 49 80 EOR #$80
CD54: 85 D7 STA $D7 ; 40 / 80 columns: 0 = 40, 128 = 80
CD56: 60 RTS
0019-0023 Stack for temporary strings
0a40-0a5a 40/80 Pointer Swap (to E0-FA)
00e0-00e1 Pointer to screen line / cursor
0a60-0a6d 40/80 Data Swap (0354-0361)
0354-035d Bitmap Of TAB Stops (10 Bytes)
00d7 40 / 80 columns: 0 = 40 column screen
; Read/Set Cursor
CC6A: B0 29 BCS $CC95
CC6C: 8A TXA
CC6D: 65 E5 ADC $E5 ; Window Upper Limit
CC6F: B0 14 BCS $CC85
CC71: C5 E4 CMP $E4 ; Window Lower Limit
CC73: F0 02 BEQ $CC77
CC75: B0 0E BCS $CC85
CC77: 48 PHA
CC78: 18 CLC
CC79: 98 TYA
CC7A: 65 E6 ADC $E6 ; Window Left Margin
CC7C: B0 06 BCS $CC84
CC7E: C5 E7 CMP $E7 ; Window Right Margin
CC80: F0 04 BEQ $CC86
CC82: 90 02 BCC $CC86
CC84: 68 PLA
CC85: 60 RTS
CC86: 85 EC STA $EC ; Current Cursor Column
CC88: 85 E9 STA $E9 ; Current Input Line Start
CC8A: 68 PLA
CC8B: 85 EB STA $EB ; Current Cursor Line
CC8D: 85 E8 STA $E8 ; Current Input Column Start
CC8F: 20 5C C1 JSR $C15C ; Set Up New Line
CC92: 20 57 CD JSR $CD57 ; Position 80-col Cursor
CC95: A5 EB LDA $EB ; Current Cursor Line
CC97: E5 E5 SBC $E5 ; Window Upper Limit
CC99: AA TAX
CC9A: 38 SEC
CC9B: A5 EC LDA $EC ; Current Cursor Column
CC9D: E5 E6 SBC $E6 ; Window Left Margin
CC9F: A8 TAY
CCA0: 18 CLC
CCA1: 60 RTS
CD56: 60 RTS
; Position 80-col Cursor
CD57: 24 D7 BIT $D7 ; 40 / 80 columns: 0 = 40, 128 = 80
CD59: 10 FB BPL $CD56
CD5B: A2 0E LDX #$0E
CD5D: 18 CLC
CD5E: A5 E0 LDA $E0 ; Pointer to Current Line (Text)
CD60: 65 EC ADC $EC ; Current Cursor Column
CD62: 48 PHA
CD63: A5 E1 LDA $E1 ; Pointer to Current Line high (Text)
CD65: 69 00 ADC #$00
CD67: 20 CC CD JSR $CDCC ; Set CRTC Register (VDC-W)
CD6A: E8 INX
CD6B: 68 PLA
CD6C: 4C CC CD JMP $CDCC ; Set CRTC Register (VDC-W)
; Set Up New Line
C15C: A6 EB LDX $EB ; Current Cursor Line
C15E: BD 33 C0 LDA $C033,X ; Screen Address Low
C161: 24 D7 BIT $D7 ; 40 / 80 columns: 0 = 40, 128 = 80
C163: 10 01 BPL $C166
C165: 0A ASL A
C166: 85 E0 STA $E0 ; Pointer to Current Line (Text)
C168: BD 4C C0 LDA $C04C,X ; Screen Address High
C16B: 29 03 AND #$03
C16D: 24 D7 BIT $D7 ; 40 / 80 columns: 0 = 40, 128 = 80
C16F: 10 06 BPL $C177
C171: 2A ROL A
C172: 0D 2E 0A ORA $0A2E ; VDC Text Screen Base address
C175: 90 03 BCC $C17A
C177: 0D 3B 0A ORA $0A3B ; VIC Text Screen Base address
C17A: 85 E1 STA $E1 ; Pointer to Current Line high (Text)
; Do Screen Color
C17C: A5 E0 LDA $E0 ; Pointer to Current Line (Text)
C17E: 85 E2 STA $E2 ; Pointer to Current Line (Attribute)
C180: A5 E1 LDA $E1 ; Pointer to Current Line high (Text)
C182: 24 D7 BIT $D7 ; 40 / 80 columns: 0 = 40, 128 = 80
C184: 10 07 BPL $C18D
C186: 29 07 AND #$07
C188: 0D 2F 0A ORA $0A2F ; VDC Attribute Base address
C18B: D0 04 BNE $C191
C18D: 29 03 AND #$03
C18F: 09 D8 ORA #$D8
C191: 85 E3 STA $E3 ; Pointer to Current Line high (Attribute)
C193: 60 RTS
$D7 215 40/80 column screen flag (BMI/128=80)
$E0 224 Pointer to Current Line (Text)
$E1 225 Pointer to Current Line high (Text)
$E2 226 Pointer to Current Line (Attribute)
$E3 227 Pointer to Current Line high (Attribute)
$E4 228 window lower limit
$E5 229 window upper limit
$E6 230 window left margin
$E7 231 window right margin
$E8 232 Current Input Column Start
$E9 233 Current Input Line Start
$EA 234 End-of-line for input pointer
$EB 235 cursor row
$EC 236 cursor column
$ED 237 max screen rows
$EE 238 max screen columns
$0A2E 2606 VDC Text Screen Base address
$0A3B 2619 VIC Text Screen Base address; Hi byte:Start Address Of VIC Screen (Use W/VMI to move screen)
0a2e-0a2f 80-Col Pages-Screen, Color
00e0-00e1 Pointer to screen line / cursor
00e2-00e3 Color line pointer
00e4 Current screen bottom margin
00e5 Current screen top margin
00e6 Current screen left margin
00e7 Current screen right margin
00e8-00e9 Input cursor log (row, column)
00ea End-of-line for input pointer
00eb Row where cursor lives
00ec Position of cursor on screen line
00ed Maximum screen lines (24)
00ee Maximum screen columns (39)
VDC Registers
$0E (R/W) CP Cursor Address (A15-A8)
$0F (R/W) CP Cursor Address (A7-A0)
Thank you for help.
Miro
154