mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-01 05:31:52 +00:00
mist: write support
update the code from qkumba
This commit is contained in:
parent
da6d097cc3
commit
e9157ad060
@ -5,50 +5,50 @@
|
|||||||
opendir_filename =$1042
|
opendir_filename =$1042
|
||||||
|
|
||||||
; linking_noise.s
|
; linking_noise.s
|
||||||
play_link_noise =$1590
|
play_link_noise =$1591
|
||||||
|
|
||||||
; decompress_fast_v2.s
|
; decompress_fast_v2.s
|
||||||
decompress_lzsa2_fast =$15ac
|
decompress_lzsa2_fast =$15ad
|
||||||
getsrc_smc =$16a2
|
getsrc_smc =$16a3
|
||||||
|
|
||||||
; draw_pointer.s
|
; draw_pointer.s
|
||||||
draw_pointer =$16af
|
draw_pointer =$16b0
|
||||||
|
|
||||||
; end_level.s
|
; end_level.s
|
||||||
end_level =$181d
|
end_level =$181e
|
||||||
|
|
||||||
; gr_copy.s
|
; gr_copy.s
|
||||||
gr_copy_to_current =$183f
|
gr_copy_to_current =$1840
|
||||||
|
|
||||||
; gr_fast_clear.s
|
; gr_fast_clear.s
|
||||||
clear_bottom =$1965
|
clear_bottom =$1966
|
||||||
clear_all =$19a3
|
clear_all =$19a4
|
||||||
clear_all_color =$19c8
|
clear_all_color =$19c9
|
||||||
|
|
||||||
; gr_offsets.s
|
; gr_offsets.s
|
||||||
gr_offsets =$19e6
|
gr_offsets =$19e7
|
||||||
|
|
||||||
; gr_page_flip.s
|
; gr_page_flip.s
|
||||||
page_flip =$1a16
|
page_flip =$1a17
|
||||||
|
|
||||||
; gr_putsprite_crop.s
|
; gr_putsprite_crop.s
|
||||||
put_sprite_crop =$1a30
|
put_sprite_crop =$1a31
|
||||||
psc_smc1 =$1a53
|
psc_smc1 =$1a54
|
||||||
psc_smc2 =$1aeb
|
psc_smc2 =$1aec
|
||||||
|
|
||||||
; keyboard.s
|
; keyboard.s
|
||||||
handle_keypress =$1b6c
|
handle_keypress =$1b6d
|
||||||
change_direction =$1c30
|
change_direction =$1c31
|
||||||
change_location =$1c69
|
change_location =$1c6a
|
||||||
|
|
||||||
; text_print.s
|
; text_print.s
|
||||||
move_and_print =$1d01
|
move_and_print =$1d02
|
||||||
ps_smc1 =$1d2e
|
ps_smc1 =$1d2f
|
||||||
|
|
||||||
; page_sprites.inc
|
; page_sprites.inc
|
||||||
blue_page_sprite =$1e16
|
blue_page_sprite =$1e17
|
||||||
red_page_sprite =$1e2c
|
red_page_sprite =$1e2d
|
||||||
white_page_sprite =$1e42
|
white_page_sprite =$1e43
|
||||||
blue_page_small_sprite =$1e58
|
blue_page_small_sprite =$1e59
|
||||||
red_page_small_sprite =$1e60
|
red_page_small_sprite =$1e61
|
||||||
|
|
||||||
|
@ -6,11 +6,17 @@
|
|||||||
|
|
||||||
;bit2tbl=$dc00 ; in loader.s
|
;bit2tbl=$dc00 ; in loader.s
|
||||||
|
|
||||||
encbuf=$e00
|
frombuff=$d00 ; sector data to write
|
||||||
frombuff=$d00
|
|
||||||
|
encbuf=$e00 ; nibble buffer must be page alined
|
||||||
|
|
||||||
|
|
||||||
popwr:
|
;================================
|
||||||
|
; set up the self-modifying code
|
||||||
|
; to point to the proper slot
|
||||||
|
;================================
|
||||||
|
; slot number is in high nibble of A
|
||||||
|
popwr_init:
|
||||||
lda #$60
|
lda #$60
|
||||||
|
|
||||||
and #$70 ; the slot number is in the top here
|
and #$70 ; the slot number is in the top here
|
||||||
@ -19,7 +25,16 @@ popwr:
|
|||||||
sta slotpatchw3+1
|
sta slotpatchw3+1
|
||||||
sta slotpatchw4+1
|
sta slotpatchw4+1
|
||||||
|
|
||||||
; convert the input to nibbles?
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;================================
|
||||||
|
; write a sector
|
||||||
|
;================================
|
||||||
|
|
||||||
|
sector_write:
|
||||||
|
|
||||||
|
; convert the input to nibbles
|
||||||
|
|
||||||
ldy #2 ; why start at 2?
|
ldy #2 ; why start at 2?
|
||||||
aa:
|
aa:
|
||||||
@ -58,8 +73,14 @@ b3:
|
|||||||
and tmpsec ; and with prev nibble?
|
and tmpsec ; and with prev nibble?
|
||||||
dey
|
dey
|
||||||
bne b3
|
bne b3
|
||||||
;reqsec:
|
|
||||||
|
|
||||||
|
requested_sector:
|
||||||
tay
|
tay
|
||||||
|
; at this point A has the sector number
|
||||||
|
; this code assumes you want sector 0
|
||||||
|
|
||||||
|
|
||||||
bne cmpsecwr ; retry if not what we want?
|
bne cmpsecwr ; retry if not what we want?
|
||||||
|
|
||||||
;skip tail #$DE #$AA #$EB some #$FFs ...
|
;skip tail #$DE #$AA #$EB some #$FFs ...
|
||||||
@ -82,116 +103,122 @@ b4:
|
|||||||
; c0e9 slot 6 motor on
|
; c0e9 slot 6 motor on
|
||||||
; c0ea slot 6 drive 1
|
; c0ea slot 6 drive 1
|
||||||
; c0eb slot 6 drive 2
|
; c0eb slot 6 drive 2
|
||||||
; c0ec slot 6 q6 off read
|
; c0ec slot 6 q6 off \ Q6 Q7
|
||||||
; c0ed slot 6 q6 on wp sense
|
; c0ed slot 6 q6 on |-- state machine 0 0 READ
|
||||||
; c0ee slot 6 q7 off read/wp sense
|
; c0ee slot 6 q7 off | 0 1 WRITE
|
||||||
; c0ef slot 6 q7 on write
|
; c0ef slot 6 q7 on / 1 0 SENSE WRITE PROTECT
|
||||||
|
; 1 1 WRITE LOAD
|
||||||
|
|
||||||
; write sector data
|
; write sector data
|
||||||
|
|
||||||
slotpatchw1:
|
slotpatchw1:
|
||||||
ldx #$d1
|
ldx #$d1 ; cycle num smc Q6 Q7
|
||||||
lda $c08d, x ; prime drive ; c0ed if X=$60
|
lda $c08d, x ; prime drive 1 X
|
||||||
lda $c08e, x ; required by Unidisk ; c0ee
|
lda $c08e, x ; required by Unidisk 1 0 ; senese wp?
|
||||||
tya
|
tya
|
||||||
sta $c08f, x ; c0ef write
|
sta $c08f, x ; 1 1 ; write load
|
||||||
ora $c08c, x ; c0ec read?
|
ora $c08c, x ; 0 1 ; write
|
||||||
|
|
||||||
;40 cycles
|
; 40 cycles
|
||||||
|
|
||||||
ldy #4 ; 2 cycles
|
ldy #4 ; 2 cycles
|
||||||
cmp $ea ; 3 cycles
|
cmp $ea ; nop ; 3 cycles
|
||||||
cmp ($ea,x) ; 6 cycles
|
cmp ($ea,x) ; nop ; 6 cycles
|
||||||
b5:
|
b5:
|
||||||
jsr writenib1 ; (29 cycles)
|
jsr writenib1 ; (29 cycles)
|
||||||
|
|
||||||
; +6 cycles
|
; +6 cycles
|
||||||
dey ; 2 cycles
|
dey ; 2 cycles
|
||||||
bne b5 ; 3 cycles if taken, 2 if not
|
bne b5 ; 3/2nt
|
||||||
|
|
||||||
; 36 cycles
|
; 36 cycles
|
||||||
; +10 cycles
|
; +10 cycles
|
||||||
ldy #(prolog_e-prolog)
|
ldy #(prolog_e-prolog)
|
||||||
; 2 cycles
|
; 2 cycles
|
||||||
cmp $ea ; 3 cycles
|
cmp $ea ; nop ; 3 cycles
|
||||||
b6:
|
b6:
|
||||||
lda prolog-1, y ; 4 cycles
|
lda prolog-1, y ; 4 cycles
|
||||||
jsr writenib3 ; (17 cycles)
|
jsr writenib3 ; (17 cycles)
|
||||||
|
|
||||||
; 32 cycles if branch taken
|
; 32 cycles if branch taken
|
||||||
; +6 cycles
|
; +6 cycles
|
||||||
dey ; 2 cycles
|
dey ; 2 cycles
|
||||||
bne b6 ; 3 cycles if taken, 2 if not
|
bne b6 ; 3/2nt
|
||||||
|
|
||||||
;36 cycles on first pass
|
; 36 cycles on first pass
|
||||||
;+10 cycles
|
; +10 cycles
|
||||||
tya ;2 cycles
|
tya ; 2 cycles
|
||||||
ldy #$56 ;2 cycles
|
ldy #$56 ; 2 cycles
|
||||||
b7: eor bit2tbl-1, y ;5 cycles
|
b7:
|
||||||
tax ;2 cycles
|
eor bit2tbl-1, y ; 5 cycles
|
||||||
lda xlattbl, x ;4 cycles
|
tax ; 2 cycles
|
||||||
|
lda xlattbl, x ; 4 cycles
|
||||||
slotpatchw2:
|
slotpatchw2:
|
||||||
ldx #$d1 ;2 cycles
|
ldx #$d1 ; slot number smc ; 2 cycles
|
||||||
sta $c08d, x ;5 cycles
|
sta $c08d, x ; wp sense ; 5 cycles
|
||||||
lda $c08c, x ;4 cycles
|
lda $c08c, x ; read ; 4 cycles
|
||||||
|
|
||||||
;32 cycles if branch taken
|
; 32 cycles if branch taken
|
||||||
|
|
||||||
lda bit2tbl-1, y ;5 cycles
|
lda bit2tbl-1, y ; 5 cycles
|
||||||
dey ;2 cycles
|
dey ; 2 cycles
|
||||||
bne b7 ;3 cycles if taken, 2 if not
|
bne b7 ; 3/2nt
|
||||||
|
|
||||||
;32 cycles
|
; 32 cycles
|
||||||
;+9 cycles
|
; +9 cycles
|
||||||
clc ;2 cycles
|
clc ; 2 cycles
|
||||||
b88: eor encbuf, y ;4 cycles
|
b88:
|
||||||
b8: tax ;2 cycles
|
eor encbuf, y ; 4 cycles
|
||||||
lda xlattbl, x ;4 cycles
|
b8:
|
||||||
|
tax ; 2 cycles
|
||||||
|
lda xlattbl, x ; 4 cycles
|
||||||
slotpatchw3:
|
slotpatchw3:
|
||||||
ldx #$d1 ;2 cycles
|
ldx #$d1 ; slot number smc ; 2 cycles
|
||||||
sta $c08d, x ;5 cycles
|
sta $c08d, x ; wp sense ; 5 cycles
|
||||||
lda $c08c, x ;4 cycles
|
lda $c08c, x ; read ; 4 cycles
|
||||||
bcs f1 ;3 cycles if taken, 2 if not
|
bcs f1 ; 3/2nt
|
||||||
|
|
||||||
;32 cycles if branch taken
|
; 32 cycles if branch taken
|
||||||
|
|
||||||
lda encbuf, y ;4 cycles
|
lda encbuf, y ; 4 cycles
|
||||||
iny ;2 cycles
|
iny ; 2 cycles
|
||||||
bne b88 ;3 cycles if taken, 2 if not
|
bne b88 ; 3/2nt
|
||||||
|
|
||||||
;32 cycles
|
; 32 cycles
|
||||||
;+10 cycles
|
; +10 cycles
|
||||||
sec ;2 cycles
|
sec ; 2 cycles
|
||||||
bcs b8 ;3 cycles
|
bcs b8 ; 3 cycles
|
||||||
|
|
||||||
;32 cycles
|
; 32 cycles
|
||||||
;+3 cycles
|
; +3 cycles
|
||||||
f1: ldy #(epilog_e-epilog)
|
f1:
|
||||||
;2 cycles
|
ldy #(epilog_e-epilog)
|
||||||
cmp ($ea,x) ;6 cycles
|
; 2 cycles
|
||||||
b9: lda epilog-1, y ;4 cycles
|
cmp ($ea,x) ; nop ; 6 cycles
|
||||||
jsr writenib3 ;(17 cycles)
|
b9:
|
||||||
|
lda epilog-1, y ; 4 cycles
|
||||||
|
jsr writenib3 ; (17 cycles)
|
||||||
|
|
||||||
;32 cycles if branch taken
|
; 32 cycles if branch taken
|
||||||
;+6 cycles
|
; +6 cycles
|
||||||
dey ;2 cycles
|
dey ; 2 cycles
|
||||||
bne b9 ;3 cycles if branch taken, 2 if not
|
bne b9 ;3/2nt
|
||||||
|
|
||||||
lda $c08e, x
|
lda $c08e, x ; read/wp
|
||||||
lda $c08c, x
|
lda $c08c, x ; read
|
||||||
lda $c088, x
|
lda $c088, x ; motor off
|
||||||
rts
|
rts ; 6 cycles
|
||||||
|
|
||||||
writenib1:
|
writenib1:
|
||||||
cmp ($ea,x) ;6 cycles
|
cmp ($ea,x) ; nop ; 6 cycles
|
||||||
cmp ($ea,x) ;6 cycles
|
cmp ($ea,x) ; nop ; 6 cycles
|
||||||
writenib3:
|
writenib3:
|
||||||
slotpatchw4:
|
slotpatchw4:
|
||||||
ldx #$d1 ;2 cycles
|
ldx #$d1 ; slot number ; 2 cycles
|
||||||
writenib4:
|
writenib4:
|
||||||
sta $c08d, x ;5 cycles
|
sta $c08d, x ; wp sense? ; 5 cycles
|
||||||
ora $c08c, x ;4 cycles
|
ora $c08c, x ; read ; 4 cycles
|
||||||
rts ;6 cycles
|
rts ; 6 cycles
|
||||||
|
|
||||||
prolog: .byte $ad, $aa, $d5
|
prolog: .byte $ad, $aa, $d5
|
||||||
prolog_e:
|
prolog_e:
|
||||||
|
Loading…
Reference in New Issue
Block a user