finaly implemented macros properly

This commit is contained in:
MCorange
2023-03-20 13:39:04 +02:00
parent 5cc80619c2
commit 30214808e5
10 changed files with 226 additions and 20 deletions

View File

@@ -1,25 +1,30 @@
mem 98 + 1 @8
0 while dup 98 < do
0 while dup 100 < do
macro puts 1 1 syscall3 drop end
macro BOARD_SIZE 100 end
mem BOARD_SIZE 2 - + 1 @8
0 while dup BOARD_SIZE 2 - < do
0 while dup BOARD_SIZE < do
dup mem + !8 if
dup mem + 100 + 42 @8
dup mem + BOARD_SIZE + 42 @8
else
dup mem + 100 + 32 @8
dup mem + BOARD_SIZE + 32 @8
end
1 +
end
mem + 100 + 10 @8
mem + BOARD_SIZE + 10 @8
101 mem 100 + 1 1 syscall3 drop
BOARD_SIZE 1 + mem BOARD_SIZE + puts
// pattern
mem !8 1 shl
mem 1 + !8
bor
1 while dup 98 < do
1 while dup BOARD_SIZE 2 - < do
swap 1 shl 7 band
over mem + 1 + !8 bor
2dup 110 swap shr 1 band