peasant: should now work with one disk in each drive

This commit is contained in:
Vince Weaver 2022-01-06 13:29:04 -05:00
parent ebbdf0a216
commit 029e579482
6 changed files with 142 additions and 94 deletions

View File

@ -127,6 +127,7 @@ qboot.inc: generate_common QBOOT
qload.inc: generate_common QLOAD
./generate_common -a 0xb00 -s load_file qload.lst > qload.inc
./generate_common -a 0xb00 -s sector_write qload.lst >> qload.inc
./generate_common -a 0xb00 -s check_floppy_in_drive2 qload.lst >> qload.inc
./generate_common -a 0xb00 -s requested_sector qload.lst >> qload.inc
./generate_common -a 0xb00 -s decompress_lzsa2_fast qload.lst >> qload.inc
./generate_common -a 0xb00 -s getsrc_smc qload.lst >> qload.inc

View File

@ -32,6 +32,18 @@ switch_drive2:
sta curtrk_smc+1
rts
;=================================
; check floppy in drive2
;=================================
; switches to drive2
; turns drive on
; seeks to track0
; attempts to read a sector
; if fails, returns C=0
; if succeeds, returns C=1
; turns drive off
; switches back to drive1
check_floppy_in_drive2:
jsr switch_drive2
@ -99,6 +111,9 @@ check_if_96:
; because result was greater or equal to #$96
done_check:
jmp driveoff
jsr driveoff
jmp switch_drive1 ; tail call

View File

@ -1,39 +1,40 @@
load_file =$0b28
sector_write =$0c90
load_file =$0b24
sector_write =$0c7f
check_floppy_in_drive2 =$0e0a
requested_sector =$0d17
decompress_lzsa2_fast =$0e46
getsrc_smc =$0f3c
hgr2 =$1842
hgr_make_tables =$15b6
hgr_put_string =$0f49
restore_bg_1x28 =$1481
hgr_draw_sprite_1x28 =$141a
input_buffer =$158e
hgr_text_box =$162c
hgr_text_box_nosave =$16c3
hgr_partial_restore =$1504
clear_bottom =$1817
hgr_input =$1534
draw_box =$12cb
disp_put_string =$1667
disp_one_line =$167b
invert_smc1 =$0fc1
disp_put_string_cursor =$1677
hgr_put_char_cursor =$0f75
vgi_simple_rectangle =$134c
peasant_text =$1f76
save_menu =$18f5
load_menu =$18ea
location_names_l =$1c22
location_names_h =$1c41
wait_until_keypress =$1e61
random16 =$1e6a
score_points =$1eef
print_score =$1e9f
update_score =$1eaa
speaker_beep =$1f5d
speaker_duration =$1f74
speaker_frequency =$1f75
decompress_lzsa2_fast =$0e49
getsrc_smc =$0f3f
hgr2 =$1845
hgr_make_tables =$15b9
hgr_put_string =$0f4c
restore_bg_1x28 =$1484
hgr_draw_sprite_1x28 =$141d
input_buffer =$1591
hgr_text_box =$162f
hgr_text_box_nosave =$16c6
hgr_partial_restore =$1507
clear_bottom =$181a
hgr_input =$1537
draw_box =$12ce
disp_put_string =$166a
disp_one_line =$167e
invert_smc1 =$0fc4
disp_put_string_cursor =$167a
hgr_put_char_cursor =$0f78
vgi_simple_rectangle =$134f
peasant_text =$1f79
save_menu =$18f8
load_menu =$18ed
location_names_l =$1c25
location_names_h =$1c44
wait_until_keypress =$1e64
random16 =$1e6d
score_points =$1ef2
print_score =$1ea2
update_score =$1ead
speaker_beep =$1f60
speaker_duration =$1f77
speaker_frequency =$1f78
hposn_high = $BA00
hposn_low = $BB00
driveoff = $A22

View File

