diff options
Diffstat (limited to 'sanctuary.s')
| -rw-r--r-- | sanctuary.s | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/sanctuary.s b/sanctuary.s index f9fc5f0..44cd4af 100644 --- a/sanctuary.s +++ b/sanctuary.s @@ -449,6 +449,7 @@ defcode "(header)", brac_header, 0 pspush r12 ret +; fix to follow ans: yielding colon-sys defcode ":", colon, 0 call parse_name ; todo check zero @@ -459,6 +460,8 @@ defcode ":", colon, 0 mov qword [state], COMPILING ret +; fix to follow ans: reading from colon-sys +; this will not work with :noname or i think does>. defcode ";", semicolon, immediate_mask mov r12, [latest] add r12, 8 @@ -659,6 +662,67 @@ defcode "rdrop", rdrop, 0 ; }}} ; math + comparison {{{ +; i believe some of these could be improved by direct accesses to [r15] +defcode "+", plus, 0 + pspop r11 + pspop r12 + add r11, r12 + pspush r11 + ret + +defcode "-", minus, 0 + pspop r11 + pspop r12 + sub r12, r11 + pspush r12 + ret + +defcode "*", _times, 0 + pspop r11 + pspop r12 + imul r11, r12 + pspush r11 + ret + +defcode "/mod", divmod, 0 + xor rdx, rdx + pspop r11 + pspop rax + idiv r11 + pspush rdx + pspush rax + ret + +defcode "and", _and, 0 + pspop r11 + and [r14], r11 + ret + +defcode "or", _or, 0 + pspop r11 + or [r14], r11 + ret + +defcode "xor", _xor, 0 + pspop r11 + xor [r14], r11 + ret + +defcode "invert", invert, 0 + not qword [r14] + ret + +defcode "*/mod", starslashmod, 0 + pspop r15 ; n3 + pspop r13 ; n2 + pspop rax ; n1 + + imul r13 + idiv r15 + + pspush rdx + pspush rax + ret ; }}} ; TEMPORARY WONKY DEBUGGING FUNCTIONS {{{ |
