Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output format for the game "Turing Complete" #183

Merged
merged 1 commit into from
Jan 20, 2024

Conversation

thenorili
Copy link
Contributor

@thenorili thenorili commented Nov 5, 2023

Players of the game "Turing Complete" often use
customasm to design a richer assembly language
than the game provides and then copy the resulting binary into the game.

This change introduces an annotated format compatible with the Turing Complete assembly editor, using '#' for comments and '0x' or '0b' to prefix data groups.

If you'd prefer that I factor this into a config option for format_annotated or factor out shared code between format_annotated and format_tcgame please ask, I'm open to that option.

An excerpted example of the output:

# outp | addr | data (base 2)

#   0:0 |    0
# init:

#   0:0 |    0
# mov sp, #0xFF
0b11000000 0b11111111 0b00000000 0b00001011
#   4:0 |    4
# mov fp, sp
0b01000000 0b00001011 0b00000000 0b00001001
#   8:0 |    8
# sub sp, sp, #16
0b01000001 0b00001011 0b00010000 0b00001011
#   c:0 |    c
# mov lr, #exit
0b11000000 0b00010100 0b00000000 0b00001110
#  10:0 |   10
# jmp #main
0b11100000 0b00000000 0b00000000 0b00011100
#  14:0 |   14
# exit:

#  14:0 |   14
# mov sp, fp
0b01000000 0b00001001 0b00000000 0b00001011
#  18:0 |   18
# mov out, #0
0b11000000 0b00000000 0b00000000 0b00001111
#  1c:0 |   1c
# main:

#  1c:0 |   1c
# push lr
0b10000001 0b00000001 0b00001011 0b00001011 0b01000000 0b00001011 0b00000000 0b00001100 0b01000000 0b00001110 0b00000000 0b00001101
#  28:0 |   28
# push fp
0b10000001 0b00000001 0b00001011 0b00001011 0b01000000 0b00001011 0b00000000 0b00001100 0b01000000 0b00001001 0b00000000 0b00001101

@thenorili thenorili marked this pull request as draft November 5, 2023 05:27
@thenorili thenorili marked this pull request as ready for review November 5, 2023 05:31
@thenorili
Copy link
Contributor Author

The latest update corrects a typo s/tmgame/tcgame and incidentally removes some trailing whitespace from the files I worked on. I hope that the whitespace changes don't trouble the review process at all!

@hlorenzi
Copy link
Owner

I think this looks great! I think it's better that the code is completely isolated, since I'm imagining this is a more of a niche use-case. But looking at the generated code, it seems to be pretty generic. Perhaps we could name the format something else? Just to avoid references to a commercial product.

If we keep the product name, I think we'll also need to move its code declarations and help entries to the end of their respective lists, to reflect their niche status.

Players of the game "Turing Complete" often use
customasm to design a richer assembly language
than the game provides and then copy the resulting
binary into the game.

This change introduces an annotated format compatible
with the Turing Complete assembly editor, using '#'
for comments and '0x' or '0b' to prefix data groups.

This change also removes some trailing whitespace.
@hlorenzi hlorenzi merged commit 5cc272a into hlorenzi:main Jan 20, 2024
1 check passed
@thenorili thenorili deleted the turing-complete-format branch February 4, 2024 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants