Code updated for Merlin32

This commit is contained in:
Florian Reitz 2017-08-26 13:07:42 +02:00
parent f9f042748d
commit 6e37a8c482
4 changed files with 1155 additions and 1291 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -56,9 +56,7 @@ DUMMY = $FF
LDX #$20
LDY #$00
LDX #$03
===== Page 2 =====
LDX #$03
STX WORK
* find slot nr
@ -88,7 +86,7 @@ DUMMY = $FF
BIT $CFFF
JSR INIT
DO 0
DO DEBUG
*
* TODO: check for init error
*
@ -115,9 +113,7 @@ INSLP LDA $BF32,X ; get a devnum
INSLP2 LDA $BF32-1,X ; move all entries down
STA $BF32,X ; to make room at front
DEX ; for a new entry
BNE INSLP2
===== Page 3 =====
BNE INSLP2
LDA #$04 ; ProFile type device
ORA SLOT16
STA $BF32 ; slot, drive 1 at top of list
@ -130,11 +126,7 @@ INSLP2 LDA $BF32-1,X ; move all entries down
TAX
LDA #<DRIVER
STA $BF10,X ; write to driver table
DO DEBUG
LDA #>DRIVER
ELSE
LDA CURSLOT
FIN
STA $BF11,X
INSOUT RTS
@ -174,9 +166,7 @@ DRIVER CLD
TSX
LDA $0100,X
STA CURSLOT ; $Cs
AND #$0F
===== Page 4 =====
AND #$0F
STA SLOT ; $0s
ASL A
ASL A
@ -214,7 +204,7 @@ DRIVER CLD
* Signature bytes
DS \ ; fill with zeroes
DS -4 ; locate to $C8FC
ORG *-4 ; locate to $C8FC
DW $FFFF ; 65535 blocks
DB $47 ; Status bits
DB #<DRIVER ; LSB of driver
@ -233,9 +223,7 @@ DRIVER CLD
********************************
INIT CLD
LDA #$03 ; set SPI mode 3
===== Page 5 =====
LDA #$03 ; set SPI mode 3
STA CTRL,X
LDA #SSNONE
STA SS,X
@ -292,8 +280,6 @@ INIT CLD
JMP :BLOCKSZ
:ERROR1 JMP :IOERROR ; needed for far jump
===== Page 6 =====
:SDV1 LDA #<CMD55
STA CMDLO
@ -351,8 +337,6 @@ INIT CLD
STA DIV,X
TYA ; retval in A
RTS
===== Page 7 =====
********************************
@ -410,9 +394,7 @@ GETR3 JSR GETR1 ; get R1 first
LDY #04 ; load counter
:LOOP LDA #DUMMY ; send dummy
STA DATA,X
:WAIT BIT CTRL,X
===== Page 8 =====
:WAIT BIT CTRL,X
BPL :WAIT
LDA DATA,X
PHA
@ -469,9 +451,7 @@ BLOCK PHX ; save X
*
* Send SD command
* Cmd is in A
*
===== Page 9 =====
*
********************************
COMMAND PHY ; save Y
@ -528,9 +508,7 @@ STATUS CLC ; no error
LDY #$FF
RTS
* TODO: check for card detect and write protect!
===== Page 10 =====
* TODO: check for card detect and write protect!
********************************
@ -587,9 +565,7 @@ READ JSR BLOCK ; calc block address
LDY #2
:CRC LDA #DUMMY ; read 2 bytes crc
STA DATA,X ; and ignore
:WAIT2 BIT CTRL,X
===== Page 11 =====
:WAIT2 BIT CTRL,X
BPL :WAIT2
DEY
BNE :CRC
@ -646,9 +622,7 @@ WRITE JSR BLOCK ; calc block address
INC $45 ; inc msb on page boundary
:INW INC WORK
BNE :LOOPW
DEY
===== Page 12 =====
DEY
BNE :LOOPY
LDY #2 ; send 2 dummy crc bytes
@ -705,9 +679,7 @@ WRITE JSR BLOCK ; calc block address
FORMAT SEC
LDA #$01 ; invalid command
RTS
===== Page 13 =====
RTS
CMD0 HEX 400000

5
make.bat Normal file
View File

@ -0,0 +1,5 @@

merlin32 -V "C:\Program Files (x86)\Merlin32\Library" AppleIISd.s
move AppleIISd AppleIISd.bin
move AppleIISd_Output.txt AppleIISd.lst
del /AH _FileInformation.txt