@ -34,9 +34,6 @@ qload_start:
sta DRIVE1_DISK ; it's in drive1
sta CURRENT_DRIVE ; and currently using drive 1
lda #0
sta DRIVE2_DISK ; don't know if disk there yet
jsr load_file ; actually load intro
jsr $6000 ; run intro
@ -47,17 +44,9 @@ qload_start:
main_game_loop:
jsr load_file
; lda WHICH_LOAD
; bne not_title
start_title:
jsr $6000
jsr $6000 ; all entry points currently $6000
jmp main_game_loop
;not_title:
; jsr $2000
; jmp main_game_loop
;====================================
; loads file specified by WHICH_LOAD
@ -116,19 +105,19 @@ disk_not_found:
; check if disk in drive2
; carry clear if not
jsr check_floppy_in_drive2
; jsr check_floppy_in_drive2
bcc nothing_in_drive2
; bcc nothing_in_drive2
; a disk is in drive2, try to use it
bcs verify_disk
; bcs verify_disk
nothing_in_drive2:
; switch back to drive1
jsr switch_drive1
; jsr switch_drive1
;==============================
@ -151,17 +140,6 @@ nothing_in_drive2:
jsr hgr_text_box
; ldy #0
;quick_print:
; lda (OUTL),Y
; beq quick_print_done
; jsr COUT1
; iny
; jmp quick_print
;quick_print_done:
fnf_keypress:
lda KEYPRESS
bpl fnf_keypress
@ -217,13 +195,12 @@ disk_compare:
; all good, retry original load
update_disk:
ldx CURRENT_DRIVE
sta DRIVE1_DISK-1,X ; indexed from 1
ldx WHICH_LOAD
lda which_disk_array,X
sta CURRENT_DISK
ldx CURRENT_DRIVE
sta DRIVE1_DISK-1,X ; indexed from 1
jmp load_file

View File

@ -1,46 +1,34 @@
; SAVE1 -- Cliffland Heights
; SAVE1 -- ??
.include "zp.inc"
; want to load this to address $90
;
.byte LOAD_CLIFF ; WHICH_LOAD = $90
.byte LOAD_PEASANT2 ; WHICH_LOAD = $90
.byte 10 ; PEASANT_X = $91
.byte 100 ; PEASANT_Y = $92
.byte PEASANT_DIR_UP ; PEASANT_DIR = $93
.byte 0 ; MAP_X = $94
.byte 1 ; MAP_Y = $95
.byte LOCATION_CLIFF_HEIGHTS ; MAP_LOCATION = $96
.byte TALKED_TO_MENDELEV | HALDO_TO_DONGOLEV | ARROW_BEATEN| GARY_SCARED | TRINKET_GIVEN | LADY_GONE
; BABY_IN_WELL | BUCKET_DOWN_WELL
.byte LOCATION_HAY_BALE ; MAP_LOCATION = $96
.byte GARY_SCARED
; GAME_STATE_0 = $97
.byte FISH_FED | PUDDLE_WET | WEARING_ROBE
; RAINING
; FISH_FED | IN_HAY_BALE | NIGHT | POT_ON_HEAD
; GAME_STATE_1 = $98
.byte COTTAGE_ROCK_MOVED | TALKED_TO_KNIGHT | GOT_MUDDY_ALREADY | ON_FIRE
; ON_FIRE | COTTAGE_ROCK_MOVED | KNUCKLES_BLEED
; DRESSER_OPEN | COVERED_IN_MUD | GOT_MUDDY_ALREADY
.byte $00 ; GAME_STATE_1 = $98
.byte TALKED_TO_KNIGHT
; GAME_STATE_2 = $99
.byte $00 ; NED_STATUS = $9A
.byte BUSH_1_SEARCHED | BUSH_2_SEARCHED | BUSH_3_SEARCHED | BUSH_4_SEARCHED
; BUSH_STATUS = $9B
.byte KERREK_ROW1 | KERREK_DECOMPOSING ; KERREK_STATE = $9C
.byte $00 ; BUSH_STATUS = $9B
.byte $00 ; KERREK_STATE = $9C
.byte $00 ; ARROW_SCORE = $9D
.byte $01 ; SCORE_HUNDREDS= $9E
.byte $22 ; SCORE_TENSONES= $9F
.byte INV1_ARROW | INV1_BABY | INV1_KERREK_BELT | INV1_CHICKEN_FEED | INV1_BOW | INV1_MONSTER_MASK | INV1_PEBBLES | INV1_PILLS
.byte $00 ; SCORE_HUNDREDS= $9E
.byte $20 ; SCORE_TENSONES= $9F
.byte INV1_MONSTER_MASK|INV1_PEBBLES
; INVENTORY_1 = $A0
.byte INV2_RICHES| INV2_ROBE | INV2_SODA | INV2_MEATBALL_SUB | INV2_TRINKET
; INVENTORY_2 = $A1
.byte $00 ; INVENTORY_2 = $A1
.byte INV3_SHIRT|INV3_MAP
; INVENTORY_3 = $A2
.byte INV1_ARROW| INV1_BABY | INV1_CHICKEN_FEED | INV1_PEBBLES
.byte INV1_PEBBLES
; INVENTORY_1_GONE = $A3
.byte INV2_RICHES | INV2_TRINKET
; INVENTORY_2_GONE_= $A4
.byte $00 ; INVENTORY_2_GONE_= $A4
.byte $00 ; INVENTORY_3_GONE = $A5
.byte 22 ; KERREK_X = $A6
.byte 76 ; KERREK_Y = $A7

