mirror of
https://github.com/freitz85/AppleIISd.git
synced 2024-11-22 13:31:39 +00:00
Linear addressing from C700, test code added to ram
This commit is contained in:
parent
9e674fe0c6
commit
b0df142692
BIN
AppleIISd.bin
BIN
AppleIISd.bin
Binary file not shown.
198
AppleIISd.hex
198
AppleIISd.hex
@ -1,129 +1,71 @@
|
||||
:10000000D8A9039D81C0BD83C009019D83C0A907F4
|
||||
:100010009D82C0A00AA9FF9D80C03C81C010FB88C2
|
||||
:10002000D0F5BD83C029FE9D83C0A9C58540A9CA5E
|
||||
:10003000854120F0C82004C9C901D039A9D1854023
|
||||
:10004000A9CA854120F0C8201FC9C901D02AA9DD4D
|
||||
:100050008540A9CA854120F0C82004C9A9E385408C
|
||||
:10006000A9CA854120F0C82004C9C901F0E0C9002F
|
||||
:10007000D0034CB2C84CDEC8A9DD8540A9CA854171
|
||||
:1000800020F0C8A9E98540A9CA854120F0C820040C
|
||||
:10009000C9C901F0E3C900D0034CB2C8A9CB85405F
|
||||
:1000A000A9CA854120F0C82004C9C901F0F6C900D9
|
||||
:1000B000D02CA9D78540A9CA854120F0C82004C901
|
||||
:1000C000C900D01ABD83C009809D83C0BD81C0090D
|
||||
:1000D000049D81C018A000900838A02FB00338A05C
|
||||
:1000E00027BD83C009019D83C0A9009D82C098607F
|
||||
:1000F0005AA000B1409D80C03C81C010FBC8C00622
|
||||
:1001000090F17A60A9FF9D80C03C81C010FBBD804A
|
||||
:10011000C0853C2980D0EDA9FF9D80C0A53C602012
|
||||
:1001200004C9485AA004A9FF9D80C03C81C010FBAF
|
||||
:10013000BD80C04888D0EFA43D6899F805689978DB
|
||||
:10014000056899F804689978047AA9FF9D80C068C9
|
||||
:1001500060DA5AA63DA5469DF805A5479D7805A9F4
|
||||
:10016000009DF8049D7804A9802443F005A9019D11
|
||||
:10017000F804A0091EF8053E78053EF8043E780410
|
||||
:1001800088D0F17AFA605AA43D9D80C0B978049D68
|
||||
:1001900080C0B9F8049D80C0B978059D80C0B9F8C9
|
||||
:1001A000059D80C0A9FF9D80C02004C97A6048A930
|
||||
:1001B000403C83C018F00138686048A9203C83C0E7
|
||||
:1001C00018F001386860A900A2FFA0FF20AEC99016
|
||||
:1001D00004A92F800720BAC99002A92B6020AEC9BC
|
||||
:1001E000B0642051C9BD83C029FE9D83C0A95120A0
|
||||
:1001F00086C9C900D050A9FF9D80C0BD80C0C9FE7E
|
||||
:10020000D0F4A002BD81C009109D81C0A9FF9D80CE
|
||||
:10021000C0643CBD80C09244E644D002E645E63C62
|
||||
:10022000D0F188D0ECBD80C0BD80C0BD80C0BD8194
|
||||
:10023000C029EF9D81C018A9000848BD83C00901ED
|
||||
:100240009D83C068286038A92780EE20AEC9B067BA
|
||||
:1002500020BAC9B0672051C9BD83C029FE9D83C0A3
|
||||
:10026000A9582086C9C900D04EA9FF9D80C0A9FE0B
|
||||
:100270009D80C0A002643CB2449D80C0E644D00290
|
||||
:10028000E645E63CD0F188D0EC9D80C09D80C09DC5
|
||||
:1002900080C0BD80C0291FC905D01C18A90008480E
|
||||
:1002A000A9FF9D80C0BD80C0C900F0F4BD83C00916
|
||||
:1002B000019D83C068286038A92780E238A92B8077
|
||||
:1002C000DD38A901604000000000954100000000F9
|
||||
:1002D000F948000001AA875000000200FF770000E3
|
||||
:1002E0000000656940000000776900000000FF0021
|
||||
:1002F00000000000000000000000000000000000FE
|
||||
:1003000000000000000000000000000000000000ED
|
||||
:1003100000000000000000000000000000000000DD
|
||||
:1003200000000000000000000000000000000000CD
|
||||
:1003300000000000000000000000000000000000BD
|
||||
:1003400000000000000000000000000000000000AD
|
||||
:10035000000000000000000000000000000000009D
|
||||
:10036000000000000000000000000000000000008D
|
||||
:10037000000000000000000000000000000000007D
|
||||
:10038000000000000000000000000000000000006D
|
||||
:10039000000000000000000000000000000000005D
|
||||
:1003A000000000000000000000000000000000004D
|
||||
:1003B000000000000000000000000000000000003D
|
||||
:1003C000000000000000000000000000000000002D
|
||||
:1003D000000000000000000000000000000000001D
|
||||
:1003E000000000000000000000000000000000000D
|
||||
:1003F00000000000000000000000000000000000FD
|
||||
:1004000000000000000000000000000000000000EC
|
||||
:1004100000000000000000000000000000000000DC
|
||||
:1004200000000000000000000000000000000000CC
|
||||
:1004300000000000000000000000000000000000BC
|
||||
:1004400000000000000000000000000000000000AC
|
||||
:10045000000000000000000000000000000000009C
|
||||
:10046000000000000000000000000000000000008C
|
||||
:10047000000000000000000000000000000000007C
|
||||
:10048000000000000000000000000000000000006C
|
||||
:10049000000000000000000000000000000000005C
|
||||
:1004A000000000000000000000000000000000004C
|
||||
:1004B000000000000000000000000000000000003C
|
||||
:1004C000000000000000000000000000000000002C
|
||||
:1004D000000000000000000000000000000000001C
|
||||
:1004E000000000000000000000000000000000000C
|
||||
:1004F00000000000000000000000000000000000FC
|
||||
:1005000000000000000000000000000000000000EB
|
||||
:1005100000000000000000000000000000000000DB
|
||||
:1005200000000000000000000000000000000000CB
|
||||
:1005300000000000000000000000000000000000BB
|
||||
:1005400000000000000000000000000000000000AB
|
||||
:10055000000000000000000000000000000000009B
|
||||
:10056000000000000000000000000000000000008B
|
||||
:10057000000000000000000000000000000000007B
|
||||
:10058000000000000000000000000000000000006B
|
||||
:10059000000000000000000000000000000000005B
|
||||
:1005A000000000000000000000000000000000004B
|
||||
:1005B000000000000000000000000000000000003B
|
||||
:1005C000000000000000000000000000000000002B
|
||||
:1005D000000000000000000000000000000000001B
|
||||
:1005E000000000000000000000000000000000000B
|
||||
:1005F00000000000000000000000000000000000FB
|
||||
:1006000000000000000000000000000000000000EA
|
||||
:1006100000000000000000000000000000000000DA
|
||||
:1006200000000000000000000000000000000000CA
|
||||
:1006300000000000000000000000000000000000BA
|
||||
:1006400000000000000000000000000000000000AA
|
||||
:10065000000000000000000000000000000000009A
|
||||
:10066000000000000000000000000000000000008A
|
||||
:10067000000000000000000000000000000000007A
|
||||
:10068000000000000000000000000000000000006A
|
||||
:10069000000000000000000000000000000000005A
|
||||
:1006A000000000000000000000000000000000004A
|
||||
:1006B000000000000000000000000000000000003A
|
||||
:1006C000000000000000000000000000000000002A
|
||||
:1006D000000000000000000000000000000000001A
|
||||
:1006E000000000000000000000000000000000000A
|
||||
:1006F00000000000000000000000000000000000FA
|
||||
:10070000A220A000A203A0FF2058FFBABD00018DC7
|
||||
:10071000F807290F853D0A0A0A0A852BAA2CFFCF64
|
||||
:1007200020AEC99003A927002000C8C900F001002D
|
||||
:10073000A9018542A62B85436444A90885456446E2
|
||||
:1007400064472CFFCF20DDC94C0108D82058FFBAE0
|
||||
:10075000BD00018DF807290F853D0A0A0A0A852B7D
|
||||
:10076000AA2CFFCF20AEC99004A927801BA9803CEA
|
||||
:1007700083C0F022A542C900F010C901F00FC902E0
|
||||
:10078000F00EC903F00DA90138604CC6C94CDDC993
|
||||
:100790004C4BCA4CC1CA2000C8B0ED80D700000045
|
||||
:1007A0000000000000000000000000000000000049
|
||||
:1007B0000000000000000000000000000000000039
|
||||
:1007C0000000000000000000000000000000000029
|
||||
:1007D0000000000000000000000000000000000019
|
||||
:1007E0000000000000000000000000000000000009
|
||||
:1007F000000000000000000000000000FFFF174B99
|
||||
:10000000A220A000A203A0FF2058FFBABD00018DCE
|
||||
:10001000F807290F853D0A0A0A0A852BAA2CFFCF6B
|
||||
:1000200020A9C99003A92F002000C8C900F0010031
|
||||
:10003000A9018542A62B85436444A90885456446E9
|
||||
:1000400064472CFFCF20CFC94C0108D82058FFBAF5
|
||||
:10005000BD00018DF807290F853D0A0A0A0A852B84
|
||||
:10006000AA2CFFCF20A9C99004A92F801FA9803CEA
|
||||
:1000700083C0F029A542C900F014C901F013C902D8
|
||||
:10008000F012C903F011C9FFF010A90138604CC18A
|
||||
:10009000C94CCFC94C38CA4CA9CA4CADCA2000C8FB
|
||||
:1000A000B0EA80D000000000000000000000000066
|
||||
:1000B0000000000000000000000000000000000040
|
||||
:1000C0000000000000000000000000000000000030
|
||||
:1000D0000000000000000000000000000000000020
|
||||
:1000E0000000000000000000000000000000000010
|
||||
:1000F000000000000000000000000000FFFF174BA0
|
||||
:10010000D8A9039D81C0BD83C009019D83C0A907F3
|
||||
:100110009D82C0A00AA9FF9D80C03C81C010FB88C1
|
||||
:10012000D0F5BD83C029FE9D83C0A9318540A9CBF0
|
||||
:10013000854120EBC820FFC8C901D039A93D8540C1
|
||||
:10014000A9CB854120EBC8201AC9C901D02AA949E9
|
||||
:100150008540A9CB854120EBC820FFC8A94F854029
|
||||
:10016000A9CB854120EBC820FFC8C901F0E0C90038
|
||||
:10017000D0034CB2C84CD9C8A9498540A9CB854108
|
||||
:1001800020EBC8A9558540A9CB854120EBC820FFAD
|
||||
:10019000C8C901F0E3C900D0034CB2C8A9378540F3
|
||||
:1001A000A9CB854120EBC820FFC8C901F0F6C900E2
|
||||
:1001B000D027A9438540A9CB854120EBC820FFC8A3
|
||||
:1001C000C900D015BD83C009809D83C0BD81C00911
|
||||
:1001D000049D81C018A000900338A027BD83C009EA
|
||||
:1001E000019D83C0A9009D82C098605AA000B140C3
|
||||
:1001F0009D80C03C81C010FBC8C00690F17A60A908
|
||||
:10020000FF9D80C03C81C010FBBD80C0853C298023
|
||||
:10021000D0EDA9FF9D80C0A53C6020FFC8485AA032
|
||||
:1002200004A9FF9D80C03C81C010FBBD80C04888F0
|
||||
:10023000D0EFA43D6899F805689978056899F804A5
|
||||
:10024000689978047AA9FF9D80C06860DA5AA63D53
|
||||
:10025000A5469DF805A5479D7805A9009DF8049D34
|
||||
:100260007804A9802443F005A9019DF804A0091E83
|
||||
:10027000F8053E78053EF8043E780488D0F17AFA15
|
||||
:10028000605AA43D9D80C0B978049D80C0B9F8042F
|
||||
:100290009D80C0B978059D80C0B9F8059D80C0A932
|
||||
:1002A000FF9D80C020FFC87A6048A9403C83C018E9
|
||||
:1002B000F00138686048A9203C83C018F001386814
|
||||
:1002C00060A900A2FFA0FF20B5C99002A92B602061
|
||||
:1002D0004CC9BD83C029FE9D83C0A9512081C9C9D5
|
||||
:1002E00000D050A9FF9D80C0BD80C0C9FED0F4A041
|
||||
:1002F00002BD81C009109D81C0A9FF9D80C0643CE2
|
||||
:10030000BD80C09244E644D002E645E63CD0F18888
|
||||
:10031000D0ECBD80C0BD80C0BD80C0BD81C029EF14
|
||||
:100320009D81C018A9000848BD83C009019D83C0F4
|
||||
:1003300068286038A92780EE20B5C9B067204CC96D
|
||||
:10034000BD83C029FE9D83C0A9582081C9C900D0A2
|
||||
:100350004EA9FF9D80C0A9FE9D80C0A002643CB252
|
||||
:10036000449D80C0E644D002E645E63CD0F188D00A
|
||||
:10037000EC9D80C09D80C09D80C0BD80C0291FC9EC
|
||||
:1003800005D01C18A9000848A9FF9D80C0BD80C0E9
|
||||
:10039000C900F0F4BD83C009019D83C0682860389E
|
||||
:1003A000A92780E238A92B80DD38A90160A43DA9E6
|
||||
:1003B0000220F5BEB07999F8068545A9009978061E
|
||||
:1003C0008544A000989144C8D0FAE645989144C865
|
||||
:1003D000D0FAA902A43D8542AD78068544B9F80655
|
||||
:1003E000854564466447A62B204BC7B042A901A4AB
|
||||
:1003F0003D8542B978068544B9F80685456446646A
|
||||
:1004000047A62B204BC7B027A43DB978068544B931
|
||||
:10041000F8068545A00098D144D015C8D0F8E64527
|
||||
:1004200098D144D00BC8D0F820F8BE18A9006000BD
|
||||
:10043000004000000000954100000000F948000065
|
||||
:1004400001AA875000000200FF77000000006569E4
|
||||
:0B04500040000000776900000000FF82
|
||||
:00000001FF
|
||||
|
1963
AppleIISd.lst
1963
AppleIISd.lst
File diff suppressed because it is too large
Load Diff
452
AppleIISd.s
452
AppleIISd.s
@ -17,7 +17,7 @@ DEBUG = 0
|
||||
DO DEBUG
|
||||
ORG $8000
|
||||
ELSE
|
||||
ORG $C800 ; Expansion ROM
|
||||
ORG $C700 ; Expansion ROM
|
||||
FIN
|
||||
|
||||
* Memory defines
|
||||
@ -41,6 +41,8 @@ R30 = $0478
|
||||
R31 = $04F8
|
||||
R32 = $0578
|
||||
R33 = $05F8
|
||||
RAM0 = $0678
|
||||
RAM1 = $06F8
|
||||
|
||||
* Constants
|
||||
|
||||
@ -53,6 +55,196 @@ CD = $40
|
||||
INITED = $80
|
||||
|
||||
|
||||
* signature bytes
|
||||
|
||||
LDX #$20
|
||||
LDY #$00
|
||||
LDX #$03
|
||||
LDY #$FF ; neither 5.25 nor Smartport
|
||||
|
||||
* find slot nr
|
||||
|
||||
DO DEBUG
|
||||
LDA #$04
|
||||
STA SLOT
|
||||
LDA #$C4
|
||||
STA CURSLOT
|
||||
LDA #$40
|
||||
|
||||
ELSE
|
||||
JSR $FF58
|
||||
TSX
|
||||
LDA $0100,X
|
||||
STA CURSLOT ; $Cs
|
||||
AND #$0F
|
||||
STA SLOT ; $0s
|
||||
ASL A
|
||||
ASL A
|
||||
ASL A
|
||||
ASL A
|
||||
FIN
|
||||
|
||||
STA SLOT16 ; $s0
|
||||
TAX ; X holds now SLOT16
|
||||
BIT $CFFF
|
||||
JSR CARDDET
|
||||
BCC :INIT
|
||||
LDA #$2F ; no card inserted
|
||||
BRK
|
||||
|
||||
:INIT JSR INIT
|
||||
|
||||
|
||||
********************************
|
||||
*
|
||||
* Install SD card driver
|
||||
*
|
||||
********************************
|
||||
|
||||
DO DEBUG
|
||||
|
||||
* see if slot has a driver already
|
||||
|
||||
LDX $BF31 ; get devcnt
|
||||
INSTALL LDA $BF32,X ; get a devnum
|
||||
AND #$70 ; isolate slot
|
||||
CMP SLOT16 ; slot?
|
||||
BEQ :INSOUT ; yes, skip it
|
||||
DEX
|
||||
BPL INSTALL ; keep up the search
|
||||
|
||||
* restore the devnum to the list
|
||||
|
||||
LDX $BF31 ; get devcnt again
|
||||
CPX #$0D ; device table full?
|
||||
BNE :INST2
|
||||
|
||||
JSR $FF3A ; bell
|
||||
JMP :INSOUT ; do something!
|
||||
|
||||
:INST2 LDA $BF32-1,X ; move all entries down
|
||||
STA $BF32,X ; to make room at front
|
||||
DEX ; for a new entry
|
||||
BNE :INST2
|
||||
LDA #$04 ; ProFile type device
|
||||
ORA SLOT16
|
||||
STA $BF32 ; slot, drive 1 at top of list
|
||||
INC $BF31 ; update devcnt
|
||||
|
||||
* now insert the device driver vector
|
||||
|
||||
LDA SLOT
|
||||
ASL
|
||||
TAX
|
||||
LDA #<DRIVER
|
||||
STA $BF10,X ; write to driver table
|
||||
LDA #>DRIVER
|
||||
STA $BF11,X
|
||||
:INSOUT RTS
|
||||
|
||||
|
||||
********************************
|
||||
*
|
||||
* Boot from SD card
|
||||
*
|
||||
********************************
|
||||
|
||||
ELSE
|
||||
|
||||
BOOT CMP #0 ; check for error
|
||||
BEQ :BOOT1
|
||||
BRK
|
||||
|
||||
:BOOT1 LDA #$01
|
||||
STA DCMD ; load command
|
||||
LDX SLOT16
|
||||
STA $43 ; slot number
|
||||
STZ BUFFER ; buffer lo
|
||||
LDA #$08
|
||||
STA BUFFER+1 ; buffer hi
|
||||
STZ BLOCK ; block lo
|
||||
STZ BLOCK+1 ; block hi
|
||||
BIT $CFFF
|
||||
JSR READ ; call driver
|
||||
JMP $801 ; goto bootloader
|
||||
|
||||
FIN
|
||||
|
||||
|
||||
********************************
|
||||
*
|
||||
* Jump table
|
||||
*
|
||||
********************************
|
||||
|
||||
DRIVER CLD
|
||||
|
||||
DO DEBUG
|
||||
LDA #$04
|
||||
STA SLOT
|
||||
LDA #$C4
|
||||
STA CURSLOT
|
||||
LDA #$40
|
||||
|
||||
ELSE
|
||||
JSR $FF58 ; find slot nr
|
||||
TSX
|
||||
LDA $0100,X
|
||||
STA CURSLOT ; $Cs
|
||||
AND #$0F
|
||||
STA SLOT ; $0s
|
||||
ASL A
|
||||
ASL A
|
||||
ASL A
|
||||
ASL A
|
||||
FIN
|
||||
|
||||
STA SLOT16 ; $s0
|
||||
TAX ; X holds now SLOT16
|
||||
BIT $CFFF
|
||||
JSR CARDDET
|
||||
BCC :INITED
|
||||
LDA #$2F ; no card inserted
|
||||
BRA :DONE
|
||||
|
||||
:INITED LDA #INITED ; check for init
|
||||
BIT SS,X
|
||||
BEQ :INIT
|
||||
|
||||
:CMD LDA DCMD ; get command
|
||||
CMP #0
|
||||
BEQ :STATUS
|
||||
CMP #1
|
||||
BEQ :READ
|
||||
CMP #2
|
||||
BEQ :WRITE
|
||||
CMP #3
|
||||
BEQ :FORMAT
|
||||
CMP #$FF
|
||||
BEQ :TEST
|
||||
LDA #1 ; unknown command
|
||||
|
||||
:DONE SEC
|
||||
RTS
|
||||
|
||||
:STATUS JMP STATUS
|
||||
:READ JMP READ
|
||||
:WRITE JMP WRITE
|
||||
:FORMAT JMP FORMAT
|
||||
:TEST JMP TEST ; do device test
|
||||
:INIT JSR INIT
|
||||
BCS :DONE ; init failure
|
||||
BRA :CMD
|
||||
|
||||
|
||||
* Signature bytes
|
||||
|
||||
DS \ ; fill with zeroes
|
||||
DS -4 ; locate to $xxFC
|
||||
DW $FFFF ; 65535 blocks
|
||||
DB $17 ; Status bits
|
||||
DB #<DRIVER ; LSB of driver
|
||||
|
||||
********************************
|
||||
*
|
||||
* Initialize SD card
|
||||
@ -174,9 +366,6 @@ INIT CLD
|
||||
CLC ; all ok
|
||||
LDY #0
|
||||
BCC :END1
|
||||
:CDERROR SEC
|
||||
LDY #$2F ; no card error
|
||||
BCS :END1
|
||||
:IOERROR SEC
|
||||
LDY #$27 ; init error
|
||||
:END1 LDA SS,X ; set CS high
|
||||
@ -387,12 +576,7 @@ STATUS LDA #0 ; no error
|
||||
LDX #$FF ; 32 MB partition
|
||||
LDY #$FF
|
||||
|
||||
JSR CARDDET
|
||||
BCC :WRPROT
|
||||
LDA #$2F ; no card inserted
|
||||
BRA :DONE
|
||||
|
||||
:WRPROT JSR WRPROT
|
||||
JSR WRPROT
|
||||
BCC :DONE
|
||||
LDA #$2B ; card write protected
|
||||
|
||||
@ -410,14 +594,10 @@ STATUS LDA #0 ; no error
|
||||
* Set - Error
|
||||
* A $00 - No error
|
||||
* $27 - Bad block number
|
||||
* $28 - No card inserted
|
||||
*
|
||||
********************************
|
||||
|
||||
READ JSR CARDDET
|
||||
BCS :ERROR ; no card inserted
|
||||
|
||||
JSR GETBLOCK ; calc block address
|
||||
READ JSR GETBLOCK ; calc block address
|
||||
|
||||
LDA SS,X ; enable /CS
|
||||
AND #$FF!SS0
|
||||
@ -490,10 +670,7 @@ READ JSR CARDDET
|
||||
*
|
||||
********************************
|
||||
|
||||
WRITE JSR CARDDET
|
||||
BCS :IOERROR ; no card inserted
|
||||
|
||||
JSR WRPROT
|
||||
WRITE JSR WRPROT
|
||||
BCS :WPERROR ; card write protected
|
||||
|
||||
JSR GETBLOCK ; calc block address
|
||||
@ -578,17 +755,18 @@ FORMAT SEC
|
||||
*
|
||||
********************************
|
||||
|
||||
DO DEBUG
|
||||
TEST
|
||||
|
||||
* get buffer
|
||||
LDY SLOT
|
||||
LDA #2 ; get 512 byte buffer
|
||||
JSR $BEF5 ; call GETBUFR
|
||||
BCS :ERROR
|
||||
STA BUFADD+1
|
||||
STA RAM1,Y
|
||||
STA BUFFER+1
|
||||
STZ BUFADD
|
||||
STZ BUFFER
|
||||
LDA #0
|
||||
STA RAM0,Y
|
||||
STA BUFFER
|
||||
|
||||
* fill buffer
|
||||
LDY #0
|
||||
@ -604,10 +782,11 @@ TEST
|
||||
|
||||
* write to card
|
||||
LDA #2 ; write cmd
|
||||
LDY SLOT
|
||||
STA DCMD
|
||||
LDA BUFADD ; buffer address
|
||||
LDA RAM0 ; buffer address
|
||||
STA BUFFER
|
||||
LDA BUFADD+1
|
||||
LDA RAM1,Y
|
||||
STA BUFFER+1
|
||||
STZ BLOCK ; block number
|
||||
STZ BLOCK+1
|
||||
@ -617,10 +796,11 @@ TEST
|
||||
|
||||
* read from card
|
||||
LDA #1 ; read cmd
|
||||
LDY SLOT
|
||||
STA DCMD
|
||||
LDA BUFADD ; buffer address
|
||||
LDA RAM0,Y ; buffer address
|
||||
STA BUFFER
|
||||
LDA BUFADD+1
|
||||
LDA RAM1,Y
|
||||
STA BUFFER+1
|
||||
STZ BLOCK ; block number
|
||||
STZ BLOCK+1
|
||||
@ -629,9 +809,10 @@ TEST
|
||||
BCS :ERROR
|
||||
|
||||
* check for errors
|
||||
LDA BUFADD ; buffer address
|
||||
LDY SLOT
|
||||
LDA RAM0,Y ; buffer address
|
||||
STA BUFFER
|
||||
LDA BUFADD+1
|
||||
LDA RAM1,Y
|
||||
STA BUFFER+1
|
||||
LDY #0
|
||||
:LOOP2 TYA
|
||||
@ -655,9 +836,6 @@ TEST
|
||||
:ERROR BRK
|
||||
:ERRCMP BRK
|
||||
|
||||
BUFADD DW 0
|
||||
FIN
|
||||
|
||||
|
||||
CMD0 HEX 400000
|
||||
HEX 000095
|
||||
@ -674,213 +852,3 @@ ACMD4140 HEX 694000
|
||||
ACMD410 HEX 690000
|
||||
HEX 0000FF
|
||||
|
||||
|
||||
********************************
|
||||
*
|
||||
* This region is mapped to
|
||||
* the $CsXX space. On the ROM
|
||||
* it must appear at address $700
|
||||
*
|
||||
********************************
|
||||
|
||||
DO DEBUG-1
|
||||
DS \
|
||||
DS $400
|
||||
ERR *-1/$CF00 ; must be at $CF00
|
||||
FIN
|
||||
|
||||
* signature bytes
|
||||
|
||||
START LDX #$20
|
||||
LDY #$00
|
||||
LDX #$03
|
||||
LDY #$FF ; neither 5.25 nor Smartport
|
||||
|
||||
* find slot nr
|
||||
|
||||
DO DEBUG
|
||||
LDA #$04
|
||||
STA SLOT
|
||||
LDA #$C4
|
||||
STA CURSLOT
|
||||
LDA #$40
|
||||
|
||||
ELSE
|
||||
JSR $FF58
|
||||
TSX
|
||||
LDA $0100,X
|
||||
STA CURSLOT ; $Cs
|
||||
AND #$0F
|
||||
STA SLOT ; $0s
|
||||
ASL A
|
||||
ASL A
|
||||
ASL A
|
||||
ASL A
|
||||
FIN
|
||||
|
||||
STA SLOT16 ; $s0
|
||||
TAX ; X holds now SLOT16
|
||||
BIT $CFFF
|
||||
JSR CARDDET
|
||||
BCC :INIT
|
||||
LDA #$27 ; no card inserted
|
||||
BRK
|
||||
|
||||
:INIT JSR INIT
|
||||
|
||||
|
||||
********************************
|
||||
*
|
||||
* Install SD card driver
|
||||
*
|
||||
********************************
|
||||
|
||||
DO DEBUG
|
||||
|
||||
* see if slot has a driver already
|
||||
|
||||
LDX $BF31 ; get devcnt
|
||||
INSTALL LDA $BF32,X ; get a devnum
|
||||
AND #$70 ; isolate slot
|
||||
CMP SLOT16 ; slot?
|
||||
BEQ :INSOUT ; yes, skip it
|
||||
DEX
|
||||
BPL INSTALL ; keep up the search
|
||||
|
||||
* restore the devnum to the list
|
||||
|
||||
LDX $BF31 ; get devcnt again
|
||||
CPX #$0D ; device table full?
|
||||
BNE :INST2
|
||||
|
||||
JSR $FF3A ; bell
|
||||
JMP :INSOUT ; do something!
|
||||
|
||||
:INST2 LDA $BF32-1,X ; move all entries down
|
||||
STA $BF32,X ; to make room at front
|
||||
DEX ; for a new entry
|
||||
BNE :INST2
|
||||
LDA #$04 ; ProFile type device
|
||||
ORA SLOT16
|
||||
STA $BF32 ; slot, drive 1 at top of list
|
||||
INC $BF31 ; update devcnt
|
||||
|
||||
* now insert the device driver vector
|
||||
|
||||
LDA SLOT
|
||||
ASL
|
||||
TAX
|
||||
LDA #<DRIVER
|
||||
STA $BF10,X ; write to driver table
|
||||
LDA #>DRIVER
|
||||
STA $BF11,X
|
||||
:INSOUT RTS
|
||||
|
||||
|
||||
********************************
|
||||
*
|
||||
* Boot from SD card
|
||||
*
|
||||
********************************
|
||||
|
||||
ELSE
|
||||
|
||||
BOOT CMP #0 ; check for error
|
||||
BEQ :BOOT1
|
||||
BRK
|
||||
|
||||
:BOOT1 LDA #$01
|
||||
STA DCMD ; load command
|
||||
LDX SLOT16
|
||||
STA $43 ; slot number
|
||||
STZ BUFFER ; buffer lo
|
||||
LDA #$08
|
||||
STA BUFFER+1 ; buffer hi
|
||||
STZ BLOCK ; block lo
|
||||
STZ BLOCK+1 ; block hi
|
||||
BIT $CFFF
|
||||
JSR READ ; call driver
|
||||
JMP $801 ; goto bootloader
|
||||
|
||||
FIN
|
||||
|
||||
|
||||
********************************
|
||||
*
|
||||
* Jump table
|
||||
*
|
||||
********************************
|
||||
|
||||
DRIVER CLD
|
||||
|
||||
DO DEBUG
|
||||
LDA #$04
|
||||
STA SLOT
|
||||
LDA #$C4
|
||||
STA CURSLOT
|
||||
LDA #$40
|
||||
|
||||
ELSE
|
||||
JSR $FF58 ; find slot nr
|
||||
TSX
|
||||
LDA $0100,X
|
||||
STA CURSLOT ; $Cs
|
||||
AND #$0F
|
||||
STA SLOT ; $0s
|
||||
ASL A
|
||||
ASL A
|
||||
ASL A
|
||||
ASL A
|
||||
FIN
|
||||
|
||||
STA SLOT16 ; $s0
|
||||
TAX ; X holds now SLOT16
|
||||
BIT $CFFF
|
||||
JSR CARDDET
|
||||
BCC :INITED
|
||||
LDA #$27 ; no card inserted
|
||||
BRA :DONE
|
||||
|
||||
:INITED LDA #INITED ; check for init
|
||||
BIT SS,X
|
||||
BEQ :INIT
|
||||
|
||||
:CMD LDA DCMD ; get command
|
||||
CMP #0
|
||||
BEQ :STATUS
|
||||
CMP #1
|
||||
BEQ :READ
|
||||
CMP #2
|
||||
BEQ :WRITE
|
||||
CMP #3
|
||||
BEQ :FORMAT
|
||||
DO DEBUG
|
||||
CMP #$FF
|
||||
BEQ :TEST
|
||||
FIN
|
||||
LDA #1 ; unknown command
|
||||
|
||||
:DONE SEC
|
||||
RTS
|
||||
|
||||
:STATUS JMP STATUS
|
||||
:READ JMP READ
|
||||
:WRITE JMP WRITE
|
||||
:FORMAT JMP FORMAT
|
||||
:INIT JSR INIT
|
||||
BCS :DONE ; init failure
|
||||
BRA :CMD
|
||||
|
||||
DO DEBUG
|
||||
:TEST JMP TEST ; do device test
|
||||
FIN
|
||||
|
||||
|
||||
* Signature bytes
|
||||
|
||||
DS \ ; fill with zeroes
|
||||
DS -4 ; locate to $xxFC
|
||||
DW $FFFF ; 65535 blocks
|
||||
DB $17 ; Status bits
|
||||
DB #<DRIVER ; LSB of driver
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user