diff --git a/make.scm b/make.scm index 2b9e7bf7..bdc55bba 100755 --- a/make.scm +++ b/make.scm @@ -326,17 +326,17 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$ ;;(add-target (group "check-scaffold" #:dependencies (filter (target-prefix? "check-scaffold") %targets))) -;; (add-target (bin.gcc "scaffold/main.c")) -;; (add-target (check "scaffold/main.gcc" #:exit 42)) +(add-target (bin.gcc "scaffold/main.c")) +(add-target (check "scaffold/main.gcc" #:exit 42)) -;; (add-target (bin.gcc "scaffold/main.c" #:libc #f)) -;; (add-target (check "scaffold/main.mlibc-gcc" #:exit 42)) +(add-target (bin.gcc "scaffold/main.c" #:libc #f)) +(add-target (check "scaffold/main.mlibc-gcc" #:exit 42)) -;; (add-target (bin.mescc "scaffold/main.c" #:libc mini-libc-mes.hex2)) -;; (add-target (check "scaffold/main.mini-guile" #:exit 42)) +(add-target (bin.mescc "scaffold/main.c" #:libc mini-libc-mes.hex2)) +(add-target (check "scaffold/main.mini-guile" #:exit 42)) -;; (add-target (bin.mescc "scaffold/main.c")) -;; (add-target (check "scaffold/main.guile" #:exit 42)) +(add-target (bin.mescc "scaffold/main.c")) +(add-target (check "scaffold/main.guile" #:exit 42)) (add-target (bin.gcc "scaffold/hello.c")) diff --git a/scaffold/main.c b/scaffold/main.c index 2d5a08af..d9ef110c 100644 --- a/scaffold/main.c +++ b/scaffold/main.c @@ -18,91 +18,14 @@ * along with Mes. If not, see . */ -// #if __i386__ -// #define main _start -// #endif - int main (int argc, char *argv[]) { #if 0 - - -#if __MESC__ - asm ("mov____$i32,%ebx !42"); - asm ("mov____$i32,%eax !1"); - asm ("int____$0x80"); -#elif __i386__ - asm (".byte 144"); - asm (".byte 144"); - asm (".byte 144"); -#if 1 //MESC_TCC - asm (".byte 184"); //mov $1,%eax - asm (".byte 42"); - asm (".byte 0"); - asm (".byte 0"); - asm (".byte 0"); - - asm (".byte 201"); // leave - asm (".byte 195"); // ret - -#if 0 - - asm (".byte 187"); // mov $42,%ebx - asm (".byte 42"); - asm (".byte 0"); - asm (".byte 0"); - asm (".byte 0"); - - asm (".byte 184"); //mov $1,%eax - asm (".byte 1"); - asm (".byte 0"); - asm (".byte 0"); - asm (".byte 0"); - - asm (".byte 201"); // leave - asm (".byte 195"); // ret - - - asm (".byte 205"); //int $0x80 - asm (".byte 128"); - - asm (".byte 137"); //%eax,-0x4(%ebp) - asm (".byte 69"); - asm (".byte 252"); - - asm (".byte 244"); //hlt - - // asm (".byte 201"); - // asm (".byte 195"); -#endif - + int a = 40; + int b = 2; + return a + b; #else - asm ("mov $42,%eax"); - asm ("leave"); - asm ("ret"); - - // asm ("mov $42,%ebx"); - // asm ("mov $1,%eax"); - // asm ("int $128"); -#endif - - asm (".byte 144"); - asm (".byte 144"); - asm (".byte 144"); - -#elif __x86_64__ - asm (".byte 144"); - asm ("mov $42,%rbx"); - asm ("mov $1,%rax"); - asm ("int $128"); - asm ("hlt"); -#else - #error "platform not supported" -#endif - // not reached - -#endif - return 42; +#endif }