%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