2020-05-25 22:48:33 +02:00
|
|
|
MODULE HW;
|
2016-10-24 01:30:27 +02:00
|
|
|
|
2022-01-18 17:23:19 +01:00
|
|
|
IMPORT
|
|
|
|
SYSTEM, KOSAPI;
|
2016-10-24 01:30:27 +02:00
|
|
|
|
2022-01-18 17:23:19 +01:00
|
|
|
|
|
|
|
PROCEDURE BeginDraw;
|
|
|
|
BEGIN
|
|
|
|
KOSAPI.sysfunc2(12, 1)
|
|
|
|
END BeginDraw;
|
|
|
|
|
|
|
|
|
|
|
|
PROCEDURE EndDraw;
|
2016-10-24 01:30:27 +02:00
|
|
|
BEGIN
|
2022-01-18 17:23:19 +01:00
|
|
|
KOSAPI.sysfunc2(12, 2)
|
|
|
|
END EndDraw;
|
|
|
|
|
2016-10-24 01:30:27 +02:00
|
|
|
|
2022-01-18 17:23:19 +01:00
|
|
|
PROCEDURE DefineAndDrawWindow (left, top, width, height, color, style, hcolor, hstyle: INTEGER; header: ARRAY OF CHAR);
|
2016-10-24 01:30:27 +02:00
|
|
|
BEGIN
|
2022-01-18 17:23:19 +01:00
|
|
|
KOSAPI.sysfunc6(0, left*65536 + width, top*65536 + height, color + LSL(style, 24), hcolor + LSL(hstyle, 24), SYSTEM.ADR(header[0]))
|
2016-10-24 01:30:27 +02:00
|
|
|
END DefineAndDrawWindow;
|
|
|
|
|
2022-01-18 17:23:19 +01:00
|
|
|
|
|
|
|
PROCEDURE WriteTextToWindow (x, y, color: INTEGER; text: ARRAY OF CHAR);
|
2016-10-24 01:30:27 +02:00
|
|
|
BEGIN
|
2022-01-18 17:23:19 +01:00
|
|
|
KOSAPI.sysfunc6(4, x*65536 + y, color + LSL(48, 24), SYSTEM.ADR(text[0]), LENGTH(text), 0)
|
2016-10-24 01:30:27 +02:00
|
|
|
END WriteTextToWindow;
|
|
|
|
|
2022-01-18 17:23:19 +01:00
|
|
|
|
|
|
|
PROCEDURE WaitForEvent (): INTEGER;
|
|
|
|
RETURN KOSAPI.sysfunc1(10)
|
2016-10-24 01:30:27 +02:00
|
|
|
END WaitForEvent;
|
|
|
|
|
2022-01-18 17:23:19 +01:00
|
|
|
|
2016-10-24 01:30:27 +02:00
|
|
|
PROCEDURE ExitApp;
|
|
|
|
BEGIN
|
2022-01-18 17:23:19 +01:00
|
|
|
KOSAPI.sysfunc1(-1)
|
2016-10-24 01:30:27 +02:00
|
|
|
END ExitApp;
|
|
|
|
|
2022-01-18 17:23:19 +01:00
|
|
|
|
|
|
|
PROCEDURE draw_window (header, text: ARRAY OF CHAR);
|
|
|
|
CONST
|
|
|
|
WHITE = 0FFFFFFH;
|
|
|
|
RED = 0C00000H;
|
|
|
|
GREEN = 0008000H;
|
|
|
|
BLUE = 00000C0H;
|
|
|
|
GRAY = 0808080H;
|
2016-10-24 01:30:27 +02:00
|
|
|
BEGIN
|
2022-01-18 17:23:19 +01:00
|
|
|
BeginDraw;
|
|
|
|
DefineAndDrawWindow(200, 200, 300, 150, WHITE, 51, 0, 0, header);
|
|
|
|
WriteTextToWindow( 5, 10, RED, text);
|
|
|
|
WriteTextToWindow(35, 30, GREEN, text);
|
|
|
|
WriteTextToWindow(65, 50, BLUE, text);
|
|
|
|
WriteTextToWindow(95, 70, GRAY, text);
|
|
|
|
EndDraw
|
2016-10-24 01:30:27 +02:00
|
|
|
END draw_window;
|
|
|
|
|
2022-01-18 17:23:19 +01:00
|
|
|
|
|
|
|
PROCEDURE main (header, text: ARRAY OF CHAR);
|
|
|
|
CONST
|
|
|
|
EVENT_REDRAW = 1;
|
|
|
|
EVENT_KEY = 2;
|
|
|
|
EVENT_BUTTON = 3;
|
2016-10-24 01:30:27 +02:00
|
|
|
BEGIN
|
2022-01-18 17:23:19 +01:00
|
|
|
WHILE TRUE DO
|
|
|
|
CASE WaitForEvent() OF
|
|
|
|
|EVENT_REDRAW: draw_window(header, text)
|
|
|
|
|EVENT_KEY: ExitApp
|
|
|
|
|EVENT_BUTTON: ExitApp
|
|
|
|
END
|
|
|
|
END
|
|
|
|
END main;
|
|
|
|
|
2016-10-24 01:30:27 +02:00
|
|
|
|
|
|
|
BEGIN
|
2022-01-18 17:23:19 +01:00
|
|
|
main("Hello", "Hello, world!")
|
2020-05-25 22:48:33 +02:00
|
|
|
END HW.
|