• entries
222
606
• views
592867

# 64KB RAM and a CHIP-8/SCHIP interpreter

1509 views

The only major hardware modification since last time is the addition of another 32KB SRAM.

Click to toggle labels

This appears as two 16KB pages in the $4000..$7FFF slot. Currently only the first page is used for OS variables and scratch space, freeing up the upper 32KB entirely for BBC BASIC's use.

One other minor hardware addition is support for a dual-coloured LED on the control port. This LED will be used to signify file access - reads by a green LED and writes by a red LED. As such I haven't implemented a proper file system, but typing SAVE "FILE" or LOAD "FILE" at the prompt will transfer data between the Z80 RAM and a 24LC256 32KB EEPROM. The routines do not pay attention to any file name specified - the first two bytes on the EEPROM indicate the file size, and the rest of the EEPROM is the file. I think some sort of simplified version of FAT may work well, as the EEPROM has a natural page size of 64 bytes which could be used in place of clusters.

Adding the second 32KB SRAM required soldering wires to the underside of the stripboard, not something I'd recommend!

As I have not yet added any graphical commands to BBC BASIC, and as porting assembly programs to this hardware is going to be a bit of a pain until I decide on the way the OS is going to work, I decided to try and port Vinegar to the system. Vinegar is a CHIP-8 and SCHIP interpreter - CHIP-8 programs being simple bytecode and so relatively simple to interpret.

The code I had written was difficult to port, however, being inefficiently and messily written, so I ended up rewriting all of it apart from the sprite drawing routines. The TI-83+ LCD follows the usual trend of storing 8 horizontal pixels in each byte of video memory. The LCD I have stores 8 vertical pixels in each byte of video memory, which means that each 8x8 pixel block in memory needs to be rotated by 90? before being sent to the LCD hardware. This is understandably very slow, and not helped by the Z80 only running at 2MHz. To further complicate issues, games rely on two 60Hz timers, and I have no timing hardware. The current version of the interpreter has some bugs, but is good enough to run some SCHIP programs.

Click for video (1.16MB XviD MPEG-4 AVI)

CHIP-8 programs are displayed squashed in the top-left hand corner, as they're designed to run in a 64x32 video mode unlike SCHIP's 128x64 (happily, the resolution of the LCD) - typically, the one thing I really did need to fix for the new hardware, the sprite code, is the only thing I copied over. In reality, CHIP-8 graphics would need to be scaled up to fit the screen. Working out a way of getting the system to operate at 10MHz would really be a welcome upgrade!

Although I don't comment here much (since I do not have the expertise to say anything relevant), I would like to say that I am fascinated by your project and its progression. Excellent stuff, Ben. [smile]

I can't help thinking piggy-backing or sandwiching the second SRAM chip might have been easier...

Quote:
 Original post by HopeDagger Although I don't comment here much (since I do not have the expertise to say anything relevant), I would like to say that I am fascinated by your project and its progression. Excellent stuff, Ben. [smile]
Quote:
 Original post by MaximZhao I can't help thinking piggy-backing or sandwiching the second SRAM chip might have been easier...
If you mean bending out the chip select and A14 pins, then soldering the second chip onto the first one, I did ponder this, but I don't trust my soldering skills enough (I'd rather keep the chips in sockets than risk overheating them) and would also like to be able to re-use the SRAM chips if I end up rebuilding the final design on a PCB.

Quote:
 Original post by benryves ...and writes by a red LED.

I KNEW it!

## Create an account

Register a new account