mirror of
https://github.com/Michaelangel007/Directi-DOS.git
synced 2024-09-29 09:56:57 +00:00
Replace hard-coded magic number with descriptive symbols
This commit is contained in:
parent
34bf209a1a
commit
33e2b23aeb
106
fastboot.s
106
fastboot.s
@ -5,12 +5,59 @@
|
||||
;assemble using ACME
|
||||
!cpu 6502
|
||||
!to "fstbt",plain
|
||||
|
||||
; Disk
|
||||
PHASEOFF = $c080
|
||||
PHASEON = $c081
|
||||
|
||||
; P6PROM
|
||||
P6BUFF = $26 ; ZP: 16-bit pointer to decoded disk nibbles
|
||||
P6SLOTx16 = $2b ; ZP: Slot * 16, #$C600 -> #$60
|
||||
P6SECTOR = $3D ; ZP: Sector to read
|
||||
P6TRKHAVE = $40 ; ZP: Track Found or Actual
|
||||
P6TRKWANT = $41 ; ZP: Track Wanted or Expected
|
||||
P6READSEC = $c05c ; + P6SLOTx16 = $C65c: CLC, PHP, read sector
|
||||
|
||||
; Text Screen Holes
|
||||
; Apple II Monitors Peeled, Page 16, Peripheral Controller Work Areas
|
||||
; Laser 128 Reference Manual, Page 52, Figure 5.2, 4o Column Text Mode
|
||||
;
|
||||
; |Row |Slot 0|Slot 1|Slot 2|Slot 3|Slot 4|Slot 5|Slot 6|Slot 7|
|
||||
; |:--:|:-----|:-----|:-----|:-----|:-----|:-----|:-----|:-----|
|
||||
; | 0 | $478 | $479 | $47A | $47B | $47C | $47D | $47E | $47F |
|
||||
; | 1 | $4F8 | $4F9 | $4FA | $4FB | $4FC | $4FD | $4FE | $4FF |
|
||||
; | 2 | $578 | $579 | $57A | $57B | $57C | $57D | $57E | $57F |
|
||||
; | 3 | $5F8 | $5F9 | $5FA | $5FB | $5FC | $5FD | $5FE | $5FF |
|
||||
; | 4 | $678 | $679 | $67A | $67B | $67C | $67D | $67E | $67F |
|
||||
; | 5 | $6F8 | $6F9 | $6FA | $6FB | $6FC | $6FD | $6FE | $6FF |
|
||||
; | 6 | $778 | $779 | $77A | $77B | $77C | $77D | $77E | $77F |
|
||||
; | 7 | $7F8 | $7F9 | $7FA | $7FB | $7FC | $7FD | $7FE | $7FF |
|
||||
TXTHOLE00 = $478
|
||||
TXTHOLE31 = $4fb
|
||||
|
||||
; Graphics!
|
||||
SCRN2 = $f879
|
||||
|
||||
; Mem/Softswitches
|
||||
ROMIN = $c081 ; Disable LC Bank, read ROM
|
||||
LCBANK2 = $c083
|
||||
CLR80VID = $c00c ; OFF 80-column display mode
|
||||
CLRALTCH = $c00e ; OFF alternate character set (MouseText)
|
||||
|
||||
; Misc
|
||||
INIT = $fb2f ; Set Text Mode, Set Window
|
||||
WAIT = $fca8 ; wait _minimum_ 1/2(26+27 A+5A'^2) cycles -> *14 / 14.318181 uSeconds; see: Technote #12: The Apple II Firmware WAIT Routine
|
||||
SETKBD = $fe89 ; IN#0
|
||||
SETVID = $fe93 ; PR#0
|
||||
|
||||
|
||||
; .org $0800 ; 16-sector P6PROM Reads T0S0 into $0800
|
||||
*=$800
|
||||
|
||||
!byte 1
|
||||
!byte 1 ; First Byte = Number of sectors to read
|
||||
|
||||
tay ;A is last read sector+1 on entry
|
||||
lda $C081 ;bank in ROM
|
||||
lda ROMIN ;bank in ROM
|
||||
|
||||
;check array before checking sector number
|
||||
;allows us to avoid a redundant seek if all slots are full in a track,
|
||||
@ -21,10 +68,10 @@ incindex
|
||||
|
||||
adrindex
|
||||
lda adrtable - 1 ;15 entries in first row, 16 entries thereafter
|
||||
sta $4FB ;set 80-column state (final store is an #$FF to disable it)
|
||||
sta TXTHOLE31 ;set 80-column state (final store is an #$FF to disable it)
|
||||
cmp #$FF
|
||||
beq jmpoep ;#$FF means end of data
|
||||
sta $27 ;set high part of address
|
||||
sta P6BUFF+1 ;set high part of address
|
||||
|
||||
;2, 4, 6, 8, $0A, $0C, $0E
|
||||
;because PROM increments by one itself
|
||||
@ -32,7 +79,7 @@ adrindex
|
||||
;so we offer every other sector for read candidates
|
||||
|
||||
iny
|
||||
cpy #$10
|
||||
cpy #$10 ; 16 sectors/track
|
||||
bcc setsector ;cases 1-$0F
|
||||
beq sector1 ;finished with $0E
|
||||
;next should be 1 for 1, 3, 5, 7... sequence
|
||||
@ -44,59 +91,66 @@ adrindex
|
||||
;back to 0
|
||||
|
||||
tay
|
||||
!byte $2C ;mask LDY #1
|
||||
!byte $2C ; BIT $xxyy: mask LDY #1
|
||||
sector1
|
||||
ldy #1
|
||||
|
||||
setsector
|
||||
sty $3D ;set sector
|
||||
sty P6SECTOR ;set sector
|
||||
iny ;prepare to be next sector in case of unallocated sector
|
||||
lda $27
|
||||
lda P6BUFF+1
|
||||
beq incindex ;empty slot, back to the top
|
||||
|
||||
;convert slot to PROM address
|
||||
|
||||
; F879 SCRN2 BCC RTMASKZ
|
||||
; F87B LSR
|
||||
; F87C LSR
|
||||
; F87D LSR
|
||||
; F87E LSR
|
||||
; F87F RTMASKZ AND #$0F
|
||||
; F881 RTS
|
||||
txa
|
||||
jsr $F87B ;4xlsr
|
||||
jsr SCRN2+2 ;4xlsr
|
||||
tay
|
||||
ora #$C0
|
||||
ora #>P6READSEC ; Hi: $C0 -> $C65C = P6ReadSector
|
||||
pha
|
||||
lda #$5B ;read-1
|
||||
lda #<P6READSEC-1 ; Lo: $5B -> P6ReadSector-1
|
||||
pha
|
||||
lda #2
|
||||
sta $478, y ;save current phase for DOS use when we exit
|
||||
sta TXTHOLE00, y ;save current phase for DOS use when we exit
|
||||
|
||||
writeenable
|
||||
lda $C083
|
||||
lda $C083 ;write-enable RAM and bank it in so read can decode
|
||||
lda LCBANK2
|
||||
lda LCBANK2 ;write-enable RAM and bank it in so read can decode
|
||||
rts ;return to PROM
|
||||
|
||||
seek
|
||||
inc $41 ;next track
|
||||
asl $40 ;carry clear, phase off
|
||||
inc P6TRKWANT ;next track
|
||||
asl P6TRKHAVE ;carry clear, phase off
|
||||
jsr seek1 ;returns carry set, not useful
|
||||
clc ;carry clear, phase off
|
||||
|
||||
seek1
|
||||
jsr delay ;returns with carry set, phase on
|
||||
inc $40 ;next phase
|
||||
inc P6TRKHAVE ;next phase
|
||||
|
||||
delay
|
||||
lda $40
|
||||
lda P6TRKHAVE
|
||||
and #3
|
||||
rol
|
||||
ora $2B ;merge in slot
|
||||
ora P6SLOTx16 ;merge in slot
|
||||
tay
|
||||
lda $C080, y
|
||||
lda PHASEOFF, y
|
||||
lda #$30
|
||||
jmp $FCA8 ;common delay for all phases
|
||||
jmp WAIT ;common delay for all phases
|
||||
|
||||
jmpoep
|
||||
jsr $FE89 ;rehook keyboard (needed particularly after PR#)
|
||||
jsr $FE93 ;rehook video
|
||||
jsr $FB2F ;text mode
|
||||
sta $C00C
|
||||
sta $C00E ;clear 80-column mode
|
||||
jsr SETKBD ;rehook keyboard (needed particularly after PR#)
|
||||
jsr SETVID ;rehook video
|
||||
jsr INIT ;text mode
|
||||
sta CLR80VID
|
||||
sta CLRALTCH ;clear 80-column mode
|
||||
jsr writeenable ;bank in our RAM, write-enabled
|
||||
jmp $D000 ;jump to unpacker
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user