summaryrefslogtreecommitdiff
path: root/content/hardware/imc-2001-chargen40.md
blob: 84bf54aef7689e12af48297a0c26eaf88f37b145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
+++
title = "IMC-2001 40 character mode"
+++

{{< figure src="/images/hardware/imc-2001/chargen.png" alt="character in the 40-char ROM" >}}

*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 <stdio.h>
#include <stdlib.h>
#include <SDL.h>

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" >}}