more work on RAM disk support, added ATTIC/CELLAR RAM test
This commit is contained in:
1 parent
fad9333e59
commit
0e34cd8d68
8 files changed
+174
-35
No files matched your search
@@ -44,7 +44,7 @@
|
||||
!addr OLDLIN = $3B ; $3B-$3C previous BASIC line number
|
||||
!addr OLDTXT = $3D ; $3D-$3E current BASIC line pointer
|
||||
!addr DATLIN = $3F ; $3F-$40 -- NOT IMPLEMENTED --
|
||||
!addr DATPTR = $41 ; $41-$42 pointer for READ/DATA copmmands
|
||||
!addr DATPTR = $41 ; $41-$42 pointer for READ/DATA commands
|
||||
!addr INPPTR = $43 ; $43-$44 -- NOT IMPLEMENTED --
|
||||
!addr VARNAM = $45 ; $45-$46 current variable name
|
||||
!addr VARPNT = $47 ; $47-$48 current variable/descriptor pointer
|
||||
|
||||
@@ -27,7 +27,12 @@
|
||||
!addr REG_Y = $8007
|
||||
!addr REG_Z = $8008
|
||||
|
||||
; Reserved: $8009 - $800C
|
||||
; System configuration
|
||||
|
||||
!addr RAM_ATTIC = $8009 ; $8000000-$87FFFFF RAM status; 0 = not present, $FF = present
|
||||
!addr RAM_CELLAR = $800A ; $8800000-$8FFFFFF RAM status; 0 = not present, $FF = present
|
||||
|
||||
; Reserved: $800B - $800C
|
||||
|
||||
; General DOS configuration
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
; A vector table to integrate DOS with the MEGA65 Kernal
|
||||
|
||||
!word dos_INIT
|
||||
!word dos_PRELOAD
|
||||
!word dos_UNITCHK
|
||||
!word dos_UNITSET
|
||||
!word dos_UNITNUM
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
;
|
||||
; Preload RAM disk image
|
||||
;
|
||||
|
||||
|
||||
dos_PRELOAD:
|
||||
|
||||
; Before the start make sure memory content is not damaged
|
||||
|
||||
jsr dos_MEMCHK
|
||||
bcc @ok
|
||||
rts
|
||||
@ok:
|
||||
jsr dos_ENTER
|
||||
jsr unit_rd_preload
|
||||
jmp dos_EXIT_CLC
|
||||
@@ -1,11 +1,12 @@
|
||||
|
||||
;
|
||||
; Initializes DOS part of ram disk
|
||||
; Initializes DOS part of RAM disk
|
||||
;
|
||||
|
||||
|
||||
unit_rd_init:
|
||||
|
||||
|
||||
; Copy status string
|
||||
|
||||
ldx #$00
|
||||
@@ -23,41 +24,98 @@ unit_rd_init:
|
||||
sta RD_STATUS_BUF,x
|
||||
bne @1
|
||||
|
||||
; End of initialization, now try to load the initial RAM disk; first set file name
|
||||
; FALLTROUGH
|
||||
|
||||
ldy #>ramdisk_filename
|
||||
ldx #<ramdisk_filename
|
||||
lda #$2E ; dos_setname
|
||||
sta HTRAP00
|
||||
+nop
|
||||
bcc @error_not_found
|
||||
unit_rd_init_test_ram: ; non-destructive ATTIC/CELLAR RAM test
|
||||
|
||||
; Try to find the file
|
||||
; Preserve temporary address area on stack
|
||||
|
||||
lda #$34 ; dos_findfile
|
||||
sta HTRAP00
|
||||
+nop
|
||||
bcc @error_not_found ; branch if file not found XXX why it can't find the file?
|
||||
ldx #$03
|
||||
@2:
|
||||
lda PNTR, x
|
||||
pha
|
||||
dex
|
||||
bpl @2
|
||||
|
||||
; XXX load the file
|
||||
; For the start, mark extended RAM as not present
|
||||
|
||||
inx
|
||||
stx RAM_ATTIC ; set ATTIC/CELLAR RAM as not present
|
||||
stx RAM_CELLAR
|
||||
|
||||
;@x:
|
||||
; inc $D020
|
||||
; bra @x
|
||||
; Prepare address - ATTIC RAM, $0800:$0000
|
||||
|
||||
stx PNTR+0
|
||||
stx PNTR+1
|
||||
stx PNTR+2
|
||||
lda #$08
|
||||
sta PNTR+3
|
||||
|
||||
; lda #$20 ; dos_closefile
|
||||
; sta HTRAP00
|
||||
; +nop
|
||||
ldz #$00
|
||||
|
||||
; Test for ATTIC RAM
|
||||
|
||||
jsr @perform_ram_test
|
||||
bne @done_attic
|
||||
dec RAM_ATTIC ; test passed
|
||||
|
||||
@done_attic:
|
||||
|
||||
; Prepare address - CELLAR RAM, $0880:$0000
|
||||
|
||||
lda #$80
|
||||
sta PNTR+2
|
||||
|
||||
; Test for cellar RAM
|
||||
|
||||
jsr @perform_ram_test
|
||||
bne @done_cellar
|
||||
dec RAM_CELLAR ; test passed
|
||||
|
||||
@done_cellar:
|
||||
|
||||
; Restore temporary address area content
|
||||
|
||||
ldx #$00
|
||||
@3:
|
||||
pla
|
||||
sta PNTR, x
|
||||
inx
|
||||
cpx #$04
|
||||
bne @3
|
||||
|
||||
; End of initialization
|
||||
|
||||
rts
|
||||
|
||||
@perform_ram_test:
|
||||
|
||||
@error_not_found:
|
||||
; Try to change one byte in extended RAM
|
||||
|
||||
; XXX set information about file not found
|
||||
lda [PNTR], z
|
||||
tax
|
||||
eor #$FF
|
||||
sta [PNTR], z
|
||||
|
||||
; Make sure the cache does not contain the value any more
|
||||
|
||||
tay
|
||||
dez
|
||||
lda [PNTR], z
|
||||
inz
|
||||
tya
|
||||
|
||||
; Check if byte still contains the new value
|
||||
|
||||
cmp [PNTR], z
|
||||
php
|
||||
|
||||
; Restore byte content
|
||||
|
||||
txa
|
||||
sta [PNTR], z
|
||||
|
||||
; Return test result
|
||||
|
||||
plp
|
||||
rts
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
;
|
||||
; Preload RAM disk image from SD card
|
||||
;
|
||||
|
||||
|
||||
unit_rd_preload:
|
||||
|
||||
; XXX make sure attic RAM is present
|
||||
|
||||
rts ; XXX remove when code is fully implemented
|
||||
|
||||
; Set file name
|
||||
|
||||
ldy #>ramdisk_filename
|
||||
ldx #<ramdisk_filename
|
||||
lda #$2E ; dos_setname
|
||||
sta HTRAP00
|
||||
+nop
|
||||
bcc @error_not_found
|
||||
|
||||
; Try to find the file
|
||||
|
||||
lda #$34 ; dos_findfile
|
||||
sta HTRAP00
|
||||
+nop
|
||||
bcc @error_not_found ; branch if file not found
|
||||
|
||||
; XXX load the file
|
||||
|
||||
|
||||
|
||||
|
||||
; lda #$20 ; dos_closefile
|
||||
; sta HTRAP00
|
||||
; +nop
|
||||
|
||||
; End of initialization
|
||||
|
||||
rts
|
||||
|
||||
|
||||
@error_not_found:
|
||||
|
||||
; XXX set information about file not found
|
||||
|
||||
rts
|
||||
@@ -7,17 +7,18 @@
|
||||
|
||||
|
||||
!addr VDOS_INIT = $4020 + 0 * 2
|
||||
!addr VDOS_UNITCHK = $4020 + 1 * 2
|
||||
!addr VDOS_UNITSET = $4020 + 2 * 2
|
||||
!addr VDOS_UNITNUM = $4020 + 3 * 2
|
||||
!addr VDOS_ACPTR = $4020 + 4 * 2
|
||||
!addr VDOS_CIOUT = $4020 + 5 * 2
|
||||
!addr VDOS_LISTEN = $4020 + 6 * 2
|
||||
!addr VDOS_SECOND = $4020 + 7 * 2
|
||||
!addr VDOS_TALK = $4020 + 8 * 2
|
||||
!addr VDOS_TKSA = $4020 + 9 * 2
|
||||
!addr VDOS_UNTLK = $4020 + 10 * 2
|
||||
!addr VDOS_UNLSN = $4020 + 11 * 2
|
||||
!addr VDOS_PRELOAD = $4020 + 1 * 2
|
||||
!addr VDOS_UNITCHK = $4020 + 2 * 2
|
||||
!addr VDOS_UNITSET = $4020 + 3 * 2
|
||||
!addr VDOS_UNITNUM = $4020 + 4 * 2
|
||||
!addr VDOS_ACPTR = $4020 + 5 * 2
|
||||
!addr VDOS_CIOUT = $4020 + 6 * 2
|
||||
!addr VDOS_LISTEN = $4020 + 7 * 2
|
||||
!addr VDOS_SECOND = $4020 + 8 * 2
|
||||
!addr VDOS_TALK = $4020 + 9 * 2
|
||||
!addr VDOS_TKSA = $4020 + 10 * 2
|
||||
!addr VDOS_UNTLK = $4020 + 11 * 2
|
||||
!addr VDOS_UNLSN = $4020 + 12 * 2
|
||||
|
||||
|
||||
m65dos_init:
|
||||
@@ -28,6 +29,14 @@ m65dos_init:
|
||||
jsr (VDOS_INIT)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_preload:
|
||||
|
||||
; Preaload RAM disk content, only to be used during KERNAL initialization
|
||||
|
||||
jsr map_DOS_1
|
||||
jsr (VDOS_PRELOAD)
|
||||
bra m65dos_end_1
|
||||
|
||||
m65dos_unitchk: ; XXX expose to BASIC
|
||||
|
||||
; Checks is the unit number is supported by the internal DOS
|
||||
|
||||
@@ -64,6 +64,8 @@ hw_entry_reset:
|
||||
|
||||
jsr m65_reset_common ; RAMTAS, RESTOR, CINT
|
||||
|
||||
jsr m65dos_preload ; preload RAM disk content
|
||||
|
||||
clc
|
||||
jsr M65_MODESET ; on MEGA65 go to native mode by default
|
||||
|
||||
|
||||
Reference in new issue
Block a user