From c59fa6c0e4097bb6c38f617e8a4209219738f825 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 20 Oct 2021 23:54:09 -0400 Subject: [PATCH] peasant: load parse_input high have the actual compressed strings loaded by each individual section --- games/peasant/Makefile | 47 ++++++++++++++++++++------------ games/peasant/NOTES | 6 ++-- games/peasant/cliff.s | 3 +- games/peasant/copy_check.s | 2 +- games/peasant/new_game.s | 8 +++--- games/peasant/parse_input.s | 10 +++---- games/peasant/peasant1.s | 4 +-- games/peasant/peasant2.s | 20 ++++++++++++-- games/peasant/peasant2_actions.s | 2 +- games/peasant/peasant3.s | 3 +- games/peasant/peasant4.s | 3 +- games/peasant/qload.s | 10 +++---- games/peasant/zp.inc | 2 +- linker_scripts/apple2_ee00.inc | 12 ++++++++ 14 files changed, 88 insertions(+), 44 deletions(-) create mode 100644 linker_scripts/apple2_ee00.inc diff --git a/games/peasant/Makefile b/games/peasant/Makefile index 8f4acf0e..08294748 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -11,7 +11,7 @@ all: peasant.dsk peasant_side2.dsk peasant.dsk: QBOOT QLOAD VID_LOGO TITLE INTRO \ PEASANT1 PEASANT2 PEASANT3 PEASANT4 ENDING TROGDOR \ - SAVE1 SAVE2 SAVE3 MUSIC INVENTORY DIALOG_PEASANT2.LZSA + SAVE1 SAVE2 SAVE3 MUSIC INVENTORY PARSE_INPUT.LZSA cp $(EMPTY_DISK)/empty.dsk peasant.dsk $(DOS33_RAW) peasant.dsk 0 0 QBOOT 0 1 $(DOS33_RAW) peasant.dsk 0 2 QBOOT 1 1 @@ -24,7 +24,7 @@ peasant.dsk: QBOOT QLOAD VID_LOGO TITLE INTRO \ $(DOS33_RAW) peasant.dsk 4 0 VID_LOGO 0 0 $(DOS33_RAW) peasant.dsk 6 0 TITLE 0 0 $(DOS33_RAW) peasant.dsk 9 0 INTRO 0 0 - $(DOS33_RAW) peasant.dsk 13 0 DIALOG_PEASANT2.LZSA 0 0 + $(DOS33_RAW) peasant.dsk 13 0 PARSE_INPUT.LZSA 0 0 $(DOS33_RAW) peasant.dsk 14 0 INVENTORY 0 0 $(DOS33_RAW) peasant.dsk 15 0 PEASANT1 0 0 $(DOS33_RAW) peasant.dsk 20 0 PEASANT2 0 0 @@ -262,7 +262,8 @@ game_over.o: game_over.s zp.inc \ PEASANT1: peasant1.o ld65 -o PEASANT1 peasant1.o -C $(LINKER_SCRIPTS)/apple2_6000.inc -peasant1.o: peasant1.s zp.inc inventory.inc dialog_peasant2.inc \ +peasant1.o: peasant1.s zp.inc inventory.inc parse_input.inc \ + dialog_peasant2.inc \ sprites/peasant_sprites.inc sprites/inventory_sprites.inc \ graphics_peasantry/graphics_peasant1.inc \ graphics_peasantry/priority_peasant1.inc \ @@ -279,6 +280,7 @@ PEASANT2: peasant2.o ld65 -o PEASANT2 peasant2.o -C $(LINKER_SCRIPTS)/apple2_6000.inc peasant2.o: peasant2.s zp.inc inventory.inc dialog_peasant2.inc \ + parse_input.inc \ peasant2_actions.s \ graphics_peasantry/graphics_peasant2.inc sprites/peasant_sprites.inc \ graphics_peasantry/priority_peasant2.inc \ @@ -393,11 +395,28 @@ save3.o: save3.s ### +parse_input.inc: generate_common parse_input + ./generate_common -a 0xee00 -s parse_input parse_input.lst > parse_input.inc + ./generate_common -a 0xee00 -s setup_verb_table parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s load_custom_verb_table parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s partial_message_step parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s finish_parse_message parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s parse_common_talk parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s parse_common_haldo parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s parse_common_give parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s parse_common_ask parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s parse_common_unknown parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s parse_common_look parse_input.lst >> parse_input.inc + ./generate_common -a 0xee00 -s parse_common_get parse_input.lst >> parse_input.inc + + +### + PARSE_INPUT.LZSA: parse_input $(LZSA) -r -f2 parse_input PARSE_INPUT.LZSA parse_input: parse_input.o - ld65 -o parse_input parse_input.o -C ../../linker_scripts/apple2_d000.inc + ld65 -o parse_input parse_input.o -C ../../linker_scripts/apple2_ee00.inc parse_input.o: parse_input.s tokens.inc ca65 -o parse_input.o parse_input.s -l parse_input.lst @@ -409,7 +428,7 @@ DIALOG_PEASANT1.LZSA: dialog_peasant1 $(LZSA) -r -f2 dialog_peasant1 DIALOG_PEASANT1.LZSA dialog_peasant1: dialog_peasant1.o - ld65 -o dialog_peasant1 dialog_peasant1.o -C ../../linker_scripts/apple2_6000.inc + ld65 -o dialog_peasant1 dialog_peasant1.o -C ../../linker_scripts/apple2_d000.inc dialog_peasant1.o: dialog_peasant1.s ca65 -o dialog_peasant1.o dialog_peasant1.s -l dialog_peasant1.lst @@ -420,7 +439,7 @@ DIALOG_PEASANT2.LZSA: dialog_peasant2 $(LZSA) -r -f2 dialog_peasant2 DIALOG_PEASANT2.LZSA dialog_peasant2: dialog_peasant2.o - ld65 -o dialog_peasant2 dialog_peasant2.o -C ../../linker_scripts/apple2_6000.inc + ld65 -o dialog_peasant2 dialog_peasant2.o -C ../../linker_scripts/apple2_d000.inc dialog_peasant2.o: dialog_peasant2.s text/peasant2.inc ca65 -o dialog_peasant2.o dialog_peasant2.s -l dialog_peasant2.lst @@ -428,7 +447,7 @@ dialog_peasant2.o: dialog_peasant2.s text/peasant2.inc ### dialog_peasant2.inc: generate_all_symbols dialog_peasant2 - ./generate_all_symbols -a 0xe000 dialog_peasant2.lst > dialog_peasant2.inc + ./generate_all_symbols -a 0xd000 dialog_peasant2.lst > dialog_peasant2.inc #### @@ -436,7 +455,7 @@ DIALOG_PEASANT3.LZSA: dialog_peasant3 $(LZSA) -r -f2 dialog_peasant3 DIALOG_PEASANT3.LZSA dialog_peasant3: dialog_peasant3.o - ld65 -o dialog_peasant3 dialog_peasant3.o -C ../../linker_scripts/apple2_6000.inc + ld65 -o dialog_peasant3 dialog_peasant3.o -C ../../linker_scripts/apple2_d000.inc dialog_peasant3.o: dialog_peasant3.s ca65 -o dialog_peasant3.o dialog_peasant3.s -l dialog_peasant3.lst @@ -447,7 +466,7 @@ DIALOG_PEASANT4.LZSA: dialog_peasant4 $(LZSA) -r -f2 dialog_peasant4 DIALOG_PEASANT4.LZSA dialog_peasant4: dialog_peasant4.o - ld65 -o dialog_peasant4 dialog_peasant4.o -C ../../linker_scripts/apple2_6000.inc + ld65 -o dialog_peasant4 dialog_peasant4.o -C ../../linker_scripts/apple2_d000.inc dialog_peasant4.o: dialog_peasant4.s ca65 -o dialog_peasant4.o dialog_peasant4.s -l dialog_peasant4.lst @@ -458,7 +477,7 @@ DIALOG_INSIDE.LZSA: dialog_inside $(LZSA) -r -f2 dialog_inside DIALOG_INSIDE.LZSA dialog_inside: dialog_inside.o - ld65 -o dialog_inside dialog_inside.o -C ../../linker_scripts/apple2_6000.inc + ld65 -o dialog_inside dialog_inside.o -C ../../linker_scripts/apple2_d000.inc dialog_inside.o: dialog_inside.s ca65 -o dialog_inside.o dialog_inside.s -l dialog_inside.lst @@ -469,17 +488,11 @@ DIALOG_CLIFF.LZSA: dialog_cliff $(LZSA) -r -f2 dialog_cliff DIALOG_CLIFF.LZSA dialog_cliff: dialog_cliff.o - ld65 -o dialog_cliff dialog_cliff.o -C ../../linker_scripts/apple2_6000.inc + ld65 -o dialog_cliff dialog_cliff.o -C ../../linker_scripts/apple2_d000.inc dialog_cliff.o: dialog_cliff.s ca65 -o dialog_cliff.o dialog_cliff.s -l dialog_cliff.lst - - - - - - #### graphics_vid/vid_graphics.inc: diff --git a/games/peasant/NOTES b/games/peasant/NOTES index bbeb10e8..ed9d4f82 100644 --- a/games/peasant/NOTES +++ b/games/peasant/NOTES @@ -31,6 +31,8 @@ peasant2 18302 17918 -- text parsing nearing completion 18208 -- mountain pass parsing working 18780 -- most dialog hooked up + 17394 -- move loadsave to qload.inc + 17100 -- move parse_input high and move p2 strings back in partial save, can we fit in 4k? 102 lines ; inventory was 115? @@ -77,8 +79,8 @@ $D0-$DF (Language Card BANK2) Mockingboard music/PT3-routines $E0-$FF (Language Card) ????? $D0-$DF (bank2) inventory -$D0-$DF (bank1) common parser code -$E0-$FF per-level parser strings +$D0-$ED (bank1) per-levelstrings +$EE-$FF common parser code Disk1 Map (disk has 35 tracks, each 4k in size) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/games/peasant/cliff.s b/games/peasant/cliff.s index d1af9142..2da3a778 100644 --- a/games/peasant/cliff.s +++ b/games/peasant/cliff.s @@ -11,6 +11,7 @@ WHICH_PEASANTRY=0 .include "qload.inc" .include "inventory.inc" +.include "parse_input.inc" cliff_base: lda #0 @@ -149,7 +150,7 @@ game_over: .include "peasant_move.s" -.include "parse_input.s" +;.include "parse_input.s" ;.include "inventory.s" diff --git a/games/peasant/copy_check.s b/games/peasant/copy_check.s index 203d3045..3fe45c1a 100644 --- a/games/peasant/copy_check.s +++ b/games/peasant/copy_check.s @@ -112,7 +112,7 @@ forever: ;.include "decompress_fast_v2.s" -.include "wait_keypress.s" +;.include "wait_keypress.s" ;.include "hgr_font.s" ;.include "draw_box.s" diff --git a/games/peasant/new_game.s b/games/peasant/new_game.s index 75f824fb..f9c96b63 100644 --- a/games/peasant/new_game.s +++ b/games/peasant/new_game.s @@ -29,21 +29,21 @@ start_new_game: lda LCBANK1 lda LCBANK1 - ; load dialog to $20 + ; load parse_input compressed to $2000 - lda #LOAD_DIALOG2 + lda #LOAD_PARSE_INPUT sta WHICH_LOAD jsr load_file - ; decompress to $E000 + ; decompress to $EE00 lda #$00 sta getsrc_smc+1 lda #$20 sta getsrc_smc+2 - lda #$E0 + lda #$EE jsr decompress_lzsa2_fast diff --git a/games/peasant/parse_input.s b/games/peasant/parse_input.s index f21a6544..812d7e1e 100644 --- a/games/peasant/parse_input.s +++ b/games/peasant/parse_input.s @@ -1,9 +1,9 @@ -;.include "zp.inc" -;.include "hardware.inc" -;.include "qload.inc" +.include "zp.inc" +.include "hardware.inc" +.include "qload.inc" -;.include "version.inc" -;.include "inventory.inc" +.include "version.inc" +.include "inventory.inc" .include "tokens.inc" diff --git a/games/peasant/peasant1.s b/games/peasant/peasant1.s index 81a8fc6a..612e4e56 100644 --- a/games/peasant/peasant1.s +++ b/games/peasant/peasant1.s @@ -153,8 +153,8 @@ game_over: .include "peasant_move.s" -.include "parse_input.s" - +;.include "parse_input.s" +.include "parse_input.inc" .include "score.s" diff --git a/games/peasant/peasant2.s b/games/peasant/peasant2.s index 242cc0a7..2cc9a86d 100644 --- a/games/peasant/peasant2.s +++ b/games/peasant/peasant2.s @@ -16,6 +16,8 @@ WHICH_PEASANTRY=1 .include "qload.inc" .include "inventory.inc" +.include "parse_input.inc" + peasant_quest: lda #0 @@ -25,6 +27,18 @@ peasant_quest: jsr hgr_make_tables ; necessary? jsr hgr2 ; necessary? + ; decompress dialog to $D000 + + lda #peasant2_text_lzsa + sta getsrc_smc+2 + + lda #$D0 + + jsr decompress_lzsa2_fast + + ; update map location jsr update_map_location @@ -197,7 +211,7 @@ to_left: .include "score.s" -.include "parse_input.s" +;.include "parse_input.s" .include "keyboard.s" @@ -278,8 +292,8 @@ verb_tables_hi: -;peasant2_text_lzsa: -;.incbin "DIALOG_PEASANT2.LZSA" +peasant2_text_lzsa: +.incbin "DIALOG_PEASANT2.LZSA" ;.include "dialog_peasant2.inc" diff --git a/games/peasant/peasant2_actions.s b/games/peasant/peasant2_actions.s index e5e75250..7a9a2972 100644 --- a/games/peasant/peasant2_actions.s +++ b/games/peasant/peasant2_actions.s @@ -1,4 +1,4 @@ -;.include "tokens.inc" +.include "tokens.inc" ;======================= ;======================= diff --git a/games/peasant/peasant3.s b/games/peasant/peasant3.s index df4cbfd9..11aa0b61 100644 --- a/games/peasant/peasant3.s +++ b/games/peasant/peasant3.s @@ -15,6 +15,7 @@ WHICH_PEASANTRY = 2 .include "qload.inc" .include "inventory.inc" +.include "parse_input.inc" peasant_quest: lda #0 @@ -167,7 +168,7 @@ game_over: .include "score.s" -.include "parse_input.s" +;.include "parse_input.s" ;.include "inventory.s" diff --git a/games/peasant/peasant4.s b/games/peasant/peasant4.s index 4f5dfe25..9b8fa9ef 100644 --- a/games/peasant/peasant4.s +++ b/games/peasant/peasant4.s @@ -15,6 +15,7 @@ WHICH_PEASANTRY = 3 .include "qload.inc" .include "inventory.inc" +.include "parse_input.inc" peasant_quest: lda #0 @@ -176,7 +177,7 @@ game_over: .include "new_map_location.s" -.include "parse_input.s" +;.include "parse_input.s" ;.include "inventory.s" diff --git a/games/peasant/qload.s b/games/peasant/qload.s index 68628e6b..a716d60a 100644 --- a/games/peasant/qload.s +++ b/games/peasant/qload.s @@ -196,7 +196,7 @@ which_disk_array: .byte 1,1,1,2 ; VID_LOGO, TITLE, INTRO. COPY_CHECK .byte 1,1,1,1 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte 2,2,1,2 ; TROGDOR, ENDING, MUSIC, CLIFF - .byte 2,1,1,1 ; GAME_OVER, INVENTORY, DIALOG2 + .byte 2,1,1,1 ; GAME_OVER, INVENTORY, PARSE_INPUT .byte 1 ; .byte 1,1,1,1,1 ; SAVE1, SAVE2, SAVE3 .byte $f ; disk detect @@ -205,7 +205,7 @@ load_address_array: .byte $60,$60,$60,$60 ; VID_LOGO, TITLE, INTRO, COPY_CHECK .byte $60,$60,$60,$60 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte $60,$60,$D0,$60 ; TROGDOR, ENDING, MUSIC, CLIFF - .byte $60,$D0,$20,$40 ; GAME_OVER, INVENTORY, DIALOG2 + .byte $60,$D0,$20,$40 ; GAME_OVER, INVENTORY, PARSE_INPUT .byte $08 ; .byte $BC,$BC,$BC,$0A ; SAVE1, SAVE2, SAVE3 .byte $0A ; @@ -215,7 +215,7 @@ track_array: .byte 4, 6, 9,1 ; VID_LOGO, TITLE, INTRO, COPY_CHECK .byte 15,20,25,30 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte 19,24, 3,29 ; TROGDOR, ENDING, MUSIC, CLIFF - .byte 3,14,13,30 ; GAME_OVER, INVENTORY, DIALOG2 + .byte 3,14,13,30 ; GAME_OVER, INVENTORY, PARSE_INPUT .byte 0 ; .byte 0, 0, 0, 0, 0 ; SAVE1, SAVE2, SAVE3 .byte 0 ; disk detect @@ -224,7 +224,7 @@ sector_array: .byte 0, 0, 0, 0 ; VID_LOGO, TITLE, INTRO, COPY_CHECK .byte 0, 0, 0, 0 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte 0, 0, 0, 0 ; TROGDOR, ENDING, MUSIC, CLIFF - .byte 0, 0, 0, 1 ; GAME_OVER, INVENTORY, DIALOG2 + .byte 0, 0, 0, 1 ; GAME_OVER, INVENTORY, PARSE_INPUT .byte 6 ; .byte 11,12,13,14,15 ; SAVE1, SAVE2, SAVE3 .byte 0 ; disk detect @@ -233,7 +233,7 @@ length_array: .byte 32, 50, 60, 20 ; VID_LOGO, TITLE, INTRO, COPY_CHECK .byte 80, 88, 88, 80 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte 80, 80, 16, 80 ; TROGDOR, ENDING, MUSIC, CLIFF - .byte 16, 16, 16, 78 ; GAME_OVER, INVENTORY, DIALOG2 + .byte 16, 16, 16, 78 ; GAME_OVER, INVENTORY, PARSE_INPUT .byte 3 ; .byte 1,1,1,1,1 ; SAVE1, SAVE2, SAVE3 .byte 1 ; disk detect diff --git a/games/peasant/zp.inc b/games/peasant/zp.inc index 0d83294e..eadc7f06 100644 --- a/games/peasant/zp.inc +++ b/games/peasant/zp.inc @@ -236,7 +236,7 @@ LOAD_MUSIC = 10 LOAD_CLIFF = 11 LOAD_GAME_OVER = 12 LOAD_INVENTORY = 13 -LOAD_DIALOG2 = 14 +LOAD_PARSE_INPUT= 14 LOAD_SAVE1 = 17 LOAD_SAVE2 = 18 diff --git a/linker_scripts/apple2_ee00.inc b/linker_scripts/apple2_ee00.inc new file mode 100644 index 00000000..b01b48fe --- /dev/null +++ b/linker_scripts/apple2_ee00.inc @@ -0,0 +1,12 @@ +MEMORY { + ZP: start = $00, size = $1A, type = rw; + RAM: start = $EE00, size = $1200, file = %O; +} + +SEGMENTS { +CODE: load = RAM, type = ro; +RODATA: load = RAM, type = ro; +DATA: load = RAM, type = rw; +BSS: load = RAM, type = bss, define = yes; +ZEROPAGE: load = ZP, type = zp; +}