1
0
mirror of https://github.com/janet-lang/janet synced 2024-09-30 07:50:41 +00:00

Work on windows.

This commit is contained in:
Calvin Rose 2024-06-16 13:37:25 -07:00
parent c413bc2b4e
commit cdb3baaca3
4 changed files with 10 additions and 6 deletions

View File

@ -0,0 +1,4 @@
janet.exe examples/sysir/samples.janet > temp.nasm
nasm -fwin64 temp.nasm -l temp.lst -o temp.o
link temp.o legacy_stdio_definitions.lib msvcrt.lib /out:temp.exe
temp.exe

View File

@ -32,8 +32,8 @@
(return x)))
(def main-fn
'(defn _start:void []
(syscall 1 1 "Hello, world!\n" 14)
'(defn WinMain:void []
#(syscall 1 1 "Hello, world!\n" 14)
(doloop 10 20)
(exit (the int 0))
(return)))

View File

@ -287,7 +287,7 @@ static uint32_t instr_read_type_operand(Janet x, JanetSysIR *ir, ReadOpMode rmod
return (uint32_t) n;
} else if (rmode == READ_TYPE_FORWARD_REF) {
uint32_t operand = linkage->type_def_count++;
janet_table_put(linkage->type_name_lookup, x, janet_wrap_number(-operand - 1));
janet_table_put(linkage->type_name_lookup, x, janet_wrap_number(-(int64_t)operand - 1));
return operand;
} else if (rmode == READ_TYPE_DEFINITION) {
uint32_t operand = linkage->type_def_count++;
@ -1600,7 +1600,7 @@ void janet_sys_ir_lower_to_ir(JanetSysIRLinkage *linkage, JanetArray *into) {
build_tuple[0] = janet_csymbolv("type-array");
build_tuple[1] = janet_sys_get_desttype(linkage, instruction.array.dest_type);
build_tuple[2] = janet_sys_get_desttype(linkage, instruction.array.type);
build_tuple[4] = janet_wrap_number(instruction.array.fixed_count);
build_tuple[4] = janet_wrap_number((double) instruction.array.fixed_count);
break;
}
const Janet *tuple = janet_tuple_end(build_tuple);

View File

@ -585,8 +585,8 @@ void janet_sys_ir_lower_to_x64(JanetSysIRLinkage *linkage, JanetBuffer *buffer)
sysemit_operand(&ctx, instruction.branch.cond, ", 0\n");
janet_formatb(buffer,
"%s label_%d_%u\n",
instruction.opcode == JANET_SYSOP_BRANCH ? "jnz " : "jz ",
i, instruction.branch.to);
instruction.opcode == JANET_SYSOP_BRANCH ? "jnz" : "jz",
i, (uint64_t) instruction.branch.to);
break;
case JANET_SYSOP_JUMP:
janet_formatb(buffer, "jmp label_%d_%u\n", i, instruction.jump.to);