This commit is contained in:
Antoine Vignau
2024-11-20 19:04:11 +01:00
parent 8f9f81078b
commit 204afd2202
21 changed files with 1511 additions and 1537 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -42,9 +42,12 @@ 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_ACCESS = $e4000a ; read or write
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
@@ -63,21 +66,21 @@ AS_SPEED = $e50000 ; just write a speed byte
* GS/OS EQUATES
*-----------------------------------
GSOS2 = $E100B0
MOVE_INFO = $01FC70
SET_DISKSW = $01FC90
GSOS2 = $E100B0
MOVE_INFO = $01FC70
SET_DISKSW = $01FC90
uncertainBlockCountBit = $8000
diskSwitchedBit = $0001
diskInDriveBit = $0010
diskModifyBit = $0100
uncertainBlockCountBit = $8000
diskSwitchedBit = $0001
diskInDriveBit = $0010
diskModifyBit = $0100
dftHDD = $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
@@ -87,14 +90,13 @@ 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
* 0 0000 => 4 4000 generated device
* 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
dftCHAR = $4BE8 ; default characteristics 0BA8
dftVERSION = $1020 ; v1
*-----------------------------------
* GS/OS DIRECT PAGE

View File

@@ -2,7 +2,7 @@
* AppleSqueezer - SD Driver
*
* (c) 2023, Niek Van Suchtelen
* (c) 2023, Brutal Deluxe Software
* (c) 2023-24, Brutal Deluxe Software
*
* v1.0 (202304) - AV
@@ -12,6 +12,11 @@
*
* v1.1 (202306) - AV
* Writes a sector too!
*
* v1.2 (202411) - AV
* The Time flies version
* We read/write 512 bytes only
* I know what a partition map is...
*
mx %00
@@ -65,8 +70,7 @@ tblDISPATCH da DStartup ; Driver_Startup
* Driver_Startup
*
DStartup
ldal FL_IDLE
DStartup ldal FL_IDLE
and #$ff
cmp #$01
bne DShutdown ; no AS found
@@ -103,102 +107,31 @@ DFlush ; Driver_Flush
DRead jsr doSETUP
bcc dr1
brk $bd
rts
*--- The AS magic is here
dr1 pei workSpace+2
pei workSpace
* 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
dr1 sep #$20
lda blockNum+3
sta [workSpace]
rep #$20
lda #SD_ADDRESS_SET_MSB_1 ; $02
sta workSpace
sep #$20
stal SD_ADDRESS_SET_MSB
lda blockNum+2
sta [workSpace]
rep #$20
lda #SD_ADDRESS_SET_MSB_2 ; $04
sta workSpace
sep #$20
stal SD_ADDRESS_SET_MSB_1
lda blockNum+1
sta [workSpace]
rep #$20
lda #SD_ADDRESS_SET_MSB_3 ; $06
sta workSpace
sep #$20
stal SD_ADDRESS_SET_MSB_2
lda blockNum
sta [workSpace]
rep #$20
* lda #1
* stal SD_START_READ
stal SD_ADDRESS_SET_MSB_3
lda #SD_START_READ ; $08
sta workSpace
sep #$20
lda #1
sta [workSpace]
rep #$20
stal SD_START_READ
lda #SD_READ ; $0a
sta workSpace
sep #$20
ldy #0
]lp lda [workSpace]
ldy #0 ; read one block
]lp ldal SD_ACCESS
sta [bufferPtr],y
iny
cpy #512
bne ]lp
cpy #blockSIZE
bcc ]lp
rep #$20
* 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
@@ -213,9 +146,7 @@ DWrite jsr doSETUP
*--- The AS magic is here
dw1 pei bufferPtr+1 ; save pointer
sep #$20
dw1 sep #$20
lda blockNum+3
stal SD_ADDRESS_SET_MSB
lda blockNum+2
@@ -228,26 +159,14 @@ dw1 pei bufferPtr+1 ; save pointer
lda #1
stal SD_START_WRITE
ldx nbPAGES ; number of 512-byte pages to copy
dw2 ldy #0 ; read one block
sep #$20
ldy #0 ; read one block
]lp lda [bufferPtr],y
stal SD_READ
stal SD_ACCESS
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
@@ -378,7 +297,7 @@ ds2 lda requestCount ; nb of bytes to read
ora requestCount+2
bne ds4
lda #$002C ; invalidByteCount
lda #$002C ; invalidByteCount
sta errCODE
sec
rts
@@ -388,14 +307,7 @@ ds2 lda requestCount ; nb of bytes to read
*--- 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
ds4 lda requestCount ; multiple of $0200
and #blockSIZE-1
beq ds6
@@ -416,8 +328,7 @@ ds6 lda requestCount ; assume transfer=request
*----------------------------
checkSWITCHED
lda fgSTARTED
checkSWITCHED lda fgSTARTED
bne cs1
jsl SET_DISKSW
@@ -443,10 +354,10 @@ MyDIB ds 4 ; +00 pointer to the next DIB
adrl entryPOINT ; +04 driver entry point
dw dftCHAR ; +08 characteristics
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
str 'ASSDDevice' ; +0E device name
ds 21 ; 32 - 11 = 21
dw $8000 ; +2E slot number
dw $0001 ; +30 unit number
dw dftVERSION ; +32 version
dw dftHDD ; +34 device ID
dw $0000 ; +36 first linked device

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
devices=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)
debug=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)

