From 62831f626f1f04562b3a8a93ae9004a30e3c9abc Mon Sep 17 00:00:00 2001 From: kitty Date: Sat, 21 Feb 2026 20:15:42 +1100 Subject: execute, ? --- jefs.fs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'jefs.fs') diff --git a/jefs.fs b/jefs.fs index b5d2cc2..1120bfd 100644 --- a/jefs.fs +++ b/jefs.fs @@ -10,9 +10,8 @@ : nip swap drop ; : tuck swap over ; -hex -: ret, c3 c, ; -decimal +\ https://wiki.osdev.org/X86-64_Instruction_Encoding Laterâ„¢ +hex : ret, c3 c, ; decimal : cells 8 * ; : allot here @ swap here +! ; @@ -23,12 +22,17 @@ decimal : literal [compile] lit ; immediate : constant create [compile] lit ret, ; : variable 1 cells allot create [compile] lit ret, ; +: execute [ hex + 4d c, 8b c, 1e c, \ mov r11, [r14] + 4d c, 8d c, 76 c, 08 c, \ lea r14, [r14+8] + 41 c, ff c, d3 c, \ call r11 + decimal ] ; \ TODO interpret mode strings? : s" [ char " ] literal 1 >in +! ( skip spc ) [compile] litstring ; immediate : ." [compile] s" ' say compile, ; immediate \ lol this word breaks the highlighting, here have another " -\ forth83 (got them from pforth tho ehehe) +\ jump helpers from forth83 (got them from pforth tho ehehe) \ < backward jump > forward jump \ adding/subtracting 4 gets to the next instruction. : decimal ; : .qword (.qword) say space ; -: .s sp 8 + ( skip sp itself ) begin dup s0 @ >= while dup @ .qword 8 + repeat drop cr ; +: ? @ . ; +: .s sp 8 + ( skip sp itself ) begin dup s0 @ >= while dup @ .qword 8 + repeat drop cr ; bye -- cgit v1.2.3