forked from KolibriOS/kolibrios
122 lines
2.0 KiB
Plaintext
122 lines
2.0 KiB
Plaintext
|
(*
|
||
|
BSD 2-Clause License
|
||
|
|
||
|
Copyright (c) 2018-2022, Anton Krotov
|
||
|
All rights reserved.
|
||
|
*)
|
||
|
|
||
|
MODULE API;
|
||
|
|
||
|
IMPORT SYSTEM;
|
||
|
|
||
|
CONST
|
||
|
eol* = 0DX + 0AX;
|
||
|
BIT_DEPTH* = 32;
|
||
|
|
||
|
VAR
|
||
|
action*, cmdline*: INTEGER;
|
||
|
|
||
|
|
||
|
PROCEDURE [stdcall-] sysfunc3* (arg1, arg2, arg3: INTEGER): INTEGER;
|
||
|
BEGIN
|
||
|
SYSTEM.CODE(
|
||
|
053H, (* push ebx *)
|
||
|
08BH, 045H, 008H, (* mov eax, dword [ebp + 8] *)
|
||
|
08BH, 05DH, 00CH, (* mov ebx, dword [ebp + 12] *)
|
||
|
08BH, 04DH, 010H, (* mov ecx, dword [ebp + 16] *)
|
||
|
0CDH, 040H, (* int 64 *)
|
||
|
05BH, (* pop ebx *)
|
||
|
0C9H, (* leave *)
|
||
|
0C2H, 00CH, 000H (* ret 12 *)
|
||
|
)
|
||
|
RETURN 0
|
||
|
END sysfunc3;
|
||
|
|
||
|
|
||
|
PROCEDURE OutChar* (c: CHAR);
|
||
|
BEGIN
|
||
|
sysfunc3(63, 1, ORD(c))
|
||
|
END OutChar;
|
||
|
|
||
|
|
||
|
PROCEDURE OutLn*;
|
||
|
BEGIN
|
||
|
OutChar(0DX);
|
||
|
OutChar(0AX)
|
||
|
END OutLn;
|
||
|
|
||
|
|
||
|
PROCEDURE OutStr (pchar: INTEGER);
|
||
|
VAR
|
||
|
c: CHAR;
|
||
|
BEGIN
|
||
|
IF pchar # 0 THEN
|
||
|
REPEAT
|
||
|
SYSTEM.GET(pchar, c);
|
||
|
IF c # 0X THEN
|
||
|
OutChar(c)
|
||
|
END;
|
||
|
INC(pchar)
|
||
|
UNTIL c = 0X
|
||
|
END
|
||
|
END OutStr;
|
||
|
|
||
|
|
||
|
PROCEDURE DebugMsg* (lpText, lpCaption: INTEGER);
|
||
|
BEGIN
|
||
|
IF lpCaption # 0 THEN
|
||
|
OutLn;
|
||
|
OutStr(lpCaption);
|
||
|
OutChar(":");
|
||
|
OutLn
|
||
|
END;
|
||
|
OutStr(lpText);
|
||
|
IF lpCaption # 0 THEN
|
||
|
OutLn
|
||
|
END
|
||
|
END DebugMsg;
|
||
|
|
||
|
|
||
|
PROCEDURE _NEW* (size: INTEGER): INTEGER;
|
||
|
RETURN sysfunc3(68, 12, size)
|
||
|
END _NEW;
|
||
|
|
||
|
|
||
|
PROCEDURE _DISPOSE* (ptr: INTEGER): INTEGER;
|
||
|
BEGIN
|
||
|
sysfunc3(68, 13, ptr)
|
||
|
RETURN 0
|
||
|
END _DISPOSE;
|
||
|
|
||
|
|
||
|
PROCEDURE init* (reserved, code: INTEGER);
|
||
|
BEGIN
|
||
|
sysfunc3(68, 11, 0)
|
||
|
END init;
|
||
|
|
||
|
|
||
|
PROCEDURE exit* (code: INTEGER);
|
||
|
BEGIN
|
||
|
sysfunc3(-1, 0, 0)
|
||
|
END exit;
|
||
|
|
||
|
|
||
|
PROCEDURE exit_thread* (code: INTEGER);
|
||
|
BEGIN
|
||
|
sysfunc3(-1, 0, 0)
|
||
|
END exit_thread;
|
||
|
|
||
|
|
||
|
PROCEDURE dllentry* (hinstDLL, fdwReason, lpvReserved: INTEGER): INTEGER;
|
||
|
BEGIN
|
||
|
action := hinstDLL;
|
||
|
cmdline := fdwReason
|
||
|
RETURN action
|
||
|
END dllentry;
|
||
|
|
||
|
|
||
|
PROCEDURE sofinit*;
|
||
|
END sofinit;
|
||
|
|
||
|
|
||
|
END API.
|