• Please review our updated Terms and Rules here

1802 on KIM Uno

ClausB

Experienced Member
Joined
Jan 22, 2012
Messages
180
I bought a KIM Uno from Oscar at VCFMW years ago. I just retired and finally found the time to build it. I'm running his 1802 Pixie code with a SSD1315 OLED and find that the page displays are shifted up 4 rows with wrap-around. I added this kludge to the paintscreen() inner loop:
uint8_t a = line*32 + block + (3-i)*(8) - 32;
A[i*2+1] = A[i*2] = ram[(pixiePage*0x0100)+a];
It doesn't fix the root cause, but it works.
 
Oscar's site says CHIP-8 is too big for the Uno, but it's only 1/2K and Weisbecker's 1978 Rocket game is only 1/8K, so they should fit.

I found those binaries among Emma's files and put them in place of the Seconds demo code (#5). Doesn't run. I found 3 problems:

1. CHIP-8 expects RAM size in R1 at startup. This emulator doesn't provide that, apparently, so I patched the binary with LDI 3 in place of GHI 1 at 0000.

2. Now it runs but stops at 00AC, an IDL instruction, which the emulator takes as a stop. This is for the display interrupt which is unneeded under Oscar's display emulation. I patched the binary with NOP at 00AC and also at 004C, which starts the interrupt.

3. Now it runs and animates the game on page 3, but it doesn't respond to keys. A problem for another day...

Thanks to Laurence Scotford for documenting CHIP-8.
 
Last edited:
3. The emulator doesn't reproduce Elf keypad scanning, rather it scans the Uno keys in Arduino code. So flag EF3 never gets set. I had to add some logic to set and clear it in scanKeys().

4. The emulator does not maintain the timer, probably because the interrupt is not supported. I patched the game code.

5. The game's score digit never appears. For some reason the ROM character set was zeroed out, so I had to restore it.

So CHIP-8 is running the 1978 Rocket game on the KIM Uno, for what it's worth. The timing isn't right and the sprites appear torn sometimes, but there it is.
 
4. Patching the game was not useful in the long run, so I added the timer logic to scanKeys() instead.

Next I'd like to move pages 0 and 1 to Uno ROM to free up RAM for longer CHIP-8 games.
 
I did so and available program RAM is now over 600 bytes. I loaded the Tetris game and it runs but doesn't respond to keypresses. Looks like the CHIP-8 keypad instructions Ex do work but Fx does not. Turns out that the Monitor ROM was gutted worse than I thought. Not only the character set but also the keypad routine were patched over with something else. Ugh.
 
Oops that wasn't the problem Tetris doesn't use Fx. I had to improve my keypad logic to get it to work. Now it does work but the Fx problem remains.

How much fun is it playing Tetris though a magnifying glass?
 

Attachments

  • 20230117_105216.jpg
    20230117_105216.jpg
    476.9 KB · Views: 8
Thanks, @Oscar, I'm enjoying your kit. In the 70s I saw BYTE ads for Elfs and the VIP and wondered about them. Now I can play!
 
I was unfairly critical above of the ROM. I was expecting the VIP monitor but what is provided is the Elf monitor IDIOT instead. Apologies. I'll try adding the VIP ROM...
 
Got the VIP ROM from Emma02. Working so far. Need to test more CHIP-8 programs next, or maybe write one.
 
Tetris sometimes shows screen corruption near the top when a new piece appears, though it does not crash. Even though it fits comfortably in RAM, I wondered whether it was addressing more than 1K, so I added a trap to memwrite() and found that it does use a few bytes in pages 7 and 8 for temp storage. Those got mirrored to pages 3 and 4 which corrupted some sprite data in page 3. So I patched the game code to use page 4 instead of 7 and 8, and now it's solid.

Now I'm trying my hand at writing a new CHIP-8 game.
 
Back
Top