mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-29 21:31:53 +00:00
ootw: forgot a file
This commit is contained in:
parent
0a1f21cdb6
commit
891cea37b4
103
ootw/gr_overlay.s
Normal file
103
ootw/gr_overlay.s
Normal file
@ -0,0 +1,103 @@
|
||||
;=========================================================
|
||||
; gr_overlay, 40x48 version
|
||||
;=========================================================
|
||||
; copy 0xc00 to DRAW_PAGE
|
||||
; then overlay with 0x1000, treating 0xa as transparent
|
||||
|
||||
gr_overlay:
|
||||
jsr gr_copy_to_current
|
||||
|
||||
ldy #0
|
||||
lda #40
|
||||
sta CH ; xsize is in CH ; 3
|
||||
lda #46
|
||||
sta CV ; ysize is in CV ; 3
|
||||
|
||||
gr_overlay_loop:
|
||||
|
||||
ldy CV ; 3
|
||||
lda gr_offsets,Y ; lookup low-res memory address ; 4
|
||||
sta OUTL ; store out low byte of addy ; 3
|
||||
sta INL
|
||||
lda gr_offsets+1,Y ; look up high byte ; 4
|
||||
clc
|
||||
adc DRAW_PAGE ; ; 3
|
||||
sta OUTH ; and store it out ; 3
|
||||
|
||||
lda gr_offsets+1,Y ; look up high byte ; 4
|
||||
clc
|
||||
adc #$c ; force to start at $1000
|
||||
sta INH
|
||||
|
||||
; OUTH:OUTL now points at right place
|
||||
|
||||
ldx CH ; load xsize into x ; 3
|
||||
ldy #0
|
||||
gr_overlay_put_pixel:
|
||||
lda (INL),Y ; get sprite colors ; 5
|
||||
|
||||
; check if completely transparent
|
||||
; if so, skip
|
||||
|
||||
cmp #$aa ; if all zero, transparent ; 2
|
||||
beq gr_overlay_done_draw ; don't draw it ; 2nt/3
|
||||
|
||||
sta COLOR ; save color for later ; 3
|
||||
|
||||
; check if top pixel transparent
|
||||
|
||||
and #$f0 ; check if top nibble zero ; 2
|
||||
cmp #$a0
|
||||
bne gr_overlay_bottom ; if not skip ahead ; 2nt/3
|
||||
|
||||
lda COLOR
|
||||
and #$0f
|
||||
sta COLOR
|
||||
|
||||
lda #$f0 ; setup mask ; 2
|
||||
sta MASK ; 3
|
||||
bmi gr_overlay_mask ; always? ; 3
|
||||
|
||||
|
||||
gr_overlay_bottom:
|
||||
lda COLOR ; re-load color ; 3
|
||||
and #$0f ; check if bottom nibble zero ; 2
|
||||
cmp #$0a
|
||||
bne put_sprite_all ; if not, skip ahead ; 2nt/3
|
||||
;=============
|
||||
; 7/8
|
||||
|
||||
lda COLOR
|
||||
and #$f0
|
||||
sta COLOR
|
||||
lda #$0f ; 2
|
||||
sta MASK ; setup mask ; 3
|
||||
;===========
|
||||
; 5
|
||||
|
||||
gr_overlay_mask:
|
||||
lda (OUTL),Y ; get color at output ; 5
|
||||
and MASK ; mask off unneeded part ; 3
|
||||
ora COLOR ; or the color in ; 3
|
||||
sta (OUTL),Y ; store it back ; 6
|
||||
|
||||
jmp gr_overlay_done_draw ; we are done ; 3
|
||||
|
||||
put_sprite_all:
|
||||
lda COLOR ; load color ; 3
|
||||
sta (OUTL),Y ; and write it out ; 6
|
||||
|
||||
|
||||
gr_overlay_done_draw:
|
||||
iny
|
||||
dex ; decrement x counter ; 2
|
||||
bne gr_overlay_put_pixel ; if not done, keep looping ; 2nt/3
|
||||
|
||||
dec CV ; decemenet total y count ; 5
|
||||
dec CV
|
||||
bpl gr_overlay_loop ; loop if not done ; 2nt/3
|
||||
|
||||
|
||||
rts ; return ; 6
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user