2017-11-02 17:36:50 +01:00
|
|
|
(*
|
2019-03-11 09:59:55 +01:00
|
|
|
BSD 2-Clause License
|
2016-10-24 01:30:27 +02:00
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
Copyright (c) 2018, 2019, Anton Krotov
|
|
|
|
All rights reserved.
|
2016-10-24 01:30:27 +02:00
|
|
|
*)
|
|
|
|
|
|
|
|
MODULE API;
|
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
IMPORT SYSTEM;
|
2016-10-24 01:30:27 +02:00
|
|
|
|
|
|
|
VAR
|
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
eol*: ARRAY 3 OF CHAR;
|
|
|
|
base*: INTEGER;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE [windows-, "kernel32.dll", "ExitProcess"] ExitProcess (code: INTEGER);
|
|
|
|
PROCEDURE [windows-, "kernel32.dll", "ExitThread"] ExitThread (code: INTEGER);
|
|
|
|
PROCEDURE [windows-, "kernel32.dll", "GlobalAlloc"] Alloc (uFlags, dwBytes: INTEGER): INTEGER;
|
|
|
|
PROCEDURE [windows-, "kernel32.dll", "GlobalFree"] Free (hMem: INTEGER): INTEGER;
|
2016-10-24 01:30:27 +02:00
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
PROCEDURE [windows-, "user32.dll", "MessageBoxA"] MessageBoxA (hWnd, lpText, lpCaption, uType: INTEGER): INTEGER;
|
2016-10-24 01:30:27 +02:00
|
|
|
|
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
PROCEDURE DebugMsg* (lpText, lpCaption: INTEGER);
|
2016-10-24 01:30:27 +02:00
|
|
|
BEGIN
|
2019-03-11 09:59:55 +01:00
|
|
|
MessageBoxA(0, lpText, lpCaption, 16)
|
2016-10-24 01:30:27 +02:00
|
|
|
END DebugMsg;
|
|
|
|
|
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
PROCEDURE _NEW* (size: INTEGER): INTEGER;
|
|
|
|
RETURN Alloc(64, size)
|
2016-10-24 01:30:27 +02:00
|
|
|
END _NEW;
|
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
|
|
|
|
PROCEDURE _DISPOSE* (p: INTEGER): INTEGER;
|
|
|
|
RETURN Free(p)
|
2016-10-24 01:30:27 +02:00
|
|
|
END _DISPOSE;
|
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
|
|
|
|
PROCEDURE init* (reserved, code: INTEGER);
|
2016-10-24 01:30:27 +02:00
|
|
|
BEGIN
|
2019-03-11 09:59:55 +01:00
|
|
|
eol[0] := 0DX; eol[1] := 0AX; eol[2] := 0X;
|
|
|
|
base := code - 4096
|
|
|
|
END init;
|
2016-10-24 01:30:27 +02:00
|
|
|
|
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
PROCEDURE exit* (code: INTEGER);
|
|
|
|
BEGIN
|
|
|
|
ExitProcess(code)
|
|
|
|
END exit;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE exit_thread* (code: INTEGER);
|
|
|
|
BEGIN
|
|
|
|
ExitThread(code)
|
|
|
|
END exit_thread;
|
2016-10-24 01:30:27 +02:00
|
|
|
|
|
|
|
|
2019-03-11 09:59:55 +01:00
|
|
|
END API.
|