Skip to content

Instantly share code, notes, and snippets.

@thelink2012
Last active December 8, 2016 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thelink2012/d6cc75d721592dd1dab45073768bbee1 to your computer and use it in GitHub Desktop.
Save thelink2012/d6cc75d721592dd1dab45073768bbee1 to your computer and use it in GitHub Desktop.
  • Feature Name: dump
  • Start Date: 07/12/2016

Summary

Dump of raw bytes into the bytecode.

Motivation

The seek for a semantic similar to Sanny Builder's HEX...END to embed user data in the resulting bytecode.

Detailed design

ID Command Name Command Hash Params
None DUMP 0x39c100dd
None ENDDUMP 0x5c84a58c

Whenever the DUMP command is found, all the lines following it up to the ENDDUMP should be treated as a serie of hexadecimal pairs, which should be output to the bytecode as is.

Labels, commands (except for ENDDUMP), and literals other than the hexadecimal one shall not occur inside the dump block.

Example

DUMP
    00 01 02 03 0A 0B 0C
    14 1D 90 AF F9 DD CC
    F             // invalid, must be a xdigit pair
    141D 90919293 // valid
ENDDUMP

Drawbacks

Why should we not do this?

Alternatives

What other designs have been considered? What is the impact of not doing this?

Unresolved questions

Unresolved questions.

@x87
Copy link

x87 commented Dec 8, 2016

Spaces in hex string are optional and used for readability e.g. 141D is a valid input.
In my opinion, EMIT term is somewhat opposite to the action it produces: on emit something moves outside, while in this case we are moving the data directly inside the output, are we? I'd suggest to use either old HEX..ENDHEX here, or maybe DUMP..ENDDUMP.

@thelink2012
Copy link
Author

Updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment