Initial commit, seems to work on my 128EX

This commit is contained in:
Renee Harke 2021-01-16 00:39:27 -05:00
commit ff75d6c0db
6 changed files with 282 additions and 0 deletions

56
Makefile Normal file
View File

@ -0,0 +1,56 @@
# https://github.com/AppleCommander/bastools/tree/master/tools/bt
BT=bt
# https://github.com/mach-kernel/cadius
CADIUS=cadius
# https://cc65.github.io/
CA65=ca65
LD65=ld65
BDIR=build
ODIR=$(BDIR)/obj
LDIR=$(BDIR)/lib
SDIR=src
RDIR=res
IMGNAME=laserdump.po
VOLNAME=LASERDUMP
# 04=TXT, 06=BIN, FC=BAS, FF=SYS
attrs.PRODOS = FF0000
attrs.BASIC.SYSTEM = FF2000
attrs.STARTUP = FC0801
attrs.DUMPROMNEW = 064000
# Add a file to a disk image with Cadius, using the attrs.*
# map above for the file type/subtype.
define addfile
cp $3 $3\#$(attrs.$(notdir $3)) ;
$(CADIUS) addfile $1 $2 $3\#$(attrs.$(notdir $3)) ;
rm $3\#$(attrs.$(notdir $3)) ;
endef
$(BDIR)/$(IMGNAME): \
$(RDIR)/PRODOS \
$(RDIR)/BASIC.SYSTEM \
$(LDIR)/STARTUP \
$(LDIR)/DUMPROMNEW
rm -f $@
$(CADIUS) createvolume $@ $(VOLNAME) 140KB
$(foreach f,$^,$(call addfile,$@,/$(VOLNAME),$f))
$(ODIR)/%.o: $(SDIR)/%.s
mkdir -p $(ODIR)
$(CA65) -o $@ $^
$(LDIR)/%: $(ODIR)/%.o
mkdir -p $(LDIR)
$(LD65) -t none -o $@ $^
$(LDIR)/%: $(SDIR)/%.bas
mkdir -p $(LDIR)
$(BT) -o $@ $^
clean:
rm -rf build

44
README.md Normal file
View File

@ -0,0 +1,44 @@
# Laser 128 ROM dumper
This dumps the ROM from a Laser 128 while the system is live. Useful if you don't have an EEPROM programmer/reader of your own.
I've only tested this on "new style" Laser 128s, with the red badge on the case. The old black and silver badged models might have a different ROM layout, I'm not sure. It wouldn't surprise me, they're radically different pieces of hardware.
You need to have the Parallel/Serial switch set to Parallel to run. The reason is that the serial firmware for slot 1 is really just a copy of slot 2, so if you have the switch set to Serial, then you get two copies of the serial option ROM and zero copies of the parallel option ROM.
The only part of this I don't quite understand is that 16 bytes from slot 1 don't end up matching the original ROM. They should be all $FF, but there is an odd pattern there instead. I suspect it is either (a) some convoluted logic with the Parallel/Serial switch or (b) something to do with the port configuration you can set by holding "P" while powering up the machine.
## ROM layout
```
0000 - 00FF = empty (reserved for soft switches)
0100 - 07FF = C100-C7FF (INTCXROMON)
0800 - 0FFF = C800-CFFF slot 1 option ROM (INTCXROMON)
1000 - 1FFF = D000-DFFF ROM
2000 - 2FFF = E000-EFFF ROM
3000 - 3FFF = F000-FFFF ROM
4000 - 40FF = empty (reserved for soft switches)
4100 - 47FF = C100-C7FF (INTCXROMOFF, SLOTC3ROMON)
4800 - 4FFF = C800-CFFF Slot 1 option ROM (INTCXROMOFF)
5000 - 57FF = C800-CFFF Slot 5 option ROM
5800 - 5FFF = C800-CFFF Slot 2 option ROM
6000 - 63FF = CB00-CFFF Slot 7 option ROM bank 1
6400 - 67FF = CB00-CFFF Slot 7 option ROM bank 2
6800 - 6BFF = CB00-CFFF Slot 7 option ROM bank 3
6C00 - 6FFF = CB00-CFFF Slot 7 option ROM bank 4
7000 - 73FF = CB00-CFFF Slot 7 option ROM bank 5
7400 - 77FF = CB00-CFFF Slot 7 option ROM bank 6
7800 - 7FFF = C800-CFFF Slot 6 option ROM / CB00-CFFF Slot 7 option ROM bank 7+8
```
There's an overlap because the slot 7 banking register uses 3 bits, which gives you 8 banks, but they only use 6. The other two really belong to the slot 7 option ROM. C800-C3FF for slot 7 is actually RAM dedicated to the disk controller.
## License
Copyright 2021 Renee Harke
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

BIN
res/BASIC.SYSTEM Normal file

Binary file not shown.

BIN
res/PRODOS Normal file

Binary file not shown.

