2018-01-30 22:30:49 +01:00
|
|
|
; ___ ___ _____ ___ ___ __ ___ ___ ___ ___
|
|
|
|
; | _ \ __|_ _| _ \/ _ \ / / | __| _ ___ ___| _ ) __| \
|
|
|
|
; | / _| | | | / (_) | / / | _| '_/ -_) -_) _ \__ \ |) |
|
|
|
|
; |_|_\___| |_| |_|_\\___/ /_/ |_||_| \___\___|___/___/___/
|
|
|
|
;
|
|
|
|
; This is the minimal startup + I/O functionality needed to run
|
|
|
|
; RETRO on a FreeBSD x86 system.
|
|
|
|
; =============================================================
|
|
|
|
|
2018-01-30 18:25:44 +01:00
|
|
|
bits 32
|
|
|
|
section .text
|
|
|
|
global putchar
|
|
|
|
global getchar
|
|
|
|
global _start
|
|
|
|
extern main
|
|
|
|
|
|
|
|
align 4
|
|
|
|
_start:
|
2018-01-31 18:01:44 +01:00
|
|
|
call main
|
|
|
|
jmp $
|
2018-01-30 18:25:44 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
putchar:
|
2018-01-31 18:01:44 +01:00
|
|
|
mov eax, [esp+4]
|
|
|
|
mov [buf], eax
|
|
|
|
push dword 1
|
|
|
|
push dword buf
|
|
|
|
push dword 1
|
|
|
|
mov eax, 4
|
|
|
|
call kernel
|
|
|
|
add esp, 12
|
|
|
|
ret
|
2018-01-30 18:25:44 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
getchar:
|
2018-01-31 18:01:44 +01:00
|
|
|
push dword 1
|
|
|
|
push dword buf
|
|
|
|
push dword 0
|
|
|
|
mov eax, 3
|
|
|
|
call kernel
|
|
|
|
add esp, 12
|
|
|
|
mov eax, 0
|
|
|
|
mov eax, [buf]
|
|
|
|
ret
|
2018-01-30 18:25:44 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
kernel:
|
2018-01-31 18:01:44 +01:00
|
|
|
int 80h
|
|
|
|
ret
|
2018-01-30 18:25:44 +01:00
|
|
|
|
|
|
|
section .data
|
|
|
|
buf:
|
2018-01-31 18:01:44 +01:00
|
|
|
dd 0
|
|
|
|
dd 0
|
|
|
|
dd 0
|
|
|
|
dd 0
|