mirror of
https://github.com/antoinevignau/source.git
synced 2025-04-16 23:37:24 +00:00
SD SD SD
This commit is contained in:
parent
262181d124
commit
bc5ec30f70
@ -37,18 +37,16 @@ exdram_address_set_addr_high = $e30004 ; 00/xx00
|
||||
exdram_address_set_addr_bank = $e30006 ; xx/0000
|
||||
exdram_address_access = $e30008 ; R/W auto-increment to end of main bank
|
||||
|
||||
SD_ADDRESS_SET_MSB = $e40000
|
||||
SD_ADDRESS_SET_MSB_1 = $e40002
|
||||
SD_ADDRESS_SET_MSB_2 = $e40004
|
||||
SD_ADDRESS_SET_MSB_3 = $e40006
|
||||
SD_ADDRESS_SET_MSB = $e40000
|
||||
SD_ADDRESS_SET_MSB_1 = $e40002
|
||||
SD_ADDRESS_SET_MSB_2 = $e40004
|
||||
SD_ADDRESS_SET_MSB_3 = $e40006
|
||||
SD_START_READ = $e40008 ; starts reading the sector (if it was idle)
|
||||
SD_ACCESS = $e4000a
|
||||
SD_READ = $e4000a
|
||||
SD_START_WRITE = $e4000c ; starts writing the sector (if it was idle)
|
||||
SD_IDLE = $e4000e
|
||||
SD_CARD_INSERTED = $e40012 ; 0: no card inserted, 1: card inserted
|
||||
|
||||
* STA_NOINIT = 1 ; Drive not initialized
|
||||
* STA_NODISK = 2 ; No medium in the drive
|
||||
STA_NOINIT = 1 ; Drive not initialized
|
||||
STA_NODISK = 2 ; No medium in the drive
|
||||
|
||||
TRUE = 1
|
||||
FALSE = 0
|
||||
@ -74,14 +72,29 @@ diskSwitchedBit = $0001
|
||||
diskInDriveBit = $0010
|
||||
diskModifyBit = $0100
|
||||
|
||||
devPROFILE10MB = $0002
|
||||
devRAMDISK = $000e ; device ID for RAM/ROM disks
|
||||
devHDD = $0013 ; device ID for HDD (generic)
|
||||
dftHDD = $0013 ; device ID for HDD (generic)
|
||||
|
||||
dchar = $08
|
||||
dblockcount = $0a
|
||||
ddeviceid = $34
|
||||
ddevnumber = $3e
|
||||
dchar = $08
|
||||
dblockcount = $0a
|
||||
ddeviceid = $34
|
||||
ddevnumber = $3e
|
||||
|
||||
*-----------------------------------
|
||||
* AS DRIVER EQUATES
|
||||
*-----------------------------------
|
||||
|
||||
maxIMAGES = 1 ; no more than N images
|
||||
blockSIZE = 512 ; ProDOS 8 block size
|
||||
maxBLOCKS = $ffffffff ; that is a huge number of blocks
|
||||
|
||||
* 0 0000 => 0 0000
|
||||
* B 1011 => B 1011 restartable + not speed dependent
|
||||
* A 1010 => E 1110 block device | write allowed | read allowed
|
||||
* 0 0000 => 8 1000 format allowed
|
||||
|
||||
dftCHAR = $0BA8 ; default characteristics 0BA8
|
||||
|
||||
dftVERSION = $1000 ; v1
|
||||
|
||||
*-----------------------------------
|
||||
* GS/OS DIRECT PAGE
|
||||
@ -104,3 +117,5 @@ cachePriority = $1A
|
||||
cachePointer = $1C
|
||||
dibPointer = $20
|
||||
|
||||
workSpace = $6a ; Thank you common.equ.src
|
||||
|
||||
|
571
applesqueezer/sdcard/ASSD.DRIVER OLD.S
Normal file
571
applesqueezer/sdcard/ASSD.DRIVER OLD.S
Normal file
@ -0,0 +1,571 @@
|
||||
*
|
||||
* AppleSqueezer - SD Driver
|
||||
*
|
||||
* (c) 2023, Niek Van Suchtelen
|
||||
* (c) 2023, Brutal Deluxe Software
|
||||
*
|
||||
|
||||
* v1.0 (202304) - AV
|
||||
* Reads a sector
|
||||
* Type must be $BB
|
||||
* Auxtype must be $0101
|
||||
*
|
||||
* v1.1 (202306) - AV
|
||||
* Writes a sector too!
|
||||
*
|
||||
* v1.2 (202307) - AV
|
||||
* Uses disk insertion status
|
||||
*
|
||||
* v1.3 (202307) - AV
|
||||
* Formatting options
|
||||
|
||||
mx %00
|
||||
rel
|
||||
typ $bb
|
||||
dsk ASSDDriver
|
||||
|
||||
use AS.EQUATES.S
|
||||
|
||||
use 4/Sch.Macs
|
||||
use 4/Util.Macs
|
||||
|
||||
*-----------------------------------
|
||||
* AS DRIVER EQUATES
|
||||
*-----------------------------------
|
||||
|
||||
maxIMAGES = 1 ; no more than N images
|
||||
blockSIZE = 512 ; ProDOS 8 block size
|
||||
maxBLOCKS = $ffffffff ; that is a huge number of blocks
|
||||
maxBLOCKP = 65536 ; 65536 blocks for ProDOS 8
|
||||
|
||||
* 0 0000
|
||||
* 3 0011 not speed dependent
|
||||
* E 1110 block device + write allowed + read allowed
|
||||
* C 1100 format allowed + removable media
|
||||
|
||||
dftCHAR = $8BEC ; default characteristics
|
||||
dftSLOT = $8000 ; not slot dependent
|
||||
dftUNIT = $0001 ; unit 1
|
||||
dftVERSION = $1000 ; v1
|
||||
|
||||
*-----------------------------------------------
|
||||
|
||||
*
|
||||
* Entry point
|
||||
*
|
||||
|
||||
RAMDisk da MyDIB-RAMDisk ; offset to 1st DIB
|
||||
dw maxIMAGES ; number of devices
|
||||
dw $0000 ; no configuration list
|
||||
|
||||
*
|
||||
* Dispatch routine
|
||||
*
|
||||
|
||||
entryPOINT phk ; Dispatch
|
||||
plb
|
||||
cmp #$0009
|
||||
bcc L0012
|
||||
lda #$0020
|
||||
bra L001D
|
||||
L0012 asl
|
||||
tax
|
||||
stz errCODE
|
||||
jsr (tblDISPATCH,x)
|
||||
lda errCODE
|
||||
L001D cmp #$0001
|
||||
rtl
|
||||
|
||||
tblDISPATCH da DStartup ; Driver_Startup
|
||||
da DOpen ; Driver_Open
|
||||
da DRead ; Driver_Read
|
||||
da DWrite ; Driver_Write
|
||||
da DClose ; Driver_Close
|
||||
da DStatus ; Driver_Status
|
||||
da DControl ; Driver_Control
|
||||
da DFlush ; Driver_Flush
|
||||
da DShutdown ; Driver_Shutdown
|
||||
|
||||
*
|
||||
* Driver_Startup
|
||||
*
|
||||
|
||||
DStartup
|
||||
ldal FL_IDLE
|
||||
and #$ff
|
||||
cmp #$01
|
||||
bne DShutdown ; no AS found
|
||||
|
||||
ldal FL_VERSION
|
||||
and #$ff
|
||||
cmp #minVERSION
|
||||
bcc DShutdown ; no minimum version
|
||||
|
||||
lda #1 ; we're on
|
||||
sta fgSTARTED
|
||||
|
||||
sep #$30
|
||||
ldx #0
|
||||
]lp lda proDEVNAME+3,x
|
||||
sta MyDevName+1,x
|
||||
inx
|
||||
cpx #10
|
||||
bcc ]lp
|
||||
stx MyDevName
|
||||
rep #$30
|
||||
|
||||
PushWord #0
|
||||
PushLong #myTASK
|
||||
_SchAddTask
|
||||
pla
|
||||
rts
|
||||
|
||||
*
|
||||
* Driver_Shutdown
|
||||
*
|
||||
|
||||
DShutdown stz fgSTARTED
|
||||
|
||||
*
|
||||
* Driver_Open
|
||||
* Driver_Close
|
||||
* Driver_Flush
|
||||
*
|
||||
|
||||
DOpen ; Driver_Open
|
||||
DClose ; Driver_Close
|
||||
DFlush ; Driver_Flush
|
||||
rts
|
||||
|
||||
*
|
||||
* Driver_Read
|
||||
*
|
||||
|
||||
DRead jsr doSETUP
|
||||
bcc dr1
|
||||
rts
|
||||
|
||||
*--- The AS magic is here
|
||||
|
||||
dr1 sep #$20
|
||||
ldal $c034
|
||||
inc
|
||||
stal $c034
|
||||
rep #$20
|
||||
|
||||
pei bufferPtr+1 ; save pointer
|
||||
|
||||
sep #$20
|
||||
lda blockNum+3
|
||||
stal SD_ADDRESS_SET_MSB
|
||||
lda blockNum+2
|
||||
stal SD_ADDRESS_SET_MSB_1
|
||||
lda blockNum+1
|
||||
stal SD_ADDRESS_SET_MSB_2
|
||||
lda blockNum
|
||||
stal SD_ADDRESS_SET_MSB_3
|
||||
|
||||
lda #1
|
||||
stal SD_START_READ
|
||||
|
||||
ldx nbPAGES ; number of 512-byte pages to copy
|
||||
dr2 ldy #0 ; read one block
|
||||
sep #$20
|
||||
]lp ldal SD_READ
|
||||
sta [bufferPtr],y
|
||||
iny
|
||||
cpy #blockSIZE
|
||||
bcc ]lp
|
||||
|
||||
rep #$20 ; move destination pointer
|
||||
lda bufferPtr+1
|
||||
clc
|
||||
adc #>blockSIZE ; rwBlockSize+1
|
||||
sta bufferPtr+1
|
||||
|
||||
dex ; next block
|
||||
bne dr2
|
||||
|
||||
pla ; restore pointer
|
||||
sta bufferPtr+1
|
||||
rts
|
||||
|
||||
*--- The AS magic ends here
|
||||
|
||||
*
|
||||
* Driver_Write
|
||||
*
|
||||
|
||||
DWrite jsr doSETUP
|
||||
bcc dw1
|
||||
rts
|
||||
|
||||
*--- The AS magic is here
|
||||
|
||||
dw1 pei bufferPtr+1 ; save pointer
|
||||
|
||||
sep #$20
|
||||
lda blockNum+3
|
||||
stal SD_ADDRESS_SET_MSB
|
||||
lda blockNum+2
|
||||
stal SD_ADDRESS_SET_MSB_1
|
||||
lda blockNum+1
|
||||
stal SD_ADDRESS_SET_MSB_2
|
||||
lda blockNum
|
||||
stal SD_ADDRESS_SET_MSB_3
|
||||
|
||||
lda #1
|
||||
stal SD_START_WRITE
|
||||
|
||||
ldx nbPAGES ; number of 512-byte pages to copy
|
||||
dw2 ldy #0 ; read one block
|
||||
sep #$20
|
||||
]lp lda [bufferPtr],y
|
||||
stal SD_READ
|
||||
iny
|
||||
cpy #blockSIZE
|
||||
bcc ]lp
|
||||
|
||||
rep #$20 ; move destination pointer
|
||||
lda bufferPtr+1
|
||||
clc
|
||||
adc #>blockSIZE ; rwBlockSize+1
|
||||
sta bufferPtr+1
|
||||
|
||||
dex ; next block
|
||||
bne dw2
|
||||
|
||||
pla ; restore pointer
|
||||
sta bufferPtr+1
|
||||
rts
|
||||
|
||||
*--- The AS magic ends here
|
||||
|
||||
*
|
||||
* Driver_Status
|
||||
*
|
||||
|
||||
DStatus lda statusCode
|
||||
cmp #4+1
|
||||
bcc DStatus1
|
||||
lda #$0021 ; drvrBadCode
|
||||
sta errCODE
|
||||
rts
|
||||
|
||||
DStatus1 asl
|
||||
tax
|
||||
stz transferCount
|
||||
stz transferCount+2
|
||||
jsr (tblSTATUS,x)
|
||||
rts
|
||||
|
||||
tblSTATUS da SGetStatus ; GetDeviceStatus
|
||||
da SGet ; GetConfigParameters
|
||||
da SGet ; GetWaitStatus
|
||||
da SGetFormatOptions ; GetFormatOptions
|
||||
da SNada ; GetPartitionMap
|
||||
|
||||
SNada rts
|
||||
|
||||
*----------- GetDeviceStatus
|
||||
|
||||
SGetStatus lda #2 ; GetDeviceStatus
|
||||
sta transferCount
|
||||
|
||||
lda requestCount ; check length of buffer
|
||||
cmp #6
|
||||
bcc SGS1
|
||||
lda #6
|
||||
sta transferCount
|
||||
|
||||
ldy #2 ; we can send the number of blocks
|
||||
lda #maxBLOCKS
|
||||
sta [statusListPtr],y
|
||||
iny
|
||||
iny
|
||||
lda #^maxBLOCKS
|
||||
sta [statusListPtr],y
|
||||
|
||||
SGS1 ldx #diskInDriveBit
|
||||
ldal SD_CARD_INSERTED ; check if a card is inserted
|
||||
and #$ff
|
||||
cmp #1
|
||||
beq SGS2 ; yes, a SD card is inserted
|
||||
inx
|
||||
SGS2 txa
|
||||
ora #uncertainBlockCountBit ; we are uncertain of the block count
|
||||
sta [statusListPtr]
|
||||
rts
|
||||
|
||||
*----------- GetConfigParameters / GetWaitStatus
|
||||
|
||||
SGet lda #0 ; GetConfigParameters
|
||||
sta [statusListPtr] ; GetWaitStatus
|
||||
lda #2
|
||||
sta transferCount
|
||||
rts
|
||||
|
||||
*----------- GetFormatOptions
|
||||
|
||||
SGetFormatOptions
|
||||
lda requestCount ; check size of buffer
|
||||
cmp #formatOptionsTableEnd-formatOptionsTable
|
||||
bcc SGetFormat1
|
||||
|
||||
ldy #0 ; and move data
|
||||
]lp lda formatOptionsTable,y
|
||||
sta [statusListPtr],y
|
||||
iny
|
||||
iny
|
||||
cpy #formatOptionsTableEnd-formatOptionsTable
|
||||
bcc ]lp
|
||||
sty transferCount ; save size
|
||||
|
||||
SGetFormat1 rts
|
||||
|
||||
*
|
||||
* Driver_Control
|
||||
*
|
||||
|
||||
DControl jsr checkSWITCHED
|
||||
bcc DControl1
|
||||
rts
|
||||
|
||||
DControl1 lda controlCode
|
||||
cmp #9+1
|
||||
bcc DControl2
|
||||
|
||||
lda #$0021
|
||||
sta errCODE
|
||||
rts
|
||||
|
||||
DControl2 asl
|
||||
tax
|
||||
stz transferCount
|
||||
stz transferCount+2
|
||||
jsr (tblCONTROL,x)
|
||||
rts
|
||||
|
||||
tblCONTROL da CNada ; 0 ResetDevice
|
||||
da CFormatDevice ; 1 FormatDevice
|
||||
da CNada ; 2 EjectMedium
|
||||
da CSet ; 3 SetConfigParameters
|
||||
da CSet ; 4 SetWaitStatus
|
||||
da CSetFormatOptions ; 5 SetFormatOptions
|
||||
da CNada ; 6 AssignPartitionOwner
|
||||
da CNada ; 7 ArmSignal
|
||||
da CNada ; 8 DisarmSignal
|
||||
da CNada ; 9 SetPartitionMap
|
||||
|
||||
CNada rts
|
||||
|
||||
*----------- FormatDevice
|
||||
|
||||
CFormatDevice
|
||||
lda fgFORMAT ; if 1, the Format call
|
||||
bne CFormat1 ; was already called
|
||||
rts
|
||||
|
||||
CFormat1 rts
|
||||
|
||||
*----------- SetFormatOptions
|
||||
|
||||
CSetFormatOptions
|
||||
lda [controlListPtr]
|
||||
beq CSFO9 ; empty option is not ours
|
||||
cmp #3 ; 1-2 only
|
||||
bcs CSFO9
|
||||
|
||||
cmp #1
|
||||
bne CSFOHFS
|
||||
|
||||
ldx #^maxBLOCKS ; it is 1, default values for HFS
|
||||
ldy #maxBLOCKS
|
||||
bra CSFOAll
|
||||
|
||||
CSFOHFS ldx #^maxBLOCKP ; it is 2, default values for ProDOS
|
||||
ldy #maxBLOCKP
|
||||
|
||||
CSFOAll sty fBlockCount
|
||||
stx fBlockCount+2
|
||||
|
||||
CSFO9 rts
|
||||
|
||||
*----------- SetConfigParameters / SetWaitStatus
|
||||
|
||||
CSet lda [controlListPtr] ; SetConfigParameters
|
||||
bne CSetERR ; SetWaitStatus
|
||||
rts
|
||||
CSetERR lda #$0022
|
||||
sta errCODE
|
||||
rts
|
||||
|
||||
*----------------------------
|
||||
|
||||
* Status flag of the current device
|
||||
* $0001: image has been switched (disk switched)
|
||||
* $0010: image is active (disk in drive)
|
||||
* $0100: image has been modified
|
||||
|
||||
*
|
||||
* Checks everything is OK
|
||||
*
|
||||
|
||||
doSETUP jsr checkSWITCHED
|
||||
bcc ds2
|
||||
rts
|
||||
|
||||
ds2 lda requestCount ; nb of bytes to read
|
||||
ora requestCount+2
|
||||
bne ds4
|
||||
|
||||
lda #$002C ; invalidByteCount
|
||||
sta errCODE
|
||||
sec
|
||||
rts
|
||||
|
||||
* $0102_0400 =
|
||||
|
||||
*--- requestcount : $0200 => 1
|
||||
*--- From a Block to a RAM address
|
||||
|
||||
ds4 lda requestCount+3 ; number of pages
|
||||
and #$00ff ; to calculate
|
||||
lsr
|
||||
lda requestCount+1 ; $01020400 => $010204 => $8102
|
||||
ror
|
||||
sta nbPAGES ; to calculate
|
||||
|
||||
lda requestCount ; multiple of $0200
|
||||
and #blockSIZE-1
|
||||
beq ds6
|
||||
|
||||
lda #$002D ; bad block count
|
||||
sta errCODE
|
||||
sec
|
||||
rts
|
||||
|
||||
*--- Generic transfer now
|
||||
|
||||
ds6 lda requestCount ; assume transfer=request
|
||||
sta transferCount
|
||||
lda requestCount+2
|
||||
sta transferCount+2
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
*----------------------------
|
||||
|
||||
checkSWITCHED
|
||||
ldal SD_CARD_INSERTED
|
||||
and #$ff
|
||||
cmp #1
|
||||
beq cs1
|
||||
|
||||
jsl SET_DISKSW
|
||||
|
||||
* lda #1
|
||||
* sta fgSTARTED
|
||||
lda #$002e
|
||||
sta errCODE
|
||||
sec
|
||||
rts
|
||||
|
||||
cs1 clc
|
||||
rts
|
||||
|
||||
*---------------------------- Check RAMDISK was init'ed
|
||||
|
||||
myTASK PushLong #proVOLUME
|
||||
PushWord #$2008
|
||||
jsl GSOS2
|
||||
bcc myTASK1
|
||||
|
||||
PushLong #proFORMAT
|
||||
PushWord #$2024
|
||||
jsl GSOS2
|
||||
|
||||
lda #1 ; tell the driver we've been there
|
||||
stal fgFORMAT ; a format will now be a real format
|
||||
|
||||
lda #$4000 ; no more silent formatting
|
||||
stal proFORMAT+14
|
||||
|
||||
myTASK1 rtl
|
||||
|
||||
*---------------------------- GS/OS
|
||||
|
||||
proVOLUME dw 2
|
||||
adrl proDEVNAME
|
||||
adrl outVOLNAME
|
||||
|
||||
proFORMAT dw 5 ; +00
|
||||
adrl proDEVNAME ; +02
|
||||
adrl proVOLNAME ; +06
|
||||
dw 6 ; +10
|
||||
dw 6 ; +12 - Default is ProDOS
|
||||
dw $2000 ; +14 - Cant rename, can change selection, silent formatting
|
||||
|
||||
proDEVNAME strl '.ASSDDevice'
|
||||
proVOLNAME strl ':AppleSSD'
|
||||
|
||||
outVOLNAME dw 36 ; (word) output buffer
|
||||
ds 34 ; (word) strl + (array) string
|
||||
|
||||
*----------------------------
|
||||
|
||||
|
||||
formatOptionsTable
|
||||
|
||||
* 8 bytes
|
||||
dw 2 ; numOptions
|
||||
dw 2 ; numDisplayed
|
||||
dw 1 ; recommendedOption
|
||||
dw 1 ; currentOption
|
||||
|
||||
* 16 bytes
|
||||
dw 1 ; formatOptionNum
|
||||
dw 2 ; linkRefNum
|
||||
dw %0000_1101 ; flags 1101 - GB size - Apple format
|
||||
adrl maxBLOCKS ; blockCount is the max for HFS
|
||||
dw blockSIZE ; blockSize is 512 bytes
|
||||
dw 0 ; interleaveFactor
|
||||
dw 32 ; mediaSize 11 - GB size
|
||||
|
||||
* 16 bytes
|
||||
dw 2 ; formatOptionNum
|
||||
dw 0 ; linkRefNum
|
||||
dw %0000_1001 ; flags 1001 - MB size - Apple format
|
||||
adrl maxBLOCKP ; blockCount is 65536 for ProDOS 8
|
||||
dw blockSIZE ; blockSize is 512 bytes for ProDOS 8
|
||||
dw 0 ; interleaveFactor
|
||||
dw 32 ; mediaSize 10 - MB size
|
||||
|
||||
formatOptionsTableEnd
|
||||
|
||||
*--- Default formatting options
|
||||
|
||||
fBlockCount adrl maxBLOCKS ; 65536
|
||||
|
||||
*----------------------------
|
||||
|
||||
fgSTARTED ds 2 ; 0: not started, 1: started
|
||||
fgFORMAT ds 2 ; 0: GS/OS Format never called, 1 instead
|
||||
errCODE ds 2
|
||||
thePAGE ds 4 ; page to read/write: $hh/ll00
|
||||
nbPAGES ds 2 ; number of blockSIZEP pages to copy
|
||||
|
||||
MyDIB ds 4 ; +00 pointer to the next DIB
|
||||
adrl entryPOINT ; +04 driver entry point
|
||||
dw dftCHAR ; +08 characteristics
|
||||
adrl maxBLOCKS ; +0A block count
|
||||
MyDevName ds 32 ; +0E device name
|
||||
dw dftSLOT ; +2E slot number
|
||||
dw dftUNIT ; +30 unit number
|
||||
dw dftVERSION ; +32 version
|
||||
dw devRAMDISK ; +34 device ID - LOGO
|
||||
dw $0000 ; +36 first linked device
|
||||
dw $0000 ; +38 next linked device
|
||||
adrl $00000000 ; +3A extended DIB ptr
|
||||
dw $0000 ; +3E device number
|
@ -13,11 +13,6 @@
|
||||
* v1.1 (202306) - AV
|
||||
* Writes a sector too!
|
||||
*
|
||||
* v1.2 (202307) - AV
|
||||
* Uses disk insertion status
|
||||
*
|
||||
* v1.3 (202307) - AV
|
||||
* Formatting options
|
||||
|
||||
mx %00
|
||||
rel
|
||||
@ -25,29 +20,9 @@
|
||||
dsk ASSDDriver
|
||||
|
||||
use AS.EQUATES.S
|
||||
|
||||
use 4/Sch.Macs
|
||||
|
||||
use 4/Util.Macs
|
||||
|
||||
*-----------------------------------
|
||||
* AS DRIVER EQUATES
|
||||
*-----------------------------------
|
||||
|
||||
maxIMAGES = 1 ; no more than N images
|
||||
blockSIZE = 512 ; ProDOS 8 block size
|
||||
maxBLOCKS = $ffffffff ; that is a huge number of blocks
|
||||
maxBLOCKP = 65536 ; 65536 blocks for ProDOS 8
|
||||
|
||||
* 0 0000
|
||||
* 3 0011 not speed dependent
|
||||
* E 1110 block device + write allowed + read allowed
|
||||
* C 1100 format allowed + removable media
|
||||
|
||||
dftCHAR = $8BEC ; default characteristics
|
||||
dftSLOT = $8000 ; not slot dependent
|
||||
dftUNIT = $0001 ; unit 1
|
||||
dftVERSION = $1000 ; v1
|
||||
|
||||
*-----------------------------------------------
|
||||
|
||||
*
|
||||
@ -103,21 +78,6 @@ DStartup
|
||||
|
||||
lda #1 ; we're on
|
||||
sta fgSTARTED
|
||||
|
||||
sep #$30
|
||||
ldx #0
|
||||
]lp lda proDEVNAME+3,x
|
||||
sta MyDevName+1,x
|
||||
inx
|
||||
cpx #10
|
||||
bcc ]lp
|
||||
stx MyDevName
|
||||
rep #$30
|
||||
|
||||
PushWord #0
|
||||
PushLong #myTASK
|
||||
_SchAddTask
|
||||
pla
|
||||
rts
|
||||
|
||||
*
|
||||
@ -143,51 +103,102 @@ DFlush ; Driver_Flush
|
||||
|
||||
DRead jsr doSETUP
|
||||
bcc dr1
|
||||
|
||||
brk $bd
|
||||
rts
|
||||
|
||||
*--- The AS magic is here
|
||||
|
||||
dr1 sep #$20
|
||||
ldal $c034
|
||||
inc
|
||||
stal $c034
|
||||
rep #$20
|
||||
dr1 pei workSpace+2
|
||||
pei workSpace
|
||||
* pei bufferPtr+1 ; save pointer
|
||||
|
||||
pei bufferPtr+1 ; save pointer
|
||||
* sep #$20
|
||||
* lda blockNum+3
|
||||
* stal SD_ADDRESS_SET_MSB
|
||||
* lda blockNum+2
|
||||
* stal SD_ADDRESS_SET_MSB_1
|
||||
* lda blockNum+1
|
||||
* stal SD_ADDRESS_SET_MSB_2
|
||||
* lda blockNum
|
||||
* stal SD_ADDRESS_SET_MSB_3
|
||||
|
||||
lda #^SD_ADDRESS_SET_MSB ; #$00e4
|
||||
sta workSpace+2
|
||||
|
||||
lda #SD_ADDRESS_SET_MSB ; $00
|
||||
sta workSpace
|
||||
sep #$20
|
||||
lda blockNum+3
|
||||
stal SD_ADDRESS_SET_MSB
|
||||
lda blockNum+2
|
||||
stal SD_ADDRESS_SET_MSB_1
|
||||
lda blockNum+1
|
||||
stal SD_ADDRESS_SET_MSB_2
|
||||
lda blockNum
|
||||
stal SD_ADDRESS_SET_MSB_3
|
||||
sta [workSpace]
|
||||
rep #$20
|
||||
|
||||
lda #1
|
||||
stal SD_START_READ
|
||||
|
||||
ldx nbPAGES ; number of 512-byte pages to copy
|
||||
dr2 ldy #0 ; read one block
|
||||
lda #SD_ADDRESS_SET_MSB_1 ; $02
|
||||
sta workSpace
|
||||
sep #$20
|
||||
]lp ldal SD_ACCESS
|
||||
lda blockNum+2
|
||||
sta [workSpace]
|
||||
rep #$20
|
||||
|
||||
lda #SD_ADDRESS_SET_MSB_2 ; $04
|
||||
sta workSpace
|
||||
sep #$20
|
||||
lda blockNum+1
|
||||
sta [workSpace]
|
||||
rep #$20
|
||||
|
||||
lda #SD_ADDRESS_SET_MSB_3 ; $06
|
||||
sta workSpace
|
||||
sep #$20
|
||||
lda blockNum
|
||||
sta [workSpace]
|
||||
rep #$20
|
||||
|
||||
* lda #1
|
||||
* stal SD_START_READ
|
||||
|
||||
lda #SD_START_READ ; $08
|
||||
sta workSpace
|
||||
sep #$20
|
||||
lda #1
|
||||
sta [workSpace]
|
||||
rep #$20
|
||||
|
||||
lda #SD_READ ; $0a
|
||||
sta workSpace
|
||||
sep #$20
|
||||
ldy #0
|
||||
]lp lda [workSpace]
|
||||
sta [bufferPtr],y
|
||||
iny
|
||||
cpy #blockSIZE
|
||||
bcc ]lp
|
||||
|
||||
rep #$20 ; move destination pointer
|
||||
lda bufferPtr+1
|
||||
clc
|
||||
adc #>blockSIZE ; rwBlockSize+1
|
||||
sta bufferPtr+1
|
||||
|
||||
dex ; next block
|
||||
bne dr2
|
||||
cpy #512
|
||||
bne ]lp
|
||||
rep #$20
|
||||
|
||||
pla ; restore pointer
|
||||
sta bufferPtr+1
|
||||
* ldx nbPAGES ; number of 512-byte pages to copy
|
||||
*dr2 ldy #0 ; read one block
|
||||
* sep #$20
|
||||
*]lp ldal SD_READ
|
||||
* sta [bufferPtr],y
|
||||
* iny
|
||||
* cpy #blockSIZE
|
||||
* bcc ]lp
|
||||
*
|
||||
* rep #$20 ; move destination pointer
|
||||
* lda bufferPtr+1
|
||||
* clc
|
||||
* adc #>blockSIZE ; rwBlockSize+1
|
||||
* sta bufferPtr+1
|
||||
*
|
||||
* dex ; next block
|
||||
* bne dr2
|
||||
|
||||
* pla ; restore pointer
|
||||
* sta bufferPtr+1
|
||||
pla
|
||||
sta workSpace
|
||||
pla
|
||||
sta workSpace+2
|
||||
rts
|
||||
|
||||
*--- The AS magic ends here
|
||||
@ -221,7 +232,7 @@ dw1 pei bufferPtr+1 ; save pointer
|
||||
dw2 ldy #0 ; read one block
|
||||
sep #$20
|
||||
]lp lda [bufferPtr],y
|
||||
stal SD_ACCESS
|
||||
stal SD_READ
|
||||
iny
|
||||
cpy #blockSIZE
|
||||
bcc ]lp
|
||||
@ -262,7 +273,7 @@ DStatus1 asl
|
||||
tblSTATUS da SGetStatus ; GetDeviceStatus
|
||||
da SGet ; GetConfigParameters
|
||||
da SGet ; GetWaitStatus
|
||||
da SGetFormatOptions ; GetFormatOptions
|
||||
da SGet ; GetFormatOptions
|
||||
da SNada ; GetPartitionMap
|
||||
|
||||
SNada rts
|
||||
@ -287,10 +298,8 @@ SGetStatus lda #2 ; GetDeviceStatus
|
||||
sta [statusListPtr],y
|
||||
|
||||
SGS1 ldx #diskInDriveBit
|
||||
ldal SD_CARD_INSERTED ; check if a card is inserted
|
||||
and #$ff
|
||||
cmp #1
|
||||
beq SGS2 ; yes, a SD card is inserted
|
||||
lda fgSTARTED ; send the status of the driver
|
||||
bne SGS2
|
||||
inx
|
||||
SGS2 txa
|
||||
ora #uncertainBlockCountBit ; we are uncertain of the block count
|
||||
@ -305,24 +314,6 @@ SGet lda #0 ; GetConfigParameters
|
||||
sta transferCount
|
||||
rts
|
||||
|
||||
*----------- GetFormatOptions
|
||||
|
||||
SGetFormatOptions
|
||||
lda requestCount ; check size of buffer
|
||||
cmp #formatOptionsTableEnd-formatOptionsTable
|
||||
bcc SGetFormat1
|
||||
|
||||
ldy #0 ; and move data
|
||||
]lp lda formatOptionsTable,y
|
||||
sta [statusListPtr],y
|
||||
iny
|
||||
iny
|
||||
cpy #formatOptionsTableEnd-formatOptionsTable
|
||||
bcc ]lp
|
||||
sty transferCount ; save size
|
||||
|
||||
SGetFormat1 rts
|
||||
|
||||
*
|
||||
* Driver_Control
|
||||
*
|
||||
@ -347,11 +338,11 @@ DControl2 asl
|
||||
rts
|
||||
|
||||
tblCONTROL da CNada ; 0 ResetDevice
|
||||
da CFormatDevice ; 1 FormatDevice
|
||||
da CNada ; 1 FormatDevice
|
||||
da CNada ; 2 EjectMedium
|
||||
da CSet ; 3 SetConfigParameters
|
||||
da CSet ; 4 SetWaitStatus
|
||||
da CSetFormatOptions ; 5 SetFormatOptions
|
||||
da CSet ; 5 SetFormatOptions
|
||||
da CNada ; 6 AssignPartitionOwner
|
||||
da CNada ; 7 ArmSignal
|
||||
da CNada ; 8 DisarmSignal
|
||||
@ -359,38 +350,6 @@ tblCONTROL da CNada ; 0 ResetDevice
|
||||
|
||||
CNada rts
|
||||
|
||||
*----------- FormatDevice
|
||||
|
||||
CFormatDevice
|
||||
lda fgFORMAT ; if 1, the Format call
|
||||
bne CFormat1 ; was already called
|
||||
rts
|
||||
|
||||
CFormat1 rts
|
||||
|
||||
*----------- SetFormatOptions
|
||||
|
||||
CSetFormatOptions
|
||||
lda [controlListPtr]
|
||||
beq CSFO9 ; empty option is not ours
|
||||
cmp #3 ; 1-2 only
|
||||
bcs CSFO9
|
||||
|
||||
cmp #1
|
||||
bne CSFOHFS
|
||||
|
||||
ldx #^maxBLOCKS ; it is 1, default values for HFS
|
||||
ldy #maxBLOCKS
|
||||
bra CSFOAll
|
||||
|
||||
CSFOHFS ldx #^maxBLOCKP ; it is 2, default values for ProDOS
|
||||
ldy #maxBLOCKP
|
||||
|
||||
CSFOAll sty fBlockCount
|
||||
stx fBlockCount+2
|
||||
|
||||
CSFO9 rts
|
||||
|
||||
*----------- SetConfigParameters / SetWaitStatus
|
||||
|
||||
CSet lda [controlListPtr] ; SetConfigParameters
|
||||
@ -458,15 +417,13 @@ ds6 lda requestCount ; assume transfer=request
|
||||
*----------------------------
|
||||
|
||||
checkSWITCHED
|
||||
ldal SD_CARD_INSERTED
|
||||
and #$ff
|
||||
cmp #1
|
||||
beq cs1
|
||||
lda fgSTARTED
|
||||
bne cs1
|
||||
|
||||
jsl SET_DISKSW
|
||||
|
||||
* lda #1
|
||||
* sta fgSTARTED
|
||||
lda #1
|
||||
sta fgSTARTED
|
||||
lda #$002e
|
||||
sta errCODE
|
||||
sec
|
||||
@ -475,83 +432,9 @@ checkSWITCHED
|
||||
cs1 clc
|
||||
rts
|
||||
|
||||
*---------------------------- Check RAMDISK was init'ed
|
||||
|
||||
myTASK PushLong #proVOLUME
|
||||
PushWord #$2008
|
||||
jsl GSOS2
|
||||
bcc myTASK1
|
||||
|
||||
PushLong #proFORMAT
|
||||
PushWord #$2024
|
||||
jsl GSOS2
|
||||
|
||||
lda #1 ; tell the driver we've been there
|
||||
stal fgFORMAT ; a format will now be a real format
|
||||
|
||||
lda #$4000 ; no more silent formatting
|
||||
stal proFORMAT+14
|
||||
|
||||
myTASK1 rtl
|
||||
|
||||
*---------------------------- GS/OS
|
||||
|
||||
proVOLUME dw 2
|
||||
adrl proDEVNAME
|
||||
adrl outVOLNAME
|
||||
|
||||
proFORMAT dw 5 ; +00
|
||||
adrl proDEVNAME ; +02
|
||||
adrl proVOLNAME ; +06
|
||||
dw 6 ; +10
|
||||
dw 6 ; +12 - Default is ProDOS
|
||||
dw $2000 ; +14 - Cant rename, can change selection, silent formatting
|
||||
|
||||
proDEVNAME strl '.ASSDDevice'
|
||||
proVOLNAME strl ':AppleSSD'
|
||||
|
||||
outVOLNAME dw 36 ; (word) output buffer
|
||||
ds 34 ; (word) strl + (array) string
|
||||
|
||||
*----------------------------
|
||||
|
||||
|
||||
formatOptionsTable
|
||||
|
||||
* 8 bytes
|
||||
dw 2 ; numOptions
|
||||
dw 2 ; numDisplayed
|
||||
dw 1 ; recommendedOption
|
||||
dw 1 ; currentOption
|
||||
|
||||
* 16 bytes
|
||||
dw 1 ; formatOptionNum
|
||||
dw 2 ; linkRefNum
|
||||
dw %0000_1101 ; flags 1101 - GB size - Apple format
|
||||
adrl maxBLOCKS ; blockCount is the max for HFS
|
||||
dw blockSIZE ; blockSize is 512 bytes
|
||||
dw 0 ; interleaveFactor
|
||||
dw 32 ; mediaSize 11 - GB size
|
||||
|
||||
* 16 bytes
|
||||
dw 2 ; formatOptionNum
|
||||
dw 0 ; linkRefNum
|
||||
dw %0000_1001 ; flags 1001 - MB size - Apple format
|
||||
adrl maxBLOCKP ; blockCount is 65536 for ProDOS 8
|
||||
dw blockSIZE ; blockSize is 512 bytes for ProDOS 8
|
||||
dw 0 ; interleaveFactor
|
||||
dw 32 ; mediaSize 10 - MB size
|
||||
|
||||
formatOptionsTableEnd
|
||||
|
||||
*--- Default formatting options
|
||||
|
||||
fBlockCount adrl maxBLOCKS ; 65536
|
||||
|
||||
*----------------------------
|
||||
|
||||
fgSTARTED ds 2 ; 0: not started, 1: started
|
||||
fgFORMAT ds 2 ; 0: GS/OS Format never called, 1 instead
|
||||
errCODE ds 2
|
||||
thePAGE ds 4 ; page to read/write: $hh/ll00
|
||||
nbPAGES ds 2 ; number of blockSIZEP pages to copy
|
||||
@ -559,12 +442,13 @@ nbPAGES ds 2 ; number of blockSIZEP pages to copy
|
||||
MyDIB ds 4 ; +00 pointer to the next DIB
|
||||
adrl entryPOINT ; +04 driver entry point
|
||||
dw dftCHAR ; +08 characteristics
|
||||
adrl maxBLOCKS ; +0A block count
|
||||
MyDevName ds 32 ; +0E device name
|
||||
dw dftSLOT ; +2E slot number
|
||||
dw dftUNIT ; +30 unit number
|
||||
ds 4 ; +0A block count
|
||||
str 'ASSDDevice' ; +0E device name
|
||||
ds 21 ; 32 - 12 = 20
|
||||
dw $0000 ; +2E slot number
|
||||
dw $0000 ; +30 unit number
|
||||
dw dftVERSION ; +32 version
|
||||
dw devRAMDISK ; +34 device ID - LOGO
|
||||
dw dftHDD ; +34 device ID
|
||||
dw $0000 ; +36 first linked device
|
||||
dw $0000 ; +38 next linked device
|
||||
adrl $00000000 ; +3A extended DIB ptr
|
||||
|
Binary file not shown.
BIN
applesqueezer/sdcard/ASSDDriver#BB0101
Normal file
BIN
applesqueezer/sdcard/ASSDDriver#BB0101
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
devices=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
|
||||
ASSDDriver=Type(BB),AuxType(0101),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
|
||||
debug=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
|
||||
assd=Type(B3),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
|
||||
ASSDDriver=Type(00),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
|
||||
debug=Type(00),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)
|
||||
|
Binary file not shown.
Binary file not shown.
499
applesqueezer/sdcard/debug old.s
Normal file
499
applesqueezer/sdcard/debug old.s
Normal file
@ -0,0 +1,499 @@
|
||||
*
|
||||
* Debug
|
||||
* Play with the SD card
|
||||
*
|
||||
* (c) 2023, Brutal Deluxe Software
|
||||
* Visit brutaldeluxe.fr
|
||||
*
|
||||
|
||||
xc
|
||||
xc
|
||||
mx %00
|
||||
|
||||
rel
|
||||
dsk debug.l
|
||||
lst off
|
||||
|
||||
*----------
|
||||
|
||||
use 4/Int.Macs
|
||||
use 4/Locator.Macs
|
||||
use 4/Mem.Macs
|
||||
use 4/Misc.Macs
|
||||
use 4/Text.Macs
|
||||
use 4/Util.Macs
|
||||
|
||||
Debut = $00
|
||||
GSOS = $e100a8
|
||||
|
||||
*----------
|
||||
|
||||
dcREMOVE = $0004
|
||||
dcONLINE = $0010
|
||||
dcBLOCKDEVICE = $0080
|
||||
|
||||
maxDEVICES = 128
|
||||
|
||||
*----------
|
||||
|
||||
phk
|
||||
plb
|
||||
|
||||
tdc
|
||||
sta myDP
|
||||
|
||||
_TLStartUp
|
||||
pha
|
||||
_MMStartUp
|
||||
pla
|
||||
sta appID
|
||||
ora #$0100
|
||||
sta myID
|
||||
|
||||
_MTStartUp
|
||||
_TextStartUp
|
||||
|
||||
_IMStartUp
|
||||
|
||||
pha
|
||||
pha
|
||||
PushLong #$010000
|
||||
PushWord myID
|
||||
PushWord #%11000000_00011100
|
||||
PushLong #0
|
||||
_NewHandle
|
||||
phd
|
||||
tsc
|
||||
tcd
|
||||
lda [3]
|
||||
sta ptrBUFFER
|
||||
ldy #2
|
||||
lda [3],y
|
||||
sta ptrBUFFER+2
|
||||
pld
|
||||
ply
|
||||
sty haBUFFER
|
||||
plx
|
||||
stx haBUFFER+2
|
||||
|
||||
*----------
|
||||
|
||||
PushWord #$00FF
|
||||
PushWord #$0080
|
||||
_SetInGlobals
|
||||
PushWord #$00FF
|
||||
PushWord #$0080
|
||||
_SetOutGlobals
|
||||
PushWord #$00FF
|
||||
PushWord #$0080
|
||||
_SetErrGlobals
|
||||
|
||||
PushWord #0
|
||||
PushLong #3
|
||||
_SetInputDevice
|
||||
PushWord #0
|
||||
PushLong #3
|
||||
_SetOutputDevice
|
||||
PushWord #0
|
||||
PushLong #3
|
||||
_SetErrorDevice
|
||||
|
||||
PushWord #0
|
||||
_InitTextDev
|
||||
PushWord #1
|
||||
_InitTextDev
|
||||
PushWord #2
|
||||
_InitTextDev
|
||||
|
||||
PushWord #$0c ; home
|
||||
_WriteChar
|
||||
|
||||
*----------------------------
|
||||
* MAIN MENU
|
||||
*----------------------------
|
||||
|
||||
mainMENU PushLong #strMAINMENU
|
||||
_WriteCString
|
||||
|
||||
jsr pollDEVICES ; show CD-ROM devices
|
||||
jsr waitFORKEY ; is it 0-9
|
||||
jmp doQUIT
|
||||
|
||||
*--- Data
|
||||
|
||||
strMAINMENU asc 0d'Debug ASSD'0d
|
||||
asc '(c) 2023, Brutal Deluxe Software'0d0d00
|
||||
|
||||
*----------------------------
|
||||
* QUIT PROGRAM
|
||||
*----------------------------
|
||||
|
||||
doQUIT _IMShutDown
|
||||
_TextShutDown
|
||||
_MTShutDown
|
||||
|
||||
PushWord myID
|
||||
_DisposeAll
|
||||
|
||||
PushWord appID
|
||||
_MMShutDown
|
||||
|
||||
_TLShutDown
|
||||
|
||||
jsl GSOS
|
||||
dw $2029
|
||||
adrl proQUIT
|
||||
|
||||
brk $bd
|
||||
|
||||
*----------------------------
|
||||
* POLL DEVICES
|
||||
*----------------------------
|
||||
|
||||
pollDEVICES lda #1 ; start with device 1
|
||||
sta proDINFO+2
|
||||
|
||||
]lp jsl GSOS ; do a DInfo
|
||||
dw $202c
|
||||
adrl proDINFO
|
||||
bcc found
|
||||
|
||||
cmp #$0011 ; no more devices
|
||||
bne loop
|
||||
rts
|
||||
|
||||
loop inc proDINFO+2
|
||||
bra ]lp
|
||||
|
||||
*---------- Show device
|
||||
|
||||
found lda proDINFO+8 ; block device?
|
||||
and #dcBLOCKDEVICE
|
||||
beq loop
|
||||
|
||||
lda devINFO1 ; from a STRL to a STR
|
||||
xba
|
||||
sta devINFO1
|
||||
|
||||
ldx #10 ; compare name
|
||||
]lp lda devINFO2,x
|
||||
cmp strDEVICE,x
|
||||
bne loop
|
||||
dex
|
||||
dex
|
||||
bpl ]lp
|
||||
|
||||
*--- Show device ID
|
||||
|
||||
lda proDINFO+2
|
||||
sta proDREAD+2
|
||||
sta proDWRITE+2
|
||||
sta proDSTATUS+2
|
||||
jsr showHEX
|
||||
|
||||
PushWord #$20
|
||||
_WriteChar
|
||||
|
||||
*--- Show Characteristics
|
||||
|
||||
lda proDINFO+8
|
||||
jsr showHEX
|
||||
|
||||
PushWord #$20
|
||||
_WriteChar
|
||||
|
||||
*--- Show Name
|
||||
|
||||
PushLong #devINFO2
|
||||
_WriteString
|
||||
|
||||
*--- Perform a DStatus
|
||||
|
||||
PushLong #strDSTATUS ; show the string
|
||||
_WriteCString
|
||||
|
||||
jsl GSOS
|
||||
dw $202d
|
||||
adrl proDSTATUS
|
||||
jsr showERRCODE
|
||||
|
||||
*--- Show device status characteristics
|
||||
|
||||
PushLong #strCHARS ; show device characteristics
|
||||
_WriteCString
|
||||
|
||||
lda myLIST
|
||||
jsr showHEX
|
||||
|
||||
*--- Show device status number of blocks
|
||||
|
||||
PushLong #strBLOCKS ; show number of blocks
|
||||
_WriteCString
|
||||
|
||||
lda myLIST+4
|
||||
jsr showHEX
|
||||
lda myLIST+2
|
||||
jsr showWORD
|
||||
|
||||
*--- Perform a DRead
|
||||
|
||||
doREAD PushLong #strDREAD ; show the string
|
||||
_WriteCString
|
||||
|
||||
* jsr debugBORDER
|
||||
|
||||
jsl GSOS
|
||||
dw $202f
|
||||
adrl proDREAD
|
||||
pha
|
||||
lda proDREAD+14
|
||||
jsr showWORD
|
||||
lda proDREAD+12
|
||||
jsr showWORD
|
||||
|
||||
PushWord #' '
|
||||
_WriteChar
|
||||
lda proDREAD+20
|
||||
jsr showWORD
|
||||
lda proDREAD+18
|
||||
jsr showWORD
|
||||
|
||||
pla
|
||||
jsr showERRCODE
|
||||
jsr printBUFFER ; output two lines of buffer
|
||||
|
||||
jsr waitFORKEY ; is it 0-9
|
||||
cmp #$1b
|
||||
beq doEXIT
|
||||
cmp #$9b
|
||||
beq doEXIT
|
||||
|
||||
inc proDREAD+12
|
||||
bne doREAD
|
||||
inc proDREAD+14
|
||||
bra doREAD
|
||||
|
||||
lda errCODE ; only write if read is OK
|
||||
beq okWRITE
|
||||
doEXIT rts
|
||||
|
||||
*--- Perform a DWrite
|
||||
|
||||
okWRITE PushLong #strDWRITE ; show the string
|
||||
_WriteCString
|
||||
|
||||
jsl GSOS
|
||||
dw $2030
|
||||
adrl proDWRITE
|
||||
jmp showERRCODE
|
||||
|
||||
*--- Code end
|
||||
|
||||
showERRCODE
|
||||
sta errCODE ; save it
|
||||
|
||||
PushLong #strERR ; show the string
|
||||
_WriteCString
|
||||
|
||||
lda errCODE ; show the error code
|
||||
jsr showHEX
|
||||
|
||||
PushWord #$0d
|
||||
_WriteChar
|
||||
rts
|
||||
|
||||
*--- Print a line of buffer
|
||||
|
||||
printBUFFER PushWord #$20
|
||||
_WriteChar
|
||||
|
||||
lda myBUFFER
|
||||
jsr printME
|
||||
lda myBUFFER+2
|
||||
jsr printME
|
||||
lda myBUFFER+4
|
||||
jsr printME
|
||||
lda myBUFFER+6
|
||||
jsr printME
|
||||
lda myBUFFER+8
|
||||
jsr printME
|
||||
lda myBUFFER+10
|
||||
jsr printME
|
||||
lda myBUFFER+12
|
||||
jsr printME
|
||||
lda myBUFFER+14
|
||||
jsr printME
|
||||
|
||||
PushWord #$0d
|
||||
_WriteChar
|
||||
|
||||
PushWord #$20
|
||||
_WriteChar
|
||||
|
||||
lda myBUFFER+16
|
||||
jsr printME
|
||||
lda myBUFFER+18
|
||||
jsr printME
|
||||
lda myBUFFER+20
|
||||
jsr printME
|
||||
lda myBUFFER+22
|
||||
jsr printME
|
||||
lda myBUFFER+24
|
||||
jsr printME
|
||||
lda myBUFFER+26
|
||||
jsr printME
|
||||
lda myBUFFER+28
|
||||
jsr printME
|
||||
lda myBUFFER+30 ; ends into the code below...
|
||||
|
||||
printME pha ; from a word to a string
|
||||
pha
|
||||
pha ; <= here, really
|
||||
_HexIt
|
||||
PullLong strBUFFER
|
||||
|
||||
PushLong #strBUFFER ; show the string
|
||||
_WriteCString
|
||||
rts
|
||||
|
||||
*---------- Data
|
||||
|
||||
strDREAD asc 0d0d'DRead block $'00
|
||||
strDWRITE asc 0d0d'DWrite '00
|
||||
strDSTATUS asc 0d0d'DStatus '00
|
||||
|
||||
strCHARS asc ' Characteristics: '00
|
||||
strBLOCKS asc 0d' Number of blocks: '00
|
||||
|
||||
strERR asc 0d'- Error code '00
|
||||
|
||||
*----------------------------
|
||||
* DEBUG
|
||||
*----------------------------
|
||||
|
||||
debugBORDER
|
||||
sep #$20
|
||||
ldal $c034
|
||||
inc
|
||||
stal $c034
|
||||
rep #$20
|
||||
rts
|
||||
|
||||
*----------------------------
|
||||
* TEXT ROUTINES
|
||||
*----------------------------
|
||||
|
||||
*---------- Wait for a key
|
||||
|
||||
waitFORKEY PushWord #0 ; wait for key
|
||||
PushWord #1 ; echo char
|
||||
_ReadChar
|
||||
|
||||
waitKEY1 lda 1,s ; check CR
|
||||
and #$ff ; of typed
|
||||
sta 1,s ; in char
|
||||
cmp #$8d
|
||||
beq waitKEY9
|
||||
|
||||
waitKEY8 PushWord #$0d ; return
|
||||
_WriteChar
|
||||
|
||||
waitKEY9 pla ; restore entered char
|
||||
rts
|
||||
|
||||
*---------- Display a word
|
||||
|
||||
showWORD pha ; from a word to a string
|
||||
pha
|
||||
pha ; <= here, really
|
||||
_HexIt
|
||||
PullLong strHEX
|
||||
|
||||
PushLong #strHEX ; show the string
|
||||
_WriteCString
|
||||
rts
|
||||
|
||||
*---------- Display a hex word with a $
|
||||
|
||||
showHEX pha ; from a word to a string
|
||||
pha
|
||||
pha ; <= here, really
|
||||
_HexIt
|
||||
PullLong strHEX
|
||||
|
||||
PushLong #strHEX1 ; show the string
|
||||
_WriteCString
|
||||
rts
|
||||
|
||||
*--- Data
|
||||
|
||||
strHEX1 asc '$'
|
||||
strHEX asc '0000'00
|
||||
strBUFFER asc '0000 '00
|
||||
|
||||
*----------------------------
|
||||
* DATA
|
||||
*----------------------------
|
||||
|
||||
errCODE ds 2
|
||||
|
||||
proQUIT dw 2 ; pCount
|
||||
ds 4 ; 02 pathname
|
||||
ds 2 ; 06 flags
|
||||
|
||||
proDINFO dw 8 ; Parms for DInfo
|
||||
ds 2 ; 02 device num
|
||||
adrl devINFO ; 04 device name
|
||||
ds 2 ; 08 characteristics
|
||||
ds 4 ; 0A total blocks
|
||||
ds 2 ; 0E slot number
|
||||
ds 2 ; 10 unit number
|
||||
ds 2 ; 12 version
|
||||
ds 2 ; 14 device id
|
||||
|
||||
proDREAD dw 6 ; pCount
|
||||
ds 2 ; 02 devNum
|
||||
adrl myBUFFER ; 04 buffer
|
||||
adrl 512 ; 08 requestCount
|
||||
adrl 0 ; 0C startingBlock
|
||||
dw 512 ; 10 blockSize
|
||||
ds 4 ; 14 transferCount
|
||||
|
||||
proDWRITE dw 6 ; pCount
|
||||
ds 2 ; 02 devNum
|
||||
adrl myBUFFER ; 04 buffer
|
||||
adrl 512 ; 08 requestCount
|
||||
adrl 0 ; 0C startingBlock
|
||||
dw 512 ; 10 blockSize
|
||||
ds 4 ; 14 transferCount
|
||||
|
||||
proDSTATUS dw 5 ; pCount
|
||||
ds 2 ; 02 devNum
|
||||
ds 2 ; 04 code ($0000 = Device Status)
|
||||
adrl myLIST ; 06 list
|
||||
adrl 512 ; 0A requestCount (a big buffer)
|
||||
ds 4 ; 0E transferCount
|
||||
|
||||
*----------
|
||||
|
||||
strDEVICE str '.ASSDDevice' ; length is 12 chars (including length byte)
|
||||
|
||||
devINFO dw $0032 ; buffer size
|
||||
devINFO1 db $00 ; length
|
||||
devINFO2 db $00
|
||||
devINFO3 ds $30 ; data
|
||||
|
||||
*----------
|
||||
|
||||
appID ds 2
|
||||
myID ds 2
|
||||
|
||||
myDP ds 2
|
||||
ptrBUFFER ds 4
|
||||
haBUFFER ds 4
|
||||
|
||||
*----------
|
||||
|
||||
myBUFFER ds 512,$bd
|
||||
myLIST ds 512
|
||||
|
@ -16,6 +16,14 @@
|
||||
|
||||
*----------
|
||||
|
||||
SD_ADDRESS_SET_MSB = $e40000
|
||||
SD_ADDRESS_SET_MSB_1 = $e40002
|
||||
SD_ADDRESS_SET_MSB_2 = $e40004
|
||||
SD_ADDRESS_SET_MSB_3 = $e40006
|
||||
SD_START_READ = $e40008 ; starts reading the sector (if it was idle)
|
||||
SD_READ = $e4000a
|
||||
SD_START_WRITE = $e4000c ; starts writing the sector (if it was idle)
|
||||
|
||||
use 4/Int.Macs
|
||||
use 4/Locator.Macs
|
||||
use 4/Mem.Macs
|
||||
@ -76,6 +84,11 @@ maxDEVICES = 128
|
||||
plx
|
||||
stx haBUFFER+2
|
||||
|
||||
lda #myBUFFER
|
||||
stal $300
|
||||
lda #^myBUFFER
|
||||
stal $302
|
||||
|
||||
*----------
|
||||
|
||||
PushWord #$00FF
|
||||
@ -242,10 +255,13 @@ doREAD PushLong #strDREAD ; show the string
|
||||
|
||||
* jsr debugBORDER
|
||||
|
||||
jsl GSOS
|
||||
dw $202f
|
||||
adrl proDREAD
|
||||
pha
|
||||
jsr readablock
|
||||
|
||||
* jsl GSOS
|
||||
* dw $202f
|
||||
* adrl proDREAD
|
||||
* pha
|
||||
|
||||
lda proDREAD+14
|
||||
jsr showWORD
|
||||
lda proDREAD+12
|
||||
@ -277,6 +293,31 @@ doREAD PushLong #strDREAD ; show the string
|
||||
beq okWRITE
|
||||
doEXIT rts
|
||||
|
||||
*---
|
||||
|
||||
readablock sep #$20
|
||||
lda proDREAD+15
|
||||
stal SD_ADDRESS_SET_MSB
|
||||
lda proDREAD+14
|
||||
stal SD_ADDRESS_SET_MSB_1
|
||||
lda proDREAD+13
|
||||
stal SD_ADDRESS_SET_MSB_2
|
||||
lda proDREAD+12
|
||||
stal SD_ADDRESS_SET_MSB_3
|
||||
|
||||
lda #1
|
||||
stal SD_START_READ
|
||||
|
||||
ldy #0
|
||||
]lp ldal SD_READ
|
||||
sta myBUFFER,y
|
||||
iny
|
||||
cpy #512
|
||||
bne ]lp
|
||||
rep #$20
|
||||
|
||||
rts
|
||||
|
||||
*--- Perform a DWrite
|
||||
|
||||
okWRITE PushLong #strDWRITE ; show the string
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user