added protection against DOS memory damage
This commit is contained in:
1 parent
56b9571b62
commit
4f417d714e
3 files changed
+49
-3
No files matched your search
@@ -6,6 +6,9 @@
|
||||
// Page 0
|
||||
//
|
||||
|
||||
.label UNIT_SDCARD = $00
|
||||
.label UNIT_FLOPPY = $01
|
||||
.label UNIT_RAMDISK = $02
|
||||
.label MAGICSTR = $00 // magic string; if not matching, DOS considered non-functional
|
||||
|
||||
.label UNIT_SDCARD = $05
|
||||
.label UNIT_FLOPPY = $06
|
||||
.label UNIT_RAMDISK = $07
|
||||
|
||||
@@ -6,6 +6,24 @@
|
||||
|
||||
dos_CHKUNIT:
|
||||
|
||||
// Check for magic string
|
||||
|
||||
pha
|
||||
phx
|
||||
|
||||
ldx #$04
|
||||
!:
|
||||
lda MAGICSTR, x
|
||||
cmp dos_magicstr, x
|
||||
bne dos_CHKUNIT_mem_fail
|
||||
dex
|
||||
bpl !-
|
||||
|
||||
plx
|
||||
pla
|
||||
|
||||
// Check for unit
|
||||
|
||||
cmp UNIT_SDCARD
|
||||
beq dos_CHKUNIT_sdcard
|
||||
cmp UNIT_FLOPPY
|
||||
@@ -36,3 +54,10 @@ dos_CHKUNIT_ramdisk:
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
dos_CHKUNIT_mem_fail:
|
||||
|
||||
plx
|
||||
pla
|
||||
sec
|
||||
rts
|
||||
@@ -5,6 +5,20 @@
|
||||
|
||||
dos_INIT:
|
||||
|
||||
// Set the magic string 'CBDOS'
|
||||
|
||||
phx
|
||||
ldx #$04
|
||||
!:
|
||||
lda dos_magicstr, x
|
||||
sta MAGICSTR, x
|
||||
dex
|
||||
bpl !-
|
||||
|
||||
plx
|
||||
|
||||
// Set default device numbers
|
||||
|
||||
lda #CONFIG_UNIT_SDCARD
|
||||
sta UNIT_SDCARD
|
||||
lda #CONFIG_UNIT_FLOPPY
|
||||
@@ -15,3 +29,7 @@ dos_INIT:
|
||||
// XXX initialize drivers, etc.
|
||||
|
||||
rts
|
||||
|
||||
dos_magicstr: // 'CBDOS'
|
||||
|
||||
.byte $43, $42, $44, $4F, $53
|
||||
Reference in new issue
Block a user