From 8ea755c9a26194c1287b75eb3634fd6e300d37b2 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 18 Aug 2021 00:29:23 -0400 Subject: [PATCH] peasant: peasantry too big, split up in 4 pieces --- games/peasant/Makefile | 67 ++++- games/peasant/NOTES | 6 +- games/peasant/clear_bottom.s | 30 ++ games/peasant/copy_check.s | 2 +- games/peasant/graphics/Makefile | 66 +++-- games/peasant/graphics/lady_cottage.png | Bin 0 -> 2672 bytes games/peasant/intro.s | 28 +- games/peasant/new_map_location.s | 68 +++++ games/peasant/parse_input.s | 69 +++++ games/peasant/peasant1.s | 345 +++++++++++++++++++++++ games/peasant/peasant2.s | 346 ++++++++++++++++++++++++ games/peasant/{peasant.s => peasant3.s} | 262 ++++-------------- games/peasant/peasant4.s | 345 +++++++++++++++++++++++ games/peasant/qload.s | 10 +- games/peasant/zp.inc | 7 +- 15 files changed, 1399 insertions(+), 252 deletions(-) create mode 100644 games/peasant/clear_bottom.s create mode 100644 games/peasant/graphics/lady_cottage.png create mode 100644 games/peasant/new_map_location.s create mode 100644 games/peasant/parse_input.s create mode 100644 games/peasant/peasant1.s create mode 100644 games/peasant/peasant2.s rename games/peasant/{peasant.s => peasant3.s} (54%) create mode 100644 games/peasant/peasant4.s diff --git a/games/peasant/Makefile b/games/peasant/Makefile index 85d308a7..97a85cd8 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -8,7 +8,8 @@ EMPTY_DISK = ../../empty_disk all: peasant.dsk -peasant.dsk: QBOOT QLOAD VID_LOGO TITLE INTRO COPY_CHECK PEASANT +peasant.dsk: QBOOT QLOAD VID_LOGO TITLE INTRO COPY_CHECK \ + PEASANT1 PEASANT2 PEASANT3 PEASANT4 cp $(EMPTY_DISK)/empty.dsk peasant.dsk # $(DOS33) -y peasant.dsk BSAVE -a 0x6000 INTRO $(DOS33_RAW) peasant.dsk 0 0 QBOOT 0 1 @@ -19,7 +20,10 @@ peasant.dsk: QBOOT QLOAD VID_LOGO TITLE INTRO COPY_CHECK PEASANT $(DOS33_RAW) peasant.dsk 5 0 TITLE 0 0 $(DOS33_RAW) peasant.dsk 8 0 INTRO 0 0 $(DOS33_RAW) peasant.dsk 12 0 COPY_CHECK 0 0 - $(DOS33_RAW) peasant.dsk 14 0 PEASANT 0 0 + $(DOS33_RAW) peasant.dsk 14 0 PEASANT1 0 0 + $(DOS33_RAW) peasant.dsk 19 0 PEASANT2 0 0 + $(DOS33_RAW) peasant.dsk 24 0 PEASANT3 0 0 + $(DOS33_RAW) peasant.dsk 29 0 PEASANT4 0 0 ### @@ -82,16 +86,58 @@ intro.o: intro.s zp.inc \ ### -PEASANT: peasant.o - ld65 -o PEASANT peasant.o -C $(LINKER_SCRIPTS)/apple2_6000.inc +PEASANT1: peasant1.o + ld65 -o PEASANT1 peasant1.o -C $(LINKER_SCRIPTS)/apple2_6000.inc -peasant.o: peasant.s zp.inc \ - graphics/graphics.inc sprites/peasant_sprite.inc \ +peasant1.o: peasant1.s zp.inc \ + graphics/graphics_peasant1.inc sprites/peasant_sprite.inc \ draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ hgr_7x30_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \ wait_a_bit.s draw_peasant.s hgr_text_box.s \ - keyboard.s - ca65 -o peasant.o peasant.s -l peasant.lst + keyboard.s parse_input.s new_map_location.s + ca65 -o peasant1.o peasant1.s -l peasant1.lst + +### + +PEASANT2: peasant2.o + ld65 -o PEASANT2 peasant2.o -C $(LINKER_SCRIPTS)/apple2_6000.inc + +peasant2.o: peasant2.s zp.inc \ + graphics/graphics_peasant2.inc sprites/peasant_sprite.inc \ + draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ + hgr_7x30_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \ + wait_a_bit.s draw_peasant.s hgr_text_box.s \ + keyboard.s parse_input.s new_map_location.s + ca65 -o peasant2.o peasant2.s -l peasant2.lst + +### + +PEASANT3: peasant3.o + ld65 -o PEASANT3 peasant3.o -C $(LINKER_SCRIPTS)/apple2_6000.inc + +peasant3.o: peasant3.s zp.inc \ + graphics/graphics_peasant3.inc sprites/peasant_sprite.inc \ + draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ + hgr_7x30_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \ + wait_a_bit.s draw_peasant.s hgr_text_box.s \ + keyboard.s parse_input.s new_map_location.s + ca65 -o peasant3.o peasant3.s -l peasant3.lst + +### + +PEASANT4: peasant4.o + ld65 -o PEASANT4 peasant4.o -C $(LINKER_SCRIPTS)/apple2_6000.inc + +peasant4.o: peasant4.s zp.inc \ + graphics/graphics_peasant4.inc sprites/peasant_sprite.inc \ + draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \ + hgr_7x30_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \ + wait_a_bit.s draw_peasant.s hgr_text_box.s \ + keyboard.s parse_input.s new_map_location.s + ca65 -o peasant4.o peasant4.s -l peasant4.lst + + + ### @@ -124,7 +170,7 @@ graphics_title/title_graphics.inc: cd graphics_title && make -graphics/graphics.inc: +graphics/graphics_peasant1.inc: cd graphics && make graphics_copy/copy_graphics.inc: @@ -134,5 +180,6 @@ graphics_copy/copy_graphics.inc: ### clean: - rm -f *~ *.o *.lst HELLO VID_LOGO TITLE INTRO COPY_CHECK + rm -f *~ *.o *.lst HELLO VID_LOGO TITLE INTRO COPY_CHECK \ + PEASANT1 PEASANT2 PEASANT3 PEASANT4 diff --git a/games/peasant/NOTES b/games/peasant/NOTES index ed062e11..c98e56f0 100644 --- a/games/peasant/NOTES +++ b/games/peasant/NOTES @@ -26,8 +26,10 @@ T 3 = VID_LOGO 6911 bytes 27S = 1T11S T 5 = TITLE 9662 bytes 38S = 2T6S T 8 = INTRO 16040 bytes 63S = 3T15S T 12 = COPY_CHECK 4922 bytes 20S = 1T4S -T 14 = PEASANT 18501 bytes 73S = 4T9S ; 88 is max? - +T 14 = PEASANT1 22501 bytes 79S = 4T15S ; 88 is max? +T 19 = PEASANT2 ; 79 = 20224 +T 24 = PEASANT3 +T 29 = PEASANT4 238, to 280 (6) 50 to 135 (85) 6*85=510 diff --git a/games/peasant/clear_bottom.s b/games/peasant/clear_bottom.s new file mode 100644 index 00000000..2caa6ee0 --- /dev/null +++ b/games/peasant/clear_bottom.s @@ -0,0 +1,30 @@ + +clear_bottom: + ; draw rectangle + + lda #$00 ; color is black1 + sta VGI_RCOLOR + + lda #0 + sta VGI_RX1 + lda #183 + sta VGI_RY1 + lda #140 + sta VGI_RXRUN + lda #9 + sta VGI_RYRUN + + jsr vgi_simple_rectangle + + lda #140 + sta VGI_RX1 + lda #183 + sta VGI_RY1 + lda #140 + sta VGI_RXRUN + lda #9 + sta VGI_RYRUN + + jsr vgi_simple_rectangle + + rts diff --git a/games/peasant/copy_check.s b/games/peasant/copy_check.s index 77962114..234919b4 100644 --- a/games/peasant/copy_check.s +++ b/games/peasant/copy_check.s @@ -61,7 +61,7 @@ trogdor_question: jsr wait_until_keypress - lda #LOAD_PEASANT + lda #LOAD_PEASANT3 sta WHICH_LOAD rts diff --git a/games/peasant/graphics/Makefile b/games/peasant/graphics/Makefile index 87592d41..bbe06f64 100644 --- a/games/peasant/graphics/Makefile +++ b/games/peasant/graphics/Makefile @@ -5,7 +5,9 @@ PNG2HGR = ../../../utils/hgr-utils/png2hgr LZSA = ~/research/lzsa/lzsa/lzsa B2D = ../../../utils/bmp2dhr/b2d -all: graphics_intro.inc graphics.inc +all: graphics_intro.inc graphics.inc \ + graphics_peasant1.inc graphics_peasant2.inc graphics_peasant3.inc \ + graphics_peasant4.inc graphics_intro.inc: \ @@ -23,29 +25,49 @@ graphics_intro.inc: \ ### -graphics.inc: \ +graphics_peasant1.inc: \ + todo.lzsa \ + waterfall.lzsa + echo "todo_lzsa: .incbin \"todo.lzsa\"" > graphics_peasant1.inc + echo "waterfall_lzsa: .incbin \"waterfall.lzsa\"" >> graphics_peasant1.inc + +### + +graphics_peasant2.inc: \ + todo.lzsa \ + river.lzsa \ + knight.lzsa + echo "todo_lzsa: .incbin \"todo.lzsa\"" > graphics_peasant2.inc + echo "river_lzsa: .incbin \"river.lzsa\"" >> graphics_peasant2.inc + echo "knight_lzsa: .incbin \"knight.lzsa\"" >> graphics_peasant2.inc + +### + +graphics_peasant3.inc: \ + todo.lzsa \ cottage.lzsa \ lake_e.lzsa \ lake_w.lzsa \ - river.lzsa \ - knight.lzsa \ - waterfall.lzsa \ - inn.lzsa \ - crooked_tree.lzsa \ - todo.lzsa - echo "cottage_lzsa: .incbin \"cottage.lzsa\"" > graphics.inc - echo "lake_w_lzsa: .incbin \"lake_w.lzsa\"" >> graphics.inc - echo "lake_e_lzsa: .incbin \"lake_e.lzsa\"" >> graphics.inc - echo "river_lzsa: .incbin \"river.lzsa\"" >> graphics.inc - echo "knight_lzsa: .incbin \"knight.lzsa\"" >> graphics.inc - echo "waterfall_lzsa: .incbin \"waterfall.lzsa\"" >> graphics.inc - echo "inn_lzsa: .incbin \"inn.lzsa\"" >> graphics.inc - echo "crooked_tree_lzsa: .incbin \"crooked_tree.lzsa\"" >> graphics.inc - echo "todo_lzsa: .incbin \"todo.lzsa\"" >> graphics.inc - + inn.lzsa + echo "todo_lzsa: .incbin \"todo.lzsa\"" > graphics_peasant3.inc + echo "cottage_lzsa: .incbin \"cottage.lzsa\"" >> graphics_peasant3.inc + echo "lake_w_lzsa: .incbin \"lake_w.lzsa\"" >> graphics_peasant3.inc + echo "lake_e_lzsa: .incbin \"lake_e.lzsa\"" >> graphics_peasant3.inc + echo "inn_lzsa: .incbin \"inn.lzsa\"" >> graphics_peasant3.inc ### +graphics_peasant4.inc: \ + todo.lzsa \ + lady_cottage.lzsa \ + crooked_tree.lzsa + echo "todo_lzsa: .incbin \"todo.lzsa\"" > 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 + +### + + cottage.lzsa: cottage.hgr $(LZSA) -r -f2 cottage.hgr cottage.lzsa @@ -60,6 +82,14 @@ crooked_tree.lzsa: crooked_tree.hgr crooked_tree.hgr: crooked_tree.png $(PNG2HGR) crooked_tree.png > crooked_tree.hgr +### + +lady_cottage.lzsa: lady_cottage.hgr + $(LZSA) -r -f2 lady_cottage.hgr lady_cottage.lzsa + +lady_cottage.hgr: lady_cottage.png + $(PNG2HGR) lady_cottage.png > lady_cottage.hgr + ### diff --git a/games/peasant/graphics/lady_cottage.png b/games/peasant/graphics/lady_cottage.png new file mode 100644 index 0000000000000000000000000000000000000000..fc62810272f101bd7a4ca99ef3e04e0f4b85e7d1 GIT binary patch literal 2672 zcmV-$3Xk=PP)EX>4Tx04R}tkv&MmKpe$iQ^g`J4t5Z6$WWauNELC^DionYs1;guFuC*#nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|=H{g6A|?JWDYS_3;J6>}?mh0_0YbCNG^=L<&~)3( zq>^GTzbf{)W(glehxvqHp#<}FOz%!#}HZxBgB^FCvtaLFen;P*HaZJ^8$`^7T ztDLtuYt=ey-;=*ET+mmRxlVHgDJ)_M5=1Ddqk<}I#A($@v5=wtq>q2t^-JVZ$W;L& z#{z25AiI9>Klt6PRh&$CN#P{W`{Fnsqd?y-&}ul&_p#%&PJrMuaHV(rwI(q0NqVEB z#g2f1ZQ$a%qbYm9Pl+)mWArgP4bU8j;SDZ2nEbcrI zH)&9;p9t1OE!MZW2Sl{~`Anac*>JLL9J7-IlqoLTrs1~t8Z$Bx$@MTpt{ditxnXXY z8|H?&VQ!ck=7w1>X1@mppxKL)4F+so+b@AZU2NCvq=8&4ooza6_ZbTE>0%pe?Ki-n zztlw2HE=Zy)aWi~CA8D7h=MFes;woI4)w9u!qDUf!5~S!&rthe08PX&P1AMsV!NR- zz#u@49@8O=MQLn(9SpE(@KHCop-QL`Tm(ZIhJ>Nc0Aa{rwz&+Zt~-irPBYF zEHx!O%S<&{3qz{81O_m*G=`bKLA_zY?+mO?A+oXYg4nu9@pNiL9MvofhY@uL990zQwUmA5!EhgKC4v~n{jEu@hT{rOf&t+Wr;(1*_KBvE{_->! za$f4K8;N5NL){Yv6uVF|4eVj*Y7TAbwH*wP5<2O9PEtuTL>#Q;-ued;6Au>H2({@x5j3m1q7tM3tv5&JQzK3N%Vm{u{! zKYp+O#K6xjya(;UMX2lD{&YZ$=f$-odij(w&wy_qDx;PYz$GpMej#tG3&I|DFU{klHUZypB5 z$`n!Md1Oa9Ia6sZr(6e9`?baJU>G0|MzW#L90bFI0M}cynb?0!#W27Q{BoIQ)Yn3O zn37pu3V!L@35KIuE7V89Lqgl-;KYhN9tOrR2Afw$)8ivbo@4;d&xH>zl8AXl8lzT2SXT5qqrksyvuMN(d;oa{->d>z`Q&RC?$F3C>Z?7+@BD4r?n1^VEkbQx0J)^rEPGT<9?jT8?IKj)Sq| z&3D&o@Y|Omj5#uz?36|ZlpaQpVcslfz>qdHWP>3Ogv5+5zgiwCi zq=O_gpK%jeunzNiP+W!^>eV5EJ{(~q=H)^#uyD)j6OHx1Yy0qd8=MQ9H9r5%?c${E zgu%vbp=k{humJ>iP0*kVegmO>_@s-6nbAOC&n!)+*!1n=T$ovcftbmiGQ~g;wo*TH zxd0>c*z2=iiNXY}6!hRQ%*qT#ndHZTP%^z|F2jh^tj-7eR?2mxHaxFvR+KS441WW* zaoUUu3H zECFfot#&e4Ss$v%vY@>%#oT4e^>HPHQb2}Z)4XHbjc#Mc|AF-%*hqFFg?!qB)zZ7z&Fed ebHn^!Vg3UrPAWkrHLSt_0000 0100 0001 + +parse_copy: + cmp #'C' + bne parse_look + + ; want copy + lda #NEW_FROM_DISK + sta GAME_OVER + + lda #LOAD_COPY_CHECK + sta WHICH_LOAD + + jmp done_parse_message + + +parse_look: + cmp #'L' + bne parse_talk + + lda #fake_error1 + jmp finish_parse_message + + +parse_talk: + cmp #'T' + bne parse_version + + lda #fake_error2 + jmp finish_parse_message + + +parse_version: + cmp #'V' + bne parse_help + + lda #version_message + jmp finish_parse_message + +parse_help: + lda #help_message + +finish_parse_message: + sta OUTH + jsr hgr_text_box + + jsr wait_until_keypress + +done_parse_message: + jsr hgr_partial_restore + + rts + + + diff --git a/games/peasant/peasant1.s b/games/peasant/peasant1.s new file mode 100644 index 00000000..5321c522 --- /dev/null +++ b/games/peasant/peasant1.s @@ -0,0 +1,345 @@ +; Peasant's Quest + +; Peasantry Part 1 (top line of map) + +WHICH_PEASANTRY = 0 + + +; by Vince `deater` Weaver vince@deater.net + +; with apologies to everyone + +.include "hardware.inc" +.include "zp.inc" + +.include "qload.inc" + + +peasant_quest: + lda #0 + sta GAME_OVER + + jsr hgr_make_tables + + jsr HGR2 ; Hi-res graphics, no text at bottom + ; Y=0, A=0 after this called + + + + + + lda #0 + sta FRAME + + ; update map location + + jsr update_map_location + + + ;============================= + ;============================= + ; new screen location + ;============================= + ;============================= + +new_location: + lda #0 + sta GAME_OVER + + ;===================== + ; load bg + + ; we are PEASANT1 so locations 0...4 map to 0...4, no change + + ldx MAP_LOCATION + + lda map_backgrounds_low,X + sta getsrc_smc+1 + lda map_backgrounds_hi,X + sta getsrc_smc+2 + + lda #$40 + + jsr decompress_lzsa2_fast + + ; put peasant text + + lda #peasant_text + sta OUTH + + jsr hgr_put_string + + ; put score + + lda #score_text + sta OUTH + + jsr hgr_put_string + + ;==================== + ; save background + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + + ;======================= + ; draw initial peasant + + jsr save_bg_7x30 + + jsr draw_peasant + +game_loop: + + ; redraw peasant if moved + + lda PEASANT_XADD + ora PEASANT_YADD + beq peasant_the_same + + ; restore bg behind peasant + + lda PEASANT_X + sta CURSOR_X + + lda PEASANT_Y + sta CURSOR_Y + + jsr restore_bg_7x30 + + ; move peasant + + clc + lda PEASANT_X + adc PEASANT_XADD + bmi peasant_x_negative + cmp #40 + bcs peasant_x_toobig ; bge + bcc done_movex + + ;============================ +peasant_x_toobig: + + inc MAP_X + + jsr new_map_location + + lda #0 ; new X location + + jmp done_movex + + ;============================ +peasant_x_negative: + + dec MAP_X + + jsr new_map_location + + lda #39 ; new X location + + jmp done_movex + + ; check edge of screen +done_movex: + sta PEASANT_X + + + ; Move Peasant Y + + clc + lda PEASANT_Y + adc PEASANT_YADD + cmp #45 + bcc peasant_y_negative ; blt + cmp #150 + bcs peasant_y_toobig ; bge + bcc done_movey + + + ;============================ +peasant_y_toobig: + + inc MAP_Y + + jsr new_map_location + + lda #45 ; new X location + + jmp done_movey + + + ;============================ +peasant_y_negative: + + dec MAP_Y + + jsr new_map_location + + lda #150 ; new X location + + jmp done_movey + + ; check edge of screen +done_movey: + sta PEASANT_Y + + + + + ; save behind new position + + lda PEASANT_X + sta CURSOR_X + + lda PEASANT_Y + sta CURSOR_Y + + jsr save_bg_7x30 + + ; draw peasant + + jsr draw_peasant + +peasant_the_same: + + inc FRAME + + jsr check_keyboard + + lda GAME_OVER + bmi oops_new_location + bne game_over + + + ; delay + + lda #200 + jsr WAIT + + + jmp game_loop + +oops_new_location: + jmp new_location + + + ;************************ + ; exit level + ;************************ +game_over: + + rts + + +peasant_text: + .byte 25,2,"Peasant's Quest",0 + +score_text: + .byte 0,2,"Score: 0 of 150",0 + + + + + +.include "decompress_fast_v2.s" +.include "wait_keypress.s" + +.include "draw_peasant.s" + +.include "hgr_font.s" +.include "draw_box.s" +.include "hgr_rectangle.s" +.include "hgr_7x30_sprite.s" +.include "hgr_1x5_sprite.s" +;.include "hgr_save_restore.s" +.include "hgr_partial_save.s" +.include "hgr_input.s" +.include "hgr_tables.s" +.include "hgr_text_box.s" +.include "clear_bottom.s" + +.include "new_map_location.s" + +.include "parse_input.s" + +.include "keyboard.s" + +.include "wait_a_bit.s" + +.include "graphics/graphics_peasant1.inc" + + +help_message: +.byte 0,43,24, 0,253,82 +.byte 8,41,"I don't understand. Type",13 +.byte "HELP for assistances.",0 + +version_message: +.byte 0,43,24, 0,253,82 +.byte 8,41,"APPLE ][ PEASANT'S QUEST",13 +.byte "version 0.3",0 + + +fake_error1: +.byte 0,43,24, 0,253,82 +.byte 8,41,"?SYNTAX ERROR IN 1020",13 +.byte "]",127,0 + +fake_error2: +.byte 0,43,24, 0,253,82 +.byte 8,41,"?UNDEF'D STATEMENT ERROR",13 +.byte "]",127,0 + + + + +map_backgrounds_low: + .byte todo_lzsa ; 0 + .byte >todo_lzsa ; 1 + .byte >todo_lzsa ; 2 + .byte >todo_lzsa ; 3 + .byte >waterfall_lzsa ; 4 -- waterfall +; .byte >todo_lzsa ; 5 +; .byte >todo_lzsa ; 6 +; .byte >todo_lzsa ; 7 +; .byte >river_lzsa ; 8 -- river +; .byte >knight_lzsa ; 9 -- knight +; .byte >todo_lzsa ; 10 +; .byte >cottage_lzsa ; 11 -- cottage +; .byte >lake_w_lzsa ; 12 -- lake west +; .byte >lake_e_lzsa ; 13 -- lake east +; .byte >inn_lzsa ; 14 -- inn +; .byte >todo_lzsa ; 15 +; .byte >todo_lzsa ; 16 +; .byte >todo_lzsa ; 17 +; .byte >lady_cottage_lzsa ; 18 -- cottage lady +; .byte >crooked_tree_lzsa ; 19 -- crooked tree + diff --git a/games/peasant/peasant2.s b/games/peasant/peasant2.s new file mode 100644 index 00000000..9ea98310 --- /dev/null +++ b/games/peasant/peasant2.s @@ -0,0 +1,346 @@ +; Peasant's Quest + +; Peasantry Part 2 (second line of map) + +WHICH_PEASANTRY=1 + +; by Vince `deater` Weaver vince@deater.net + +; with apologies to everyone + +.include "hardware.inc" +.include "zp.inc" + +.include "qload.inc" + + +peasant_quest: + lda #0 + sta GAME_OVER + + jsr hgr_make_tables + + jsr HGR2 ; Hi-res graphics, no text at bottom + ; Y=0, A=0 after this called + + + + + + lda #0 + sta FRAME + + ; update map location + + jsr update_map_location + + + ;============================= + ;============================= + ; new screen location + ;============================= + ;============================= + +new_location: + lda #0 + sta GAME_OVER + + ;===================== + ; load bg + + ; we are PEASANT2 so locations 5...9 map to 0...4 + + lda MAP_LOCATION + sec + sbc #5 + tax + + lda map_backgrounds_low,X + sta getsrc_smc+1 + lda map_backgrounds_hi,X + sta getsrc_smc+2 + + lda #$40 + + jsr decompress_lzsa2_fast + + ; put peasant text + + lda #peasant_text + sta OUTH + + jsr hgr_put_string + + ; put score + + lda #score_text + sta OUTH + + jsr hgr_put_string + + ;==================== + ; save background + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + + ;======================= + ; draw initial peasant + + jsr save_bg_7x30 + + jsr draw_peasant + +game_loop: + + ; redraw peasant if moved + + lda PEASANT_XADD + ora PEASANT_YADD + beq peasant_the_same + + ; restore bg behind peasant + + lda PEASANT_X + sta CURSOR_X + + lda PEASANT_Y + sta CURSOR_Y + + jsr restore_bg_7x30 + + ; move peasant + + clc + lda PEASANT_X + adc PEASANT_XADD + bmi peasant_x_negative + cmp #40 + bcs peasant_x_toobig ; bge + bcc done_movex + + ;============================ +peasant_x_toobig: + + inc MAP_X + + jsr new_map_location + + lda #0 ; new X location + + jmp done_movex + + ;============================ +peasant_x_negative: + + dec MAP_X + + jsr new_map_location + + lda #39 ; new X location + + jmp done_movex + + ; check edge of screen +done_movex: + sta PEASANT_X + + + ; Move Peasant Y + + clc + lda PEASANT_Y + adc PEASANT_YADD + cmp #45 + bcc peasant_y_negative ; blt + cmp #150 + bcs peasant_y_toobig ; bge + bcc done_movey + + + ;============================ +peasant_y_toobig: + + inc MAP_Y + + jsr new_map_location + + lda #45 ; new X location + + jmp done_movey + + + ;============================ +peasant_y_negative: + + dec MAP_Y + + jsr new_map_location + + lda #150 ; new X location + + jmp done_movey + + ; check edge of screen +done_movey: + sta PEASANT_Y + + + + + ; save behind new position + + lda PEASANT_X + sta CURSOR_X + + lda PEASANT_Y + sta CURSOR_Y + + jsr save_bg_7x30 + + ; draw peasant + + jsr draw_peasant + +peasant_the_same: + + inc FRAME + + jsr check_keyboard + + lda GAME_OVER + bmi oops_new_location + bne game_over + + + ; delay + + lda #200 + jsr WAIT + + + jmp game_loop + +oops_new_location: + jmp new_location + + + ;************************ + ; exit level + ;************************ +game_over: + + rts + + +peasant_text: + .byte 25,2,"Peasant's Quest",0 + +score_text: + .byte 0,2,"Score: 0 of 150",0 + + + + + +.include "decompress_fast_v2.s" +.include "wait_keypress.s" + +.include "draw_peasant.s" + +.include "hgr_font.s" +.include "draw_box.s" +.include "hgr_rectangle.s" +.include "hgr_7x30_sprite.s" +.include "hgr_1x5_sprite.s" +;.include "hgr_save_restore.s" +.include "hgr_partial_save.s" +.include "hgr_input.s" +.include "hgr_tables.s" +.include "hgr_text_box.s" +.include "clear_bottom.s" + +.include "new_map_location.s" + +.include "parse_input.s" + +.include "keyboard.s" + +.include "wait_a_bit.s" + +.include "graphics/graphics_peasant2.inc" + + +help_message: +.byte 0,43,24, 0,253,82 +.byte 8,41,"I don't understand. Type",13 +.byte "HELP for assistances.",0 + +version_message: +.byte 0,43,24, 0,253,82 +.byte 8,41,"APPLE ][ PEASANT'S QUEST",13 +.byte "version 0.3",0 + + +fake_error1: +.byte 0,43,24, 0,253,82 +.byte 8,41,"?SYNTAX ERROR IN 1020",13 +.byte "]",127,0 + +fake_error2: +.byte 0,43,24, 0,253,82 +.byte 8,41,"?UNDEF'D STATEMENT ERROR",13 +.byte "]",127,0 + + + +map_backgrounds_low: +; .byte todo_lzsa ; 0 +; .byte >todo_lzsa ; 1 +; .byte >todo_lzsa ; 2 +; .byte >todo_lzsa ; 3 +; .byte >waterfall_lzsa ; 4 -- waterfall + .byte >todo_lzsa ; 5 + .byte >todo_lzsa ; 6 + .byte >todo_lzsa ; 7 + .byte >river_lzsa ; 8 -- river + .byte >knight_lzsa ; 9 -- knight +; .byte >todo_lzsa ; 10 +; .byte >cottage_lzsa ; 11 -- cottage +; .byte >lake_w_lzsa ; 12 -- lake west +; .byte >lake_e_lzsa ; 13 -- lake east +; .byte >inn_lzsa ; 14 -- inn +; .byte >todo_lzsa ; 15 +; .byte >todo_lzsa ; 16 +; .byte >todo_lzsa ; 17 +; .byte >lady_cottage_lzsa ; 18 -- cottage lady +; .byte >crooked_tree_lzsa ; 19 -- crooked tree + diff --git a/games/peasant/peasant.s b/games/peasant/peasant3.s similarity index 54% rename from games/peasant/peasant.s rename to games/peasant/peasant3.s index 5b35e0bf..f5282512 100644 --- a/games/peasant/peasant.s +++ b/games/peasant/peasant3.s @@ -1,4 +1,8 @@ -; A Peasant's Quest???? +; Peasant's Quest + +; Peasantry Part 3 (third line of map) + +WHICH_PEASANTRY = 2 ; by Vince `deater` Weaver vince@deater.net @@ -10,9 +14,6 @@ .include "qload.inc" -ENDING_COPY = 1 - - peasant_quest: lda #0 sta GAME_OVER @@ -29,28 +30,8 @@ peasant_quest: lda #0 sta FRAME - ;========================= - ; init peasant position - ; draw at 18,107 + ; update map location - lda #18 - sta PEASANT_X - lda #107 - sta PEASANT_Y - - lda #PEASANT_DIR_RIGHT - sta PEASANT_DIR - - lda #0 - sta PEASANT_XADD - sta PEASANT_YADD - - ; setup map location - - lda #4 - sta MAP_X - lda #1 - sta MAP_Y jsr update_map_location @@ -67,7 +48,13 @@ new_location: ;===================== ; load bg - ldx MAP_LOCATION + ; we are PEASANT3 so locations 10...14 map to 0...4, no change + + lda MAP_LOCATION + sec + sbc #10 + tax + lda map_backgrounds_low,X sta getsrc_smc+1 lda map_backgrounds_hi,X @@ -95,13 +82,6 @@ new_location: jsr hgr_put_string - - ; draw rectangle on bottom - -; jsr clear_bottom - -; jsr hgr_save - ;==================== ; save background @@ -230,9 +210,6 @@ done_movey: peasant_the_same: -; lda #3 -; jsr wait_a_bit - inc FRAME jsr check_keyboard @@ -255,13 +232,9 @@ oops_new_location: ;************************ - ; copy protection check + ; exit level ;************************ game_over: -exit_copy_check: - lda #LOAD_COPY_CHECK - sta WHICH_LOAD - rts @@ -274,66 +247,6 @@ score_text: -parse_input: -; jsr hgr_save - - lda input_buffer ; get first char FIXME - and #$DF ; make uppercase 0110 0001 -> 0100 0001 - -parse_copy: - cmp #'C' - bne parse_look - - ; want copy - lda #ENDING_COPY - sta GAME_OVER - jmp done_parse_message - - -parse_look: - cmp #'L' - bne parse_talk - - lda #fake_error1 - jmp finish_parse_message - - -parse_talk: - cmp #'T' - bne parse_version - - lda #fake_error2 - jmp finish_parse_message - - -parse_version: - cmp #'V' - bne parse_help - - lda #version_message - jmp finish_parse_message - -parse_help: - lda #help_message - -finish_parse_message: - sta OUTH - jsr hgr_text_box - - jsr wait_until_keypress - -done_parse_message: - jsr hgr_partial_restore - - rts .include "decompress_fast_v2.s" .include "wait_keypress.s" @@ -350,12 +263,17 @@ done_parse_message: .include "hgr_input.s" .include "hgr_tables.s" .include "hgr_text_box.s" +.include "clear_bottom.s" + +.include "new_map_location.s" + +.include "parse_input.s" .include "keyboard.s" .include "wait_a_bit.s" -.include "graphics/graphics.inc" +.include "graphics/graphics_peasant3.inc" help_message: @@ -380,128 +298,48 @@ fake_error2: .byte "]",127,0 -clear_bottom: - ; draw rectangle - - lda #$00 ; color is black1 - sta VGI_RCOLOR - - lda #0 - sta VGI_RX1 - lda #183 - sta VGI_RY1 - lda #140 - sta VGI_RXRUN - lda #9 - sta VGI_RYRUN - - jsr vgi_simple_rectangle - - lda #140 - sta VGI_RX1 - lda #183 - sta VGI_RY1 - lda #140 - sta VGI_RXRUN - lda #9 - sta VGI_RYRUN - - jsr vgi_simple_rectangle - - rts - - - ;===================== - ; - ;===================== -new_map_location: - lda #$FF - sta GAME_OVER - - ; fall through - - ;================== - ; update map - ; on main map, it's (MAP_Y*5)+MAP_X -update_map_location: - ; put in map - -map_wrap_x: - ; wrap X (0..4) - lda MAP_X - bmi map_x_went_negative - cmp #5 - bcc map_wrap_y ; blt - - lda #0 - beq update_map_x ; bra - -map_x_went_negative: - lda #4 - -update_map_x: - sta MAP_X - -map_wrap_y: - - ; wrap Y (0..3) - lda MAP_Y - and #$3 - sta MAP_Y - - clc - lda MAP_Y - asl - asl - adc MAP_Y - adc MAP_X - - sta MAP_LOCATION - - rts - map_backgrounds_low: - .byte todo_lzsa ; 0 - .byte >todo_lzsa ; 1 - .byte >todo_lzsa ; 2 - .byte >todo_lzsa ; 3 - .byte >waterfall_lzsa ; 4 -- waterfall - .byte >todo_lzsa ; 5 - .byte >todo_lzsa ; 6 - .byte >todo_lzsa ; 7 - .byte >river_lzsa ; 8 -- river - .byte >knight_lzsa ; 9 -- knight +; .byte >todo_lzsa ; 0 +; .byte >todo_lzsa ; 1 +; .byte >todo_lzsa ; 2 +; .byte >todo_lzsa ; 3 +; .byte >waterfall_lzsa ; 4 -- waterfall +; .byte >todo_lzsa ; 5 +; .byte >todo_lzsa ; 6 +; .byte >todo_lzsa ; 7 +; .byte >river_lzsa ; 8 -- river +; .byte >knight_lzsa ; 9 -- knight .byte >todo_lzsa ; 10 .byte >cottage_lzsa ; 11 -- cottage .byte >lake_w_lzsa ; 12 -- lake west .byte >lake_e_lzsa ; 13 -- lake east .byte >inn_lzsa ; 14 -- inn - .byte >todo_lzsa ; 15 - .byte >todo_lzsa ; 16 - .byte >todo_lzsa ; 17 - .byte >todo_lzsa ; 18 - .byte >crooked_tree_lzsa ; 19 -- crooked tree +; .byte >todo_lzsa ; 15 +; .byte >todo_lzsa ; 16 +; .byte >todo_lzsa ; 17 +; .byte >lady_cottage_lzsa ; 18 -- cottage lady +; .byte >crooked_tree_lzsa ; 19 -- crooked tree diff --git a/games/peasant/peasant4.s b/games/peasant/peasant4.s new file mode 100644 index 00000000..6f12594f --- /dev/null +++ b/games/peasant/peasant4.s @@ -0,0 +1,345 @@ +; Peasant's Quest + +; Peasantry Part 4 (bottom line of map) + +WHICH_PEASANTRY = 3 + +; by Vince `deater` Weaver vince@deater.net + +; with apologies to everyone + +.include "hardware.inc" +.include "zp.inc" + +.include "qload.inc" + + +peasant_quest: + lda #0 + sta GAME_OVER + + jsr hgr_make_tables + + jsr HGR2 ; Hi-res graphics, no text at bottom + ; Y=0, A=0 after this called + + + + + + lda #0 + sta FRAME + + ; update map location + + jsr update_map_location + + + ;============================= + ;============================= + ; new screen location + ;============================= + ;============================= + +new_location: + lda #0 + sta GAME_OVER + + ;===================== + ; load bg + + ; we are PEASANT1 so locations 15...19 map to 0...4, no change + + lda MAP_LOCATION + sec + sbc #15 + tax + + lda map_backgrounds_low,X + sta getsrc_smc+1 + lda map_backgrounds_hi,X + sta getsrc_smc+2 + + lda #$40 + + jsr decompress_lzsa2_fast + + ; put peasant text + + lda #peasant_text + sta OUTH + + jsr hgr_put_string + + ; put score + + lda #score_text + sta OUTH + + jsr hgr_put_string + + ;==================== + ; save background + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + + ;======================= + ; draw initial peasant + + jsr save_bg_7x30 + + jsr draw_peasant + +game_loop: + + ; redraw peasant if moved + + lda PEASANT_XADD + ora PEASANT_YADD + beq peasant_the_same + + ; restore bg behind peasant + + lda PEASANT_X + sta CURSOR_X + + lda PEASANT_Y + sta CURSOR_Y + + jsr restore_bg_7x30 + + ; move peasant + + clc + lda PEASANT_X + adc PEASANT_XADD + bmi peasant_x_negative + cmp #40 + bcs peasant_x_toobig ; bge + bcc done_movex + + ;============================ +peasant_x_toobig: + + inc MAP_X + + jsr new_map_location + + lda #0 ; new X location + + jmp done_movex + + ;============================ +peasant_x_negative: + + dec MAP_X + + jsr new_map_location + + lda #39 ; new X location + + jmp done_movex + + ; check edge of screen +done_movex: + sta PEASANT_X + + + ; Move Peasant Y + + clc + lda PEASANT_Y + adc PEASANT_YADD + cmp #45 + bcc peasant_y_negative ; blt + cmp #150 + bcs peasant_y_toobig ; bge + bcc done_movey + + + ;============================ +peasant_y_toobig: + + inc MAP_Y + + jsr new_map_location + + lda #45 ; new X location + + jmp done_movey + + + ;============================ +peasant_y_negative: + + dec MAP_Y + + jsr new_map_location + + lda #150 ; new X location + + jmp done_movey + + ; check edge of screen +done_movey: + sta PEASANT_Y + + + + + ; save behind new position + + lda PEASANT_X + sta CURSOR_X + + lda PEASANT_Y + sta CURSOR_Y + + jsr save_bg_7x30 + + ; draw peasant + + jsr draw_peasant + +peasant_the_same: + + inc FRAME + + jsr check_keyboard + + lda GAME_OVER + bmi oops_new_location + bne game_over + + + ; delay + + lda #200 + jsr WAIT + + + jmp game_loop + +oops_new_location: + jmp new_location + + + ;************************ + ; exit level + ;************************ +game_over: + + rts + + +peasant_text: + .byte 25,2,"Peasant's Quest",0 + +score_text: + .byte 0,2,"Score: 0 of 150",0 + + + + + +.include "decompress_fast_v2.s" +.include "wait_keypress.s" + +.include "draw_peasant.s" + +.include "hgr_font.s" +.include "draw_box.s" +.include "hgr_rectangle.s" +.include "hgr_7x30_sprite.s" +.include "hgr_1x5_sprite.s" +;.include "hgr_save_restore.s" +.include "hgr_partial_save.s" +.include "hgr_input.s" +.include "hgr_tables.s" +.include "hgr_text_box.s" +.include "clear_bottom.s" + +.include "new_map_location.s" + +.include "parse_input.s" + +.include "keyboard.s" + +.include "wait_a_bit.s" + +.include "graphics/graphics_peasant4.inc" + + +help_message: +.byte 0,43,24, 0,253,82 +.byte 8,41,"I don't understand. Type",13 +.byte "HELP for assistances.",0 + +version_message: +.byte 0,43,24, 0,253,82 +.byte 8,41,"APPLE ][ PEASANT'S QUEST",13 +.byte "version 0.3",0 + + +fake_error1: +.byte 0,43,24, 0,253,82 +.byte 8,41,"?SYNTAX ERROR IN 1020",13 +.byte "]",127,0 + +fake_error2: +.byte 0,43,24, 0,253,82 +.byte 8,41,"?UNDEF'D STATEMENT ERROR",13 +.byte "]",127,0 + + +map_backgrounds_low: +; .byte todo_lzsa ; 0 +; .byte >todo_lzsa ; 1 +; .byte >todo_lzsa ; 2 +; .byte >todo_lzsa ; 3 +; .byte >waterfall_lzsa ; 4 -- waterfall +; .byte >todo_lzsa ; 5 +; .byte >todo_lzsa ; 6 +; .byte >todo_lzsa ; 7 +; .byte >river_lzsa ; 8 -- river +; .byte >knight_lzsa ; 9 -- knight +; .byte >todo_lzsa ; 10 +; .byte >cottage_lzsa ; 11 -- cottage +; .byte >lake_w_lzsa ; 12 -- lake west +; .byte >lake_e_lzsa ; 13 -- lake east +; .byte >inn_lzsa ; 14 -- inn + .byte >todo_lzsa ; 15 + .byte >todo_lzsa ; 16 + .byte >todo_lzsa ; 17 + .byte >lady_cottage_lzsa ; 18 -- cottage lady + .byte >crooked_tree_lzsa ; 19 -- crooked tree + diff --git a/games/peasant/qload.s b/games/peasant/qload.s index 3e09fa2a..6bdbd4cc 100644 --- a/games/peasant/qload.s +++ b/games/peasant/qload.s @@ -189,7 +189,7 @@ error_string: which_disk_array: .byte 1,1,1,1 ; VID_LOGO, TITLE, INTRO. COPY_CHECK - .byte 1,1,3,2 ; PEASANT + .byte 1,1,1,1 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte 2,1,2,2 ; .byte 1,1,1,3 ; .byte 1 ; @@ -198,7 +198,7 @@ which_disk_array: load_address_array: .byte $60,$60,$60,$60 ; VID_LOGO, TITLE, INTRO, COPY_CHECK - .byte $60,$40,$40,$40 ; PEASANT + .byte $60,$60,$60,$60 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte $40,$40,$40,$40 ; .byte $40,$40,$40,$40 ; .byte $08 ; @@ -208,7 +208,7 @@ load_address_array: track_array: .byte 3, 5, 8,12 ; VID_LOGO, TITLE, INTRO, COPY_CHECK - .byte 14,31,11, 1 ; PEASANT + .byte 14,19,24,29 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte 27,26,10,20 ; .byte 30,32,28,30 ; .byte 0 ; @@ -217,7 +217,7 @@ track_array: sector_array: .byte 0, 0, 0, 0 ; VID_LOGO, TITLE, INTRO, COPY_CHECK - .byte 0, 0, 0, 0 ; PEASANT + .byte 0, 0, 0, 0 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte 0, 0, 0, 0 ; .byte 0,13, 0, 1 ; .byte 6 ; @@ -226,7 +226,7 @@ sector_array: length_array: .byte 28, 50, 60, 20 ; VID_LOGO, TITLE, INTRO, COPY_CHECK - .byte 88, 20,158,135 ; PEASANT + .byte 80, 80, 80, 80 ; PEASANT1, PEASANT2, PEASANT3, PEASANT4 .byte 61, 31,159,109 ; .byte 20, 33, 27, 78 ; .byte 3 ; diff --git a/games/peasant/zp.inc b/games/peasant/zp.inc index d0e8220b..02fdb726 100644 --- a/games/peasant/zp.inc +++ b/games/peasant/zp.inc @@ -29,6 +29,8 @@ SAVED_X = $69 PEASANT_XADD = $6A PEASANT_YADD = $6B GAME_OVER = $6C + NEW_LOCATION = $FF + NEW_FROM_DISK = $01 MAP_X = $6D MAP_Y = $6E MAP_LOCATION = $6F @@ -107,7 +109,10 @@ LOAD_VID_LOGO = 0 LOAD_TITLE = 1 LOAD_INTRO = 2 LOAD_COPY_CHECK = 3 -LOAD_PEASANT = 4 +LOAD_PEASANT1 = 4 +LOAD_PEASANT2 = 5 +LOAD_PEASANT3 = 6 +LOAD_PEASANT4 = 7 VGI_RCOLOR = P0 VGI_RX1 = P1