.
Here's a Lua script to load the .mem files in Golly because I didn't want to deal with getting the Python program to work.
Code: Select all
--[[
deca-asm.lua
blah 2020
A script to load data into Hactar's computer's ROM.
Hacked together in a few hours.
]]
local g=golly()
g.warn("Ensure that data to load is in the clipboard, then press OK.")
prog = g.getclipstr()
-- write hex data
rom = {}
idx = 0
while true do -- for each line
local new_idx = string.find(prog, "\n", idx+1)
if new_idx == nil then
break
end
local line = string.sub(prog,idx+1,new_idx-1)
if string.sub(line,1,1) ~= "@" then
--g.warn("<"..tonumber("0x"..line)..">")
rom[#rom+1] = tonumber("0x"..line)
end
idx = new_idx
end
top, left = 47, 140 -- location of yellow '+'
for col = 1, 16 do
for row = 1, 64 do
-- get 18 bit instruction to draw
local wnum = rom[(col-1)*64+row]
if wnum == undefined then
wnum = 0 -- default value
end
-- rotate depending on appropriate temporal offset
-- equation derived via trial and error, and looking at Hactar's video,
-- where counting.mem can be seen loaded in
local t_off = -3 + (row-1)*8 - (math.floor(row/2)) - ((row-1)%2)*9 + (col-1)*10
local w = {}
for bit = 0, 17 do
w[(bit+t_off)%18 + 1] = wnum%2
wnum = math.floor(wnum/2)
end
-- draw electrons
local x = left+21+(col-1)*40
local y = top+(row-1)*6
-- the electron stream is p4, but the temporal displacement between
-- rows is 6 steps. The LCM of 4 and 6 is 12, which is 2 rows, so it
-- suffices to deal with only even and odd rows.
if row%2 == 1 then
goto odd_row
else
goto even_row
end
::odd_row::
for bit = 1, 9 do
if w[bit] == 1 then
g.setcell(x+1,y, 1)
g.setcell(x+2,y, 2)
else
g.setcell(x+1,y, 3)
g.setcell(x+2,y, 3)
end
if w[19-bit] == 1 then
g.setcell(x,y+2, 2)
g.setcell(x+1,y+2, 1)
else
g.setcell(x,y+2, 3)
g.setcell(x+1,y+2, 3)
end
x = x + 4
end
goto loop_end
::even_row::
if w[18] == 1 then
g.setcell(x,y, 2)
g.setcell(x,y+1, 1)
else
g.setcell(x,y, 3)
g.setcell(x,y+1, 3)
end
x = x + 2
for bit = 1, 8 do
if w[bit] == 1 then
g.setcell(x+1,y, 1)
g.setcell(x+2,y, 2)
else
g.setcell(x+1,y, 3)
g.setcell(x+2,y, 3)
end
if w[18-bit] == 1 then
g.setcell(x,y+2, 2)
g.setcell(x+1,y+2, 1)
else
g.setcell(x,y+2, 3)
g.setcell(x+1,y+2, 3)
end
x = x + 4
end
if w[9] == 1 then
g.setcell(x,y+1, 1)
g.setcell(x,y+2, 2)
else
g.setcell(x,y+1, 3)
g.setcell(x,y+2, 3)
end
::loop_end::
end
end
Also using "little endian" and "big endian" to refer to the organisation of bits in a byte rather than bytes in a word stored in memory is weird to me.
Overall in my opinion this is a good computer.