Binary file not shown.

Binary file not shown.

View File

@@ -16,6 +16,8 @@
*----------
SECTOR = $0000
SD_ADDRESS_SET_MSB = $e40000
SD_ADDRESS_SET_MSB_1 = $e40002
SD_ADDRESS_SET_MSB_2 = $e40004
@@ -34,6 +36,8 @@ SD_START_WRITE = $e4000c ; starts writing the sector (if it was idle)
Debut = $00
GSOS = $e100a8
dpSDREAD = Debut+4
*----------
dcREMOVE = $0004
@@ -42,6 +46,9 @@ dcBLOCKDEVICE = $0080
maxDEVICES = 128
KBD = $c000
KBDSTROBE = $c010
*----------
phk
@@ -84,9 +91,9 @@ maxDEVICES = 128
plx
stx haBUFFER+2
lda #myBUFFER
lda #myBUFFER1
stal $300
lda #^myBUFFER
lda #^myBUFFER1
stal $302
*----------
@@ -163,161 +170,163 @@ doQUIT _IMShutDown
* POLL DEVICES
*----------------------------
pollDEVICES lda #1 ; start with device 1
sta proDINFO+2
pollDEVICES PushWord #$0d
_WriteChar
]lp jsl GSOS ; do a DInfo
dw $202c
adrl proDINFO
bcc found
doREAD lda #$00e4
sta dpSDREAD+2
stz dpSDREAD
jsr debugBORDER
jsr readablock1
jsr readablock2
cmp #$0011 ; no more devices
bne loop
rts
lda #^myBUFFER
jsr showWORD
lda #myBUFFER
jsr showWORD
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
brk $bd
ldal KBD-1
bpl nextBLOCK
stal KBDSTROBE-1
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
jsr readablock
* 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
and #$ff
cmp #$9b
beq doEXIT
inc proDREAD+12
nextBLOCK inc proDREAD+12
bne doREAD
inc proDREAD+14
bra doREAD
lda errCODE ; only write if read is OK
beq okWRITE
doEXIT rts
*---
readablock sep #$20
lda #SD_ADDRESS_SET_MSB
sta dpSDREAD
lda proDREAD+15
stal SD_ADDRESS_SET_MSB
sta [dpSDREAD]
jsr waitPLEASE
lda #SD_ADDRESS_SET_MSB_1
sta dpSDREAD
lda proDREAD+14
stal SD_ADDRESS_SET_MSB_1
sta [dpSDREAD]
jsr waitPLEASE
lda #SD_ADDRESS_SET_MSB_2
sta dpSDREAD
lda proDREAD+13
stal SD_ADDRESS_SET_MSB_2
sta [dpSDREAD]
jsr waitPLEASE
lda #SD_ADDRESS_SET_MSB_3
sta dpSDREAD
lda proDREAD+12
sta [dpSDREAD]
jsr waitPLEASE
lda #SD_START_READ
sta dpSDREAD
lda #1
sta [dpSDREAD]
jsr waitPLEASE
rep #$20
lda #SD_READ
sta dpSDREAD
ldy #0
]lp lda [dpSDREAD]
and #$ff
sta myBUFFER1,y
jsr waitPLEASE
iny
cpy #512
bne ]lp
checkBLOCK ldx #512-2
]lp lda myBUFFER1,x
bne gotDATA
dex
dex
bpl ]lp
rts
gotDATA lda #^myBUFFER1
jsr showWORD
lda #myBUFFER1
jsr showWORD
* lda proDREAD+14
* jsr showWORD
* lda proDREAD+12
* jsr showWORD
*
* PushWord #' '
* _WriteChar
brk $bd
rts
waitPLEASE ds 128,$EA ; 32 NOP x 2 cycles = 64 + JSR/RTS
rts
*---
readablock1 sep #$20
lda #0
stal SD_ADDRESS_SET_MSB
lda #0
stal SD_ADDRESS_SET_MSB_1
lda #0
stal SD_ADDRESS_SET_MSB_2
lda #0
stal SD_ADDRESS_SET_MSB_3
lda #1
stal SD_START_READ
ldy #0
ldx #0
]lp ldal SD_READ
sta myBUFFER,y
iny
cpy #512
bne ]lp
sta myBUFFER1,x
jsr waitPLEASE
inx
cpx #512
bcc ]lp
rep #$20
rts
*---
readablock2 sep #$20
lda #$00
stal SD_ADDRESS_SET_MSB
lda #$00
stal SD_ADDRESS_SET_MSB_1
lda #$20
stal SD_ADDRESS_SET_MSB_2
lda #$00
stal SD_ADDRESS_SET_MSB_3
lda #1
stal SD_START_READ
ldx #0
]lp ldal SD_READ
sta myBUFFER2,x
jsr waitPLEASE
inx
cpx #512
bcc ]lp
rep #$20
rts
*--- Perform a DWrite
okWRITE PushLong #strDWRITE ; show the string
@@ -412,8 +421,7 @@ strERR asc 0d'- Error code '00
* DEBUG
*----------------------------
debugBORDER
sep #$20
debugBORDER sep #$20
ldal $c034
inc
stal $c034
@@ -494,17 +502,17 @@ proDINFO dw 8 ; Parms for DInfo
proDREAD dw 6 ; pCount
ds 2 ; 02 devNum
adrl myBUFFER ; 04 buffer
adrl myBUFFER1 ; 04 buffer
adrl 512 ; 08 requestCount
adrl 0 ; 0C startingBlock
adrl SECTOR ; 0C startingBlock
dw 512 ; 10 blockSize
ds 4 ; 14 transferCount
proDWRITE dw 6 ; pCount
ds 2 ; 02 devNum
adrl myBUFFER ; 04 buffer
adrl myBUFFER1 ; 04 buffer
adrl 512 ; 08 requestCount
adrl 0 ; 0C startingBlock
adrl SECTOR ; 0C startingBlock
dw 512 ; 10 blockSize
ds 4 ; 14 transferCount
@@ -535,6 +543,12 @@ haBUFFER ds 4
*----------
myBUFFER ds 512,$bd
myBUFFER
myBUFFER1 ds 512,$bd
ds 2,$ff
myBUFFER2 ds 512,$bd
ds 2,$ff
myLIST ds 512

