From cb97a5199b0297309be11bc7e93d84c596e57798 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 27 Jan 2024 09:05:47 +0100 Subject: added som IMC-2001 subsections for chargen40 and firmware --- content/hardware/imc-2001-chargen40.md | 88 ++++++++++++++++++++ content/hardware/imc-2001-firmware.md | 144 +++++++++++++++++++++++++++++++++ content/hardware/imc-2001.md | 5 ++ 3 files changed, 237 insertions(+) create mode 100644 content/hardware/imc-2001-chargen40.md create mode 100644 content/hardware/imc-2001-firmware.md (limited to 'content') diff --git a/content/hardware/imc-2001-chargen40.md b/content/hardware/imc-2001-chargen40.md new file mode 100644 index 0000000..5c567a6 --- /dev/null +++ b/content/hardware/imc-2001-chargen40.md @@ -0,0 +1,88 @@ ++++ +title = "IMC-2001 40 character mode" ++++ + +*A4-A6* on the schematics is the character ROM in a chip labelled +UMC UM2316-J127 8432, it is Intel 2716 EPROM compatible chip it seems. + +It can be read with the TL866 and returns the following 2K dump: + +[chargen.rom](/hardware/imc-2001/chargen.rom): Chargen 40-column ROM + +The official ROM +[3410036.BIN](http://www.applelogic.org/APPLEASICs.html) on +http://www.applelogic.org/APPLEASICs.html doesn't match +at all. The arangement of the characters is different and there are +lowercase characters in the clone ROM. + +I wrote a small program to show the contents of chargen.rom: + +``` +#!/usr/bin/tcc -run -Werror -DSDL_DISABLE_IMMINTRIN_H -I/usr/include/SDL2 -lSDL2 + +#include +#include +#include + +int main( int argc, char *argv[] ) +{ + FILE *f = fopen( "./chargen.rom", "r" ); + char *buf = malloc( 2 * 1024 ); + fread( buf, 2 * 1024, 1, f ); + + SDL_Renderer *renderer; + SDL_Window *window; + + SDL_Init( SDL_INIT_VIDEO ); + SDL_CreateWindowAndRenderer( 300, 200, 0, &window, &renderer ); + SDL_SetRenderDrawColor( renderer, 0, 0, 0, 0 ); + SDL_RenderClear( renderer ); + SDL_SetRenderDrawColor(renderer, 0xFF, 0xB0, 0, 255 ); + + int x = 0; + int y = 0; + for( int c = 0; c < 2 * 1024; c++ ) { + int v = buf[c] & 0x00ff; + for( int b = 0; b < 8; b++ ) { + if( v & 0x01 ) { + SDL_RenderDrawPoint( renderer, x, y ); + } + v >>= 1; + x++; + } + x -= 8; + y += 1; + if( ( (c+1) % 128 ) == 0 ) { + x += 10; + y = 0; + } + } + + SDL_RenderPresent( renderer ); + + int done = 0; + while( !done ) { + SDL_Event event; + SDL_PollEvent( &event ); + switch( event.type ) { + case SDL_QUIT: + case SDL_KEYDOWN: + done = 1; + break; + } + } + + + SDL_DestroyRenderer( renderer ); + SDL_DestroyWindow( window ); + SDL_Quit( ); + + free( buf ); + fclose( f ); + return 0; +} +``` + +And indeed I get: + +{{< figure src="/images/hardware/imc-2001/chargen.png" alt="character in the 40-char ROM" >}} diff --git a/content/hardware/imc-2001-firmware.md b/content/hardware/imc-2001-firmware.md new file mode 100644 index 0000000..b29aa8a --- /dev/null +++ b/content/hardware/imc-2001-firmware.md @@ -0,0 +1,144 @@ ++++ +title = "IMC-2001 Firmware" ++++ + +# 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 +#include +#include + +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 ;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. + diff --git a/content/hardware/imc-2001.md b/content/hardware/imc-2001.md index 54de32d..2abdabe 100644 --- a/content/hardware/imc-2001.md +++ b/content/hardware/imc-2001.md @@ -245,6 +245,11 @@ On the keyboard PCB there is a strange white connector with the following layout # Links +## Subtopics + +- [Chargen40](/hardware/imc-2001-chargen40): 40-column character mode +- [Firmware](/hardware/imc-2001-firmware): the monitor, Applesoft ROMs + ## Other IMC-2001 * [Mention of the IMC-2001](http://www.epocalc.net/php/liste_models.php?texte=&look=All+fields&yearmax=2018&nocomp=pc&cat=Apple+2+clone): -- cgit v1.2.3-54-g00ecf