dos33fsprogs/games/tfv/gr_hlin.s

134 lines
2.3 KiB
ArmAsm
Raw Normal View History

2021-02-10 18:16:52 +00:00
;=============================
; decently fast hlin routines
;=============================
; can also be used to print repeated text if desperate
2020-12-30 06:41:14 +00:00
;================================
2021-02-10 18:16:52 +00:00
; hlin_double:
2020-12-30 06:41:14 +00:00
;================================
2021-02-10 18:16:52 +00:00
; HLIN Y, V2 AT A
; color in COLOR
; GBASL/GBASH set to proper address
; A, Y trashed
; at end Y points to end of line
hlin_double:
inc V2 ; drawing inclusive
2020-12-30 06:41:14 +00:00
sty TEMPY ; 3
2021-02-10 18:16:52 +00:00
and #$fe ; make even ; 2
2020-12-30 06:41:14 +00:00
tay ; y=A ; 2
lda gr_offsets,Y ; lookup low-res memory address ; 4
sta GBASL ; 3
2021-02-10 18:16:52 +00:00
clc ; 2
lda gr_offsets+1,Y ; 4
2020-12-30 06:41:14 +00:00
adc DRAW_PAGE ; add in draw page offset ; 3
sta GBASH ; 3
;===========
2021-02-10 18:16:52 +00:00
; 26
2020-12-30 06:41:14 +00:00
2021-02-10 18:16:52 +00:00
lda COLOR ; 3
ldy TEMPY ; restore ; 3
hlin_double_loop:
sta (GBASL),Y ; 6
iny ; 2
cpy V2 ; 3
bne hlin_double_loop ; 2nt/3
2020-12-30 06:41:14 +00:00
2021-02-10 18:16:52 +00:00
rts ; 6
2020-12-30 06:41:14 +00:00
;=================================
; hlin_double_continue: width
;=================================
; GBASL has correct offset for row/col
2021-02-10 18:16:52 +00:00
; V2=start, width in X
; A, X, Y trashed
; V2=xcoord at end
2020-12-30 06:41:14 +00:00
hlin_double_continue:
2021-02-10 18:16:52 +00:00
txa
clc
adc V2
sta V2
2020-12-30 06:41:14 +00:00
lda COLOR ; 3
2021-02-10 18:16:52 +00:00
hlin_double_continue_loop:
2020-12-30 06:41:14 +00:00
sta (GBASL),Y ; 6
2021-02-10 18:16:52 +00:00
iny ; 2
cpy V2
bne hlin_double_continue_loop ; 2nt/3
2020-12-30 06:41:14 +00:00
rts ; 6
;=============
2021-02-10 18:16:52 +00:00
2020-12-30 06:41:14 +00:00
;================================
; hlin_single:
;================================
; HLIN Y, V2 AT A
2021-02-10 18:16:52 +00:00
; color in COLOR
; GBASL/GBASH set to proper address
; A, Y trashed
; at end Y points to end of line
2020-12-30 06:41:14 +00:00
; Y, X, A trashed
hlin_single:
2021-02-10 18:16:52 +00:00
inc V2 ; drawing inclusive
2020-12-30 06:41:14 +00:00
2021-02-10 18:16:52 +00:00
sty TEMPY ; 3
and #$fe ; make even ; 2
php ; save if zero ; 2
tay ; y=A ; 2
lda gr_offsets,Y ; lookup low-res memory address ; 4
sta GBASL ; 3
clc ; 2
lda gr_offsets+1,Y ; 4
adc DRAW_PAGE ; add in draw page offset ; 3
sta GBASH ; 3
;===========
; 28
2020-12-30 06:41:14 +00:00
2021-02-10 18:16:52 +00:00
plp ; restore if 0
beq hlin_single_bottom
2020-12-30 06:41:14 +00:00
hlin_single_top:
lda COLOR
and #$f0
sta COLOR
2021-02-10 18:16:52 +00:00
ldy TEMPY
2020-12-30 06:41:14 +00:00
hlin_single_top_loop:
lda (GBASL),Y
and #$0f
ora COLOR
sta (GBASL),Y
2021-02-10 18:16:52 +00:00
iny
cpy V2
2020-12-30 06:41:14 +00:00
bne hlin_single_top_loop
rts
hlin_single_bottom:
lda COLOR
and #$0f
sta COLOR
2021-02-10 18:16:52 +00:00
ldy TEMPY
2020-12-30 06:41:14 +00:00
hlin_single_bottom_loop:
lda (GBASL),Y
and #$f0
sta (GBASL),Y
2021-02-10 18:16:52 +00:00
iny
cpy V2
2020-12-30 06:41:14 +00:00
bne hlin_single_bottom_loop
rts