mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-29 00:31:52 +00:00
peasant: finally get qboot working across 2 disks
using PRORWTS seek now also fixed subtle bug in qboot when loading partial tracks also a bunch of movement in the demo stuff by accident, oops but it's 2am and I'm too lazy to back that out
This commit is contained in:
parent
d2f2d97ff1
commit
e7f1907f38
@ -19,7 +19,7 @@
|
||||
; 247 bytes -- combine note loop. makes song a bit faster
|
||||
; 245 bytes -- try to optimize writing out volume
|
||||
; 255 bytes -- add in some visualization
|
||||
|
||||
; 252 bytes -- re-arrange decode code
|
||||
d2:
|
||||
|
||||
;===================
|
||||
@ -35,17 +35,12 @@ tracker_song = peasant_song
|
||||
|
||||
.include "tracker_init.s"
|
||||
|
||||
jsr SETGR
|
||||
jsr SETGR ; enable lo-res graphics
|
||||
|
||||
game_loop:
|
||||
; typically A=0, X=FF, Y=0
|
||||
; typically A=0, X=FF, Y=0 here
|
||||
|
||||
; lda $70
|
||||
;blah_smc:
|
||||
; sta $400
|
||||
; inc blah_smc+1
|
||||
|
||||
; start the music playing
|
||||
; play a frame of music
|
||||
|
||||
.include "play_frame.s"
|
||||
.include "ay3_write_regs.s"
|
||||
@ -57,7 +52,6 @@ game_loop:
|
||||
|
||||
beq game_loop
|
||||
|
||||
|
||||
; music
|
||||
.include "mA2E_2.s"
|
||||
|
@ -55,12 +55,13 @@ check_floppy_in_drive2:
|
||||
|
||||
; seek to track 0
|
||||
|
||||
lda #$44 ; 68 = 34 tracks; worst case scenario(?)
|
||||
lda #$46 ; 70 = 35 tracks; worst case scenario(?)
|
||||
sta curtrk_smc+1
|
||||
lda #0 ; seek to track0
|
||||
lda #$0 ; seek to track0
|
||||
sta phase_smc+1
|
||||
|
||||
; jsr antim_seek_track0
|
||||
|
||||
jsr seek
|
||||
|
||||
;=====================================
|
||||
|
@ -1,13 +1,13 @@
|
||||
seek =$0a26
|
||||
curtrk_smc =$0a2b
|
||||
phase_smc =$0a31
|
||||
driveon =$0a9d
|
||||
wait_1s =$0aac
|
||||
driveoff =$0a22
|
||||
seek =$0a28
|
||||
curtrk_smc =$0a28
|
||||
phase_smc =$0a33
|
||||
driveon =$0aa4
|
||||
wait_1s =$0ab3
|
||||
driveoff =$0a24
|
||||
switch_drive1 =$08af
|
||||
switch_drive2 =$08be
|
||||
load_new =$0ab7
|
||||
load_address =$0ad0
|
||||
load_new =$0abe
|
||||
load_address =$0ad7
|
||||
load_track=load_address+1
|
||||
load_sector=load_address+2
|
||||
load_length=load_address+3
|
||||
|
@ -25,10 +25,21 @@ slotpatch1: ; smc
|
||||
bpl readnib
|
||||
rts
|
||||
|
||||
;===============================
|
||||
;===============================
|
||||
;===============================
|
||||
; seek then read
|
||||
;===============================
|
||||
;===============================
|
||||
;===============================
|
||||
; Y = starting sector
|
||||
; A = page to read into
|
||||
; X = number of sectors to read
|
||||
|
||||
;fill address array for one track
|
||||
seekread:
|
||||
sty startsec+1
|
||||
sta tmpadr+1
|
||||
sta tmpadr_smc+1
|
||||
stx total+1
|
||||
|
||||
inittrk:
|
||||
@ -48,11 +59,17 @@ it_skip:
|
||||
startsec:
|
||||
ldy #$d1
|
||||
|
||||
tmpadr:
|
||||
;===========================================
|
||||
; fill in table of addresses we want to read
|
||||
; corresponding to sectors on the track
|
||||
; if they are 0, it means we don't need it
|
||||
|
||||
tmpadr_loop:
|
||||
|
||||
tmpadr_smc:
|
||||
lda #$d1
|
||||
sta addrtbl, y
|
||||
inc tmpadr+1
|
||||
inc tmpadr_smc+1
|
||||
iny
|
||||
dec partial1
|
||||
bne tmpadr_loop
|
||||
@ -77,6 +94,9 @@ tmpadr_loop:
|
||||
; ends with $DE $AA $EB
|
||||
read:
|
||||
|
||||
ldx #0 ; if we don't set this, bad things can happen
|
||||
; if we start on a data field w/o setting
|
||||
; the sector first
|
||||
outer_read:
|
||||
jsr readnib
|
||||
inner_read:
|
||||
@ -89,31 +109,41 @@ inner_read:
|
||||
|
||||
; look for $D5 $AA $AD
|
||||
|
||||
tay ; we need Y=#$AA later
|
||||
tay ; we need Y=#$AA later
|
||||
jsr readnib
|
||||
eor #$ad ; zero A if match
|
||||
beq check_mode
|
||||
eor #$ad ; zero A if match
|
||||
beq check_mode ; WHY?
|
||||
|
||||
; if not #$AD, then #$96 is assumed
|
||||
; so in address field
|
||||
|
||||
ldy #2 ; volume, track, sector
|
||||
; following are volume, track, sector
|
||||
|
||||
ldy #2 ; volume, track, sector
|
||||
another:
|
||||
|
||||
; these are stored in a weird 4+4 format and this is how
|
||||
; you decode them
|
||||
|
||||
jsr readnib
|
||||
rol ; set carry
|
||||
rol
|
||||
sta sector_smc+1
|
||||
jsr readnib
|
||||
and sector_smc+1
|
||||
dey
|
||||
and sector_smc+1 ; now A has the value
|
||||
|
||||
dey ; work through the values
|
||||
bpl another
|
||||
|
||||
tay
|
||||
ldx addrtbl, Y ; fetch corresponding address
|
||||
beq read ; done?
|
||||
tay ; A should be sector#?
|
||||
; Y is now sector # VMW
|
||||
ldx addrtbl, Y ; fetch corresponding address
|
||||
; in table.
|
||||
|
||||
sta sector_smc+1 ; store index for later
|
||||
beq outer_read ; if address 0, not valid, try again
|
||||
|
||||
stx adrpatch1+2
|
||||
sta sector_smc+1 ; store sector for later
|
||||
|
||||
stx adrpatch1+2 ; store address to all of these
|
||||
stx adrpatch8+2
|
||||
stx adrpatch2+2
|
||||
stx adrpatch3+2
|
||||
@ -121,14 +151,14 @@ another:
|
||||
stx adrpatch7+2
|
||||
|
||||
inx
|
||||
stx adrpatch9+2
|
||||
stx adrpatch9+2 ; store address+1 here
|
||||
dex
|
||||
|
||||
dex
|
||||
stx adrpatch4+2
|
||||
stx adrpatch4+2 ; store address-1 here?
|
||||
stx adrpatch6+2
|
||||
|
||||
ldy #$fe
|
||||
ldy #$fe ; Y=-2
|
||||
|
||||
loop2:
|
||||
adrpatch1:
|
||||
@ -138,11 +168,11 @@ adrpatch1:
|
||||
bne loop2
|
||||
|
||||
branch_read:
|
||||
bcs read ; branch always
|
||||
bcs outer_read ; branch always
|
||||
|
||||
check_mode:
|
||||
cpx #0
|
||||
beq read ; loop if not expecting #$AD
|
||||
beq outer_read ; loop if not expecting #$AD
|
||||
|
||||
loop33:
|
||||
sta tmpval_smc+1 ; zero rolling checksum
|
||||
@ -240,12 +270,9 @@ driveoff:
|
||||
slotpatch7:
|
||||
lda $c0d1
|
||||
|
||||
seekret:
|
||||
|
||||
; the RWTS waits 25ms after seeking for things to settle
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;=================================
|
||||
;=================================
|
||||
; seek, SEEK!
|
||||
@ -254,6 +281,146 @@ seekret:
|
||||
; phase_smc+1 = track*2 to seek to
|
||||
; curtrk+1 = current track
|
||||
|
||||
|
||||
; due to problems when switching drive1/drive
|
||||
; we include here instead the larger but less fancy
|
||||
; seek from PRORWTS
|
||||
|
||||
; "no tricks here, just the regular stuff" -- qkumba
|
||||
|
||||
step = $CC ;(internal) state for stepper motor
|
||||
;tmptrk = $CD ;(internal) temporary copy of current track
|
||||
;phase = $CE ;(internal) current phase for seek
|
||||
;tmpsec = $3c
|
||||
|
||||
; X = destination track
|
||||
; Y = 0
|
||||
|
||||
;cu;rtrk_smc:
|
||||
; lda #0
|
||||
|
||||
seek:
|
||||
|
||||
;p;hase_smc:
|
||||
; lda #0
|
||||
; sta phase
|
||||
|
||||
curtrk_smc:
|
||||
lda #0
|
||||
|
||||
ldy #0 ; added
|
||||
sty step
|
||||
; asl phase
|
||||
|
||||
; txa ; get destination in A
|
||||
; asl ; multiply to get half track
|
||||
copy_cur:
|
||||
tax ; current track
|
||||
sta tmpval_smc+1 ;tmptrk ; save current track for later
|
||||
|
||||
; calculate direction to seek
|
||||
|
||||
sec
|
||||
phase_smc:
|
||||
sbc #$d1 ; track *2 to seek to?
|
||||
beq done_seek ; if match, we're there
|
||||
|
||||
; update direction
|
||||
|
||||
bcs seeking_out ; if positive, seeking out toward T34
|
||||
|
||||
seeking_in:
|
||||
eor #$ff ; negate the result?
|
||||
inx ; move current track inward
|
||||
bcc seek_dir_done
|
||||
|
||||
seeking_out:
|
||||
sbc #1 ; difference -1 (carry is set here)
|
||||
dex ; move current track outward
|
||||
|
||||
seek_dir_done:
|
||||
cmp step ; compare to step
|
||||
bcc skip_set_step ; if below minimum, don't change?
|
||||
|
||||
lda step ; load step value
|
||||
|
||||
skip_set_step:
|
||||
|
||||
; set acceleration/momentum
|
||||
|
||||
cmp #8 ; see if > 8
|
||||
; our momentum table is 8
|
||||
; (DOS3.3 it's 12)
|
||||
; Y maxes out if over 8
|
||||
|
||||
bcs skip_update_momentum
|
||||
tay ; acceleration offset in Y
|
||||
sec ; carry set is phase on
|
||||
skip_update_momentum:
|
||||
|
||||
txa ; current track in A
|
||||
pha ; save for later
|
||||
ldx phase_on_time, Y ; load on time from table
|
||||
|
||||
done_seek: ; +++
|
||||
php ; save flags(?)
|
||||
bne skip_p ; bra?
|
||||
loop_mmm:
|
||||
clc ; set phase off
|
||||
lda tmpval_smc+1 ;tmptrk ; restore saved track
|
||||
ldx phase_off_time, Y ; get off time from table
|
||||
skip_p:
|
||||
stx sector_smc+1 ;tmpsec ; why
|
||||
and #3 ; mask to 1 of 3 phases
|
||||
rol ; multiply by 2, set low bit to carry
|
||||
; carry holds on/off
|
||||
tax
|
||||
lsr ; get low bit in carry for later
|
||||
; but must do before A destroyed
|
||||
;unrseek=unrelocdsk+(*-reloc)
|
||||
|
||||
slotpatch8:
|
||||
lda $C0D1, X
|
||||
|
||||
seek_delay:
|
||||
|
||||
; delay 2+(19*5)-1 = 97 cycles, + 6+2 = 105 cycles = ~100us
|
||||
|
||||
seek_delay_outer:
|
||||
ldx #$13 ; 2
|
||||
seek_delay_inner:
|
||||
dex ; 2
|
||||
bne seek_delay_inner ; 2/3
|
||||
|
||||
dec sector_smc+1 ;tmpsec ; 6 holds on/off delay time
|
||||
bne seek_delay_outer ; 2/3
|
||||
seek_delay_end:
|
||||
|
||||
; C is from the LSR previously? so phase bit
|
||||
|
||||
bcs loop_mmm ; if carry set, try again phase off
|
||||
plp ; restore?
|
||||
|
||||
beq seekret ; if zero we were done
|
||||
|
||||
pla ; restore current track
|
||||
inc step ; increment step count
|
||||
bne copy_cur ; (bra) try again
|
||||
|
||||
seekret:
|
||||
; update current track
|
||||
ldx phase_smc+1
|
||||
stx curtrk_smc+1
|
||||
; the DOS3.3 RWTS waits 25ms after seeking for things to settle
|
||||
|
||||
rts
|
||||
|
||||
|
||||
;curtrk_smc: ; FIXME
|
||||
; lda #0
|
||||
|
||||
|
||||
.if 0
|
||||
seek:
|
||||
ldx #0 ; reset acceleration count?
|
||||
stx step_smc+1
|
||||
@ -365,6 +532,7 @@ seek_delay_end:
|
||||
inc step_smc+1 ; increment step count
|
||||
bne copy_cur ; bra(?) back to beginning
|
||||
|
||||
.endif
|
||||
|
||||
; phase on/off tables, in 100us multiples
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
load_file =$0b30
|
||||
sector_write =$0c8b
|
||||
load_file =$0b2a
|
||||
sector_write =$0c85
|
||||
check_floppy_in_drive2 =$0de6
|
||||
requested_sector =$0d17
|
||||
decompress_lzsa2_fast =$0e35
|
||||
|
@ -65,7 +65,7 @@ zp_clear_loop:
|
||||
sta DRIVE1_DISK ; it's in drive1
|
||||
sta CURRENT_DRIVE ; and currently using drive 1
|
||||
|
||||
lda #$ff
|
||||
lda #$FF
|
||||
sta DRIVE1_TRACK
|
||||
sta DRIVE2_TRACK
|
||||
|
||||
@ -76,9 +76,6 @@ zp_clear_loop:
|
||||
lda #LOAD_TITLE ; next load title
|
||||
sta WHICH_LOAD
|
||||
|
||||
bit $C054
|
||||
bit $C051
|
||||
|
||||
main_game_loop:
|
||||
jsr load_file
|
||||
|
||||
|
@ -9,16 +9,13 @@
|
||||
.include "music.inc"
|
||||
|
||||
title:
|
||||
jsr hgr2
|
||||
jsr hgr2 ; clear screen, HGR page 2
|
||||
|
||||
;=========================
|
||||
; set up hgr lookup tables
|
||||
;=========================
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
|
||||
|
||||
jsr hgr_make_tables ; necessary?
|
||||
|
||||
|
||||
;=========================
|
||||
@ -32,8 +29,8 @@ do_title:
|
||||
lda #0
|
||||
sta FRAME
|
||||
|
||||
;======================
|
||||
; load regular to $40
|
||||
;================================
|
||||
; load regular title image to $40
|
||||
|
||||
lda #<(title_trogfree_lzsa)
|
||||
sta getsrc_smc+1
|
||||
@ -45,8 +42,8 @@ do_title:
|
||||
jsr decompress_lzsa2_fast
|
||||
|
||||
|
||||
;======================
|
||||
; load trogdor to $20
|
||||
;=================================
|
||||
; load trogdor title image to $20
|
||||
|
||||
lda #<(title_lzsa)
|
||||
sta getsrc_smc+1
|
||||
@ -65,7 +62,6 @@ do_title:
|
||||
and #SOUND_MOCKINGBOARD
|
||||
beq mockingboard_notfound
|
||||
|
||||
|
||||
jsr mockingboard_loop
|
||||
jmp title_loop_done
|
||||
|
||||
@ -172,10 +168,10 @@ zurg:
|
||||
|
||||
reset_altfire:
|
||||
lda #50
|
||||
sta ALTFIRE
|
||||
sta ALTFIRE ; start on yy=50 on screen
|
||||
|
||||
lda #<altfire_sprite
|
||||
sta alt_smc1+1
|
||||
lda #<altfire_sprite ; point to alternate fire
|
||||
sta alt_smc1+1 ; sprite in memory
|
||||
sta alt_smc2+1
|
||||
|
||||
lda #>altfire_sprite
|
||||
@ -187,55 +183,57 @@ title_loop:
|
||||
lda C_VOLUME ; see if volume on trogdor channel
|
||||
beq no_trog
|
||||
|
||||
bit PAGE1
|
||||
bit PAGE1 ; if it did, flip page to trogdor
|
||||
jmp done_trog
|
||||
|
||||
no_trog:
|
||||
bit PAGE2
|
||||
bit PAGE2 ; otherwise stay at regular
|
||||
|
||||
done_trog:
|
||||
|
||||
; work on flame
|
||||
lda FRAME ; skip most of time
|
||||
and #$3f
|
||||
bne altfire_good
|
||||
|
||||
|
||||
; do altfire loop
|
||||
|
||||
ldx ALTFIRE
|
||||
ldx ALTFIRE ; point (GBASL) to current line to copy
|
||||
lda hposn_high,X
|
||||
sta GBASH
|
||||
lda hposn_low,X
|
||||
sta GBASL
|
||||
|
||||
ldy #34
|
||||
ldy #34 ; xx=34*7
|
||||
inner_altfire:
|
||||
|
||||
lda (GBASL),Y
|
||||
pha
|
||||
alt_smc1:
|
||||
lda $d000
|
||||
sta (GBASL),Y
|
||||
pla
|
||||
alt_smc2:
|
||||
sta $d000
|
||||
; swap sprite data with screen data
|
||||
|
||||
inc alt_smc1+1
|
||||
lda (GBASL),Y ; get pixels from screen
|
||||
pha ; save for later
|
||||
alt_smc1:
|
||||
lda $d000 ; get pixels from sprite
|
||||
sta (GBASL),Y ; store to screen
|
||||
pla ; restore saved pixels
|
||||
alt_smc2:
|
||||
sta $d000 ; store to pixel area
|
||||
|
||||
inc alt_smc1+1 ; increment the sprite pointers
|
||||
inc alt_smc2+1
|
||||
bne alt_noflo
|
||||
|
||||
inc alt_smc1+2
|
||||
inc alt_smc1+2 ; handle 16-bit if overflowed
|
||||
inc alt_smc2+2
|
||||
|
||||
|
||||
alt_noflo:
|
||||
iny
|
||||
cpy #40
|
||||
cpy #40 ; continue to xx=(40*7)
|
||||
bne inner_altfire
|
||||
|
||||
|
||||
inc ALTFIRE
|
||||
lda ALTFIRE
|
||||
cmp #135
|
||||
cmp #135 ; continue until yy=135
|
||||
beq reset_altfire
|
||||
|
||||
altfire_good:
|
||||
@ -244,8 +242,11 @@ altfire_good:
|
||||
|
||||
lda KEYPRESS ; 4
|
||||
bpl title_loop ; 3
|
||||
bit KEYRESET ; clear the keyboard buffer
|
||||
|
||||
;==========================
|
||||
; key was pressed, exit
|
||||
|
||||
bit KEYRESET ; clear the keyboard buffer
|
||||
|
||||
bit PAGE2 ; return to viewing PAGE2
|
||||
|
||||
|
@ -45,7 +45,6 @@ text_loop:
|
||||
dex
|
||||
bne text_loop
|
||||
|
||||
|
||||
;===================
|
||||
; detect model
|
||||
;===================
|
||||
|
Loading…
Reference in New Issue
Block a user