diff options
| author | kitty <nepeta@canaglie.net> | 2026-03-07 16:33:17 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-03-07 16:33:17 +1100 |
| commit | b226f8ae99a630334356b0e0e1de44429b64155d (patch) | |
| tree | 9ec1323a459e7c12715e18473c39288296ba35c8 | |
| parent | 96f6b7ef59073edd98edb82e3599f28d664c3857 (diff) | |
+to, -to, broken d)
| -rw-r--r-- | jefs.fs | 14 | ||||
| -rw-r--r-- | readme.md | 3 |
2 files changed, 13 insertions, 4 deletions
@@ -94,6 +94,10 @@ hex : ret, c3 c, ; decimal : value create [compile] lit ret, ; : to parse find drop >cfa 6 + state @ if [compile] lit ' ! compile, else ! then ; immediate +: +to parse find drop >cfa 6 + state @ if + [compile] lit ' +! compile, else +! then ; immediate +: -to parse find drop >cfa 6 + state @ if + [compile] lit ' -! compile, else -! then ; immediate \ TODO interpret mode strings? : s" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup cmove, nip r> dup >resolve 4 + [compile] lit [compile] lit ; immediate @@ -123,7 +127,7 @@ variable rex variable modrm variable disp -: asm$ 0 rex ! c0 modrm ! 0 disp ! ; +: asm$ 0 rex ! c0 modrm ! 0 disp ! ; asm$ : rex.w rex @ 48 or rex ! ; : rex.r rex @ 44 or rex ! ; @@ -158,10 +162,12 @@ variable disp : modrm, modrm @ c, disp @ ?dup 0<> if c, then ; : mod0 modrm @ 3f and modrm ! ; -: d) dup disp ! ( mod0 ) 0<> if modrm @ 40 or modrm ! then ; \ disp8 or 0 only for now +: d) dup disp ! ( mod0 ) 0<> if modrm @ 40 or modrm ! then ; \ disp8 or 0 only for now. bug TODO: doesn't put correct .mod bytes : disp, disp @ ?dup 0<> if c, then ; : mov, rex, 8b c, modrm @ c, disp, asm$ ; +: lea, rex, 8d c, modrm @ c, disp, asm$ ; +: call, rex, ff c, /2 modrm @ c, disp, asm$ ; \ example idea: (from execute below) \ rex.w r11, r14 0 d) mov, @@ -434,4 +440,8 @@ decimal 0 constant version : welcome ." welcome to Jewelforth, version " version u. cr .free ; +\ : execute2 [ rex.w r11, r14 0 d) mov, +\ rex.w r14, r14 8 d) lea, +\ r11 call, ] ; + welcome quit bye @@ -13,10 +13,9 @@ i am thinking of completing before that. - `s\"` - `DO` + `LOOP` -- `{+,-}TO +- `{+,-}TO` - `\<BUILDS` and `DOES>` - reading from files -- DUMP - argc + argv - testing - documentation |
