mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-27 17:29:49 +00:00
peasant: try to get save working on hard disk image
not quite there yet
This commit is contained in:
parent
b5f1bd040a
commit
017e9ef921
@ -218,6 +218,7 @@ 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 do_savegame qload.lst >> qload.inc
|
||||
./generate_common -a 0xb00 -s requested_sector qload.lst >> qload.inc
|
||||
./generate_common -a 0xb00 -s zx02_full_decomp qload.lst >> qload.inc
|
||||
./generate_common -a 0xb00 -s zx_src_l qload.lst >> qload.inc
|
||||
|
@ -527,16 +527,15 @@ save_game:
|
||||
|
||||
; print are you sure message
|
||||
|
||||
|
||||
jsr confirm_action
|
||||
|
||||
bcs done_save
|
||||
|
||||
; put which save into A
|
||||
|
||||
lda INVENTORY_Y
|
||||
; lda INVENTORY_Y
|
||||
|
||||
pha ; save slot for later on stack
|
||||
; pha ; save slot for later on stack
|
||||
|
||||
; clc
|
||||
; adc #LOAD_SAVE1
|
||||
@ -551,41 +550,54 @@ actually_save:
|
||||
; first load something from
|
||||
; disk1/track0 to seek the head there
|
||||
|
||||
lda WHICH_LOAD ; save this value as we
|
||||
; lda WHICH_LOAD ; save this value as we
|
||||
; destroy it for load
|
||||
pha
|
||||
; pha
|
||||
|
||||
lda #LOAD_SAVE1 ; use SAVE1 as it's on track 0
|
||||
sta WHICH_LOAD
|
||||
jsr load_file
|
||||
|
||||
pla
|
||||
; pla
|
||||
|
||||
sta WHICH_LOAD
|
||||
; sta WHICH_LOAD
|
||||
|
||||
;=================================
|
||||
; copy save data to load_buffer
|
||||
|
||||
lda INVENTORY_Y
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl ; multiply by 32
|
||||
sta copy_save_smc+1
|
||||
|
||||
ldx #0
|
||||
copy_loop:
|
||||
lda WHICH_LOAD,X
|
||||
copy_save_loop:
|
||||
lda LOAD_START,X
|
||||
copy_save_smc:
|
||||
sta load_buffer,X
|
||||
inx
|
||||
cpx #(END_OF_SAVE-WHICH_LOAD+1)
|
||||
bne copy_loop
|
||||
cpx #(END_OF_SAVE-LOAD_START+1) ; why +1?
|
||||
bne copy_save_loop
|
||||
|
||||
jsr do_savegame
|
||||
.if 0
|
||||
; spin up disk
|
||||
jsr driveon
|
||||
|
||||
; actually save it
|
||||
pla
|
||||
clc
|
||||
adc #11
|
||||
|
||||
lda #12 ; save is track0 sector 12
|
||||
sta requested_sector+1
|
||||
|
||||
jsr sector_write
|
||||
|
||||
jsr driveoff
|
||||
|
||||
.endif
|
||||
|
||||
done_save:
|
||||
lda #NEW_LOCATION ; reload level as we scrawled on $2000
|
||||
sta LEVEL_OVER
|
||||
@ -593,10 +605,6 @@ done_save:
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;=======================================
|
||||
; confirm action
|
||||
;=======================================
|
||||
|
@ -195,4 +195,18 @@ insert_disk_string:
|
||||
.byte "PLEASE INSERT DISK 1",13
|
||||
.byte " THEN PRESS RETURN",0
|
||||
|
||||
do_savegame:
|
||||
; spin up disk
|
||||
jsr driveon
|
||||
|
||||
; actually save it
|
||||
|
||||
lda #12 ; save is track0 sector 12
|
||||
sta requested_sector+1
|
||||
|
||||
jsr sector_write
|
||||
|
||||
jsr driveoff
|
||||
|
||||
rts
|
||||
|
||||
|
@ -14,10 +14,12 @@ setup_loop:
|
||||
ora #$c0
|
||||
sta slot_smc+2
|
||||
sta entry_smc+2 ; set up smartport/prodos entry point
|
||||
sta entry2_smc+2 ; set up smartport/prodos entry point
|
||||
|
||||
slot_smc:
|
||||
lda $cfff
|
||||
sta entry_smc+1 ; set up rest of smartport/prodos entry
|
||||
sta entry2_smc+1 ; set up rest of smartport/prodos entry
|
||||
|
||||
|
||||
; init the write code if needed
|
||||
@ -66,7 +68,7 @@ load_file_internal:
|
||||
rol BLOKHI
|
||||
sta BLOKLO
|
||||
lda sector_array,X ; sector
|
||||
lsr
|
||||
lsr ; divide by 2
|
||||
clc
|
||||
adc BLOKLO
|
||||
sta BLOKLO
|
||||
@ -91,42 +93,10 @@ load_file_internal:
|
||||
;===================================================
|
||||
; LEVEL_OVER bottom 4 bits hold which exit
|
||||
|
||||
; for hard disk image no need to change
|
||||
|
||||
change_disk:
|
||||
|
||||
; lda LEVEL_OVER
|
||||
; and #$f
|
||||
; sta LEVEL_OVER
|
||||
; tax
|
||||
|
||||
; set up locations
|
||||
; lda DISK_EXIT_DISK,X
|
||||
; sta CURRENT_DISK
|
||||
|
||||
; lda DISK_EXIT_LOAD,X
|
||||
; sta WHICH_LOAD
|
||||
; lda DISK_EXIT_LEVEL,X
|
||||
; sta LOCATION
|
||||
; lda DISK_EXIT_DIRECTION,X
|
||||
; sta DIRECTION
|
||||
|
||||
; lda DISK_EXIT_DNI_H,X
|
||||
; sta NUMBER_HIGH
|
||||
; lda DISK_EXIT_DNI_L,X
|
||||
; sta NUMBER_LOW
|
||||
|
||||
|
||||
; see if disk we want is in drive
|
||||
|
||||
|
||||
;==========================
|
||||
; load QLOAD table
|
||||
; check if disk matches
|
||||
;verify_disk:
|
||||
|
||||
; jsr load_qload_offsets
|
||||
|
||||
|
||||
|
||||
;==============================================
|
||||
; all good, continue
|
||||
update_disk:
|
||||
@ -135,38 +105,6 @@ update_disk:
|
||||
|
||||
|
||||
|
||||
.if 0
|
||||
load_qload_offsets:
|
||||
lda #$12
|
||||
sta ADRHI
|
||||
|
||||
lda CURRENT_DISK
|
||||
sta BLOKHI
|
||||
inc BLOKHI ; off by one
|
||||
lda #0 ; track
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
rol BLOKHI
|
||||
sta BLOKLO
|
||||
lda #$2 ; sector
|
||||
lsr
|
||||
clc
|
||||
adc BLOKLO
|
||||
sta BLOKLO
|
||||
|
||||
; lda #$0
|
||||
; sta load_track
|
||||
|
||||
; lda #$02 ; track 0 sector 2
|
||||
; sta load_sector
|
||||
|
||||
lda #$1
|
||||
sta COUNT
|
||||
|
||||
jmp seekread
|
||||
|
||||
.endif
|
||||
|
||||
;================================
|
||||
; seek + read blocks
|
||||
@ -203,3 +141,59 @@ no_blokloflo:
|
||||
bne seekread_loop
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;=============================
|
||||
; do_savegame
|
||||
;=============================
|
||||
; hack, 512 bytes at $BC00
|
||||
; to disk0/track0/sector12 (which is just "6" for us)
|
||||
do_savegame:
|
||||
lda #$0
|
||||
sta BLOKHI
|
||||
sta ADRLO
|
||||
lda #$6
|
||||
sta BLOKLO
|
||||
lda #$BC
|
||||
sta ADRHI
|
||||
lda #$1
|
||||
sta COUNT
|
||||
|
||||
; fallthrough
|
||||
|
||||
;================================
|
||||
; seek + write blocks
|
||||
;================================
|
||||
; this calls the smartport PRODOS entrypoint
|
||||
; command=2 WRITEBLOCK
|
||||
; I can't find this documented anywhere
|
||||
; but the paramaters are stored in the zero page
|
||||
;================================
|
||||
; BLOKHI:BLOKLO = block number to store (???)
|
||||
; COUNT = num blocks
|
||||
seekwrite:
|
||||
|
||||
seekwrite_loop:
|
||||
lda #2 ; WRITEBLOCK
|
||||
sta COMMAND
|
||||
lda ADRHI
|
||||
pha
|
||||
entry2_smc:
|
||||
jsr $d1d1
|
||||
pla
|
||||
sta ADRHI
|
||||
|
||||
inc ADRHI ; twice, as 512 byte chunks
|
||||
inc ADRHI
|
||||
|
||||
inc BLOKLO ; increment block pointer
|
||||
bne no_sblokloflo
|
||||
inc BLOKHI
|
||||
no_sblokloflo:
|
||||
|
||||
|
||||
dec COUNT
|
||||
bne seekwrite_loop
|
||||
|
||||
rts
|
||||
|
||||
|
13
games/peasant/text/climb.inc
Normal file
13
games/peasant/text/climb.inc
Normal file
@ -0,0 +1,13 @@
|
||||
;============
|
||||
; Climbing
|
||||
;============
|
||||
|
||||
; + fallen
|
||||
climb_fallen_message:
|
||||
.byte "Oops! You climbed real bad.",13
|
||||
.byte "You knew that you were",13
|
||||
.byte "AVOIDING the rocks, right?",13
|
||||
.byte "Not collecting them.",13
|
||||
.byte "Anyways, nice try. You",13
|
||||
.byte "dead. Thanks for playing.",0
|
||||
|
Loading…
Reference in New Issue
Block a user