diff --git a/games/peasant/hgr_2x16_sprite.s b/games/peasant/hgr_2x16_sprite.s new file mode 100644 index 00000000..115c99f1 --- /dev/null +++ b/games/peasant/hgr_2x16_sprite.s @@ -0,0 +1,44 @@ + ;====================== + ; hgr 2x16 draw sprite + ;====================== + ; Note: NOT TRANSPARENT + ; + ; SPRITE in INL/INH + ; Location at CURSOR_X*7 CURSOR_Y + ; X, Y, A trashed + +hgr_draw_sprite_2x16: + + ; set up pointers + lda INL + sta hds2_smc1+1 + lda INH + sta hds2_smc1+2 + + ldx #0 +hgr_2x16_sprite_yloop: + txa + pha + + clc + adc CURSOR_Y + + tax + lda hposn_low,X + sta GBASL + lda hposn_high,X + sta GBASH + + pla + tax + + ldy CURSOR_X +hds2_smc1: + lda $D000 + sta (GBASL),Y + + inx + cpx #16 + bne hgr_2x16_sprite_yloop + + rts diff --git a/games/peasant/inventory.s b/games/peasant/inventory.s index 2eaa41d5..31ef922d 100644 --- a/games/peasant/inventory.s +++ b/games/peasant/inventory.s @@ -180,9 +180,12 @@ handle_inv_keypress: and #$7f ; clear top bit cmp #27 - beq done_inv_keypress ; ESCAPE + beq urgh_done ; ESCAPE cmp #$7f - beq done_inv_keypress ; DELETE + bne inv_check_down ; DELETE + +urgh_done: + jmp done_inv_keypress inv_check_down: cmp #$0A @@ -269,6 +272,24 @@ inv_done_moving: ldy INVENTORY_Y jsr overwrite_entry + ;================ + ; draw item + +; ldy INVENTORY_Y + + lda #arrow_sprite + sta INH + + lda #18 + sta CURSOR_X + lda #88 + sta CURSOR_Y + + jsr hgr_draw_sprite_2x16 + + ;================ ; repeat @@ -711,3 +732,20 @@ overwite_char_smc: masks: .byte $01,$02,$04,$08, $10,$20,$40,$80 + + + +arrow_sprite: + .byte $00,$00,$00,$00,$00,$00,$00,$00 + .byte $00,$00,$00,$00,$00,$00,$00,$00 + .byte $00,$00,$00,$00,$00,$00,$00,$00 + .byte $00,$00,$00,$00,$00,$00,$00,$00 + +no_sprite: + .byte $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f + .byte $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f + .byte $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f + .byte $7f,$7f,$7f,$7f,$7f,$7f,$7f,$7f + + +.include "hgr_2x16_sprite.s" diff --git a/games/peasant/sprites/inventory.png b/games/peasant/sprites/inventory.png new file mode 100644 index 00000000..f56a1d2c Binary files /dev/null and b/games/peasant/sprites/inventory.png differ diff --git a/games/peasant/zp.inc b/games/peasant/zp.inc index 03f63759..7fbf4666 100644 --- a/games/peasant/zp.inc +++ b/games/peasant/zp.inc @@ -20,8 +20,7 @@ PEASANT_PRIORITY = $30 INVENTORY_MASK = $60 -INVENTORY_X = $61 -INVENTORY_Y = $62 +INVENTORY_Y = $61 CURSOR_X = $63 CURSOR_Y = $64