diff options
Diffstat (limited to 'jefs.fs')
| -rw-r--r-- | jefs.fs | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -32,6 +32,7 @@ hex : ret, c3 c, ; decimal : constant create [compile] lit ret, ; : variable 1 cells allot create [compile] lit ret, ; +\ FLOW CONTROL {{{ \ jump helpers from forth83 (got them from pforth tho ehehe) \ < backward jump > forward jump \ adding/subtracting 4 gets to the next instruction. @@ -56,12 +57,14 @@ hex : ret, c3 c, ; decimal : of ' over compile, ' = compile, [compile] if ' drop compile, ; immediate : endof [compile] else ; immediate : endcase ' drop compile, begin ?dup while [compile] then repeat ; immediate +\ }}} \ TODO interpret mode strings? \ i think s" causes stack underflow : s" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup cmove, r> >resolve swap [compile] lit [compile] lit ; immediate : ." [compile] s" ' say compile, ; immediate \ lol this word breaks the highlighting, here have another " +\ ASSEMBLER {{{ \ https://wiki.osdev.org/X86-64_Instruction_Encoding \ see dusk os asm/x86.fs \ my idea is that operands are given in the reverse order that @@ -118,6 +121,7 @@ variable modrm \ rex.w r14, r14 8 d) lea, \ r11 call, decimal +\ }}} : execute [ hex 4d c, 8b c, 1e c, \ mov r11, [r14] @@ -146,7 +150,7 @@ decimal : space bl emit ; : spaces begin dup 0> while space 1- repeat drop ; -\ PNO +\ PNO {{{ \ mostly from pforth 255 allot variable pad drop variable hld @@ -173,6 +177,7 @@ variable hld : .dword (.dword) say space ; : (.qword) hex <# # # # # # # # # # # # # # # # # #> decimal ; : .qword (.qword) say space ; +\ }}} : ? @ . ; : .s sp cell+ ( skip sp itself ) begin dup s0 @ > while dup @ .qword cell+ repeat drop cr ; @@ -188,10 +193,8 @@ variable hld : (evaluate) ( c-addr u -- ) 0 >in ! ( u ) #tib ! ( c-addr ) tib ! interpret ; : evaluate ( c-addr u -- ) tib @ >r #tib @ >r >in @ >r (evaluate) r> >in ! r> #tib ! r> tib ! ; -\ maybe the old TIB should be on retstack -\ so stack undeflows don't fuck with INTERPRET : teststr3 s" 1 2 3 .s 2drop drop" ; teststr3 evaluate -.free -bye + +.free bye |