File diff suppressed because it is too large Load Diff

View File

@@ -184,36 +184,23 @@ disk_read ldal SD_CARD_INSERTED
dr_0 sty drSECTOR
stx drSECTOR+2
sep #$20
lda drSECTOR+3
stal SD_ADDRESS_SET_MSB
nop
nop
lda drSECTOR+2
stal SD_ADDRESS_SET_MSB+1
nop
nop
lda drSECTOR+1
stal SD_ADDRESS_SET_MSB+2
nop
nop
lda drSECTOR
stal SD_ADDRESS_SET_MSB+3
nop
nop
lda #1 ; dummy read
stal SD_START_READ
nop
nop
ldx #0
]lp ldal SD_ACCESS
sta buff,x
nop
nop
inx
cpx #SIZE_SECTOR
bcc ]lp

View File

@@ -12,6 +12,10 @@
* EQUATES
*-------------------------------
FS_OK = 0
FS_NOT_FAT = 1
FS_NOT_BR = 2
PF_USE_READ = 1
PF_USE_DIR = 0
PF_USE_LSEEK = 0
@@ -108,8 +112,8 @@ DIR_FileSize = 28
check_fs lda buff+BS_55AA ; check record signature
cmp #$aa55
beq cfs_1
lda #2
lda #FS_NOT_BR
sec
rts
@@ -121,11 +125,11 @@ cfs_1 lda buff+BS_FilSysType ; check FAT12/16
cmp #$4146
bne cfs_2
cfs_ok lda #0
cfs_ok lda #FS_OK ; we have a FAT
clc
rts
cfs_2 lda #1
cfs_2 lda #FS_NOT_FAT ; we do not have a FAT
sec
rts