lemm: integrate vlin code

This commit is contained in:
Vince Weaver 2022-03-14 16:43:58 -04:00
parent ad103d2feb
commit 29bf0b06b8
4 changed files with 87 additions and 3 deletions

View File

@ -41,7 +41,7 @@ lemm.o: lemm.s zp.inc hardware.inc \
graphics/graphics_test.inc graphics/sprites.inc \
intro_level1.s update_time.s hgr_sprite.s draw_flames.s \
draw_door.s move_lemming.s draw_lemming.s \
hgr_hlin.s update_menu.s \
hgr_hlin.s hgr_vlin.s update_menu.s \
interrupt_handler.s keyboard.s draw_pointer.s \
pointer_sprites.inc \
level1.s

69
games/lemm/hgr_vlin.s Normal file
View File

@ -0,0 +1,69 @@
;=================================
; Simple Vertical LINE
;=================================
; line from (x,a) to (x,a+y)
; todo: use Carry to say if X>255
hgr_vlin:
; don't handle run of 0
cpy #0
beq done_hgr_vlin
; get initial ROW into (GBASL)
sta current_row_smc+1 ; save current A
; sty vlin_row_count
lda div7_table,X
sta x1_save_smc+1
and #$1 ; only shift if in odd column?
beq vlin_no_shift_colors
jsr shift_colors
vlin_no_shift_colors:
lda mod7_table,X
tax
lda vlin_masks,X
sta vlin_mask_smc+1
tya
tax ; get line count into X
hgr_vlin_loop:
current_row_smc:
ldy #$dd ; get row info for Y1 into GBASL/GBASH
lda hposn_high,Y
sta GBASH
lda hposn_low,Y
sta GBASL
x1_save_smc:
ldy #$dd
lda (GBASL),Y
eor HGR_BITS
vlin_mask_smc:
and #$dd
eor (GBASL),Y
sta (GBASL),Y
inc current_row_smc+1
; dec vlin_row_count
dex
bne hgr_vlin_loop
done_hgr_vlin:
rts
;vlin_row_count: .byte $00
vlin_masks:
.byte $81,$82,$84,$88,$90,$A0,$C0

View File

@ -273,6 +273,7 @@ load_song_chunk_good:
.include "draw_door.s"
.include "wait.s"
.include "hgr_hlin.s"
.include "hgr_vlin.s"
.include "update_menu.s"
; pt3 player

View File

@ -4,14 +4,28 @@ update_menu:
lda #7
jsr set_hcolor
lda #168
; two hlins
ldx #144
lda #168
ldy #15
jsr hgr_hlin ; (x,a) to (x+y,a)
lda #191
ldx #144
lda #191
ldy #15
jsr hgr_hlin ; (x,a) to (x+y,a)
; two vlins
ldx #144
lda #168
ldy #47
jsr hgr_vlin ; (x,a) to (x,a+y)
ldx #159
lda #168
ldy #47
jsr hgr_vlin ; (x,a) to (x,a+y)
rts