summaryrefslogtreecommitdiff
path: root/content/hardware/imc-2001-firmware.md
diff options
context:
space:
mode:
Diffstat (limited to 'content/hardware/imc-2001-firmware.md')
-rw-r--r--content/hardware/imc-2001-firmware.md185
1 files changed, 185 insertions, 0 deletions
diff --git a/content/hardware/imc-2001-firmware.md b/content/hardware/imc-2001-firmware.md
new file mode 100644
index 0000000..8e4aabc
--- /dev/null
+++ b/content/hardware/imc-2001-firmware.md
@@ -0,0 +1,185 @@
++++
+title = "IMC-2001 Firmware"
++++
+
+{{< figure src="/images/hardware/imc-2001/romboard.jpg" alt="IMC-2001 ROM card" >}}
+
+# Intro
+
+The ROM consists of two ROM chips. The bigger chip labelled "ROM1" was
+broken (it got really hot) and could not be read (it returned all zeroes).
+It has no markings on it, so one can only guess it is something AT28C256
+compatible.
+
+The ROMs sit in the special "slot 0". The board has two other
+unused ROM sockets and an arrow pointing to an additional ROM socket on
+the motherboard itself.
+
+On the schematics the slot is not labelled "slot 0" but "ROM" and this
+gives away it's special purpose for the machine.
+
+# ROM 2
+
+ROM 2 (sticker with hand-written red 2 on top) is a Mitsubishi M5L2732K,
+32k-bit, 4k-ROM, seems very ok during operation (the carvings say
+"M5L2732K, 83080L, JAPAN").
+
+## lower-case patch
+
+Comparing ROM2 to the standard Apple autostart ROM
+(https://6502disassembly.com/a2-rom/AutoF8ROM.html) we see only one difference at:
+
+```
+FD80 (F800+580)
+
+AutoF8ROM
+00000580 90 02 29 df 9d 00 02 c9 8d d0 b2 20 9c fc a9 8d |..)........ ....|
+monitor.rom:
+00000580 90 02 ea ea 9d 00 02 c9 8d d0 b2 20 9c fc a9 8d |........... ....|
+```
+
+```
+fd80: 90 02 bcc ADDINP
+fd82: 29 df and #$df ;shift to upper case
+fd84: 9d 00 02 ADDINP sta IN,x
+fd87: c9 8d cmp #$8d
+fd89: d0 b2 bne NOTCR
+fd8b: 20 9c fc CROUT1 jsr CLREOL
+fd8e: a9 8d CROUT lda #$8d
+fd90: d0 5b bne COUT
+```
+
+*EA EA* are 2 nops where the *and #$df* is. This seems to do away with
+uppercasing the byte coming from the keyboard, so that lower-case character
+work.
+
+# ROM 1
+
+ROM 1 is hard to guess, what it originally contained (as mine got fried).
+
+# addressing mode
+
+I put back the original Autostart ROM, the addressing on the PCB is a little
+bit weird. As the monitor was working I could write a test ROM with
+
+```
+#!/usr/bin/tcc -run -Werror
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main( int argc, char *argv[] )
+{
+ FILE *f = fopen( "./pattern.rom", "w" );
+ char *buf = malloc( 1024 );
+ for( int i = 0; i < 32; i++ ) {
+ memset( buf, i, 1024 );
+ fwrite( buf, 1024, 1, f );
+ }
+ fclose( f );
+ free( buf );
+ return 0;
+}
+```
+
+and get the following pattern in the monitor:
+
+```
+D000 1C
+D400 1D
+D800 1E
+DC00 1F
+E000 18
+E400 19
+E800 1A
+EC00 1B
+```
+
+So the replacement AT28C256 is arranged as follows:
+
+```
+0x6000 18 must contain the second 4k of the apple rom starting with e000 (24k)
+0x7000 1c must contain the first 4k of the apple rom d000
+```
+
+So I ended up doing this:
+
+```
+dd if=/dev/zero of=zero1 bs=1 count=24576
+dd if=Applesoft of=apple1 bs=1 skip=4096 count=4096
+dd if=Applesoft of=apple2 bs=1 count=4096
+cat zero1 apple1 apple2 > newrom1.rom
+```
+
+## Unkown difference
+
+When I watched the series on the Apple clone from Adrian's Digital Basement
+(he has a nice 3 part mini-series on the fixing of an Apple clone of unknown
+origin) I noticed the following difference:
+
+ROMS he published 'Apple\ II\ Clone\ ROM\ E0\ 300854cc.bin' which
+has one single difference in the E000 ROM:
+
+```
+ ; Convert FAC to integer. Must be -32767 <= FAC <= 32767.
+e10c: a5 9d AYINT lda FAC ;exponent of value in FAC
+e10e: c9 90 cmp #$90 ;abs(value) < 32768?
+e110: 90 09 bcc MI2 ;yes, okay for integer
+e112: a9 fe lda #<NEG32768 ;no; next few lines are supposed
+e114: a0 e0 ldy #>NEG32768 ;to allow -32768 ($8000), but do not!
+e116: 20 b2 eb jsr FCOMP ;because compared to -32768.00049
+ ; <<< BUG: A=-32768.00049:A%=A is accepted, but PRINT A,A% shows that A=-
+ ; 32768.0005 (ok), A%=32767 (wrong!) >>>
+```
+
+instead of *a0e0* it has *a0e5*
+
+```
+ ; <<< meant to be -32768, which would be 9080000000 >>>
+ ; <<< 1 byte short, so picks up $20 from next instruction >>>
+e0fe: 90 80 00 00 NEG32768 .bulk $90,$80,$00,$00 ;-32768.00049 in floating point
+```
+
+maybe the variable got moved to *e5fe* for some reasons? hard to tell, especially
+as the other ROMs have no differences. I kept mine on the original autostart ROM.
+
+## PIN Layout
+
+Found on https://forum.classic-computing.de/forum/index.php?thread/11666-apple-clon-gtac-fragen/&postID=401752#post457130
+
+```
+Slot Rom1 Rom2 Slot Rom1 Rom2
+
+Pin Pin
+
+26 12 14-12 25 28 24
+27 20,18 24
+28 22 23
+29 22
+30 21
+31 20
+32 19
+33 18
+34 17
+35 16
+36 15
+37 14 2
+38 13 23
+39 12 20
+40 11 24
+41 10 25 23
+42 9 3 1
+43 8 4 2
+44 7 5 3
+45 6 6 4
+46 5 7 5
+47 4 8 6
+48 3 9 7
+49 2 PIN10 8
+50 1
+```
+
+## Links
+
+* https://forum.classic-computing.de/forum/index.php?thread/11666-apple-clon-gtac-fragen/&postID=401752#post457130