165
src/DUMPROMNEW.s Normal file
View File

@ -0,0 +1,165 @@
; Copyright 2021 Renee Harke
;
; Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
; associated documentation files (the "Software"), to deal in the Software without restriction,
; including without limitation the rights to use, copy, modify, merge, publish, distribute,
; sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in all copies or
; substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
; NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
; DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.setcpu "65C02"
DEST := $42
SRC1 := $3c
SRC2 := $3e
INTCXROMOFF := $c006
INTCXROMON := $c007
SLOTC3ROMOFF := $c00a
SLOTC3ROMON := $c00b
MOVE := $fe2c
; Move the block of memory srcbegin:srcend to dest
.macro mv dest, srcbegin, srcend
lda #<dest
sta DEST
lda #>dest
sta DEST+1
lda #<srcbegin
sta SRC1
lda #>srcbegin
sta SRC1+1
lda #<srcend
sta SRC2
lda #>srcend
sta SRC2+1
ldy #$00
jsr MOVE
.endmacro
; Bank in a particular slot 7 ROM bank at CC00-CFFF
; Bank is in bits 4-6, so $00, $10, $20, ... $70.
.macro s7bank bank
lda $cfff
lda $c700
lda $c0e8
lda $c0ee
lda $c0ed
lda bank
sta $c0e8
.endmacro
; Fill some memory with $FF
.macro fillff base, len
.scope
lda #$ff
ldy #$00
loop: sta base,y
iny
cpy #len
bne loop
.endscope
.endmacro
.org $4000
; jump table
jmp block0
jmp block1
jmp block2
jmp block3
; $0000 - $1fff
block0: fillff $2000,0 ; $C000-C0FF empty (soft switches)
sta INTCXROMON
mv $2100,$c100,$c7ff ; $C100-C7FF from main ROM
sta INTCXROMOFF
lda $cfff
lda $c100
sta INTCXROMON
mv $2800,$c800,$cfff ; slot 1 option ROM alternate
sta INTCXROMOFF
lda $cfff
fillff $2ff8,8
mv $3000,$d000,$dfff ; D000-DFFF ROM
rts
; $2000 - 3fff
block1: mv $2000,$e000,$ffff ; E000-FFFF ROM
rts
; $4000 - $5fff
block2: fillff $2000,0 ; $C000-C0FF empty (soft switches)
sta SLOTC3ROMON
mv $2100,$c100,$c7ff ; $C100-C7FF from slot ROM
sta SLOTC3ROMOFF
fillff $21c0,16 ; not sure, something funky with the ser/par logic
lda $cfff
lda $c100
mv $2800,$c800,$cfff ; slot 1 option ROM
lda $cfff
fillff $2ff8,8
lda $cfff
lda $c500
mv $3000,$c800,$cfff ; slot 5 option ROM
lda $cfff
fillff $37f8,8
lda $cfff
lda $c200
mv $3800,$c800,$cfff ; slot 2 option ROM
lda $cfff
fillff $3ff8,8
rts
; $6000 - $7fff
block3: s7bank #$00
mv $2000,$cc00,$cfff ; slot 7 option ROM bank 0
fillff $23f8,8
s7bank #$10
mv $2400,$cc00,$cfff ; slot 7 option ROM bank 1
fillff $27f8,8
s7bank #$20
mv $2800,$cc00,$cfff ; slot 7 option ROM bank 2
fillff $2bf8,8
s7bank #$30
mv $2c00,$cc00,$cfff ; slot 7 option ROM bank 3
fillff $2ff8,8
s7bank #$40
mv $3000,$cc00,$cfff ; slot 7 option ROM bank 4
fillff $33f8,8
s7bank #$50
mv $3400,$cc00,$cfff ; slot 7 option ROM bank 5
fillff $37f8,8
lda $cfff
lda $c600
mv $3800,$c800,$cfff ; slot 6 option ROM
lda $cfff
fillff $3ff8,8
rts

17
src/STARTUP.bas Normal file
View File

@ -0,0 +1,17 @@
10 PRINT CHR$(4) "BLOAD DUMPROMNEW"
20 PRINT "Make sure slot 5 and 7 are"
30 PRINT "set to internal, and slot 1"
40 PRINT "is set to Parallel!"
50 PRINT
60 PRINT "Dumping $0000-$1FFF"
70 CALL 16384
80 PRINT CHR$(4) "BSAVE ROM0000,A$2000,L$2000"
90 PRINT "Dumping $2000-$3FFF"
100 CALL 16384+3
110 PRINT CHR$(4) "BSAVE ROM2000,A$2000,L$2000"
120 PRINT "Dumping $4000-$5FFF"
130 CALL 16384+6
140 PRINT CHR$(4) "BSAVE ROM4000,A$2000,L$2000"
150 PRINT "Dumping $6000-$7FFF"
160 CALL 16384+9
170 PRINT CHR$(4) "BSAVE ROM6000,A$2000,L$2000"