riven: hd work progressing

This commit is contained in:
Vince Weaver 2024-07-17 01:46:48 -04:00
parent e714cdf8be
commit 690fc0d303
6 changed files with 137 additions and 93 deletions

View File

@ -163,7 +163,7 @@ qload.o: qload.s qload_floppy.s qboot.inc \
QLOAD_HD: qload_hd.o
ld65 -o QLOAD_HD qload_hd.o -C $(LINKER_SCRIPTS)/apple2_1600.inc
qload_hd.o: qload.s qload_floppy.s qboot.inc \
qload_hd.o: qload.s qload_hd.s qboot.inc \
zx02_optim.s wait.s wait_a_bit.s \
gr_offsets.s text_print.s \
draw_pointer.s log_table.s \
@ -171,7 +171,7 @@ qload_hd.o: qload.s qload_floppy.s qboot.inc \
graphics_sprites/pointer_sprites.inc \
hgr_14x14_sprite.s \
keyboard.s
ca65 -o qload_hd.o qload.s -DFLOPPY=0 -l qload.lst
ca65 -o qload_hd.o qload.s -DFLOPPY=0 -l qload_hd.lst
####

View File

@ -46,9 +46,9 @@ $0400-$07ff = lores graphics page1
$0800-$0bff = lores graphics page2
$800-$8ff = (qboot initial sector)
$1000-$11ff = qboot_stage2 (disk code)
$1200-$12ff = QLOAD tables
$1300-$14FF = HGR lookup tables
$1500-$15FF = UNUSED
$1200-$13ff = QLOAD tables (only need 1 page, but prodos load is 2)
could in theory load to $1000 instead when using HD
$1400-$15FF = HGR lookup tables
$1600-$1FFF = QLOAD = loader code (2k?)
$2000-$3FFF = HGR Page1, lores movie overlays
$4000-$BFFF = our code (up to 32k in theory)

View File

@ -1,5 +1,5 @@
hposn_high = $1300
hposn_low = $1400
hposn_high = $1400
hposn_low = $1500
;=============================

View File

@ -44,20 +44,15 @@ proboot_start:
; set up disk stuff?
pla ; restore slot
sta UNIT ; save for later
sta UNIT ; save for later (also has meaning)
tax
; X = boot slot x16
; Y = 0
; 4cade calls a print-title routine here that exits with Y=0
ldy #0
; set up ProDOS shim
; from IIgs smartport firmware manual
; prodos entry point is $CX00+($CXFF)
@ -86,7 +81,7 @@ slot_smc:
; we want to load 5 blocks from 1024 to $1600
QLOAD_BLOCK = 1024
QLOAD_BLOCK = ((0+1)*512)+(1*8)+(0) ; D0 T1 S0
QLOAD_ADDR = $1600
@ -98,15 +93,17 @@ QLOAD_ADDR = $1600
lda #0
sta ADRLO
lda #5
jsr seekread
done:
jmp done
jmp QLOAD_ADDR
;================================
; seek read
; seek + read blocks
;================================
; this calls the smartport PRODOS entrypoint
; command=1 READBLOCK
@ -114,10 +111,14 @@ done:
; but the paramaters are stored in the zero page
;================================
; Y:X = block number to load (???)
; ADRHI preserved
; A = num blocks
seekread:
sta COUNT
stx BLOKLO
sty BLOKHI
seekread_loop:
lda #1 ; READBLOCK
sta COMMAND
lda ADRHI
@ -126,4 +127,17 @@ entry_smc:
jsr $d1d1
pla
sta ADRHI
inc ADRHI ; twice, as 512 byte chunks
inc ADRHI
inc BLOKLO ; increment block pointer
bne no_blokloflo
inc BLOKHI
no_blokloflo:
dec COUNT
bne seekread_loop
rts

View File

