Turing Complete

Turing Complete

View Stats:
Suggestion about assembler instructions
Well, two things.

1. They should be case insensitive. Assemblers don't care if its Jmp, jmp, or JMP when you write the line. I set up all my instructions uppercase just because I thought it looked better but now I have to upper case them all of the time. This isn't a huge deal but sometimes I might want r0 and R0 to be equivalent in case I get lazy.

2. Once we get to the LEG architecture it's 4 byte instructions but really nothing in the game seems to cover how to actually generate 4 byte instructions. The syntax is TOKEN TOKEN TOKEN TOKEN it seems (that is, write 4 things on one line). For instance with the codes I setup I might write "ADD R0 R0 R1" to mean add the first register's value to itself (multiply by 2) then write that to the second register. It doesn't seem to like it if I use commas in between the operands. But, nowhere in the game does it give any advice about what is acceptable and what is not.

Both of these are pretty minor gripes but I do think my suggestions would still improve the experience a bit.
< >
Showing 1-8 of 8 comments
Lord Testosticles Oct 16, 2021 @ 10:48am 
Oh, also, as above you can see that I figured out that I should create assembly codes for my registers and the I/O and all that. That is also not covered by any manual entries or documentation that I can find. I'm on the "shift" level now and it seems I've got to write assembly to call my shift instructions in the proper sequence and while I can figure this out, it seems like this would be quite a jump for people at this point in the game.
altrag Oct 17, 2021 @ 1:58am 
1. Probably a good idea, though I wouldn't really bother comparing to real assemblers.. they're definitely not always consistent across brands/etc in the real world.

2. There sort of is, but its not the most obvious thing. The assembler just translates tokens into numbers so you are in essence just writing a list of digits (ie: the numbers you see in the program component). In particular, the assembler itself doesn't understand or care about your instruction width or anything like that. All it does is "see token -> is number".

Its vaguely described as such when you first learn the assembler (while building the first architecture) but its not super clear up front that both architectures are using the same assembler or that "4 byte instructions" is only in the counter you attached to the program input.. its not a fundamental property of LEG (and I'm pretty sure - though I haven't tried it - that you could build your own entire architecture if you wanted. I believe the tests on the full computers just compare inputs to outputs rather than trying to validate your assembler source or the layout of your components).

This is especially obvious in certain levels like SHIFT where you can just delete your entire computer (including the program module) and build a one-off piece of hardware (I used a 1-Bit memory cell with a NOT to make a one-bit "program" counter, and used that to MUX a couple of Byte maker-based shift operations). I'd recommend doing that on a new schematic rather than actually deleting your computer though - I'm not 100% sure what scenarios cause the game to overwrite the main LEG schematic! :D
Ender Oct 17, 2021 @ 3:24am 
Originally posted by altrag:
1. Probably a good idea, though I wouldn't really bother comparing to real assemblers.. they're definitely not always consistent across brands/etc in the real world.

2. There sort of is, but its not the most obvious thing. The assembler just translates tokens into numbers so you are in essence just writing a list of digits (ie: the numbers you see in the program component). In particular, the assembler itself doesn't understand or care about your instruction width or anything like that. All it does is "see token -> is number".

Its vaguely described as such when you first learn the assembler (while building the first architecture) but its not super clear up front that both architectures are using the same assembler or that "4 byte instructions" is only in the counter you attached to the program input.. its not a fundamental property of LEG (and I'm pretty sure - though I haven't tried it - that you could build your own entire architecture if you wanted. I believe the tests on the full computers just compare inputs to outputs rather than trying to validate your assembler source or the layout of your components).

This is especially obvious in certain levels like SHIFT where you can just delete your entire computer (including the program module) and build a one-off piece of hardware (I used a 1-Bit memory cell with a NOT to make a one-bit "program" counter, and used that to MUX a couple of Byte maker-based shift operations). I'd recommend doing that on a new schematic rather than actually deleting your computer though - I'm not 100% sure what scenarios cause the game to overwrite the main LEG schematic! :D

From what I can tell, ALL levels dealing with OVERTURE and LEG will automatically overwrite the schematic. You'll definitely want to create a new schematic when doing something like that or when implementing your own.
I agree that there should be a proper assembler. The assembler as it is has no notion of ‘operands’ or ‘instruction formats’ – all it does is translate single words (or expressions) to single numbers. E.g. in my LEG I have to write load and store instructions as ‘load addr 0 dest’ and ‘store addr val 0’ just so that they’d follow the four-byte instruction format despite those additional operands being ignored in the actual circuit.
Ender Jul 15, 2022 @ 12:53pm 
Originally posted by Schyrsivochter:
I agree that there should be a proper assembler. The assembler as it is has no notion of ‘operands’ or ‘instruction formats’ – all it does is translate single words (or expressions) to single numbers. E.g. in my LEG I have to write load and store instructions as ‘load addr 0 dest’ and ‘store addr val 0’ just so that they’d follow the four-byte instruction format despite those additional operands being ignored in the actual circuit.

A more advanced assembler is already on the roadmap. In the mean time, you can design your own assembly with customasm (or write your own assembler) if the current assembler is too tedious for you.
Originally posted by Endershadow:
In the mean time, you can design your own assembly with customasm

What is that?
SunCat Jul 16, 2022 @ 2:17pm 
Originally posted by Schyrsivochter:
What is that?
a program, https://github.com/hlorenzi/customasm
:0 this is cool, thank you!
< >
Showing 1-8 of 8 comments
Per page: 1530 50

Date Posted: Oct 16, 2021 @ 10:46am
Posts: 8