View File

@ -15,6 +15,10 @@
intro_text:
;===========================
; print text part of intro
;===========================
jsr TEXT
jsr HOME
@ -139,7 +143,21 @@ yes_language_card:
ora #SOUND_IN_LC
sta SOUND_STATUS
jmp done_language_card
no_language_card:
;===============================
; print error if not enough RAM
;===============================
lda #<ram_error
sta OUTL
lda #>ram_error
sta OUTH
jsr move_and_print
done_language_card:
;===================================
; Detect Mockingboard
@ -200,11 +218,54 @@ ssi_not_found:
mockingboard_notfound:
;==================================
; check if disk in drive #2
;==================================
lda #0 ; mark drive2 as empty
sta DRIVE2_DISK
jsr check_floppy_in_drive2
bcc no_floppy_drive2
yes_floppy_drive2:
lda #2 ; assume for now disk2 is in it
sta DRIVE2_DISK
; print message
lda #<drive2_message
sta OUTL
lda #>drive2_message
sta OUTH
jsr move_and_print
jmp done_drive2_check
no_floppy_drive2:
done_drive2_check:
skip_all_checks:
;=============================
; linger at sysinfo a bit
;=============================
lda #30
jsr wait_a_bit
;===================================
;===================================
; do the animated vidalectrix intro
;===================================
;===================================
videlectrix_intro:
jsr hgr2 ; HGR_PAGE=$40
@ -454,11 +515,16 @@ boot_message:
.byte 0,6,"DISK CODE : QKUMBA",0
.byte 0,7,"LZSA CODE : EMMANUEL MARTY",0
.byte 0,8,"ELECTRIC DUET: PAUL LUTUS",0
.byte 7,19,"______",0
.byte 5,20,"A \/\/\/ SOFTWARE PRODUCTION",0
.byte 7,18,"______",0
.byte 5,19,"A \/\/\/ SOFTWARE PRODUCTION",0
config_string:
; 0123456789012345678901234567890123456789
.byte 0,23,"APPLE II?, 48K, MOCKINGBOARD: NO, SSI: N",0
; MOCKINGBOARD: NONE
ram_error:
.byte 1,21,"SORRY, 48K REQUIRED TO PLAY THIS GAME",0
drive2_message:
.byte 10,22,"FOUND DISK IN DRIVE2",0