diff options
Diffstat (limited to 'jefs.fs')
| -rw-r--r-- | jefs.fs | 14 |
1 files changed, 12 insertions, 2 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 |
