mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-09-30 03:54:37 +00:00
Rewrote GETHSR(), GETHSP(), GETVSR(), GETVSP()
This commit is contained in:
parent
f81f76eefb
commit
303263e915
@ -43,53 +43,58 @@ GETBYT: JSR SETADR ;Set Vera Address
|
|||||||
RTS
|
RTS
|
||||||
|
|
||||||
;getvsp() - Get Vertical Stop
|
;getvsp() - Get Vertical Stop
|
||||||
;Destroys: TEMP0
|
|
||||||
;Affects: A
|
;Affects: A
|
||||||
;Returns: Y,X = Vertical Stop
|
;Returns: Y,X = Vertical Stop
|
||||||
GETVSP: LDA #3 ;Set Lookup Index to Vertical Stop
|
GETVSP: LDA #7 ;Set Reg Offset to Vertical Stop
|
||||||
.DC $2C ;Skip to GETHVS (BIT Absolute)
|
JSR GETHVS ;Read Registers
|
||||||
|
LSR ;Shift Left One Bit
|
||||||
|
JMP GETVSS ;Then Four More Bits and Mask
|
||||||
|
|
||||||
;getvsr() - Get Vertical Start
|
;getvsr() - Get Vertical Start
|
||||||
;Destroys: TEMP0
|
|
||||||
;Affects: A
|
;Affects: A
|
||||||
;Returns: Y,X = Vertical Start
|
;Returns: Y,X = Vertical Start
|
||||||
GETVSR: LDA #2 ;Set Lookup Index to Vertical Start
|
GETVSR: LDA #6 ;Set Reg Offset to Vertical Start
|
||||||
.DC $2C ;Skip to GETHVS (BIT Absolute)
|
JSR GETHVS ;Read Registers
|
||||||
|
GETVSS: LSR ;Shift Left Four Bit
|
||||||
;gethsp() - Get Horizontal Stop
|
LSR
|
||||||
;Destroys: TEMP0
|
LSR
|
||||||
;Affects: A
|
LSR
|
||||||
;Returns: Y,X = Horizontal Start
|
AND #$01 ;Isolate Bit 0
|
||||||
GETHSP: LDA #1 ;Set Lookup Index to Horizontal Start
|
TAY ;and Copy MSB to Y
|
||||||
.DC $2C ;Skip to GETHVS (BIT Absolute)
|
RTS
|
||||||
|
|
||||||
|
;gethsp() - Get Horizontal Stop
|
||||||
|
;Affects: A
|
||||||
|
;Returns: Y,X = Horizontal Stop
|
||||||
|
GETHSP: LDA #5 ;Set Lookup Index to Horizontal Start
|
||||||
|
JSR GETHVS ;Read Registers
|
||||||
|
LSR ;Shift Left Two Bits
|
||||||
|
LSR
|
||||||
|
JMP GETHSS ;then Mask and Return
|
||||||
|
|
||||||
;gethsr() - Get Horizontal Start
|
;gethsr() - Get Horizontal Start
|
||||||
;Destroys: TEMP0
|
|
||||||
;Affects: A
|
;Affects: A
|
||||||
;Returns: Y,X = Horizontal Start
|
;Returns: Y,X = Horizontal Start
|
||||||
GETHSR: LDA #0 ;Set Lookup Index to Horizontal Start
|
GETHSR: LDA #4 ;Set Lookup Index to Horizontal Start
|
||||||
|
JSR GETHVS ;Read Registers
|
||||||
|
;.dc $ff ;debug
|
||||||
|
GETHSS: AND #$03 ;Isolate Bit 0
|
||||||
|
TAY ;and Copy MSB to Y
|
||||||
|
RTS
|
||||||
|
|
||||||
GETHVS: LDY GETHVM,X ;Get High Bits Mask
|
;gethvs() - Get Start/Stop Low Byte and High Bits
|
||||||
STY TEMP0 ;and Save It
|
;Args: X = Low Register
|
||||||
LDY GETHVO,X ;Get High Bits Rotation Count
|
;Affects: Y
|
||||||
.DC $5A ;PHY ;And Save it on Stack
|
;Returns: A = High Bits
|
||||||
ORA #4 ;Convert Index to Register Offset
|
; X = Low Byte
|
||||||
JSR GETDCR ;Read LSB from Register
|
GETHVS: JSR GETDCR ;Read LSB from Register
|
||||||
|
;.dc $ff ;debug
|
||||||
PHA ;and Save It
|
PHA ;and Save It
|
||||||
LDA #8 ;Load Register Offset for High Bits
|
LDA #8 ;Load Register Offset for High Bits
|
||||||
STA $9F20 ;Set As Address LSB
|
STA $9F20 ;Set As Address LSB
|
||||||
LDA $9F23,X ;and Read High Byte from Data Port
|
LDA $9F23,X ;and Read High Bits into A
|
||||||
AND TEMP0 ;and Isolate High Bits
|
.DC $FA ;PLX ;Restore LSB into X
|
||||||
.DC $FA ;PLX ;Restore LSB into X Register
|
|
||||||
.DC $7A ;PLY ;Restore Rotation Count into Y
|
|
||||||
BEQ GETHVY ;If Not Zero
|
|
||||||
GETHVR: LSR ;Shift Right One Bit
|
|
||||||
DEY ;Decrement Counter
|
|
||||||
BNE GETHVR ;and Loop if Not Zero
|
|
||||||
GETHVY: TYA ;Return MSB in Y Register
|
|
||||||
RTS
|
RTS
|
||||||
GETHVM: .DC $03,$C0,$10,$20
|
|
||||||
GETHVO: .DC 0,2,4,5
|
|
||||||
|
|
||||||
;getiql() - Get Interrupt Line
|
;getiql() - Get Interrupt Line
|
||||||
;Affects: A
|
;Affects: A
|
||||||
@ -130,6 +135,41 @@ GETINT: ORA #$10 ;Set Auto-Increment to 1
|
|||||||
TAX ;Copy LSB to X
|
TAX ;Copy LSB to X
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
;sethsr() - Get Horizontal Start
|
||||||
|
;Affects: A
|
||||||
|
;Returns: Y,X = Horizontal Start
|
||||||
|
SETHSR: TYA ;Convert MSB to High Bits
|
||||||
|
AND #$03
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
STA TEMP0 ;and Save
|
||||||
|
TXA ;Copy LSB to Accumlator
|
||||||
|
LDX #5 ;Set Register Offset to Horizontal Start
|
||||||
|
JSR SETHVS ;Write LSB and Get High Bits
|
||||||
|
AND #$F3 ;Mask Start Stop High
|
||||||
|
JMP SETHST ;OR in High Bits and Write Back
|
||||||
|
|
||||||
|
;sethsr() - Get Horizontal Start
|
||||||
|
;Affects: A
|
||||||
|
;Returns: Y,X = Horizontal Start
|
||||||
|
SETHSR: TYA ;Convert MSB to High Bits
|
||||||
|
AND #$03
|
||||||
|
STA TEMP0 ;and Save
|
||||||
|
TXA ;Copy LSB to Accumlator
|
||||||
|
LDX #4 ;Set Register Offset to Horizontal Start
|
||||||
|
JSR SETHVS ;Write LSB and Get High Bits
|
||||||
|
AND #$FC ;Mask Start Stop High
|
||||||
|
SETHST: ORA TEMP0 ;OR in High Bits
|
||||||
|
STA $9F23,X ;and Write back to Register
|
||||||
|
RTS
|
||||||
|
|
||||||
|
|
||||||
|
SETHVS: JSR SETDCX ;Write LSB
|
||||||
|
LDA #8 ;Load Register Offset for High Bits
|
||||||
|
STA $9F20 ;Set As Address LSB
|
||||||
|
LDA $9F23,X ;and Read High Bits into A
|
||||||
|
RTS
|
||||||
|
|
||||||
;setvid() - Set Video Output Mode
|
;setvid() - Set Video Output Mode
|
||||||
;Args: A = Video Mode
|
;Args: A = Video Mode
|
||||||
; Y = Chroma Disabled
|
; Y = Chroma Disabled
|
||||||
|
@ -32,10 +32,10 @@ void passed() {
|
|||||||
void prtayx(aa,yy,xx) {prhex(aa); prhex(yy); prhex(xx); putspc(); putspc();}
|
void prtayx(aa,yy,xx) {prhex(aa); prhex(yy); prhex(xx); putspc(); putspc();}
|
||||||
|
|
||||||
void prthvs() {
|
void prthvs() {
|
||||||
setdst(hstart);printf("HSTART=%w, ");
|
setdst(hstart);printf("HSTART=%w, "); //$0000
|
||||||
setdst(hstop);printf("HSTOP=%w, ");
|
setdst(hstop);printf("HSTOP=%w, "); //$0280 (640)
|
||||||
setdst(vstart);printf("VSTART=%w, ");
|
setdst(vstart);printf("VSTART=%w, "); //$0000
|
||||||
setdst(vstop);printf("VSTOP=%w%n");
|
setdst(vstop);printf("VSTOP=%w%n"); //$01E0 (480)
|
||||||
}
|
}
|
||||||
|
|
||||||
void prttmp() {
|
void prttmp() {
|
||||||
@ -110,7 +110,7 @@ main:
|
|||||||
} while (i);
|
} while (i);
|
||||||
passed();
|
passed();
|
||||||
|
|
||||||
putln("TESTING GETHST(), GETHSP()");
|
putln("TESTING GETHSR(), GETHSP(), GETVSR(), GETVSP()");
|
||||||
hstart = gethsr();
|
hstart = gethsr();
|
||||||
hstop = gethsp();
|
hstop = gethsp();
|
||||||
vstart = getvsr();
|
vstart = getvsr();
|
||||||
|
Loading…
Reference in New Issue
Block a user