Skip to content

Added hex, c-hex and binary file output formats to the assembler.#24

Open
sebimoe wants to merge 3 commits into
mattbatwings:mainfrom
sebimoe:asm-output-formats
Open

Added hex, c-hex and binary file output formats to the assembler.#24
sebimoe wants to merge 3 commits into
mattbatwings:mainfrom
sebimoe:asm-output-formats

Conversation

@sebimoe

@sebimoe sebimoe commented Nov 29, 2024

Copy link
Copy Markdown

I have added the ability to select output file format to the assembler, so it is easier to use the binary in other programs. Also I improved file i/o error display a little.

Now it prints usage:

usage: assembler.py <input_file> [output_file] [format]
available formats:
  lines-bin - ascii file contatining line-separated 16-bit binary numbers (default)
  hex - zero-padded 4-character hex
  c-hex - comma-separated c-style hex literals e.g. 0x1234, 0x456
  binary - binary file (big endian)

Formats:

lines-bin (default, original format)

1000111111111000
1111111100001110
...

hex

8ff8ff0eff0dff03ff05ff02ff018e14ff...

c-hex

0x8ff8, 0xff0e, 0xff0d, 0xff03, ...

binary

Outputs binary file (big-endian) containing the bytecode.

@sebimoe sebimoe changed the title Added hex, c-hex and binary file output formats to assembler. Added hex, c-hex and binary file output formats to the assembler. Nov 29, 2024
@PenguineDavid

Copy link
Copy Markdown

Hey mat! you got me into programming with your redstone Videos i love your videos i created a tool you might enjoy its todo with computers i hope you check it out!
link: https://github.com/PenguineDavid/CPU-design

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