ponydos/hello.asm
2023-03-23 00:41:12 +02:00

40 lines
494 B
NASM

%include "ponydos.inc"
cpu 8086
bits 16
; 0x0000
jmp near process_event
; 0x0003 PROC_INITIALIZE_ENTRYPOINT
; This needs to preserve ds
initialize:
push ds
call deallocate_own_memory
pop ds
retf
process_event:
retf
deallocate_own_memory:
push bx
push cx
push es
mov bx, PONYDOS_SEG
mov es, bx
; Segment 0xn000 corresponds to slot n in the allocation table
mov bx, cs
mov cl, 12
shr bx, cl
mov byte [es:GLOBAL_MEMORY_ALLOCATION_MAP + bx], 0
pop es
pop cx
pop bx
ret