forked from Apple-2-HW/ProDOS-ROM-Drive
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
|
||||
;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
|
||||
if SLOT1
|
||||
slot equ $01
|
||||
endif
|
||||
if SLOT2
|
||||
slot equ $02
|
||||
endif
|
||||
if SLOT3
|
||||
slot equ $03
|
||||
endif
|
||||
if SLOT4
|
||||
slot equ $04
|
||||
endif
|
||||
if SLOT5
|
||||
slot equ $05
|
||||
endif
|
||||
if SLOT6
|
||||
slot equ $06
|
||||
endif
|
||||
if SLOT7
|
||||
slot equ $07
|
||||
endif
|
||||
.ifdef SLOT1
|
||||
slot = $01
|
||||
.endif
|
||||
.ifdef SLOT2
|
||||
slot = $02
|
||||
.endif
|
||||
.ifdef SLOT3
|
||||
slot = $03
|
||||
.endif
|
||||
.ifdef SLOT4
|
||||
slot = $04
|
||||
.endif
|
||||
.ifdef SLOT5
|
||||
slot = $05
|
||||
.endif
|
||||
.ifdef SLOT6
|
||||
slot = $06
|
||||
.endif
|
||||
.ifdef SLOT7
|
||||
slot = $07
|
||||
.endif
|
||||
|
||||
;Calculate I/O addresses for this slot
|
||||
|
||||
slotwh equ $C081+slot*$10
|
||||
slotwl equ $C080+slot*$10
|
||||
slotrd equ $C080+slot*$10
|
||||
sdrive equ slot*$10
|
||||
slotwh = $C081+slot*$10
|
||||
slotwl = $C080+slot*$10
|
||||
slotrd = $C080+slot*$10
|
||||
sdrive = slot*$10
|
||||
|
||||
sram0 equ $478+slot
|
||||
sram1 equ $4F8+slot
|
||||
sram2 equ $578+slot
|
||||
sram3 equ $5F8+slot
|
||||
sram4 equ $678+slot
|
||||
sram5 equ $6F8+slot
|
||||
sram6 equ $778+slot
|
||||
sram7 equ $7F8+slot
|
||||
sram0 = $478+slot
|
||||
sram1 = $4F8+slot
|
||||
sram2 = $578+slot
|
||||
sram3 = $5F8+slot
|
||||
sram4 = $678+slot
|
||||
sram5 = $6F8+slot
|
||||
sram6 = $778+slot
|
||||
sram7 = $7F8+slot
|
||||
|
||||
;ProDOS defines
|
||||
|
||||
command equ $42 ;ProDOS command
|
||||
unit equ $43 ;7=drive 6-4=slot 3-0=not used
|
||||
buflo equ $44 ;low address of buffer
|
||||
bufhi equ $45 ;hi address of buffer
|
||||
blklo equ $46 ;low block
|
||||
blkhi equ $47 ;hi block
|
||||
ioerr equ $27 ;I/O error code
|
||||
nodev equ $28 ;no device connected
|
||||
wperr equ $2B ;write protect error
|
||||
command = $42 ;ProDOS command
|
||||
unit = $43 ;7=drive 6-4=slot 3-0=not used
|
||||
buflo = $44 ;low address of buffer
|
||||
bufhi = $45 ;hi address of buffer
|
||||
blklo = $46 ;low block
|
||||
blkhi = $47 ;hi block
|
||||
ioerr = $27 ;I/O error code
|
||||
nodev = $28 ;no device connected
|
||||
wperr = $2B ;write protect error
|
||||
|
||||
org $C000+slot*$100
|
||||
.org $C000+slot*$100
|
||||
;code is non-relocatable
|
||||
; but duplicated seven times,
|
||||
; once for each slot
|
||||
@ -68,7 +78,7 @@ wperr equ $2B ;write protect error
|
||||
|
||||
;display copyright message
|
||||
ldy #$00
|
||||
drawtxt lda text,y
|
||||
drawtxt: lda text,y
|
||||
beq boot ;check for NULL
|
||||
ora #$80 ;make it visible to the Apple
|
||||
sta $07D0,y ;put text on last line
|
||||
@ -76,7 +86,7 @@ drawtxt lda text,y
|
||||
bpl drawtxt
|
||||
|
||||
;load first two blocks and execute to boot
|
||||
boot lda #$01 ;set read command
|
||||
boot: lda #$01 ;set read command
|
||||
sta command
|
||||
lda #sdrive ;set slot and unit
|
||||
sta unit
|
||||
@ -101,14 +111,14 @@ boot lda #$01 ;set read command
|
||||
jmp $801 ;execute the block
|
||||
|
||||
;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
|
||||
beq docmd ;yep, do command
|
||||
sec ;nope, set device not connected
|
||||
lda #nodev
|
||||
rts ;go back to ProDOS
|
||||
|
||||
docmd lda command ;get ProDOS command
|
||||
docmd: lda command ;get ProDOS command
|
||||
beq getstat ;command 0 is GetStatus
|
||||
cmp #$01 ;
|
||||
beq readblk ;command 1 is ReadBlock
|
||||
@ -116,13 +126,13 @@ docmd lda command ;get ProDOS command
|
||||
lda #wperr ;write protect error
|
||||
rts ;go back to ProDOS
|
||||
|
||||
getstat clc ;send back status
|
||||
getstat: clc ;send back status
|
||||
lda #$00 ;good status
|
||||
ldx #$00 ;1024 blocks
|
||||
ldy #$04 ;
|
||||
rts
|
||||
|
||||
readblk lda blkhi ;get hi block
|
||||
readblk: lda blkhi ;get hi block
|
||||
asl a ;shift up to top 3 bits
|
||||
asl a ;since that's all the high
|
||||
asl a ;blocks we can handle
|
||||
@ -165,15 +175,15 @@ readblk lda blkhi ;get hi block
|
||||
;This gets 256 bytes from the ROM card
|
||||
;assuming high latch value is in sram0
|
||||
;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
|
||||
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
|
||||
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
|
||||
iny
|
||||
inx
|
||||
@ -186,10 +196,19 @@ loop16 lda slotrd,x ;get a byte
|
||||
|
||||
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
|
||||
db 0,0 ;0000 blocks = check status
|
||||
db 3 ;bit 0=read 1=status
|
||||
db entry&$00FF ;low byte of entry
|
||||
; These bytes need to be at the top of the 256 byte firmware as ProDOS
|
||||
; uses these to find the entry point and drive capabilities
|
||||
|
||||
; 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