mirror of
https://github.com/tjboldt/ProDOS-ROM-Drive.git
synced 2024-06-07 04:29:29 +00:00
Update assembler code to work with modern version of cc65 tools
This commit is contained in:
parent
336615f3af
commit
9667fda1e4
|
@ -3,59 +3,69 @@
|
||||||
;This allows the card to work in any slot without
|
;This allows the card to work in any slot without
|
||||||
;having to write space consuming relocatable code.
|
;having to write space consuming relocatable code.
|
||||||
|
|
||||||
|
;Install cc65 (on Ubuntu this is: sudo apt install cc65)
|
||||||
|
;Execute the following commands to generate the binary:
|
||||||
|
;ca65 Firmware.asm -D SLOT1 -o slot1.o
|
||||||
|
;ca65 Firmware.asm -D SLOT2 -o slot2.o
|
||||||
|
;ca65 Firmware.asm -D SLOT3 -o slot3.o
|
||||||
|
;ca65 Firmware.asm -D SLOT4 -o slot4.o
|
||||||
|
;ca65 Firmware.asm -D SLOT5 -o slot5.o
|
||||||
|
;ca65 Firmware.asm -D SLOT6 -o slot6.o
|
||||||
|
;ca65 Firmware.asm -D SLOT7 -o slot7.o
|
||||||
|
;ld65 -t none slot1.o slot2.o slot3.o slot4.o slot5.o slot6.o slot7.o -o Firmware.bin
|
||||||
|
|
||||||
;Determine which slot we want by command-line define
|
;Determine which slot we want by command-line define
|
||||||
if SLOT1
|
.ifdef SLOT1
|
||||||
slot equ $01
|
slot = $01
|
||||||
endif
|
.endif
|
||||||
if SLOT2
|
.ifdef SLOT2
|
||||||
slot equ $02
|
slot = $02
|
||||||
endif
|
.endif
|
||||||
if SLOT3
|
.ifdef SLOT3
|
||||||
slot equ $03
|
slot = $03
|
||||||
endif
|
.endif
|
||||||
if SLOT4
|
.ifdef SLOT4
|
||||||
slot equ $04
|
slot = $04
|
||||||
endif
|
.endif
|
||||||
if SLOT5
|
.ifdef SLOT5
|
||||||
slot equ $05
|
slot = $05
|
||||||
endif
|
.endif
|
||||||
if SLOT6
|
.ifdef SLOT6
|
||||||
slot equ $06
|
slot = $06
|
||||||
endif
|
.endif
|
||||||
if SLOT7
|
.ifdef SLOT7
|
||||||
slot equ $07
|
slot = $07
|
||||||
endif
|
.endif
|
||||||
|
|
||||||
;Calculate I/O addresses for this slot
|
;Calculate I/O addresses for this slot
|
||||||
|
|
||||||
slotwh equ $C081+slot*$10
|
slotwh = $C081+slot*$10
|
||||||
slotwl equ $C080+slot*$10
|
slotwl = $C080+slot*$10
|
||||||
slotrd equ $C080+slot*$10
|
slotrd = $C080+slot*$10
|
||||||
sdrive equ slot*$10
|
sdrive = slot*$10
|
||||||
|
|
||||||
sram0 equ $478+slot
|
sram0 = $478+slot
|
||||||
sram1 equ $4F8+slot
|
sram1 = $4F8+slot
|
||||||
sram2 equ $578+slot
|
sram2 = $578+slot
|
||||||
sram3 equ $5F8+slot
|
sram3 = $5F8+slot
|
||||||
sram4 equ $678+slot
|
sram4 = $678+slot
|
||||||
sram5 equ $6F8+slot
|
sram5 = $6F8+slot
|
||||||
sram6 equ $778+slot
|
sram6 = $778+slot
|
||||||
sram7 equ $7F8+slot
|
sram7 = $7F8+slot
|
||||||
|
|
||||||
;ProDOS defines
|
;ProDOS defines
|
||||||
|
|
||||||
command equ $42 ;ProDOS command
|
command = $42 ;ProDOS command
|
||||||
unit equ $43 ;7=drive 6-4=slot 3-0=not used
|
unit = $43 ;7=drive 6-4=slot 3-0=not used
|
||||||
buflo equ $44 ;low address of buffer
|
buflo = $44 ;low address of buffer
|
||||||
bufhi equ $45 ;hi address of buffer
|
bufhi = $45 ;hi address of buffer
|
||||||
blklo equ $46 ;low block
|
blklo = $46 ;low block
|
||||||
blkhi equ $47 ;hi block
|
blkhi = $47 ;hi block
|
||||||
ioerr equ $27 ;I/O error code
|
ioerr = $27 ;I/O error code
|
||||||
nodev equ $28 ;no device connected
|
nodev = $28 ;no device connected
|
||||||
wperr equ $2B ;write protect error
|
wperr = $2B ;write protect error
|
||||||
|
|
||||||
org $C000+slot*$100
|
.org $C000+slot*$100
|
||||||
;code is non-relocatable
|
;code is non-relocatable
|
||||||
; but duplicated seven times,
|
; but duplicated seven times,
|
||||||
; once for each slot
|
; once for each slot
|
||||||
|
@ -68,7 +78,7 @@ wperr equ $2B ;write protect error
|
||||||
|
|
||||||
;display copyright message
|
;display copyright message
|
||||||
ldy #$00
|
ldy #$00
|
||||||
drawtxt lda text,y
|
drawtxt: lda text,y
|
||||||
beq boot ;check for NULL
|
beq boot ;check for NULL
|
||||||
ora #$80 ;make it visible to the Apple
|
ora #$80 ;make it visible to the Apple
|
||||||
sta $07D0,y ;put text on last line
|
sta $07D0,y ;put text on last line
|
||||||
|
@ -76,7 +86,7 @@ drawtxt lda text,y
|
||||||
bpl drawtxt
|
bpl drawtxt
|
||||||
|
|
||||||
;load first two blocks and execute to boot
|
;load first two blocks and execute to boot
|
||||||
boot lda #$01 ;set read command
|
boot: lda #$01 ;set read command
|
||||||
sta command
|
sta command
|
||||||
lda #sdrive ;set slot and unit
|
lda #sdrive ;set slot and unit
|
||||||
sta unit
|
sta unit
|
||||||
|
@ -101,14 +111,14 @@ boot lda #$01 ;set read command
|
||||||
jmp $801 ;execute the block
|
jmp $801 ;execute the block
|
||||||
|
|
||||||
;This is the ProDOS entry point for this card
|
;This is the ProDOS entry point for this card
|
||||||
entry lda #sdrive ;unit number is $n0 - n = slot
|
entry: lda #sdrive ;unit number is $n0 - n = slot
|
||||||
cmp unit ;make sure same as ProDOS
|
cmp unit ;make sure same as ProDOS
|
||||||
beq docmd ;yep, do command
|
beq docmd ;yep, do command
|
||||||
sec ;nope, set device not connected
|
sec ;nope, set device not connected
|
||||||
lda #nodev
|
lda #nodev
|
||||||
rts ;go back to ProDOS
|
rts ;go back to ProDOS
|
||||||
|
|
||||||
docmd lda command ;get ProDOS command
|
docmd: lda command ;get ProDOS command
|
||||||
beq getstat ;command 0 is GetStatus
|
beq getstat ;command 0 is GetStatus
|
||||||
cmp #$01 ;
|
cmp #$01 ;
|
||||||
beq readblk ;command 1 is ReadBlock
|
beq readblk ;command 1 is ReadBlock
|
||||||
|
@ -116,13 +126,13 @@ docmd lda command ;get ProDOS command
|
||||||
lda #wperr ;write protect error
|
lda #wperr ;write protect error
|
||||||
rts ;go back to ProDOS
|
rts ;go back to ProDOS
|
||||||
|
|
||||||
getstat clc ;send back status
|
getstat: clc ;send back status
|
||||||
lda #$00 ;good status
|
lda #$00 ;good status
|
||||||
ldx #$00 ;1024 blocks
|
ldx #$00 ;1024 blocks
|
||||||
ldy #$04 ;
|
ldy #$04 ;
|
||||||
rts
|
rts
|
||||||
|
|
||||||
readblk lda blkhi ;get hi block
|
readblk: lda blkhi ;get hi block
|
||||||
asl a ;shift up to top 3 bits
|
asl a ;shift up to top 3 bits
|
||||||
asl a ;since that's all the high
|
asl a ;since that's all the high
|
||||||
asl a ;blocks we can handle
|
asl a ;blocks we can handle
|
||||||
|
@ -165,15 +175,15 @@ readblk lda blkhi ;get hi block
|
||||||
;This gets 256 bytes from the ROM card
|
;This gets 256 bytes from the ROM card
|
||||||
;assuming high latch value is in sram0
|
;assuming high latch value is in sram0
|
||||||
;and low latch value is in sram1
|
;and low latch value is in sram1
|
||||||
get256 ldy #$00 ;clear buffer counter
|
get256: ldy #$00 ;clear buffer counter
|
||||||
lda sram0 ;get high latch value
|
lda sram0 ;get high latch value
|
||||||
sta slotwh ;set high latch for card
|
sta slotwh ;set high latch for card
|
||||||
|
|
||||||
loop256 ldx #$00 ;clear port counter
|
loop256: ldx #$00 ;clear port counter
|
||||||
lda sram1 ;get low latch value
|
lda sram1 ;get low latch value
|
||||||
sta slotwl ;set low latch
|
sta slotwl ;set low latch
|
||||||
|
|
||||||
loop16 lda slotrd,x ;get a byte
|
loop16: lda slotrd,x ;get a byte
|
||||||
sta (buflo),y ;write into the buffer
|
sta (buflo),y ;write into the buffer
|
||||||
iny
|
iny
|
||||||
inx
|
inx
|
||||||
|
@ -186,10 +196,19 @@ loop16 lda slotrd,x ;get a byte
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
text db "ROM-Drive (c)1998-2019 Terence J. Boldt", 0
|
text: .byte "ROM-Drive (c)1998-2019 Terence J. Boldt", 0
|
||||||
|
|
||||||
org $C0FC+slot*$100
|
; These bytes need to be at the top of the 256 byte firmware as ProDOS
|
||||||
db 0,0 ;0000 blocks = check status
|
; uses these to find the entry point and drive capabilities
|
||||||
db 3 ;bit 0=read 1=status
|
|
||||||
db entry&$00FF ;low byte of entry
|
; In 1998, cc65 used to allow this but now with ld65 removes the padded bytes
|
||||||
|
; .org $C0FC+slot*$100
|
||||||
|
|
||||||
|
; CAUTION: These are padding bytes entered manually, add or remove
|
||||||
|
; to match if changing code. Firmware must be 256 bytes
|
||||||
|
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||||
|
|
||||||
|
.byte 0,0 ;0000 blocks = check status
|
||||||
|
.byte 3 ;bit 0=read 1=status
|
||||||
|
.byte entry&$00FF ;low byte of entry
|
||||||
|
|
||||||
|
|
BIN
Firmware/Firmware.bin
Normal file
BIN
Firmware/Firmware.bin
Normal file
Binary file not shown.
1
Firmware/Warning.asm
Normal file
1
Firmware/Warning.asm
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.byte "Do not overwrite any of blocks after this point as it is used for the firmware. There are 7 copies of the 256 byte firmware, one for each slot due to 6502 code being non-relocatable. Have fun and feel free to improve on the hardware / sofware. --- Terence"
|
10
Firmware/assemble.sh
Executable file
10
Firmware/assemble.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
ca65 Warning.asm -o warning.o
|
||||||
|
ca65 Firmware.asm -D SLOT1 -o slot1.o
|
||||||
|
ca65 Firmware.asm -D SLOT2 -o slot2.o
|
||||||
|
ca65 Firmware.asm -D SLOT3 -o slot3.o
|
||||||
|
ca65 Firmware.asm -D SLOT4 -o slot4.o
|
||||||
|
ca65 Firmware.asm -D SLOT5 -o slot5.o
|
||||||
|
ca65 Firmware.asm -D SLOT6 -o slot6.o
|
||||||
|
ca65 Firmware.asm -D SLOT7 -o slot7.o
|
||||||
|
ld65 -t none warning.o slot1.o slot2.o slot3.o slot4.o slot5.o slot6.o slot7.o -o Firmware.bin
|
Loading…
Reference in New Issue
Block a user