diff --git a/games/peasant/Makefile b/games/peasant/Makefile index 8d3bfd85..85d308a7 100644 --- a/games/peasant/Makefile +++ b/games/peasant/Makefile @@ -69,9 +69,11 @@ title.o: title.s \ INTRO: intro.o ld65 -o INTRO intro.o -C $(LINKER_SCRIPTS)/apple2_6000.inc -intro.o: intro.s graphics/graphics_intro.inc sprites/peasant_sprite.inc \ +intro.o: intro.s zp.inc \ + graphics/graphics_intro.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 \ + hgr_partial_save.s \ wait_a_bit.s draw_peasant.s hgr_text_box.s \ title.s directions.s \ intro_cottage.s intro_lake_w.s intro_lake_e.s \ @@ -83,7 +85,8 @@ intro.o: intro.s graphics/graphics_intro.inc sprites/peasant_sprite.inc \ PEASANT: peasant.o ld65 -o PEASANT peasant.o -C $(LINKER_SCRIPTS)/apple2_6000.inc -peasant.o: peasant.s graphics/graphics.inc sprites/peasant_sprite.inc \ +peasant.o: peasant.s zp.inc \ + graphics/graphics.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 \ diff --git a/games/peasant/NOTES b/games/peasant/NOTES index 78015121..ed062e11 100644 --- a/games/peasant/NOTES +++ b/games/peasant/NOTES @@ -21,12 +21,12 @@ $D0-$FF ROM Disk Map (disk has 35 tracks, each 4k in size) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ T 0 = Qboot -T 1 = QLOAD 4301 bytes 17S = 1T1S +T 1 = QLOAD 4813 bytes 19S = 1T3S T 3 = VID_LOGO 6911 bytes 27S = 1T11S T 5 = TITLE 9662 bytes 38S = 2T6S -T 8 = INTRO 14265 bytes 56S = 3T8S -T 12 = COPY_CHECK 4642 bytes 18S = 1T2S -T 14 = PEASANT 15332 bytes 60S = 3T12S ; 88 is max? +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? 238, to 280 (6) diff --git a/games/peasant/copy_check.s b/games/peasant/copy_check.s index 7e3f9fe5..77962114 100644 --- a/games/peasant/copy_check.s +++ b/games/peasant/copy_check.s @@ -120,6 +120,7 @@ forever: .include "hgr_input.s" .include "hgr_tables.s" .include "hgr_text_box.s" +.include "hgr_partial_save.s" .include "graphics_copy/copy_graphics.inc" diff --git a/games/peasant/hgr_partial_save.s b/games/peasant/hgr_partial_save.s new file mode 100644 index 00000000..56de052a --- /dev/null +++ b/games/peasant/hgr_partial_save.s @@ -0,0 +1,80 @@ + ;======================= + ; HGR Partial Save + ;======================= + ; loads from $40 + ; save to $20 + ; only save from row in P2 to P2+P4 +hgr_partial_save: + + clc + lda BOX_Y1 + sta SAVED_Y1 + + ldx BOX_Y2 + stx SAVED_Y2 + +partial_save_yloop: + + lda hposn_low,X + sta psx_smc1+1 + sta psx_smc2+1 + + lda hposn_high,X + sta psx_smc1+2 + sec + sbc #$20 + sta psx_smc2+2 + + ldy #$27 +partial_save_xloop: +psx_smc1: + lda $d000,Y +psx_smc2: + sta $d000,Y + dey + bpl partial_save_xloop + + dex + cpx BOX_Y1 + bcs partial_save_yloop + + rts + + + + ;======================= + ; HGR Partial Restore + ;======================= + ; loads from $20 + ; save to $40 + +hgr_partial_restore: + + ldx SAVED_Y2 + +partial_restore_yloop: + + lda hposn_low,X + sta prx_smc2+1 + sta prx_smc1+1 + + lda hposn_high,X + sta prx_smc2+2 + sec + sbc #$20 + sta prx_smc1+2 + + ldy #$27 +partial_restore_xloop: +prx_smc1: + lda $d000,Y +prx_smc2: + sta $d000,Y + dey + bpl partial_restore_xloop + + dex + cpx SAVED_Y1 + bcs partial_restore_yloop ; bge + + rts diff --git a/games/peasant/hgr_text_box.s b/games/peasant/hgr_text_box.s index cd5f48cc..61794ae6 100644 --- a/games/peasant/hgr_text_box.s +++ b/games/peasant/hgr_text_box.s @@ -32,6 +32,8 @@ hgr_text_box: lda (OUTL),Y sta BOX_Y2 + jsr hgr_partial_save + jsr draw_box clc diff --git a/games/peasant/intro.s b/games/peasant/intro.s index 7a3bf3c2..41e14e5f 100644 --- a/games/peasant/intro.s +++ b/games/peasant/intro.s @@ -84,6 +84,8 @@ peasant_quest_intro: ; Start actual game ;************************ + jsr draw_peasant + ; wait a bit lda #10 @@ -94,9 +96,7 @@ escape_handler: sei ; turn off music jsr clear_ay_both ; clear AY state - jsr draw_peasant - - +; jsr draw_peasant ; start game @@ -122,7 +122,8 @@ escape_handler: .include "hgr_rectangle.s" .include "hgr_7x30_sprite.s" .include "hgr_1x5_sprite.s" -.include "hgr_save_restore.s" +;.include "hgr_save_restore.s" +.include "hgr_partial_save.s" .include "hgr_input.s" .include "hgr_tables.s" .include "hgr_text_box.s" diff --git a/games/peasant/intro_cottage.s b/games/peasant/intro_cottage.s index 7e38c619..3da9e483 100644 --- a/games/peasant/intro_cottage.s +++ b/games/peasant/intro_cottage.s @@ -44,7 +44,7 @@ cottage: jsr hgr_put_string - jsr hgr_save +; jsr hgr_save ;==================== ; save background @@ -60,50 +60,18 @@ cottage: jsr save_bg_7x30 cottage_walk_loop: + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + jsr restore_bg_7x30 - lda FRAME -check_cottage_action1: - cmp #0 - bne check_cottage_action2 - ; display cottage text 1 + ;======================= + ; draw peasant - lda #cottage_text1 - - jmp finish_cottage_action - -check_cottage_action2: - cmp #1 - bne check_cottage_action3 - jsr hgr_restore - - ; display cottage text 2 - - lda #cottage_text2 - - jmp finish_cottage_action - -check_cottage_action3: - cmp #13 - bne done_cottage_action - jsr hgr_restore - - ; display cottage text 3 - - lda #cottage_text3 - -finish_cottage_action: - sta OUTH - jsr hgr_text_box - -done_cottage_action: lda FRAME asl @@ -123,6 +91,56 @@ done_cottage_action: jsr draw_peasant + + ;======================== + ; handle special + + + lda FRAME +check_cottage_action1: + cmp #0 + bne check_cottage_action2 + + ; display cottage text 1 + + lda #cottage_text1 + + jmp finish_cottage_action + +check_cottage_action2: + cmp #1 + bne check_cottage_action3 + jsr hgr_partial_restore + + ; display cottage text 2 + + lda #cottage_text2 + + jmp finish_cottage_action + +check_cottage_action3: + cmp #13 + bne done_cottage_action + jsr hgr_partial_restore + + ; display cottage text 3 + + lda #cottage_text3 + +finish_cottage_action: + sta OUTH + jsr hgr_text_box + +done_cottage_action: + + + ; jsr wait_until_keypress lda FRAME @@ -188,7 +206,7 @@ cottage_text2: ; wait a few seconds, then start walking toward cottage cottage_text3: - .byte 0,30,20, 0,253,86 + .byte 0,28,20, 0,252,86 .byte 7,33,"With nothing left to lose,",13 .byte "you swear to get revenge on",13 .byte "the Wingaling Dragon in the",13 diff --git a/games/peasant/intro_knight.s b/games/peasant/intro_knight.s index d366fdcf..cd0b3880 100644 --- a/games/peasant/intro_knight.s +++ b/games/peasant/intro_knight.s @@ -39,7 +39,7 @@ knight: jsr hgr_put_string - jsr hgr_save +; jsr hgr_save ;==================== @@ -56,42 +56,15 @@ knight: jsr save_bg_7x30 knight_walk_loop: + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + jsr restore_bg_7x30 - lda FRAME -check_knight_action1: - cmp #0 - bne check_knight_action2 - - lda #river_message1 - sta OUTH - - jsr hgr_text_box - - jmp done_knight_action - -check_knight_action2: - cmp #8 - bne check_knight_action3 - jsr hgr_restore - jmp done_knight_action - -check_knight_action3: - cmp #17 - bne done_knight_action - - lda #knight_message1 - sta OUTH - - jsr hgr_text_box - - -done_knight_action: - + ; draw peasant lda FRAME asl @@ -111,6 +84,45 @@ done_knight_action: jsr draw_peasant + + + + lda FRAME +check_knight_action1: + cmp #0 + bne check_knight_action2 + + lda #river_message1 + sta OUTH + + jsr hgr_text_box + + jmp done_knight_action + +check_knight_action2: + cmp #8 + bne check_knight_action3 + jsr hgr_partial_restore + jmp done_knight_action + +check_knight_action3: + cmp #17 + bne done_knight_action + + lda #knight_message1 + sta OUTH + + jsr hgr_text_box + + +done_knight_action: + + + ; jsr wait_until_keypress lda #3 diff --git a/games/peasant/intro_lake_e.s b/games/peasant/intro_lake_e.s index 13058ad9..45826195 100644 --- a/games/peasant/intro_lake_e.s +++ b/games/peasant/intro_lake_e.s @@ -36,7 +36,7 @@ lake_east: jsr hgr_put_string - jsr hgr_save +; jsr hgr_save ;==================== @@ -53,32 +53,15 @@ lake_east: jsr save_bg_7x30 lake_e_walk_loop: + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + jsr restore_bg_7x30 - lda FRAME -check_lake_e_action1: - cmp #10 - bne check_lake_e_action2 - - lda #lake_e_message1 - sta OUTH - jsr hgr_text_box - - jmp done_lake_e_action - -check_lake_e_action2: - cmp #28 - bne done_lake_e_action - jsr hgr_restore - lda #PEASANT_DIR_UP - sta PEASANT_DIR - -done_lake_e_action: - - jsr update_bubbles_e - + ; draw peasant lda FRAME asl @@ -98,6 +81,34 @@ done_lake_e_action: jsr draw_peasant + + lda FRAME +check_lake_e_action1: + cmp #10 + bne check_lake_e_action2 + + lda #lake_e_message1 + sta OUTH + jsr hgr_text_box + + jmp done_lake_e_action + +check_lake_e_action2: + cmp #28 + bne done_lake_e_action + jsr hgr_partial_restore + lda #PEASANT_DIR_UP + sta PEASANT_DIR + +done_lake_e_action: + + jsr update_bubbles_e + + + + ; jsr wait_until_keypress lda #3 diff --git a/games/peasant/intro_lake_w.s b/games/peasant/intro_lake_w.s index d884c138..f0bb3dec 100644 --- a/games/peasant/intro_lake_w.s +++ b/games/peasant/intro_lake_w.s @@ -38,7 +38,7 @@ lake_west: jsr hgr_put_string - jsr hgr_save +; jsr hgr_save ;==================== ; save background @@ -54,32 +54,15 @@ lake_west: jsr save_bg_7x30 lake_w_walk_loop: + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + jsr restore_bg_7x30 - lda FRAME -check_lake_w_action1: - cmp #0 - bne check_lake_w_action2 - - ; re-display cottage text 3 - lda #cottage_text3 - sta OUTH - jsr hgr_text_box - jmp done_lake_w_action - -check_lake_w_action2: - cmp #20 - bne done_lake_w_action - jsr hgr_restore - jsr display_lake_w_text1 - -done_lake_w_action: - - - jsr update_bubbles - + ; draw peasant lda FRAME asl @@ -99,6 +82,36 @@ done_lake_w_action: jsr draw_peasant + + + + lda FRAME +check_lake_w_action1: + cmp #0 + bne check_lake_w_action2 + + ; re-display cottage text 3 + lda #cottage_text3 + sta OUTH + jsr hgr_text_box + jmp done_lake_w_action + +check_lake_w_action2: + cmp #20 + bne done_lake_w_action + jsr hgr_partial_restore + jsr display_lake_w_text1 + +done_lake_w_action: + + + jsr update_bubbles + + + + ; jsr wait_until_keypress lda #3 @@ -125,7 +138,7 @@ done_lake_w: ; walk halfway across the screen lake_w_message1: - .byte 0,43,24, 0,253,82 + .byte 0,42,24, 0,252,82 .byte 8,41,"You head east toward the",13 .byte "mountain atop which",13 .byte "TROGDOR lives.",0 @@ -345,9 +358,3 @@ bubble_sprite5: .byte $88 ; 1XX0 10XX .byte $2A ; 0010 1010 - - - - - - diff --git a/games/peasant/intro_river.s b/games/peasant/intro_river.s index 6e81e2f9..d91eb87f 100644 --- a/games/peasant/intro_river.s +++ b/games/peasant/intro_river.s @@ -56,8 +56,35 @@ river: jsr save_bg_7x30 river_walk_loop: + + lda PEASANT_X + sta CURSOR_X + lda PEASANT_Y + sta CURSOR_Y + jsr restore_bg_7x30 + ; draw peasant + + lda FRAME + asl + tax + + lda river_path,X + bmi done_river + sta PEASANT_X + sta CURSOR_X + + inx + lda river_path,X + sta PEASANT_Y + sta CURSOR_Y + + jsr save_bg_7x30 + + jsr draw_peasant + + lda FRAME check_river_action1: cmp #10 @@ -84,23 +111,7 @@ done_river_action: jsr update_bubbles_r - lda FRAME - asl - tax - lda river_path,X - bmi done_river - sta PEASANT_X - sta CURSOR_X - - inx - lda river_path,X - sta PEASANT_Y - sta CURSOR_Y - - jsr save_bg_7x30 - - jsr draw_peasant ; jsr wait_until_keypress diff --git a/games/peasant/peasant.s b/games/peasant/peasant.s index 89d1eb6f..01f2cf65 100644 --- a/games/peasant/peasant.s +++ b/games/peasant/peasant.s @@ -100,7 +100,7 @@ new_location: ; jsr clear_bottom - jsr hgr_save +; jsr hgr_save ;==================== ; save background @@ -275,7 +275,7 @@ score_text: parse_input: - jsr hgr_save +; jsr hgr_save lda input_buffer ; get first char FIXME and #$DF ; make uppercase 0110 0001 -> 0100 0001 @@ -331,14 +331,10 @@ finish_parse_message: jsr wait_until_keypress done_parse_message: - jsr hgr_restore + jsr hgr_partial_restore rts - - - - .include "decompress_fast_v2.s" .include "wait_keypress.s" @@ -349,7 +345,8 @@ done_parse_message: .include "hgr_rectangle.s" .include "hgr_7x30_sprite.s" .include "hgr_1x5_sprite.s" -.include "hgr_save_restore.s" +;.include "hgr_save_restore.s" +.include "hgr_partial_save.s" .include "hgr_input.s" .include "hgr_tables.s" .include "hgr_text_box.s" diff --git a/games/peasant/vid_logo.s b/games/peasant/vid_logo.s index bd0082e8..019bbb0a 100644 --- a/games/peasant/vid_logo.s +++ b/games/peasant/vid_logo.s @@ -20,12 +20,12 @@ HGR_PAGE = $E6 DISP_PAGE = $F0 DRAW_PAGE = $F1 -P0 = $F1 -P1 = $F2 -P2 = $F3 -P3 = $F4 -P4 = $F5 -P5 = $F6 +;P0 = $F1 +;P1 = $F2 +;P2 = $F3 +;P3 = $F4 +;P4 = $F5 +;P5 = $F6 INL = $FC INH = $FD diff --git a/games/peasant/zp.inc b/games/peasant/zp.inc index 841268a0..d0e8220b 100644 --- a/games/peasant/zp.inc +++ b/games/peasant/zp.inc @@ -80,14 +80,14 @@ BOX_Y1 = $C3 BOX_X2L = $C4 BOX_X2H = $C5 BOX_Y2 = $C6 +SAVED_Y1 = $C7 +SAVED_Y2 = $C8 WHICH_SLOT = $DA CURRENT_DISK = $DC HGR_COLOR = $E4 HGR_PAGE = $E6 - - P0 = $F1 P1 = $F2 P2 = $F3 @@ -95,6 +95,7 @@ P3 = $F4 P4 = $F5 P5 = $F6 + INL = $FC INH = $FD OUTL = $FE