Historically, from the first Fibonacci algorithm and the first video loops on the breadboard prototype, we've used Python notation for assembly. This way we didn't have to write an assembler, but more importantly, we got a free macro assembler and that is really required for the job. This ad-hoc framework was grown bottom-up and got expanded all the way to implementing vCPU, the ROM loader, the audio system, the built-in applications and eventually the release of ROM v1. During that time we never considered the readability of the source syntax. We knew it was poor, but it worked for us. Now is time for big cleanups. As of today, theloop.py (I will rename it later to ROMv1.py) contains no more unintelligible eaYXregOUTIX, busRAM, zp(), lo(), ...etc ... anywhere.
For comparison, before we wrote things like this:
Old:
Code: Select all
# Update LEDs (memory is present and counted, reset is stable)
ld(val(0b0001)); C('LEDs |*OOO|')
ld(val(syncBits^hSync),regOUT)
ld(val(syncBits),regOUT)
# Scan the entire RAM space to collect entropy for a random number generator.
# The 16-bit address space is scanned, even if less RAM was detected.
ld(val(0)); C('Collect entropy from RAM')
st(d(vAC+0),busAC|ea0DregX)
st(d(vAC+1),busAC|ea0DregY)
Code: Select all
ld $01 ;LEDs |*OOO|
ld $80,out
ld $c0,out
ld $00 ;Collect entropy from RAM
st [$18],x
st [$19],y
New:
Code: Select all
# Update LEDs (memory is present and counted, reset is stable)
ld(0b0001); C('LEDs |*OOO|')
ld(syncBits^hSync, OUT)
ld(syncBits, OUT)
# Scan the entire RAM space to collect entropy for a random number generator.
# The 16-bit address space is scanned, even if less RAM was detected.
ld(0); C('Collect entropy from RAM')
st([vAC+0], X)
st([vAC+1], Y)
I feel this updated notation is finally quite workable now. One of the next big steps will be to untangle the GCL compiler even more. (Issue #16)