mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-13 03:29:32 +00:00
peasant: trying to add drive2 support
currently broken, something goes wrong after switching to drive2
This commit is contained in:
parent
28128c4820
commit
ebbdf0a216
|
@ -110,6 +110,20 @@ generate_all_symbols.o: generate_all_symbols.c
|
||||||
|
|
||||||
####
|
####
|
||||||
|
|
||||||
|
qboot.inc: generate_common QBOOT
|
||||||
|
./generate_common -a 0x000 -s seek qboot_sector.lst > qboot.inc
|
||||||
|
./generate_common -a 0x000 -s curtrk_smc qboot_sector.lst >> qboot.inc
|
||||||
|
./generate_common -a 0x000 -s phase_smc qboot_sector.lst >> qboot.inc
|
||||||
|
./generate_common -a 0x000 -s driveon qboot_sector.lst >> qboot.inc
|
||||||
|
./generate_common -a 0x000 -s driveoff qboot_sector.lst >> qboot.inc
|
||||||
|
./generate_common -a 0x000 -s load_new qboot_sector.lst >> qboot.inc
|
||||||
|
./generate_common -a 0x000 -s load_address qboot_sector.lst >> qboot.inc
|
||||||
|
echo "load_track=load_address+1" >> qboot.inc
|
||||||
|
echo "load_sector=load_address+2" >> qboot.inc
|
||||||
|
echo "load_length=load_address+3" >> qboot.inc
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
qload.inc: generate_common QLOAD
|
qload.inc: generate_common QLOAD
|
||||||
./generate_common -a 0xb00 -s load_file qload.lst > qload.inc
|
./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 sector_write qload.lst >> qload.inc
|
||||||
|
|
|
@ -1,8 +1,40 @@
|
||||||
; based on anti-m/anti-m.a
|
; roughly based on anti-m/anti-m.a
|
||||||
|
|
||||||
|
|
||||||
|
; Notes from qkumba/4am
|
||||||
|
|
||||||
|
; Drive with no disk and no motor, will return same value in range $00..$7f
|
||||||
|
; Drive with no disk but motor running will return random $00..$FF
|
||||||
|
; Some cards will return random even with no drive connected
|
||||||
|
; so the best way to detect if disk is there is to try seeking/reading
|
||||||
|
; and seeing if you get valid data
|
||||||
|
|
||||||
|
|
||||||
|
; FIXME: patch these
|
||||||
|
|
||||||
|
switch_drive1:
|
||||||
|
lda curtrk_smc+1
|
||||||
|
sta DRIVE2_TRACK ; save track location
|
||||||
|
lda $C0EA ; drive 1 select
|
||||||
|
lda #1
|
||||||
|
sta CURRENT_DRIVE
|
||||||
|
lda DRIVE1_TRACK ; restore saved track location
|
||||||
|
sta curtrk_smc+1
|
||||||
|
rts
|
||||||
|
|
||||||
|
switch_drive2:
|
||||||
|
lda curtrk_smc+1
|
||||||
|
sta DRIVE1_TRACK ; save track location
|
||||||
|
lda $C0EB ; drive 2 select
|
||||||
|
lda #2
|
||||||
|
sta CURRENT_DRIVE
|
||||||
|
lda DRIVE2_TRACK ; restore saved track location
|
||||||
|
sta curtrk_smc+1
|
||||||
|
rts
|
||||||
|
|
||||||
check_floppy_in_drive2:
|
check_floppy_in_drive2:
|
||||||
|
|
||||||
lda $C0EB ; drive 2 select
|
jsr switch_drive2
|
||||||
|
|
||||||
jsr driveon
|
jsr driveon
|
||||||
|
|
||||||
|
@ -10,7 +42,16 @@ check_floppy_in_drive2:
|
||||||
|
|
||||||
; jsr spinup ; spin up drive
|
; jsr spinup ; spin up drive
|
||||||
|
|
||||||
jsr seek ; seek to where?
|
; jsr seek_track0 ; seek to track0
|
||||||
|
|
||||||
|
; seek to track 0
|
||||||
|
|
||||||
|
lda #(35*2) ; worst case scenario(?)
|
||||||
|
sta curtrk_smc+1
|
||||||
|
lda #0 ; seek to track0
|
||||||
|
sta phase_smc+1
|
||||||
|
|
||||||
|
jsr seek
|
||||||
|
|
||||||
|
|
||||||
;=====================================
|
;=====================================
|
||||||
|
@ -59,3 +100,5 @@ check_if_96:
|
||||||
|
|
||||||
done_check:
|
done_check:
|
||||||
jmp driveoff
|
jmp driveoff
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
; made by hand?
|
seek =$0a26
|
||||||
seek = $a26
|
curtrk_smc =$0a2b
|
||||||
driveon = $a9D
|
phase_smc =$0a31
|
||||||
driveoff = $a22
|
driveon =$0a9d
|
||||||
load_new = $aAB
|
driveoff =$0a22
|
||||||
load_address=$aC4
|
load_new =$0aab
|
||||||
|
load_address =$0ac4
|
||||||
load_track=load_address+1
|
load_track=load_address+1
|
||||||
load_sector=load_address+2
|
load_sector=load_address+2
|
||||||
load_length=load_address+3
|
load_length=load_address+3
|
||||||
|
|
|
@ -221,7 +221,7 @@ preread:
|
||||||
; pha
|
; pha
|
||||||
|
|
||||||
lda #<(firsttrk*2)
|
lda #<(firsttrk*2)
|
||||||
sta phase+1
|
sta phase_smc+1
|
||||||
ldx #sectors
|
ldx #sectors
|
||||||
lda #address
|
lda #address
|
||||||
ldy #firstsec
|
ldy #firstsec
|
||||||
|
|
|
@ -232,8 +232,8 @@ sector:
|
||||||
total:
|
total:
|
||||||
ldx #$d1
|
ldx #$d1
|
||||||
beq driveoff
|
beq driveoff
|
||||||
inc phase+1
|
inc phase_smc+1
|
||||||
inc phase+1 ; update current track
|
inc phase_smc+1 ; update current track
|
||||||
jmp inittrk
|
jmp inittrk
|
||||||
|
|
||||||
driveoff:
|
driveoff:
|
||||||
|
@ -247,11 +247,11 @@ seek:
|
||||||
ldx #0
|
ldx #0
|
||||||
stx step+1
|
stx step+1
|
||||||
copy_cur:
|
copy_cur:
|
||||||
curtrk:
|
curtrk_smc:
|
||||||
lda #0
|
lda #0
|
||||||
sta tmpval+1
|
sta tmpval+1
|
||||||
sec
|
sec
|
||||||
phase:
|
phase_smc: ; track*2 to seek to
|
||||||
sbc #$d1
|
sbc #$d1
|
||||||
beq seekret
|
beq seekret
|
||||||
|
|
||||||
|
@ -259,12 +259,12 @@ phase:
|
||||||
bcs sback
|
bcs sback
|
||||||
|
|
||||||
eor #$ff
|
eor #$ff
|
||||||
inc curtrk+1
|
inc curtrk_smc+1
|
||||||
|
|
||||||
bcc ssback
|
bcc ssback
|
||||||
sback:
|
sback:
|
||||||
adc #$fe
|
adc #$fe
|
||||||
dec curtrk+1
|
dec curtrk_smc+1
|
||||||
ssback:
|
ssback:
|
||||||
cmp step+1
|
cmp step+1
|
||||||
bcc loop10
|
bcc loop10
|
||||||
|
@ -276,7 +276,7 @@ loop10:
|
||||||
tay
|
tay
|
||||||
sec
|
sec
|
||||||
loop11:
|
loop11:
|
||||||
lda curtrk+1
|
lda curtrk_smc+1
|
||||||
ldx step1, Y
|
ldx step1, Y
|
||||||
bne loop12
|
bne loop12
|
||||||
loopmmm:
|
loopmmm:
|
||||||
|
@ -338,7 +338,7 @@ load_new:
|
||||||
|
|
||||||
lda load_track
|
lda load_track
|
||||||
asl ; track to start*2
|
asl ; track to start*2
|
||||||
sta phase+1
|
sta phase_smc+1
|
||||||
|
|
||||||
lda load_sector
|
lda load_sector
|
||||||
tay ; sector to start
|
tay ; sector to start
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
load_file =$0b20
|
load_file =$0b28
|
||||||
sector_write =$0c63
|
sector_write =$0c90
|
||||||
requested_sector =$0d17
|
requested_sector =$0d17
|
||||||
decompress_lzsa2_fast =$0de6
|
decompress_lzsa2_fast =$0e46
|
||||||
getsrc_smc =$0edc
|
getsrc_smc =$0f3c
|
||||||
hgr2 =$17e2
|
hgr2 =$1842
|
||||||
hgr_make_tables =$1556
|
hgr_make_tables =$15b6
|
||||||
hgr_put_string =$0ee9
|
hgr_put_string =$0f49
|
||||||
restore_bg_1x28 =$1421
|
restore_bg_1x28 =$1481
|
||||||
hgr_draw_sprite_1x28 =$13ba
|
hgr_draw_sprite_1x28 =$141a
|
||||||
input_buffer =$152e
|
input_buffer =$158e
|
||||||
hgr_text_box =$15cc
|
hgr_text_box =$162c
|
||||||
hgr_text_box_nosave =$1663
|
hgr_text_box_nosave =$16c3
|
||||||
hgr_partial_restore =$14a4
|
hgr_partial_restore =$1504
|
||||||
clear_bottom =$17b7
|
clear_bottom =$1817
|
||||||
hgr_input =$14d4
|
hgr_input =$1534
|
||||||
draw_box =$126b
|
draw_box =$12cb
|
||||||
disp_put_string =$1607
|
disp_put_string =$1667
|
||||||
disp_one_line =$161b
|
disp_one_line =$167b
|
||||||
invert_smc1 =$0f61
|
invert_smc1 =$0fc1
|
||||||
disp_put_string_cursor =$1617
|
disp_put_string_cursor =$1677
|
||||||
hgr_put_char_cursor =$0f15
|
hgr_put_char_cursor =$0f75
|
||||||
vgi_simple_rectangle =$12ec
|
vgi_simple_rectangle =$134c
|
||||||
peasant_text =$1f16
|
peasant_text =$1f76
|
||||||
save_menu =$1895
|
save_menu =$18f5
|
||||||
load_menu =$188a
|
load_menu =$18ea
|
||||||
location_names_l =$1bc2
|
location_names_l =$1c22
|
||||||
location_names_h =$1be1
|
location_names_h =$1c41
|
||||||
wait_until_keypress =$1e01
|
wait_until_keypress =$1e61
|
||||||
random16 =$1e0a
|
random16 =$1e6a
|
||||||
score_points =$1e8f
|
score_points =$1eef
|
||||||
print_score =$1e3f
|
print_score =$1e9f
|
||||||
update_score =$1e4a
|
update_score =$1eaa
|
||||||
speaker_beep =$1efd
|
speaker_beep =$1f5d
|
||||||
speaker_duration =$1f14
|
speaker_duration =$1f74
|
||||||
speaker_frequency =$1f15
|
speaker_frequency =$1f75
|
||||||
hposn_high = $BA00
|
hposn_high = $BA00
|
||||||
hposn_low = $BB00
|
hposn_low = $BB00
|
||||||
driveoff = $A22
|
driveoff = $A22
|
||||||
|
|
|
@ -31,12 +31,17 @@ qload_start:
|
||||||
|
|
||||||
lda #1
|
lda #1
|
||||||
sta CURRENT_DISK ; current disk number
|
sta CURRENT_DISK ; current disk number
|
||||||
|
sta DRIVE1_DISK ; it's in drive1
|
||||||
|
sta CURRENT_DRIVE ; and currently using drive 1
|
||||||
|
|
||||||
jsr load_file
|
lda #0
|
||||||
|
sta DRIVE2_DISK ; don't know if disk there yet
|
||||||
|
|
||||||
jsr $6000
|
jsr load_file ; actually load intro
|
||||||
|
|
||||||
lda #LOAD_TITLE ; load title
|
jsr $6000 ; run intro
|
||||||
|
|
||||||
|
lda #LOAD_TITLE ; next load title
|
||||||
sta WHICH_LOAD
|
sta WHICH_LOAD
|
||||||
|
|
||||||
main_game_loop:
|
main_game_loop:
|
||||||
|
@ -60,9 +65,9 @@ start_title:
|
||||||
load_file:
|
load_file:
|
||||||
ldx WHICH_LOAD
|
ldx WHICH_LOAD
|
||||||
|
|
||||||
lda which_disk_array,X
|
lda which_disk_array,X ; get disk# for file to load
|
||||||
cmp CURRENT_DISK
|
cmp CURRENT_DISK ; if not currently using
|
||||||
bne change_disk
|
bne change_disk ; need to change disk
|
||||||
|
|
||||||
load_file_no_diskcheck:
|
load_file_no_diskcheck:
|
||||||
lda load_address_array,X
|
lda load_address_array,X
|
||||||
|
@ -86,12 +91,45 @@ load_file_no_diskcheck:
|
||||||
; change disk
|
; change disk
|
||||||
;===================================================
|
;===================================================
|
||||||
;===================================================
|
;===================================================
|
||||||
|
; WHICH_LOAD is still in X?
|
||||||
|
|
||||||
change_disk:
|
change_disk:
|
||||||
|
|
||||||
; turn off disk drive light
|
; see if disk we want is in drive1
|
||||||
|
check_drive1:
|
||||||
|
lda which_disk_array,X
|
||||||
|
cmp DRIVE1_DISK
|
||||||
|
bne check_drive2
|
||||||
|
|
||||||
|
jsr switch_drive1 ; switch to drive1
|
||||||
|
jmp update_disk
|
||||||
|
|
||||||
|
check_drive2:
|
||||||
|
cmp DRIVE2_DISK
|
||||||
|
bne disk_not_found
|
||||||
|
|
||||||
|
jsr switch_drive2 ; switch to drive2
|
||||||
|
jmp update_disk
|
||||||
|
|
||||||
|
disk_not_found:
|
||||||
|
|
||||||
|
; check if disk in drive2
|
||||||
|
; carry clear if not
|
||||||
|
|
||||||
|
jsr check_floppy_in_drive2
|
||||||
|
|
||||||
|
bcc nothing_in_drive2
|
||||||
|
|
||||||
|
; a disk is in drive2, try to use it
|
||||||
|
|
||||||
|
bcs verify_disk
|
||||||
|
|
||||||
|
|
||||||
|
nothing_in_drive2:
|
||||||
|
|
||||||
|
; switch back to drive1
|
||||||
|
jsr switch_drive1
|
||||||
|
|
||||||
jsr driveoff
|
|
||||||
|
|
||||||
;==============================
|
;==============================
|
||||||
; print "insert disk" message
|
; print "insert disk" message
|
||||||
|
@ -132,7 +170,7 @@ fnf_keypress:
|
||||||
;==============================================
|
;==============================================
|
||||||
; actually verify proper disk is there
|
; actually verify proper disk is there
|
||||||
; read T0:S0 and verify proper disk
|
; read T0:S0 and verify proper disk
|
||||||
|
verify_disk:
|
||||||
lda WHICH_LOAD
|
lda WHICH_LOAD
|
||||||
pha
|
pha
|
||||||
|
|
||||||
|
@ -177,11 +215,16 @@ disk_compare:
|
||||||
|
|
||||||
;==============================================
|
;==============================================
|
||||||
; all good, retry original load
|
; all good, retry original load
|
||||||
|
update_disk:
|
||||||
|
|
||||||
|
ldx CURRENT_DRIVE
|
||||||
|
sta DRIVE1_DISK-1,X ; indexed from 1
|
||||||
|
|
||||||
ldx WHICH_LOAD
|
ldx WHICH_LOAD
|
||||||
lda which_disk_array,X
|
lda which_disk_array,X
|
||||||
sta CURRENT_DISK
|
sta CURRENT_DISK
|
||||||
|
|
||||||
|
|
||||||
jmp load_file
|
jmp load_file
|
||||||
|
|
||||||
; offset for disk number is 27
|
; offset for disk number is 27
|
||||||
|
@ -239,13 +282,14 @@ length_array:
|
||||||
|
|
||||||
.include "qkumba_popwr.s"
|
.include "qkumba_popwr.s"
|
||||||
|
|
||||||
|
.include "drive2.s"
|
||||||
|
|
||||||
.include "decompress_fast_v2.s"
|
.include "decompress_fast_v2.s"
|
||||||
|
|
||||||
.include "hgr_font.s"
|
.include "hgr_font.s"
|
||||||
.include "draw_box.s"
|
.include "draw_box.s"
|
||||||
.include "hgr_rectangle.s"
|
.include "hgr_rectangle.s"
|
||||||
.include "hgr_1x28_sprite_mask.s"
|
.include "hgr_1x28_sprite_mask.s"
|
||||||
;.include "hgr_1x5_sprite.s"
|
|
||||||
.include "hgr_partial_save.s"
|
.include "hgr_partial_save.s"
|
||||||
.include "hgr_input.s"
|
.include "hgr_input.s"
|
||||||
.include "hgr_tables.s"
|
.include "hgr_tables.s"
|
||||||
|
|
|
@ -10,7 +10,11 @@ MOCKINGBOARD_SLOT = $06
|
||||||
DISP_PAGE = $07 ; only in videlectrix intro?
|
DISP_PAGE = $07 ; only in videlectrix intro?
|
||||||
DRAW_PAGE = $08
|
DRAW_PAGE = $08
|
||||||
NIBCOUNT = $09
|
NIBCOUNT = $09
|
||||||
DISK_TRY = $0A
|
CURRENT_DRIVE = $0A
|
||||||
|
DRIVE1_DISK = $0B
|
||||||
|
DRIVE2_DISK = $0C
|
||||||
|
DRIVE1_TRACK = $0D
|
||||||
|
DRIVE2_TRACK = $0E
|
||||||
|
|
||||||
TEMP0 = $10
|
TEMP0 = $10
|
||||||
TEMP1 = $11
|
TEMP1 = $11
|
||||||
|
|
Loading…
Reference in New Issue
Block a user