Skip to content

Commit

Permalink
add some example huff files
Browse files Browse the repository at this point in the history
  • Loading branch information
z80dev committed Oct 19, 2024
1 parent 6acf325 commit 4a809ff
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/add_two.huff
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "./dummy.huff"

#define macro MAIN() = takes(0) returns(0) {
0x00 calldataload // [number1] // load first 32 bytes onto the stack - number 1
0x20 calldataload // [number2] // load second 32 bytes onto the stack - number 2
add // [number1+number2] // add number 1 and 2 and put the result onto the stack

0x00 mstore // place [number1 + number2] in memory
0x20 0x00 return // return the result
}
10 changes: 10 additions & 0 deletions examples/add_two_consts.huff
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "./dummy.huff"

#define macro MAIN() = takes(0) returns(0) {
[NAME] // load first const
[NAME2] // load second const
add // [number1+number2] // add number 1 and 2 and put the result onto the stack

0x00 mstore // place [number1 + number2] in memory
0x20 0x00 return // return the result
}
2 changes: 2 additions & 0 deletions examples/dummy.huff
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "./dummy2.huff"
#define constant NAME = 0x1234
2 changes: 2 additions & 0 deletions examples/dummy2.huff
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "./included/rel.huff"
#define constant NAME2 = 0x1234
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4a809ff

Please sign in to comment.