From 4f6f22391a5e7e41f2ebf4299ea6538921ad7a03 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 31 Aug 2021 15:46:22 -0400 Subject: [PATCH] peasant: more work on inventory --- games/peasant/intro.s | 3 +++ games/peasant/inventory.s | 24 +++++++++++++++++++ games/peasant/zp.inc | 49 ++++++++++++++++++++++++--------------- 3 files changed, 57 insertions(+), 19 deletions(-) diff --git a/games/peasant/intro.s b/games/peasant/intro.s index bb60590f..35416e9a 100644 --- a/games/peasant/intro.s +++ b/games/peasant/intro.s @@ -129,6 +129,9 @@ escape_handler: lda #1 sta MAP_Y + lda #$AA + sta INVENTORY_1 + rts diff --git a/games/peasant/inventory.s b/games/peasant/inventory.s index e4840a45..db9b01ac 100644 --- a/games/peasant/inventory.s +++ b/games/peasant/inventory.s @@ -5,6 +5,10 @@ ;===================== show_inventory: + lda #0 + sta INVENTORY_X + sta INVENTORY_Y + ;==================== ; draw text box @@ -36,12 +40,15 @@ show_inventory: jsr disp_put_string + ;=============== ; left column lda #28 sta CURSOR_Y ldy #0 + lda #1 + sta INVENTORY_MASK left_column_loop: lda #4 @@ -50,12 +57,25 @@ left_column_loop: tya pha + lda INVENTORY_MASK + and INVENTORY_1 + beq left_questionmarks + +left_have_item: clc lda left_item_offsets,Y adc #item_strings + jmp left_print_item + +left_questionmarks: + lda #unknown_string + +left_print_item: sta OUTH jsr disp_one_line @@ -65,6 +85,8 @@ left_column_loop: adc #8 sta CURSOR_Y + asl INVENTORY_MASK + pla tay iny @@ -74,6 +96,8 @@ left_column_loop: ; extra for riches + + ;================ ; right column diff --git a/games/peasant/zp.inc b/games/peasant/zp.inc index 1841312b..1ebfa418 100644 --- a/games/peasant/zp.inc +++ b/games/peasant/zp.inc @@ -17,13 +17,12 @@ MASK = $2E MASK_COUNTDOWN = $2F PEASANT_PRIORITY = $30 -PEASANT_X = $60 -PEASANT_Y = $61 -PEASANT_DIR = $62 - PEASANT_DIR_UP = 0 - PEASANT_DIR_RIGHT = 1 - PEASANT_DIR_LEFT = 2 - PEASANT_DIR_DOWN = 3 + + +INVENTORY_MASK = $60 +INVENTORY_X = $61 +INVENTORY_Y = $62 + CURSOR_X = $63 CURSOR_Y = $64 FRAME = $65 @@ -36,9 +35,7 @@ PEASANT_YADD = $6B GAME_OVER = $6C NEW_LOCATION = $FF NEW_FROM_DISK = $01 -MAP_X = $6D -MAP_Y = $6E -MAP_LOCATION = $6F + ; pt3 player registers AY_REGISTERS = $70 @@ -77,7 +74,21 @@ DONE_SONG = $8B APPLEII_MODEL = $8C ESC_PRESSED = $8D -GAME_STATE_0 = $90 +;======================= +; savegame state +;======================= +PEASANT_X = $90 +PEASANT_Y = $91 +PEASANT_DIR = $92 + PEASANT_DIR_UP = 0 + PEASANT_DIR_RIGHT = 1 + PEASANT_DIR_LEFT = 2 + PEASANT_DIR_DOWN = 3 +MAP_X = $93 +MAP_Y = $94 +MAP_LOCATION = $95 + +GAME_STATE_0 = $96 BABY_IN_WELL=$00 TURN_WELL_CRANK=$00 TALK_TO_MENDELEV=$00 @@ -126,14 +137,14 @@ INVENTORY_1 = $A0 INV1_PILLS = $80 INVENTORY_2 = $A1 - INV2_ROBE = $02 - INV2_SODA = $04 - INV2_MEATBALL = $08 - INV2_TRINKET = $10 - INV2_TROGHELM = $20 - INV2_TROGSHIELD = $40 - INV2_TROGSWORD = $80 - INV2_IMPOSSIBLE = $01 + INV2_ROBE = $01 + INV2_SODA = $02 + INV2_MEATBALL = $04 + INV2_TRINKET = $08 + INV2_TROGHELM = $10 + INV2_TROGSHIELD = $20 + INV2_TROGSWORD = $40 + INV2_IMPOSSIBLE = $80 INVENTORY_3 = $A2 INV3_RICHES = $01