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