mirror of
https://github.com/a2-4am/passport.git
synced 2024-12-22 19:30:50 +00:00
229 lines
5.6 KiB
Plaintext
Executable File
229 lines
5.6 KiB
Plaintext
Executable File
;-------------------------------
|
|
; YE OLDE GRAND UNIFIED MEMORY MAP
|
|
;
|
|
; 0200..03FF - clobbered by DOS 3.2 tracer (and other supported 13-sector disks like Choplifter)
|
|
; 0200..02CB - clobbered by exodecrunch
|
|
; 02D8..038D - clobbered by Optimum reader
|
|
; 0300..0395 - clobbered by DOS 3.3 tracer
|
|
; 0800..08FF - clobbered by all boot tracers and RAM disk
|
|
; 0900..09FF - clobbered by Special Delivery tracer and RAM disk
|
|
; 0A00..0AFF - backup of zero page during Special Delivery tracer, used by RAM disk
|
|
; 0B00..0BFF - used by RAM disk
|
|
; 0C00..0CFF - clobbered by Special Delivery tracer
|
|
; 0CD0..0EFF - sector map
|
|
; 0F00..0FFF - backup of page $BF (SwapProDOS)
|
|
; 1000..1FFF - data buffer for current track
|
|
; 2000..35FF - clobbered by Special Delivery tracer
|
|
; 2600..26FF - clobbered by all boot tracers (copy of C600)
|
|
; 3600..3FFF - clobbered by lomem DOS 3.2/3.3 tracers, Special Delivery tracer
|
|
; 4000..B1FF - program code
|
|
; B200..BFFF - clobbered by DOS boot tracer (RDOS is B200+, DOS 3.x is B600+)
|
|
;-------------------------------
|
|
|
|
|
|
;-------------------------------
|
|
; SwapProDOS
|
|
; saves/restores memory used by ProDOS ($BF00..$BFFF)
|
|
; in: none
|
|
; out: all flags and registers preserved
|
|
;-------------------------------
|
|
SwapProDOS
|
|
php
|
|
pha
|
|
lda #$BF
|
|
ldx #$0F
|
|
ldy #$01
|
|
sec
|
|
jsr SwapMemory
|
|
pla
|
|
plp
|
|
- rts
|
|
|
|
MoveT00PakLow
|
|
bit T00PakPtr+1
|
|
bpl - ; already low
|
|
lda #$B2
|
|
ldx #$32
|
|
bne + ; always branches
|
|
MoveT00PakHigh
|
|
bit T00PakPtr+1
|
|
bmi - ; already high
|
|
lda #$32
|
|
ldx #$B2
|
|
+ stx T00PakPtr+1
|
|
ldy #$0D
|
|
; /!\ execution falls through here
|
|
|
|
;-------------------------------
|
|
; CopyMemory
|
|
; in: A = source address (high)
|
|
; X = destination address (high)
|
|
; Y = number of pages to copy
|
|
; out: Z = 1
|
|
; X = 0
|
|
; Y = 0
|
|
; all other flags and registers clobbered
|
|
;-------------------------------
|
|
CopyMemory
|
|
sta @source+2
|
|
stx @dest+2
|
|
ldx #$00
|
|
@source lda $FF00,x
|
|
@dest sta $FF00,x
|
|
inx
|
|
bne @source
|
|
inc @source+2
|
|
inc @dest+2
|
|
dey
|
|
bne @source
|
|
rts
|
|
|
|
;-------------------------------
|
|
; ClearTSBuffer
|
|
; clear the $1000 byte memory buffer
|
|
; used to store the current track's data
|
|
; in: none
|
|
; out: Z = 1
|
|
; X preserved
|
|
; Y = 0
|
|
; all other flags and registers clobbered
|
|
;-------------------------------
|
|
ClearTSBuffer
|
|
lda #BASEPAGE
|
|
ldx #$00
|
|
ldy #$10
|
|
; /!\ execution falls through here
|
|
|
|
;-------------------------------
|
|
; ClearMemory
|
|
; in: A = source address (high)
|
|
; X = value to set
|
|
; Y = number of pages
|
|
; out: Z = 1
|
|
; X preserved
|
|
; Y = 0
|
|
; all other flags and registers clobbered
|
|
;-------------------------------
|
|
ClearMemory
|
|
sta @dest+2
|
|
@dest stx $FF00
|
|
inc @dest+1
|
|
bne @dest
|
|
inc @dest+2
|
|
dey
|
|
bne @dest
|
|
rts
|
|
|
|
;-------------------------------
|
|
; ReorderBuffer - convert data
|
|
; buffer between ProDOS and
|
|
; DOS 3.3 ordering (use after
|
|
; read or before write under
|
|
; ProDOS)
|
|
; in: none
|
|
; out: all flags clobbered
|
|
; all registers clobbered
|
|
;-------------------------------
|
|
ReorderBuffer
|
|
lda #BASEPAGE+1
|
|
ldx #BASEPAGE+$0E
|
|
ldy #$07
|
|
clc
|
|
; /!\ execution falls through here
|
|
|
|
;-------------------------------
|
|
; SwapMemory
|
|
; in: A = source address (high)
|
|
; X = destination address (high)
|
|
; Y = number of pages to copy
|
|
; C = dest direction (set: +, clear: -)
|
|
; out: all flags and registers clobbered
|
|
;-------------------------------
|
|
SwapMemory
|
|
sta @source1+2
|
|
sta @source2+2
|
|
stx @dest1+2
|
|
stx @dest2+2
|
|
lda #$FF
|
|
adc #0
|
|
ora #1
|
|
sta @destadjust+1
|
|
ldx #$00
|
|
@source1 lda $FF00,x
|
|
pha
|
|
@dest1 lda $FF00,x
|
|
@source2 sta $FF00,x
|
|
pla
|
|
@dest2 sta $FF00,x
|
|
inx
|
|
bne @source1
|
|
inc @source1+2
|
|
inc @source2+2
|
|
lda @dest1+2
|
|
clc
|
|
@destadjust
|
|
adc #$D1
|
|
sta @dest1+2
|
|
sta @dest2+2
|
|
dey
|
|
bne @source1
|
|
rts
|
|
|
|
;-------------------------------
|
|
; ReorderLogicalToPhysical - reorder pages in
|
|
; track data buffer for disks that expect
|
|
; sectors in physical sector order
|
|
;
|
|
; 1 -> 7
|
|
; 2 -> E
|
|
; 3 -> 6
|
|
; 4 -> D
|
|
;
|
|
; 6 -> C
|
|
; 7 -> 4
|
|
; 8 -> B
|
|
; 9 -> 3
|
|
;
|
|
; B -> 2
|
|
; C -> 9
|
|
; D -> 1
|
|
; E -> 8
|
|
;
|
|
; 0123456789ABCDEF
|
|
; 07E6D5C4B3A2918F
|
|
; in: track buffer has data in logical sector order
|
|
; out: A,X,Y clobbered
|
|
;-------------------------------
|
|
ReorderLogicalToPhysical
|
|
ldy #$00
|
|
- ldx $1800,y
|
|
lda $1e00,y
|
|
sta $1800,y
|
|
lda $1200,y
|
|
sta $1e00,y
|
|
lda $1b00,y
|
|
sta $1200,y
|
|
txa
|
|
sta $1b00,y
|
|
ldx $1100,y
|
|
lda $1d00,y
|
|
sta $1100,y
|
|
lda $1400,y
|
|
sta $1d00,y
|
|
lda $1700,y
|
|
sta $1400,y
|
|
txa
|
|
sta $1700,y
|
|
ldx $1900,y
|
|
lda $1c00,y
|
|
sta $1900,y
|
|
lda $1600,y
|
|
sta $1c00,y
|
|
lda $1300,y
|
|
sta $1600,y
|
|
txa
|
|
sta $1300,y
|
|
iny
|
|
bne -
|
|
rts
|