@ -1,5 +1,25 @@
qload_hd:
; set up prodos entry
lda UNIT ;
ldy #0
setup_loop:
lsr
lsr
lsr
lsr
and #7
ora #$c0
sta slot_smc+2
sta entry_smc+2 ; set up smartport/prodos entry point
slot_smc:
lda $cfff
sta entry_smc+1 ; set up rest of smartport/prodos entry
; init the write code if needed
; ???
@ -8,6 +28,9 @@ qload_hd:
lda #1
sta NEW_GAME
lda #0
sta CURRENT_DISK
; load the QLOAD offsets file to $1200
jsr load_qload_offsets
@ -21,7 +44,7 @@ qload_hd:
main_game_loop:
jsr load_file
entry_smc:
entry_point_smc:
jsr $4000 ; most entry points currently $4000
; CHECK LEVEL_OVER
@ -40,21 +63,38 @@ load_file:
ldx WHICH_LOAD
lda LOAD_ADDRESS_ARRAY,X
sta load_address
sta entry_smc+2
sta ADRHI
sta entry_point_smc+2
lda TRACK_ARRAY,X
sta load_track
; lda TRACK_ARRAY,X
; sta load_track
; lda SECTOR_ARRAY,X
; sta load_sector
lda CURRENT_DISK
sta BLOKHI
inc BLOKHI ; off by one
lda TRACK_ARRAY,X ; track
asl
asl
asl
rol BLOKHI
sta BLOKLO
lda SECTOR_ARRAY,X ; sector
lsr
clc
adc BLOKLO
sta BLOKLO
lda SECTOR_ARRAY,X
sta load_sector
lda LENGTH_ARRAY,X
sta load_length
sta COUNT
jsr load_new
jsr seekread
rts
rts ; todo: tail call
;===================================================
;===================================================
@ -89,58 +129,6 @@ change_disk:
; see if disk we want is in drive
;==============================
; print "insert disk" message
; TODO: switch to GR and print D'NI number too
jsr GR
jsr HOME
bit LORES
lda #<insert_disk_string
sta OUTL
lda #>insert_disk_string
sta OUTH
; patch error string to say correct disk to insert
ldy #21
lda NEW_DISK
lsr
lsr
lsr
lsr
clc
adc #$30
sta (OUTL),Y
iny
lda NEW_DISK
and #$f
clc
adc #$30
sta (OUTL),Y
jsr move_and_print
jsr move_and_print
lda #4
sta XPOS
lda #5
sta YPOS
jsr draw_full_dni_number
fnf_keypress:
lda KEYPRESS
bpl fnf_keypress
bit KEYRESET
;==========================
; load QLOAD table
@ -149,10 +137,6 @@ verify_disk:
jsr load_qload_offsets
lda QLOAD_TABLE
cmp NEW_DISK
bne fnf_keypress
;==============================================
@ -162,26 +146,71 @@ update_disk:
jmp main_game_loop
insert_disk_string:
.byte 9,20,"PLEASE INSERT DISK 01.",0 ; 21+22 location of disk number
.byte 11,21,"THEN PRESS ANY KEY",0
load_qload_offsets:
lda #$12
sta load_address
sta ADRHI
lda #$0
sta load_track
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 #$01 ; track 0 sector 1
sta load_sector
; lda #$0
; sta load_track
; lda #$02 ; track 0 sector 2
; sta load_sector
lda #$1
sta load_length
sta COUNT
jmp load_new
jmp seekread
;================================
; seek + read blocks
;================================
; this calls the smartport PRODOS entrypoint
; command=1 READBLOCK
; I can't find this documented anywhere
; but the paramaters are stored in the zero page
;================================
; BLOKHI:BLOKLO = block number to load (???)
; COUNT = num blocks
seekread:
seekread_loop:
lda #1 ; READBLOCK
sta COMMAND
lda ADRHI
pha
entry_smc:
jsr $d1d1
pla
sta ADRHI
inc ADRHI ; twice, as 512 byte chunks
inc ADRHI
inc BLOKLO ; increment block pointer
bne no_blokloflo
inc BLOKHI
no_blokloflo:
dec COUNT
bne seekread_loop
rts

View File

@ -127,6 +127,7 @@ NUMBER_HIGH = $A4
MAGLEV_FLIP_DIRECTION = $B0
BEACH_ANIMALS_SEEN = $B1
COUNT = $F7
TEMPY = $F8
TEMP = $F9
MASKL = $FA