word: compile call jmp execute call jmp addr label asmtime runtime num: write 00 push 00 postpone: call jmp call jmp label asmtime runtime 00 00
This version of `/bin/true` is more illustrative of a typical Blue program. It is formed from several blocks which start a progression of using green numbers to jit machine code, then using those words to build other higher level words, which are often used as macros or run at `asmtime`. Near the bottom, `cmd/true2/true2.bo` calls `bye` as a blue word which causes it to be executed at `asmtime`. This word is a macro, defined prior in `aarch64/Linux/cmd/true2/true2.bo`, which writes the machine code to issue the minimal exit system call. `bye` will disassemble to: mov w8, 0x5D svc 0 The `fin.bo` from the elf lib takes the size from the start of the output to the end, and writes that into the `elfbsz` and `elfmsz` fields. In this case the magenta word pushes the `asmtime` address of the word, which allows it to be set like a variable.
Generally the first block in a Blue program, this contains code that is meant to be run at asmtime. Green numbers: | Word | Assembly | ; | postponed `ret` | l> | str x30, [sp, -16]! | >l | ldr x30, [sp], 16 | a-b | sub x0, x0, x1 | *b=a | str x0, [x1] | $^! | mov x13, x12
; D65F03C0 D65F03C0 l> F81F0FFE ; >l F84107FE ; a-b CB010000 ; *b=a F9000020 ; $^! AA0C03ED ;[top]
Basic data stack manipulation, can be used at asm or runtime. Green numbers: | Word | Assembly | >ds | str x0, [x14], 8 | ds>2 | ldr x1, [x14, -8]! | ds> | ldr x0, [x14, -8]!
>ds F80085C0 ; ds>2 F85F8DC1 ds> F85F8DC0 ; dup l> ds> >ds >l >ds - l> ds>2 >l a-b >ds ! l> ds>2 >l *b=a ;[top]
REG_DST manipulation, can be used at asm or runtime. Green numbers: | Word | Assembly | $ | mov x0, x12 | $^ | mov x0, x13
$ AA0C03E0 >ds $^ AA0D03E0 >ds[top]
bye D400000152800BA8 ;[top]
elfhdrs $^! 00010102464C457F 0000000000000000 0000000100B70002 entry 0000000000400078 0000000000000040 0000000000000000 0038004005000000 0000000000400001 0000000700000001 0000000000000000 0000000000400000 0000000000400000 elfbsz 0000000000000000 elfmsz 0000000000000000 0000000000001000[top]
bye [top]
$ $^ - dup elfbsz ! elfmsz ![top]