From b77e1891cd14fa0e1e60b950749a302523736c88 Mon Sep 17 00:00:00 2001 From: Renee Harke Date: Sat, 16 Jan 2021 20:31:04 -0500 Subject: [PATCH] Support both old and new model 128s --- Makefile | 4 +- README.md | 43 ++++++++++++- src/{DUMPROMNEW.s => DUMPROM.s} | 106 +++++++++++++++++++++++++++----- src/STARTUP.bas | 74 +++++++++++++++++----- 4 files changed, 191 insertions(+), 36 deletions(-) rename src/{DUMPROMNEW.s => DUMPROM.s} (61%) diff --git a/Makefile b/Makefile index 400c9aa..e6c0aeb 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ VOLNAME=LASERDUMP attrs.PRODOS = FF0000 attrs.BASIC.SYSTEM = FF2000 attrs.STARTUP = FC0801 -attrs.DUMPROMNEW = 064000 +attrs.DUMPROM = 064000 # Add a file to a disk image with Cadius, using the attrs.* # map above for the file type/subtype. @@ -35,7 +35,7 @@ $(BDIR)/$(IMGNAME): \ $(RDIR)/PRODOS \ $(RDIR)/BASIC.SYSTEM \ $(LDIR)/STARTUP \ -$(LDIR)/DUMPROMNEW +$(LDIR)/DUMPROM rm -f $@ $(CADIUS) createvolume $@ $(VOLNAME) 140KB $(foreach f,$^,$(call addfile,$@,/$(VOLNAME),$f)) diff --git a/README.md b/README.md index e315c42..121d98f 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,51 @@ 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. +This utility will work on both "old" and "new" model Laser 128s, but the ROM map is quite different, so you must tell the tool which model you have. -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. +On the "old" models, you will need to manually toggle between Parallel and Serial to get both versions of the slot 1 ROM. You will be prompted to do this. -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. +On the "new" models, you should leave the switch in the Parallel position the whole time, otherwise you will get two copies of the serial option ROM and zero copies of the parallel option ROM. You must also ensure that slot 5 and 7 are set to Internal, or you will be dumping the ROMs from your attached cards (or random electrical noise). + +## Accuracy / known issues + +Output is correct for ROM version 2.9 (on an old model) and ROM version 6.0 (on a new model). + +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. The tool manually rewrites it. 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 +### "Old" Laser 128 + +``` +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 - 42FF = C100-C2FF (INTCXROMOFF, Parallel mode) +4300 - 43FF = empty (no ROM for slot 3) +4400 - 44FF = C400-C4FF (INTCXROMOFF) +4500 - 45FF = empty (slot 5 is always external) +4600 - 46FF = C600-C6FF (INTCXROMOFF) +4700 - 47FF = empty (slot 7 is always external) +4800 - 4FFF = C800-CFFF Slot 1 option ROM (INTCXROMOFF) +5000 - 50FF = empty (reserved for soft switches) +5100 - 51FF = C100-C2FF (INTCXROMOFF, Serial mode) +5200 - 57FF = empty (no alternate slot 2-7) +5800 - 5FFF = C800-CFFF Slot 2 option ROM +6000 - 67FF = empty (inaccessible?) +6800 - 6FFF = CC00-CFFF Slot 6 option ROM bank 1 +7000 - 77FF = empty (inaccessible?) +7800 - 7FFF = C800-CFFF Slot 6 option ROM bank 2 +``` + +Slot 6 option ROM bank 2 is empty in ROM 2.9, but it might be populated on other models. I've confirmed that it's accessible. + +### "New" Laser 128 (also EX and EX/2) + ``` 0000 - 00FF = empty (reserved for soft switches) 0100 - 07FF = C100-C7FF (INTCXROMON) diff --git a/src/DUMPROMNEW.s b/src/DUMPROM.s similarity index 61% rename from src/DUMPROMNEW.s rename to src/DUMPROM.s index 8de1454..5d72821 100644 --- a/src/DUMPROMNEW.s +++ b/src/DUMPROM.s @@ -56,7 +56,7 @@ MOVE := $fe2c sta $c0e8 .endmacro -; Fill some memory with $FF +; Fill some memory with $FF (up to 256 bytes) .macro fillff base, len .scope lda #$ff @@ -72,15 +72,22 @@ loop: sta base,y .org $4000 - ; jump table - jmp block0 - jmp block1 - jmp block2 - jmp block3 + ; jump table - "new" Laser 128 + jmp com0 + jmp com2 + jmp new4 + jmp new6 + + ; jump table - "old" Laser 128 + jmp com0 + jmp com2 + jmp old4 + jmp oldser + jmp old6 - ; $0000 - $1fff -block0: fillff $2000,0 ; $C000-C0FF empty (soft switches) + ; $0000 - $1fff, common to old and new models +com0: fillff $2000,0 ; $C000-C0FF empty (soft switches) sta INTCXROMON mv $2100,$c100,$c7ff ; $C100-C7FF from main ROM sta INTCXROMOFF @@ -98,13 +105,13 @@ block0: fillff $2000,0 ; $C000-C0FF empty (soft switches) rts - ; $2000 - 3fff -block1: mv $2000,$e000,$ffff ; E000-FFFF ROM + ; $2000 - 3fff, common to old and new models +com2: mv $2000,$e000,$ffff ; E000-FFFF ROM rts - ; $4000 - $5fff -block2: fillff $2000,0 ; $C000-C0FF empty (soft switches) + ; $4000 - $5fff, new models +new4: fillff $2000,0 ; $C000-C0FF empty (soft switches) sta SLOTC3ROMON mv $2100,$c100,$c7ff ; $C100-C7FF from slot ROM sta SLOTC3ROMOFF @@ -131,8 +138,8 @@ block2: fillff $2000,0 ; $C000-C0FF empty (soft switches) rts - ; $6000 - $7fff -block3: s7bank #$00 + ; $6000 - $7fff, new models +new6: s7bank #$00 mv $2000,$cc00,$cfff ; slot 7 option ROM bank 0 fillff $23f8,8 @@ -163,3 +170,74 @@ block3: s7bank #$00 fillff $3ff8,8 rts + + + ; $4000 - $5fff, old models +old4: fillff $2000,0 ; $C000-C0FF empty (soft switches) + mv $2100,$c100,$c7ff ; $C100-C7FF from slot ROM + fillff $2300,0 ; slot 3 does not exist + fillff $2500,0 ; slot 5 is always external + fillff $2700,0 ; slot 7 is always external + 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 + + fillff $3000,0 ; empty + fillff $3200,0 + fillff $3300,0 + fillff $3400,0 + fillff $3500,0 + fillff $3600,0 + fillff $3700,0 + + lda $cfff + lda $c200 + mv $3800,$c800,$cfff ; slot 2 option ROM + lda $cfff + fillff $3ff8,8 + + rts + + +oldser: mv $3100,$c100,$c1ff ; serial version of slot 1 + rts + + + ; $6000 - $7fff, old models +old6: fillff $2000,0 ; empty + fillff $2100,0 + fillff $2200,0 + fillff $2300,0 + fillff $2400,0 + fillff $2500,0 + fillff $2600,0 + fillff $2700,0 + + lda $cfff + lda $c600 + lda $c100 + mv $2800,$c800,$cfff ; slot 6 option ROM bank 1 + lda $cfff + fillff $2ff8,8 + + fillff $3000,0 ; empty + fillff $3100,0 + fillff $3200,0 + fillff $3300,0 + fillff $3400,0 + fillff $3500,0 + fillff $3600,0 + fillff $3700,0 + + lda $cfff + lda $c600 + lda $c200 + mv $3800,$c800,$cfff ; slot 6 option ROM bank 2 + lda $cfff + fillff $3ff8,8 + + rts diff --git a/src/STARTUP.bas b/src/STARTUP.bas index d7a7c87..ca97426 100644 --- a/src/STARTUP.bas +++ b/src/STARTUP.bas @@ -1,17 +1,57 @@ -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" +10 PRINT CHR$(4) "BLOAD DUMPROM" +20 PRINT "Laser 128 ROM Dumper Tool" +30 PRINT +40 PRINT "For new model, make sure slot 5 and 7" +50 PRINT "are set to INTERNAL!" +60 PRINT +70 PRINT "Choose model:" +80 PRINT " (1) Old model, black on silver badge" +90 PRINT " (2) New model, LASER in red" +100 PRINT " (Q) Quit" +110 PRINT +120 PRINT "Enter choice: "; +130 GET C$ +140 IF C$ = "1" THEN PRINT C$: PRINT: GOTO 1000 +150 IF C$ = "2" THEN PRINT C$: PRINT: GOTO 2000 +160 IF C$ = "Q" OR C$ = "q" THEN PRINT C$: PRINT: END +170 GOTO 130 +1000 PRINT "Make sure switch is set to PARALLEL" +1010 PRINT "and press any key: "; +1020 GET C$ +1030 PRINT: PRINT +1040 PRINT "Dumping $0000-$1FFF" +1050 CALL 16384+12 +1060 PRINT CHR$(4) "BSAVE ROM0000,A$2000,L$2000" +1070 PRINT "Dumping $2000-$3FFF" +1080 CALL 16384+15 +1090 PRINT CHR$(4) "BSAVE ROM2000,A$2000,L$2000" +1100 PRINT "Dumping $4000-$5FFF" +1110 CALL 16384+18 +1120 PRINT +1130 PRINT "Make sure switch is set to SERIAL" +1140 PRINT "and press any key: "; +1150 GET C$ +1160 PRINT: PRINT +1170 CALL 16384+21 +1180 PRINT CHR$(4) "BSAVE ROM4000,A$2000,L$2000" +1190 PRINT "Dumping $6000-$7FFF" +1200 CALL 16384+24 +1210 PRINT CHR$(4) "BSAVE ROM6000,A$2000,L$2000" +1220 END +2000 PRINT "Make sure switch is set to PARALLEL" +2010 PRINT "and press any key: "; +2020 GET C$ +2030 PRINT: PRINT +2040 PRINT "Dumping $0000-$1FFF" +2050 CALL 16384 +2060 PRINT CHR$(4) "BSAVE ROM0000,A$2000,L$2000" +2070 PRINT "Dumping $2000-$3FFF" +2080 CALL 16384+3 +2090 PRINT CHR$(4) "BSAVE ROM2000,A$2000,L$2000" +2100 PRINT "Dumping $4000-$5FFF" +2110 CALL 16384+6 +2120 PRINT CHR$(4) "BSAVE ROM4000,A$2000,L$2000" +2130 PRINT "Dumping $6000-$7FFF" +2140 CALL 16384+9 +2150 PRINT CHR$(4) "BSAVE ROM6000,A$2000,L$2000" +2160 END