|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#!/usr/bin/tclsh
# (find-angg "CRIM1/crim1a-lib.tcl")
# (find-angg "CRIM1/crim1a-prims.tcl")
proc scriptdir {} { file dirname [info script]] }
proc tmpdir {} { return /tmp }
source [scriptdir]/crim1a-lib.tcl
source [scriptdir]/crim1a-prims.tcl
proc shell {str} { writefile [tmpdir]/crim1.sh "set -v\n$str\nset +v" }
proc asm {str} { global asm_code; append asm_code $str }
proc gtick {name} { asm "global ADR_$name\n"; tick $name }
set whichdemo 0
switch $whichdemo 0 {
tick 2 ; run CON: ; asm "\tdd 2\n"
tick SQUARE ; run : DUP * \;
tick CUBE ; run : DUP SQUARE * \;
gtick DEMO ; run : 2 CUBE \;
set_final_prim_data
doCfilestuff [scriptdir]/engine0.skel.c [tmpdir]/engine.c
doasmfilestuff [tmpdir]/x.asm
shell "
cd [tmpdir]
nasm -f elf -o x.o -l x.lst x.asm
gcc -c -o engine.o engine.c
gcc -o demo engine.o x.o
./demo
"
}
# print_vars
# doCfilestuff engine0.skel.c -
# doasmfilestuff -