From 814d465eaa569548fe1a7b1ba65d0f4f1817c58f Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 24 Aug 2021 13:38:03 -0400 Subject: [PATCH] peasant: add priority graphic loading --- games/peasant/gr_copy.s | 39 +++++++++ games/peasant/graphics/Makefile | 76 +++++++++++++++++- ...prioirty.png => lady_cottage_priority.png} | Bin games/peasant/graphics/todo_priority.png | Bin 0 -> 4917 bytes games/peasant/parse_input.s | 22 +++-- games/peasant/peasant1.s | 39 +++++++++ games/peasant/peasant2.s | 36 +++++++++ games/peasant/peasant3.s | 35 ++++++++ games/peasant/peasant4.s | 38 +++++++++ 9 files changed, 278 insertions(+), 7 deletions(-) create mode 100644 games/peasant/gr_copy.s rename games/peasant/graphics/{lady_cottage_prioirty.png => lady_cottage_priority.png} (100%) create mode 100644 games/peasant/graphics/todo_priority.png diff --git a/games/peasant/gr_copy.s b/games/peasant/gr_copy.s new file mode 100644 index 00000000..ddb537f0 --- /dev/null +++ b/games/peasant/gr_copy.s @@ -0,0 +1,39 @@ + ;========================================================= + ; gr_copy_to_page1, 40x48 version + ;========================================================= + ; copy $2000 to $400, careful to avoid screen holes + +gr_copy_to_page1: + + ldy #119 ; for early ones, copy 120 bytes ; 2 + +gr_copy_line: + lda $2000,Y ; load a byte (self modified) ; 4 + sta $400,Y ; store a byte (self modified) ; 5 + + lda $2080,Y ; load a byte (self modified) ; 4 + sta $480,Y ; store a byte (self modified) ; 5 + + lda $2100,Y ; load a byte (self modified) ; 4 + sta $500,Y ; store a byte (self modified) ; 5 + + lda $2180,Y ; load a byte (self modified) ; 4 + sta $580,Y ; store a byte (self modified) ; 5 + + lda $2200,Y ; load a byte (self modified) ; 4 + sta $600,Y ; store a byte (self modified) ; 5 + + lda $2280,Y ; load a byte (self modified) ; 4 + sta $680,Y ; store a byte (self modified) ; 5 + + lda $2300,Y ; load a byte (self modified) ; 4 + sta $700,Y ; store a byte (self modified) ; 5 + + lda $2380,Y ; load a byte (self modified) ; 4 + sta $780,Y ; store a byte (self modified) ; 5 + + dey ; decrement pointer ; 2 + bpl gr_copy_line ; ; 2nt/3 + + rts ; 6 + diff --git a/games/peasant/graphics/Makefile b/games/peasant/graphics/Makefile index 7e78a019..a687b3d0 100644 --- a/games/peasant/graphics/Makefile +++ b/games/peasant/graphics/Makefile @@ -6,10 +6,18 @@ LZSA = ~/research/lzsa/lzsa/lzsa B2D = ../../../utils/bmp2dhr/b2d all: graphics_intro.inc \ - graphics_peasant1.inc graphics_peasant2.inc graphics_peasant3.inc \ - graphics_peasant4.inc + graphics_peasant1.inc \ + graphics_peasant2.inc \ + graphics_peasant3.inc \ + graphics_peasant4.inc \ + priority_peasant1.inc \ + priority_peasant2.inc \ + priority_peasant3.inc \ + priority_peasant4.inc +### + graphics_intro.inc: \ cottage.lzsa \ lake_e.lzsa \ @@ -81,6 +89,50 @@ graphics_peasant4.inc: \ echo "lady_cottage_lzsa: .incbin \"lady_cottage.lzsa\"" >> graphics_peasant4.inc echo "crooked_tree_lzsa: .incbin \"crooked_tree.lzsa\"" >> graphics_peasant4.inc +########### +########### + +priority_peasant1.inc: \ + todo_priority.lzsa + echo "gary_priority_lzsa: .incbin \"todo_priority.lzsa\"" > priority_peasant1.inc + echo "top_prints_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant1.inc + echo "wishing_well_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant1.inc + echo "leaning_tree_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant1.inc + echo "waterfall_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant1.inc + + +### + +priority_peasant2.inc: \ + todo_priority.lzsa + echo "haystack_priority_lzsa: .incbin \"todo_priority.lzsa\"" > priority_peasant2.inc + echo "puddle_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant2.inc + echo "archery_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant2.inc + echo "river_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant2.inc + echo "knight_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant2.inc + +### + +priority_peasant3.inc: \ + todo_priority.lzsa + echo "jhonka_priority_lzsa: .incbin \"todo_priority.lzsa\"" > priority_peasant3.inc + echo "cottage_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant3.inc + echo "lake_w_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant3.inc + echo "lake_e_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant3.inc + echo "inn_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant3.inc + +### + +priority_peasant4.inc: \ + todo_priority.lzsa \ + lady_cottage_priority.lzsa + echo "empty_hut_priority_lzsa: .incbin \"todo_priority.lzsa\"" > priority_peasant4.inc + echo "ned_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant4.inc + echo "bottom_prints_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant4.inc + echo "lady_cottage_priority_lzsa: .incbin \"lady_cottage_priority.lzsa\"" >> priority_peasant4.inc + echo "crooked_tree_priority_lzsa: .incbin \"todo_priority.lzsa\"" >> priority_peasant4.inc + + ### archery.lzsa: archery.hgr @@ -264,6 +316,26 @@ todo.hgr: todo.png $(PNG2HGR) todo.png > todo.hgr +########################################### +########################################### + + +### + +lady_cottage_priority.lzsa: lady_cottage_priority.hgr + $(LZSA) -r -f2 lady_cottage_priority.hgr lady_cottage_priority.lzsa + +lady_cottage_priority.hgr: lady_cottage_priority.png + $(PNG2GR) lady_cottage_priority.png lady_cottage_priority.hgr + +#### + +todo_priority.lzsa: todo_priority.gr + $(LZSA) -r -f2 todo_priority.gr todo_priority.lzsa + +todo_priority.gr: todo_priority.png + $(PNG2GR) todo_priority.png todo_priority.gr + ### diff --git a/games/peasant/graphics/lady_cottage_prioirty.png b/games/peasant/graphics/lady_cottage_priority.png similarity index 100% rename from games/peasant/graphics/lady_cottage_prioirty.png rename to games/peasant/graphics/lady_cottage_priority.png diff --git a/games/peasant/graphics/todo_priority.png b/games/peasant/graphics/todo_priority.png new file mode 100644 index 0000000000000000000000000000000000000000..e730dba3001d1f1c0d4d417a65a5e76cdeab5273 GIT binary patch literal 4917 zcmeHLX;c$g77ik!2#AWHHcDBb0#aFu1d;=ydbT;#T65s%Z7((M z0VjMPzv;tSJ^XyHC%@fwmA4Om7uFg+H)X}_rfT=ZelG&GXES!0Z`So)KKbGx<~Z`C zqlv=XqPW!8J3p;urtgtDk+h_D=q6Tqn_aA+ZMQ0C{M++wX)lGV4YDR^1U+s6BnfqqzD`Te|o$C;1oqk@V|;xs~sepJa(H3SJSmQ_}bv&(s9F zm=5-SrmC47Sl;UL_VACB{7=13sd`-LL4=e;gO@(vJ|WvoGW@vWT9~Z%Ov;Ah#c$V* z-d9mga0cw=Z;D>G!(n9TaG4ltxMOqsUBk)QJ|%JY`nhe)jZVHeyZYvtMb2JMn>6+2 zm+3K8S4}df+mx&nE3apoK-`RJ6R#<3uQoUSa;euisNl}Uex|Oc=C~AIaXU=J%=zOq z!*mhpF~iHO7Jj;yozlDae8<2Q4_Ez>R(r1Zc#{ndmyfQC@-3{!Mw_nf%dhD5bQNz> zB6HkaS#=I0Z%}#Cm>-SySXtl4M+wTLftPa&110~KBY_Vt>>G*{MIFryWgm)=pFgnP z(b-YLnK8vVf1Mz`l(%=-o6O+KV(aLcxy50zXI2KeOy89kx$1gkVey8PRw|E5zc@3p zczxyUS(D+8TYK|!5{GfErZ||7h`HtGkbw@243=jK>ke*|=hW|vD>xODIJV>FwMJ>3 z#S}Z2Plsfs)Zm^J+Q9eFWe;=Pu>jtcr ztOaXDex(!a%I5}`!$VB|VI7ku&2~*25_8SPI?sF8keRXU;`aWVxQ@=u)k~tzoXIFJ zT$=uCk!8^m=(W*f}t zIsqrK`&gBxl?5zduAfq(nO{?S?&fi)OE1QEJZcPnF~)d4{M_}bMY?XOF5&7G!Lz}s zq5eT>mzJNiI0ij;xJmwek8eA|MklY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c#66}KF z!Rt)X;^chrD#Vrsgowd+-N>-8sV6&qKQOk1Wo2bqU;0p0+8IV0cSd?cjR$0IF ztg2Z>cUEh)wJJ4z=Ps9?Zy%1EOJC zaj4curO@xN8HSA?NkH+GHUiRb{H8Cqv;|7Z{=O4K!2e5?918}++&DL(aFOb#{e-C# gw7?PlKOG%?s%@Skt>Uv=K|lfake_error2 jmp finish_parse_message +parse_show: + cmp #'S' + bne parse_version + + bit LORES + bit PAGE1 + + jsr wait_until_keypress + + bit PAGE2 + bit HIRES + + jmp done_parse_message parse_version: cmp #'V' @@ -60,10 +73,9 @@ finish_parse_message: jsr wait_until_keypress -done_parse_message: jsr hgr_partial_restore +done_parse_message: + + rts - - - diff --git a/games/peasant/peasant1.s b/games/peasant/peasant1.s index 137944d8..24dfa431 100644 --- a/games/peasant/peasant1.s +++ b/games/peasant/peasant1.s @@ -62,6 +62,27 @@ new_location: jsr decompress_lzsa2_fast + ; load priority to $400 + ; indirectly as we can't trash screen holes + + + ldx MAP_LOCATION + + lda map_priority_low,X + sta getsrc_smc+1 + lda map_priority_hi,X + sta getsrc_smc+2 + + lda #$20 ; temporarily load to $2000 + + jsr decompress_lzsa2_fast + + ; copy to $400 + + jsr gr_copy_to_page1 + + + ; put peasant text lda #lady_cottage_lzsa ; 18 -- cottage lady ; .byte >crooked_tree_lzsa ; 19 -- crooked tree + + +map_priority_low: + .byte gary_priority_lzsa ; 0 -- gary the horse + .byte >top_prints_priority_lzsa ; 1 -- top footprints + .byte >wishing_well_priority_lzsa ; 2 -- wishing well + .byte >leaning_tree_priority_lzsa ; 3 -- leaning tree + .byte >waterfall_priority_lzsa ; 4 -- waterfall diff --git a/games/peasant/peasant2.s b/games/peasant/peasant2.s index ea826c02..e2d851f3 100644 --- a/games/peasant/peasant2.s +++ b/games/peasant/peasant2.s @@ -64,6 +64,25 @@ new_location: jsr decompress_lzsa2_fast + + ; we are PEASANT2 so locations 5...9 map to 0...4 + + lda MAP_LOCATION + sec + sbc #5 + tax + + lda map_priority_low,X + sta getsrc_smc+1 + lda map_priority_hi,X + sta getsrc_smc+2 + + lda #$20 + + jsr decompress_lzsa2_fast + + jsr gr_copy_to_page1 + ; put peasant text lda #lady_cottage_lzsa ; 18 -- cottage lady ; .byte >crooked_tree_lzsa ; 19 -- crooked tree + +map_priority_low: + .byte haystack_priority_lzsa ; 5 -- haystack + .byte >puddle_priority_lzsa ; 6 -- puddle + .byte >archery_priority_lzsa ; 7 -- archery + .byte >river_priority_lzsa ; 8 -- river + .byte >knight_priority_lzsa ; 9 -- knight diff --git a/games/peasant/peasant3.s b/games/peasant/peasant3.s index f431025c..c291ea26 100644 --- a/games/peasant/peasant3.s +++ b/games/peasant/peasant3.s @@ -64,6 +64,24 @@ new_location: jsr decompress_lzsa2_fast + ; Load priority + + lda MAP_LOCATION + sec + sbc #10 + tax + + lda map_priority_low,X + sta getsrc_smc+1 + lda map_priority_hi,X + sta getsrc_smc+2 + + lda #$20 + + jsr decompress_lzsa2_fast + + jsr gr_copy_to_page1 + ; put peasant text lda #lady_cottage_lzsa ; 18 -- cottage lady ; .byte >crooked_tree_lzsa ; 19 -- crooked tree + +map_priority_low: + .byte jhonka_priority_lzsa ; 10 -- jhonka + .byte >cottage_priority_lzsa ; 11 -- cottage + .byte >lake_w_priority_lzsa ; 12 -- lake west + .byte >lake_e_priority_lzsa ; 13 -- lake east + .byte >inn_priority_lzsa ; 14 -- inn diff --git a/games/peasant/peasant4.s b/games/peasant/peasant4.s index c0de45ab..2b8312a6 100644 --- a/games/peasant/peasant4.s +++ b/games/peasant/peasant4.s @@ -64,6 +64,24 @@ new_location: jsr decompress_lzsa2_fast + ; load priority + + lda MAP_LOCATION + sec + sbc #15 + tax + + lda map_priority_low,X + sta getsrc_smc+1 + lda map_priority_hi,X + sta getsrc_smc+2 + + lda #$20 + + jsr decompress_lzsa2_fast + + jsr gr_copy_to_page1 + ; put peasant text lda #lady_cottage_lzsa ; 18 -- cottage lady .byte >crooked_tree_lzsa ; 19 -- crooked tree + + +map_priority_low: + .byte empty_hut_priority_lzsa ; 15 -- empty hut + .byte >ned_priority_lzsa ; 16 -- ned + .byte >bottom_prints_priority_lzsa ; 17 -- bottom footprints + .byte >lady_cottage_priority_lzsa ; 18 -- cottage lady + .byte >crooked_tree_priority_lzsa ; 19 -- crooked tree + +