Close

Assembly compiler and memory loader

A project log for Nits Processor

8-bit TTL technology processor

cedCed 12/30/2019 at 18:120 Comments

Two new pieces were added to the system :

Indeed since the beginning of the project I had to manually write the binary code and upload it using dip switches and this is very error prone and it takes forever.

My assembly compiler is very basic, written in PHP (just because it's the langage I'm more comfortable with). The input is an assembly file such as (custom format):

;
; Brute force find three consecutive integers whose sum is equal to 204

var x1
var x2
var x3
var result
const expected 204

init
	LD A, 0
	LD [x1], A

compute_x
	; compute the 3 values and total
	LD A, [x1]
	LD B, 1
	ADD A
	OUT A
	LD [x1], A
...

It handles:

And it produces a binary file and a human readable processed file very useful to debug both the software and the hardware:

VAR x1 at address 11111111
VAR x2 at address 11111110
VAR x3 at address 11111101
VAR result at address 11111100
CONST expected = 11001100
Label init
  00000000  LD A, 0x0                       00100110 00000000
  00000010  LD [x1], A                      01001000 11111111
Label compute_x
  00000100  LD A, [x1]                      00100101 11111111
  00000110  OUT A                           00011000
  00000111  LD B, 0x1                       00101110 00000001

 Each line of compiled code contains

Once the binary file is obtained, it was required to load the code into the memory. For this I used an Arduino nano connected to a 74HC595 in a way very close to Ben Eater's EEPROM programmer.

The Arduino will take over the Address and Data bus of the memory by activating the PROG mode, this basically disconects the memory from the Bus through 75HCT245 chips. Once the memory is isolated, the arduino will go through all the needed address using the 75HC595 (a shift register) and upload the data.

Note : 

Overall everything works and it a good way to finish 2019. I hope 2020 will bring new features such as:

Discussions