dos33fsprogs/pt3_player/gr_putsprite.s

103 lines
2.1 KiB
ArmAsm
Raw Normal View History

;=============================================
; put_sprite_one_color_no_transparent
;=============================================
; Sprite to display in INH,INL
; Location is XPOS,YPOS
; Note, only works if YPOS is multiple of two
; This is a fast sprite with no transparency and assumes
; only black/white sprite. Can change color by setting the
; sprite_color_smc+1 value
put_sprite:
ldy #0 ; byte 0 is xsize ; 2
lda (INL),Y ; 5
sta CH ; xsize is in CH ; 3
iny ; 2
lda (INL),Y ; byte 1 is ysize ; 5
sta CV ; ysize is in CV ; 3
iny ; 2
2019-06-01 04:00:40 +00:00
ldx YPOS ; make a copy of ypos ; 3
;===========
2019-06-01 04:00:40 +00:00
; 25
put_sprite_loop:
2019-06-08 01:35:42 +00:00
stx put_sprite_loop_smc+1 ; as we modify it ; 4
2019-06-01 04:00:40 +00:00
lda gr_offsets,X ; lookup low-res memory address ; 4
clc ; 2
adc XPOS ; add in xpos ; 3
sta OUTL ; store out low byte of addy ; 3
2019-06-01 04:00:40 +00:00
lda gr_offsets+1,X ; look up high byte ; 4
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
; OUTH:OUTL now points at right place
ldx CH ; load xsize into x ; 3
;===========
2019-06-01 04:00:40 +00:00
; 28
put_sprite_pixel:
lda (INL),Y ; get sprite colors ; 5
iny ; increment sprite pointer ; 2
2019-06-08 01:35:42 +00:00
sty put_sprite_pixel_smc+1 ; save sprite pointer ; 4
sprite_color_smc:
and #$ff
; cmp #$00
; beq sprite_output
; cmp #$ff
; bne not_ff
;sprite_color_ff_smc:
; lda #$ff
; jmp sprite_output
;not_ff:
; cmp #$f0
; bne not_f0
;sprite_color_f0_smc:
; lda #$f0
; jmp sprite_output
;not_f0:
;sprite_color_0f_smc:
; lda #$0f
;sprite_output:
ldy #$0 ; 2
sta (OUTL),Y ; and write it out ; 6
;============
; 9
put_sprite_done_draw:
2019-06-08 01:35:42 +00:00
put_sprite_pixel_smc:
ldy #$d1 ; restore sprite pointer ; 2
inc OUTL ; increment output pointer ; 5
dex ; decrement x counter ; 2
bne put_sprite_pixel ; if not done, keep looping ; 2nt/3
;==============
; 12/13
2019-06-08 01:35:42 +00:00
put_sprite_loop_smc:
ldx #$d1 ; 2
2019-06-01 04:00:40 +00:00
inx ; each line has two y vars ; 2
inx ; 2
dec CV ; decemenet total y count ; 5
bne put_sprite_loop ; loop if not done ; 2nt/3
;==============
2019-06-01 04:00:40 +00:00
; 14/15
rts ; return ; 6