47 lines
841 B
ArmAsm
Raw Normal View History

2021-01-06 14:00:59 -05:00
;================================
; scrn routine
;================================
; Xcoord in XPOS
; Ycoord in YPOS
; color returned in A
; assume reading from $c00
scrn:
2021-01-06 14:21:51 -05:00
lda YPOS ; 3
2021-01-06 14:00:59 -05:00
2021-01-06 14:21:51 -05:00
and #$fe ; make even ; 2
tay ; 2
2021-01-06 14:00:59 -05:00
lda gr_offsets,Y ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; 3
sta GBASL ; 3
lda gr_offsets+1,Y ; 4
adc #$8 ; assume reading from $c0 ; 3
sta GBASH ; 3
2021-01-06 14:21:51 -05:00
ldy #0 ; 2
2021-01-06 14:00:59 -05:00
2021-01-06 14:21:51 -05:00
lda YPOS ; 3
lsr ; 2
bcs scrn_adjust_even ;2nt/3t
2021-01-06 14:00:59 -05:00
scrn_adjust_odd:
2021-01-06 14:21:51 -05:00
lda (GBASL),Y ; top/bottom color ; 5+
jmp scrn_done ; 3
2021-01-06 14:00:59 -05:00
scrn_adjust_even:
2021-01-06 14:21:51 -05:00
lda (GBASL),Y ; top/bottom color ; 5+
2021-01-06 14:00:59 -05:00
2021-01-06 14:21:51 -05:00
lsr ; 2
lsr ; 2
lsr ; 2
lsr ; 2
2021-01-06 14:00:59 -05:00
scrn_done:
2021-01-06 14:21:51 -05:00
and #$f ; 2
2021-01-06 14:00:59 -05:00
2021-01-06 14:21:51 -05:00
rts ; 6