2017-02-12 18:46:52 +00:00
|
|
|
;-------------------------------
|
|
|
|
; YE OLDE GRAND UNIFIED MEMORY MAP
|
|
|
|
;
|
2017-02-13 21:21:30 +00:00
|
|
|
; 02D8..038D - clobbered by Optimum reader
|
2017-06-23 03:50:39 +00:00
|
|
|
; 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
|
2017-02-12 18:46:52 +00:00
|
|
|
; 0C00..0CFF - clobbered by Special Delivery tracer
|
|
|
|
; 0D00..0FFF - unused
|
|
|
|
; 1000..1FFF - data buffer for current track
|
|
|
|
; 2000..35FF - clobbered by Special Delivery tracer
|
|
|
|
; 3600..3FFF - clobbered by lomem DOS 3.3 / Special Delivery tracers
|
|
|
|
; 4000..42FF - backup of zero page, page 3, page $BF (SaveProDOS, SwapProDOS)
|
|
|
|
; 4300..B5FF - program code
|
|
|
|
; B600..BFFF - clobbered by DOS 3.3 boot tracer
|
|
|
|
;-------------------------------
|
|
|
|
|
|
|
|
|
2017-01-08 03:35:35 +00:00
|
|
|
;-------------------------------
|
|
|
|
; CopyMemory
|
|
|
|
; in: A = source address (high)
|
|
|
|
; X = destination address (high)
|
|
|
|
; Y = number of pages to copy
|
|
|
|
; out: all flags and registers clobbered
|
|
|
|
;-------------------------------
|
2017-01-24 00:57:43 +00:00
|
|
|
!zone {
|
2017-01-08 03:35:35 +00:00
|
|
|
CopyMemory
|
2017-01-24 00:57:43 +00:00
|
|
|
sta .source+2
|
|
|
|
stx .dest+2
|
2017-01-08 03:35:35 +00:00
|
|
|
ldx #$00
|
2017-01-24 00:57:43 +00:00
|
|
|
.source lda $FF00,x
|
|
|
|
.dest sta $FF00,x
|
2017-01-08 03:35:35 +00:00
|
|
|
inx
|
2017-01-24 00:57:43 +00:00
|
|
|
bne .source
|
|
|
|
inc .source+2
|
|
|
|
inc .dest+2
|
2017-01-08 03:35:35 +00:00
|
|
|
dey
|
2017-01-24 00:57:43 +00:00
|
|
|
bne .source
|
2017-01-08 03:35:35 +00:00
|
|
|
rts
|
2017-01-24 00:57:43 +00:00
|
|
|
}
|
2017-01-08 03:35:35 +00:00
|
|
|
|
|
|
|
;-------------------------------
|
|
|
|
; ClearMemory
|
|
|
|
; in: A = source address (high)
|
|
|
|
; X = value to set
|
|
|
|
; Y = number of pages
|
|
|
|
; out: all flags and registers clobbered
|
|
|
|
;-------------------------------
|
2017-01-24 00:57:43 +00:00
|
|
|
!zone {
|
2017-01-08 03:35:35 +00:00
|
|
|
ClearMemory
|
2017-01-24 00:57:43 +00:00
|
|
|
sta .dest+2
|
2017-01-08 03:35:35 +00:00
|
|
|
txa
|
|
|
|
ldx #$00
|
2017-01-24 00:57:43 +00:00
|
|
|
.dest sta $FF00,x
|
2017-01-08 03:35:35 +00:00
|
|
|
inx
|
2017-01-24 00:57:43 +00:00
|
|
|
bne .dest
|
|
|
|
inc .dest+2
|
2017-01-08 03:35:35 +00:00
|
|
|
dey
|
2017-01-24 00:57:43 +00:00
|
|
|
bne .dest
|
2017-01-08 03:35:35 +00:00
|
|
|
rts
|
2017-01-24 00:57:43 +00:00
|
|
|
}
|
2017-01-08 03:35:35 +00:00
|
|
|
|
|
|
|
;-------------------------------
|
|
|
|
; ClearTSBuffer
|
|
|
|
; clear the $1000 byte memory buffer
|
|
|
|
; used to store the current track's data
|
|
|
|
; in: none
|
|
|
|
; out: all flags and registers clobbered
|
|
|
|
;-------------------------------
|
|
|
|
ClearTSBuffer
|
|
|
|
lda #BASEPAGE
|
|
|
|
ldx #$00
|
|
|
|
ldy #$10
|
|
|
|
jmp ClearMemory
|
|
|
|
|
|
|
|
;-------------------------------
|
|
|
|
; SwapMemory
|
|
|
|
; in: A = source address (high)
|
|
|
|
; X = destination address (high)
|
|
|
|
; Y = number of pages to copy
|
2017-11-09 05:47:12 +00:00
|
|
|
; C = dest direction (set: +, clear: -)
|
2017-01-08 03:35:35 +00:00
|
|
|
; out: all flags and registers clobbered
|
|
|
|
;-------------------------------
|
2017-01-24 00:57:43 +00:00
|
|
|
!zone {
|
2017-01-08 03:35:35 +00:00
|
|
|
SwapMemory
|
2017-01-24 00:57:43 +00:00
|
|
|
sta .source1+2
|
|
|
|
sta .source2+2
|
|
|
|
stx .dest1+2
|
|
|
|
stx .dest2+2
|
2017-11-09 05:47:12 +00:00
|
|
|
lda #$FF
|
|
|
|
adc #0
|
|
|
|
ora #1
|
|
|
|
sta .destadjust+1
|
2017-01-08 03:35:35 +00:00
|
|
|
ldx #$00
|
2017-01-24 00:57:43 +00:00
|
|
|
.source1 lda $FF00,x
|
2017-01-08 03:35:35 +00:00
|
|
|
pha
|
2017-01-24 00:57:43 +00:00
|
|
|
.dest1 lda $FF00,x
|
|
|
|
.source2 sta $FF00,x
|
2017-01-08 03:35:35 +00:00
|
|
|
pla
|
2017-01-24 00:57:43 +00:00
|
|
|
.dest2 sta $FF00,x
|
2017-01-08 03:35:35 +00:00
|
|
|
inx
|
2017-01-24 00:57:43 +00:00
|
|
|
bne .source1
|
|
|
|
inc .source1+2
|
|
|
|
inc .source2+2
|
2017-11-09 05:47:12 +00:00
|
|
|
lda .dest1+2
|
|
|
|
clc
|
|
|
|
.destadjust
|
|
|
|
adc #$D1
|
|
|
|
sta .dest1+2
|
|
|
|
sta .dest2+2
|
2017-01-08 03:35:35 +00:00
|
|
|
dey
|
2017-01-24 00:57:43 +00:00
|
|
|
bne .source1
|
2017-01-08 03:35:35 +00:00
|
|
|
rts
|
2017-01-24 00:57:43 +00:00
|
|
|
}
|
2017-01-08 03:35:35 +00:00
|
|
|
|
2017-11-09 05:47:12 +00:00
|
|
|
;-------------------------------
|
|
|
|
; 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
|
|
|
|
;-------------------------------
|
|
|
|
!zone {
|
|
|
|
ReorderBuffer
|
|
|
|
lda #BASEPAGE+1
|
|
|
|
ldx #BASEPAGE+$0E
|
|
|
|
ldy #$07
|
|
|
|
clc
|
|
|
|
jmp SwapMemory
|
|
|
|
}
|
|
|
|
|
2017-01-08 03:35:35 +00:00
|
|
|
;-------------------------------
|
|
|
|
; SaveProDOS
|
|
|
|
; saves memory pages used by ProDOS
|
|
|
|
; pages $00, $03, $BF
|
|
|
|
; in: none
|
|
|
|
; out: all flags and registers clobbered
|
|
|
|
;-------------------------------
|
2017-01-24 00:57:43 +00:00
|
|
|
!zone {
|
2017-01-08 03:35:35 +00:00
|
|
|
SaveProDOS
|
|
|
|
lda #$00
|
|
|
|
ldx #$40
|
|
|
|
ldy #$01
|
|
|
|
jsr CopyMemory
|
|
|
|
lda #$03
|
|
|
|
ldx #$41
|
|
|
|
ldy #$01
|
|
|
|
jsr CopyMemory
|
2017-06-23 03:50:39 +00:00
|
|
|
SaveGlobal
|
2017-01-08 03:35:35 +00:00
|
|
|
lda #$BF
|
|
|
|
ldx #$42
|
|
|
|
ldy #$01
|
|
|
|
jsr CopyMemory
|
2017-01-24 00:57:43 +00:00
|
|
|
.exit
|
2017-01-08 03:35:35 +00:00
|
|
|
rts
|
2017-01-24 00:57:43 +00:00
|
|
|
}
|
2017-01-08 03:35:35 +00:00
|
|
|
|
|
|
|
;-------------------------------
|
|
|
|
; SwapProDOS
|
|
|
|
; saves/restores memory pages used by ProDOS
|
|
|
|
; pages $00, $03, $BF
|
|
|
|
; in: none
|
|
|
|
; out: all flags and registers clobbered
|
|
|
|
;-------------------------------
|
|
|
|
SwapProDOS
|
|
|
|
lda #$00
|
|
|
|
ldx #$40
|
|
|
|
ldy #$01
|
2017-11-09 05:47:12 +00:00
|
|
|
sec
|
2017-01-08 03:35:35 +00:00
|
|
|
jsr SwapMemory
|
|
|
|
lda #$03
|
|
|
|
ldx #$41
|
|
|
|
ldy #$01
|
2017-11-09 05:47:12 +00:00
|
|
|
sec
|
2017-01-08 03:35:35 +00:00
|
|
|
jsr SwapMemory
|
|
|
|
lda #$BF
|
|
|
|
ldx #$42
|
|
|
|
ldy #$01
|
2017-11-09 05:47:12 +00:00
|
|
|
sec
|
2017-01-08 03:35:35 +00:00
|
|
|
jsr SwapMemory
|
|
|
|
rts
|
2017-05-01 14:48:33 +00:00
|
|
|
|
|
|
|
;-------------------------------
|
|
|
|
; 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
|
2017-11-09 05:47:12 +00:00
|
|
|
; out: A,X,Y clobbered
|
2017-05-01 14:48:33 +00:00
|
|
|
;-------------------------------
|
|
|
|
!zone {
|
|
|
|
ReorderLogicalToPhysical
|
|
|
|
ldy #$00
|
2017-11-09 05:47:12 +00:00
|
|
|
- ldx $1800,y
|
2017-05-01 14:48:33 +00:00
|
|
|
lda $1e00,y
|
|
|
|
sta $1800,y
|
2017-11-09 05:47:12 +00:00
|
|
|
lda $1200,y
|
|
|
|
sta $1e00,y
|
|
|
|
lda $1b00,y
|
2017-05-01 14:48:33 +00:00
|
|
|
sta $1200,y
|
2017-11-09 05:47:12 +00:00
|
|
|
txa
|
2017-05-01 14:48:33 +00:00
|
|
|
sta $1b00,y
|
2017-11-09 05:47:12 +00:00
|
|
|
ldx $1100,y
|
|
|
|
lda $1d00,y
|
|
|
|
sta $1100,y
|
|
|
|
lda $1400,y
|
|
|
|
sta $1d00,y
|
|
|
|
lda $1700,y
|
2017-05-01 14:48:33 +00:00
|
|
|
sta $1400,y
|
2017-11-09 05:47:12 +00:00
|
|
|
txa
|
|
|
|
sta $1700,y
|
|
|
|
ldx $1900,y
|
|
|
|
lda $1c00,y
|
|
|
|
sta $1900,y
|
|
|
|
lda $1600,y
|
2017-05-01 14:48:33 +00:00
|
|
|
sta $1c00,y
|
2017-11-09 05:47:12 +00:00
|
|
|
lda $1300,y
|
2017-05-01 14:48:33 +00:00
|
|
|
sta $1600,y
|
2017-11-09 05:47:12 +00:00
|
|
|
txa
|
|
|
|
sta $1300,y
|
2017-05-01 14:48:33 +00:00
|
|
|
iny
|
|
|
|
bne -
|
|
|
|
rts
|
|
|
|
}
|