add newline for test, (terminal sometimes clears output without '\n')
This commit is contained in:
parent
f6a2cd8de9
commit
299e36172b
|
@ -48,7 +48,7 @@ bool compile_internal_test(const char *filename, VM *vm) {
|
|||
|
||||
bool test_simple_compile(VM *vm) {
|
||||
u32 ptr;
|
||||
/*u32 newline_addr = str_alloc(vm, &vm->frames[vm->fp], "\n", 2);*/
|
||||
u32 newline_addr = str_alloc(vm, &vm->frames[vm->fp], "\n", 2);
|
||||
u32 terminal_path_addr =
|
||||
str_alloc(vm, &vm->frames[vm->fp], "/dev/term/0", 12);
|
||||
vm->code[vm->cp++] = OP_LOAD;
|
||||
|
@ -87,6 +87,23 @@ bool test_simple_compile(VM *vm) {
|
|||
vm->code[vm->cp++] = 5;
|
||||
vm->code[vm->cp++] = 3;
|
||||
vm->code[vm->cp++] = 4;
|
||||
|
||||
vm->code[vm->cp++] = OP_LOAD_IMM;
|
||||
vm->code[vm->cp++] = 6;
|
||||
write_u32(vm, code, vm->cp, newline_addr);
|
||||
vm->cp += 4;
|
||||
|
||||
vm->code[vm->cp++] = OP_STRLEN;
|
||||
vm->code[vm->cp++] = 7;
|
||||
vm->code[vm->cp++] = 6;
|
||||
|
||||
vm->code[vm->cp++] = OP_SYSCALL;
|
||||
write_u32(vm, code, vm->cp, AS_UINT(SYSCALL_DEVICE_WRITE));
|
||||
vm->cp += 4;
|
||||
vm->code[vm->cp++] = 5;
|
||||
vm->code[vm->cp++] = 6;
|
||||
vm->code[vm->cp++] = 7;
|
||||
|
||||
/* syscall_id=WRITE, device-str-ptr=5, ptr, length ; print(sum.toS()); */
|
||||
vm->code[vm->cp++] = OP_HALT; /* explicit halt */
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue