Make terminal ui binaries work well everywhere

Here's some screenshots of an emulator tui program that was compiled on
Linux, then scp'd it to Windows, Mac, and FreeBSD.

https://justine.storage.googleapis.com/blinkenlights-cmdexe.png
https://justine.storage.googleapis.com/blinkenlights-imac.png
https://justine.storage.googleapis.com/blinkenlights-freebsd.png
https://justine.storage.googleapis.com/blinkenlights-lisp.png

How is this even possible that we have a nontrivial ui binary that just
works on Mac, Windows, Linux, and BSD? Surely a first ever achievement.

Fixed many bugs. Bootstrapped John McCarthy's metacircular evaluator on
bare metal in half the size of Altair BASIC (about 2.5kb) and ran it in
emulator for fun and profit.
This commit is contained in:
Justine Tunney 2020-10-10 21:18:53 -07:00
parent 680daf1210
commit 9e3e985ae5
276 changed files with 7026 additions and 3790 deletions

View file

@ -1,2 +1,15 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_CancelIo,CancelIo,101
.text.windows
CancelIo:
push %rbp
mov %rsp,%rbp
.profilable
mov %rdi,%rcx
sub $32,%rsp
call *__imp_CancelIo(%rip)
leave
ret
.endfn CancelIo,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_CancelIoEx,CancelIoEx,102
.text.windows
CancelIoEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CancelIoEx(%rip),%rax
jmp __sysv2nt
.endfn CancelIoEx,globl
.previous

View file

@ -1,2 +1,15 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_CancelSynchronousIo,CancelSynchronousIo,103
.text.windows
CancelSynchronousIo:
push %rbp
mov %rsp,%rbp
.profilable
mov %rdi,%rcx
sub $32,%rsp
call *__imp_CancelSynchronousIo(%rip)
leave
ret
.endfn CancelSynchronousIo,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_CreateIoCompletionPort,CreateIoCompletionPort,195
.text.windows
CreateIoCompletionPort:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateIoCompletionPort(%rip),%rax
jmp __sysv2nt
.endfn CreateIoCompletionPort,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_CreateThread,CreateThread,224
.text.windows
CreateThread:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateThread(%rip),%rax
jmp __sysv2nt6
.endfn CreateThread,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_CreateWaitableTimerW,CreateWaitableTimerW,234
.text.windows
CreateWaitableTimer:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateWaitableTimerW(%rip),%rax
jmp __sysv2nt
.endfn CreateWaitableTimer,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetQueuedCompletionStatus,GetQueuedCompletionStatus,695
.text.windows
GetQueuedCompletionStatus:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetQueuedCompletionStatus(%rip),%rax
jmp __sysv2nt6
.endfn GetQueuedCompletionStatus,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_GetQueuedCompletionStatusEx,GetQueuedCompletionStatusEx,696
.text.windows
GetQueuedCompletionStatusEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_GetQueuedCompletionStatusEx(%rip),%rax
jmp __sysv2nt6
.endfn GetQueuedCompletionStatusEx,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_PostQueuedCompletionStatus,PostQueuedCompletionStatus,1221
.text.windows
PostQueuedCompletionStatus:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_PostQueuedCompletionStatus(%rip),%rax
jmp __sysv2nt
.endfn PostQueuedCompletionStatus,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_ReadFileEx,ReadFileEx,1312
.text.windows
ReadFileEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_ReadFileEx(%rip),%rax
jmp __sysv2nt6
.endfn ReadFileEx,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_SetWaitableTimer,SetWaitableTimer,1583
.text.windows
SetWaitableTimer:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_SetWaitableTimer(%rip),%rax
jmp __sysv2nt6
.endfn SetWaitableTimer,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp KernelBase,__imp_WriteFileEx,WriteFileEx,1824
.text.windows
WriteFileEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_WriteFileEx(%rip),%rax
jmp __sysv2nt6
.endfn WriteFileEx,globl
.previous