Rev 666 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 666 | Rev 763 | ||
---|---|---|---|
1 | {-$codepage cp866} |
1 | {-$codepage cp866} |
2 | 2 | ||
3 | type |
3 | type |
4 | TKosPoint = packed record |
4 | TKosPoint = packed record |
5 | X: Longint; |
5 | X: Longint; |
6 | Y: Longint; |
6 | Y: Longint; |
7 | end; |
7 | end; |
8 | 8 | ||
9 | TKosRect = packed record |
9 | TKosRect = packed record |
10 | case Integer of |
10 | case Integer of |
11 | 0: (Left, Top, Width, Height: Longint); |
11 | 0: (Left, Top, Width, Height: Longint); |
12 | 1: (TopLeft, HeightWidth: TKosPoint); |
12 | 1: (TopLeft, HeightWidth: TKosPoint); |
13 | end; |
13 | end; |
14 | 14 | ||
15 | { User interface } |
15 | { User interface } |
16 | procedure kos_definewindow(x, y, w, h: Word; style: DWord = $23FFFFFF; header: DWord = $008899FF; clframe: DWord = $008899FF); |
16 | procedure kos_definewindow(x, y, w, h: Word; style: DWord = $23FFFFFF; header: DWord = $008899FF; clframe: DWord = $008899FF); |
17 | procedure kos_movewindow(x, y, w, h: DWord); |
17 | procedure kos_movewindow(x, y, w, h: DWord); |
18 | function kos_getkey(): DWord; |
18 | function kos_getkey(): DWord; |
19 | function kos_getevent(wait: Boolean = True): DWord; |
19 | function kos_getevent(wait: Boolean = True): DWord; |
20 | function kos_waitevent(timeout: DWord): DWord; |
20 | function kos_waitevent(timeout: DWord): DWord; |
21 | function kos_getbutton(): DWord; |
21 | function kos_getbutton(): DWord; |
22 | function kos_getmousepos(): TKosPoint; |
22 | function kos_getmousepos(): TKosPoint; |
23 | function kos_getmousewinpos(): TKosPoint; |
23 | function kos_getmousewinpos(): TKosPoint; |
24 | function kos_getmousebuttons(): DWord; |
24 | function kos_getmousebuttons(): DWord; |
25 | procedure kos_maskevents(mask: DWord); |
25 | procedure kos_maskevents(mask: DWord); |
- | 26 | procedure kos_setkeyboardmode(mode: DWord); |
|
- | 27 | function kos_getkeyboardmode(): DWord; |
|
26 | procedure kos_setcaption(caption: PChar); |
28 | procedure kos_setcaption(caption: PChar); |
27 | 29 | ||
28 | { Graphics } |
30 | { Graphics } |
29 | function kos_screensize(): TKosPoint; |
31 | function kos_screensize(): TKosPoint; |
30 | procedure kos_begindraw(); |
32 | procedure kos_begindraw(); |
31 | procedure kos_enddraw(); |
33 | procedure kos_enddraw(); |
32 | procedure kos_putpixel(x, y: Word; color: DWord = $000000); |
34 | procedure kos_putpixel(x, y: Word; color: DWord = $000000); |
33 | procedure kos_drawtext(x, y: Word; text: String; flags: DWord = $000000; bgcolor: DWord = $00FFFFFF); |
35 | procedure kos_drawtext(x, y: Word; text: String; flags: DWord = $000000; bgcolor: DWord = $00FFFFFF); |
34 | procedure kos_drawrect(x, y, w, h: Word; color: DWord = $000000); |
36 | procedure kos_drawrect(x, y, w, h: Word; color: DWord = $000000); |
35 | procedure kos_drawline(x1, y1, x2, y2: Word; color: DWord = $000000); |
37 | procedure kos_drawline(x1, y1, x2, y2: Word; color: DWord = $000000); |
36 | procedure kos_drawimage(x, y, w, h, depth: DWord; image: Pointer; palette: Pointer = nil; xoffset: DWord = 0); |
38 | procedure kos_drawimage(x, y, w, h, depth: DWord; image: Pointer; palette: Pointer = nil; xoffset: DWord = 0); |
37 | procedure kos_drawimage24(x, y, w, h: DWord; image: Pointer); |
39 | procedure kos_drawimage24(x, y, w, h: DWord; image: Pointer); |
38 | 40 | ||
39 | { Work with system } |
41 | { Work with system } |
40 | 42 | ||
41 | { Work with system - System services } |
43 | { Work with system - System services } |
42 | function kos_killthread(tid: TThreadID): Boolean; |
44 | function kos_killthread(tid: TThreadID): Boolean; |
43 | procedure kos_setactivewindow(slot: TThreadSlot); |
45 | procedure kos_setactivewindow(slot: TThreadSlot); |
44 | function kos_getthreadslot(tid: TThreadID): TThreadSlot; |
46 | function kos_getthreadslot(tid: TThreadID): TThreadSlot; |
45 | 47 | ||
46 | { Work with system - Set system parameters } |
48 | { Work with system - Set system parameters } |
47 | procedure kos_enablepci(); |
49 | procedure kos_enablepci(); |
48 | 50 | ||
49 | { Work with system - Get system parameters } |
51 | { Work with system - Get system parameters } |
50 | function kos_timecounter(): DWord; |
52 | function kos_timecounter(): DWord; |
51 | 53 | ||
52 | { Work with system - Internal system services } |
54 | { Work with system - Internal system services } |
53 | procedure kos_switchthread(); |
55 | procedure kos_switchthread(); |
54 | function kos_initheap(): DWord; |
56 | function kos_initheap(): DWord; |
55 | function kos_alloc(size: DWord): Pointer; |
57 | function kos_alloc(size: DWord): Pointer; |
56 | function kos_free(ptr: Pointer): Boolean; |
58 | function kos_free(ptr: Pointer): Boolean; |
57 | function kos_loaddriver(name: PChar): THandle; |
59 | function kos_loaddriver(name: PChar): THandle; |
58 | 60 | ||
59 | { Processes and threads } |
61 | { Processes and threads } |
60 | type |
62 | type |
61 | PKosThreadInfo = ^TKosThreadInfo; |
63 | PKosThreadInfo = ^TKosThreadInfo; |
62 | TKosThreadInfo = packed record |
64 | TKosThreadInfo = packed record |
63 | Speed: DWord; |
65 | Speed: DWord; |
64 | WindowID: Word; |
66 | WindowID: Word; |
65 | ThreadSlot: Word; |
67 | ThreadSlot: Word; |
66 | Reserved1: Word; |
68 | Reserved1: Word; |
67 | AppName: array[0..10] of Char; |
69 | AppName: array[0..10] of Char; |
68 | Reserved2: Byte; |
70 | Reserved2: Byte; |
69 | ProcessBase: Pointer; |
71 | ProcessBase: Pointer; |
70 | MemoryUsage: DWord; |
72 | MemoryUsage: DWord; |
71 | ThreadID: TThreadID; |
73 | ThreadID: TThreadID; |
72 | WindowRect: TKosRect; |
74 | WindowRect: TKosRect; |
73 | Reserved3: DWord; |
75 | Reserved3: DWord; |
74 | ClientRect: TKosRect; |
76 | ClientRect: TKosRect; |
75 | Reserved4: array[1..1046] of Byte; |
77 | Reserved4: array[1..1046] of Byte; |
76 | end; |
78 | end; |
77 | 79 | ||
78 | {ãä¥à IPC} |
80 | {ãä¥à IPC} |
79 | PKosIPC = ^TKosIPC; |
81 | PKosIPC = ^TKosIPC; |
80 | TKosIPC = packed record |
82 | TKosIPC = packed record |
81 | Lock: LongBool; |
83 | Lock: LongBool; |
82 | Size: DWord; |
84 | Size: DWord; |
83 | {á®®¡é¥¨¥ #1...} |
85 | {á®®¡é¥¨¥ #1...} |
84 | {á®®¡é¥¨¥ #2...} |
86 | {á®®¡é¥¨¥ #2...} |
85 | {...} |
87 | {...} |
86 | end; |
88 | end; |
87 | 89 | ||
88 | {®®¡é¥¨¥ IPC} |
90 | {®®¡é¥¨¥ IPC} |
89 | PKosMessage = ^TKosMessage; |
91 | PKosMessage = ^TKosMessage; |
90 | TKosMessage = packed record |
92 | TKosMessage = packed record |
91 | SenderID: TThreadID; |
93 | SenderID: TThreadID; |
92 | Size: DWord; |
94 | Size: DWord; |
93 | {⥫® á®®¡é¥¨ï...} |
95 | {⥫® á®®¡é¥¨ï...} |
94 | end; |
96 | end; |
95 | 97 | ||
96 | function kos_threadinfo(info: PKosThreadInfo; slot: TThreadSlot = -1): DWord; |
98 | function kos_threadinfo(info: PKosThreadInfo; slot: TThreadSlot = -1): DWord; |
97 | function kos_newthread(entry, stack: Pointer): TThreadID; |
99 | function kos_newthread(entry, stack: Pointer): TThreadID; |
98 | procedure kos_initipc(ipc: PKosIPC; size: DWord); |
100 | procedure kos_initipc(ipc: PKosIPC; size: DWord); |
99 | function kos_sendmsg(tid: TThreadID; msg: Pointer; size: DWord): DWord; |
101 | function kos_sendmsg(tid: TThreadID; msg: Pointer; size: DWord): DWord; |
100 | function kos_resizemem(size: DWord): Boolean; |
102 | function kos_resizemem(size: DWord): Boolean; |
101 | 103 | ||
102 | { File system } |
104 | { File system } |
103 | { File system - Work with the current folder } |
105 | { File system - Work with the current folder } |
104 | 106 | ||
105 | procedure kos_setdir(path: PChar); |
107 | procedure kos_setdir(path: PChar); |
106 | function kos_getdir(path: PChar; size: DWord): DWord; |
108 | function kos_getdir(path: PChar; size: DWord): DWord; |
107 | 109 | ||
108 | { File system - Work with file system with long names support } |
110 | { File system - Work with file system with long names support } |
109 | 111 | ||
110 | const |
112 | const |
111 | kfReadOnly = $01; |
113 | kfReadOnly = $01; |
112 | kfHidden = $02; |
114 | kfHidden = $02; |
113 | kfSystem = $04; |
115 | kfSystem = $04; |
114 | kfLabel = $08; |
116 | kfLabel = $08; |
115 | kfFolder = $10; |
117 | kfFolder = $10; |
116 | kfNotArchive = $20; |
118 | kfNotArchive = $20; |
117 | 119 | ||
118 | type |
120 | type |
119 | PKosFile = ^TKosFile; |
121 | PKosFile = ^TKosFile; |
120 | TKosFile = packed record |
122 | TKosFile = packed record |
121 | SubFunc: DWord; |
123 | SubFunc: DWord; |
122 | Position, PositionReserved: DWord; |
124 | Position, PositionReserved: DWord; |
123 | Size: DWord; |
125 | Size: DWord; |
124 | Data: Pointer; |
126 | Data: Pointer; |
125 | Name: array[0..0] of Char; {...ASCIIZ} |
127 | Name: array[0..0] of Char; {...ASCIIZ} |
126 | end; |
128 | end; |
127 | 129 | ||
128 | PKosBDFE = ^TKosBDFE; |
130 | PKosBDFE = ^TKosBDFE; |
129 | TKosBDFE = packed record |
131 | TKosBDFE = packed record |
130 | Attributes: DWord; |
132 | Attributes: DWord; |
131 | NameType: Byte; {bit0 - 0:ascii, 1:unicode} |
133 | NameType: Byte; {bit0 - 0:ascii, 1:unicode} |
132 | Reserved: array[0..2] of Byte; |
134 | Reserved: array[0..2] of Byte; |
133 | CTime: DWord; {ss,mm,hh,00} |
135 | CTime: DWord; {ss,mm,hh,00} |
134 | CDate: DWord; {dd,mm,yyyy} |
136 | CDate: DWord; {dd,mm,yyyy} |
135 | ATime: DWord; |
137 | ATime: DWord; |
136 | ADate: DWord; |
138 | ADate: DWord; |
137 | MTime: DWord; |
139 | MTime: DWord; |
138 | MDate: DWord; |
140 | MDate: DWord; |
139 | Size: QWord; |
141 | Size: QWord; |
140 | Name: array[0..519] of Char; |
142 | Name: array[0..519] of Char; |
141 | end; |
143 | end; |
142 | 144 | ||
143 | function kos_readfile(kosfile: PKosFile; var readed: Longint): DWord; |
145 | function kos_readfile(kosfile: PKosFile; var readed: Longint): DWord; |
144 | function kos_rewritefile(kosfile: PKosFile; var writed: Longint): DWord; |
146 | function kos_rewritefile(kosfile: PKosFile; var writed: Longint): DWord; |
145 | function kos_writefile(kosfile: PKosFile; var writed: Longint): DWord; |
147 | function kos_writefile(kosfile: PKosFile; var writed: Longint): DWord; |
146 | function kos_fileinfo(kosfile: PKosFile): DWord; |
148 | function kos_fileinfo(kosfile: PKosFile): DWord; |
147 | 149 | ||
148 | { Sound } |
150 | { Sound } |
149 | 151 | ||
150 | function kos_speaker(notes: Pointer): Boolean; |
152 | function kos_speaker(notes: Pointer): Boolean; |
151 | 153 | ||
152 | { Work with hardware } |
154 | { Work with hardware } |
153 | function kos_readport(index: DWord): DWord; |
155 | function kos_readport(index: DWord): DWord; |
154 | procedure kos_writeport(index, value: DWord); |
156 | procedure kos_writeport(index, value: DWord); |
155 | function kos_reserveport(port: DWord): Boolean; |
157 | function kos_reserveport(port: DWord): Boolean; |
156 | 158 | ||
157 | { Work with hardware - Low-level access to PCI} |
159 | { Work with hardware - Low-level access to PCI} |
158 | function kos_lastpcibus(): Byte; |
160 | function kos_lastpcibus(): Byte; |
159 | function kos_readpcib(bus, dev, func, reg: Byte): Byte; |
161 | function kos_readpcib(bus, dev, func, reg: Byte): Byte; |
160 | function kos_readpciw(bus, dev, func, reg: Byte): Word; |
162 | function kos_readpciw(bus, dev, func, reg: Byte): Word; |
161 | function kos_readpcid(bus, dev, func, reg: Byte): DWord; |
163 | function kos_readpcid(bus, dev, func, reg: Byte): DWord; |
162 | 164 | ||
163 | { Other } |
165 | { Other } |
164 | procedure kos_delay(ms: DWord); {1/100 s} |
166 | procedure kos_delay(ms: DWord); {1/100 s} |
165 | 167 | ||
166 | { my } |
168 | { my } |
167 | type |
169 | type |
168 | TKosSign = array[0..7] of Byte; |
170 | TKosSign = array[0..7] of Byte; |
169 | PKosHeader = ^TKosHeader; |
171 | PKosHeader = ^TKosHeader; |
170 | TKosHeader = packed record |
172 | TKosHeader = packed record |
171 | sign : TKOSSign; |
173 | sign : TKOSSign; |
172 | version: DWord; |
174 | version: DWord; |
173 | start : DWord; |
175 | start : DWord; |
174 | size : DWord; |
176 | size : DWord; |
175 | memory : DWord; |
177 | memory : DWord; |
176 | stack : DWord; |
178 | stack : DWord; |
177 | args : PChar; |
179 | args : PChar; |
178 | path : PChar; |
180 | path : PChar; |
179 | end; |
181 | end; |
180 | 182 | ||
181 | 183 | ||
182 | type |
184 | type |
183 | PKonsole = ^TKonsole; |
185 | PKonsole = ^TKonsole; |
184 | TKonsole = object |
186 | TKonsole = object |
185 | private |
187 | private |
186 | FCaption: String; |
188 | FCaption: String; |
187 | FLines: array of ShortString; |
189 | FLines: array of ShortString; |
188 | FCursor: TKosPoint; |
190 | FCursor: TKosPoint; |
189 | FMaxLines: Word; |
191 | FMaxLines: Word; |
190 | FThreadID: TThreadID; |
192 | FThreadID: TThreadID; |
191 | FThreadSlot: TThreadSlot; |
193 | FThreadSlot: TThreadSlot; |
192 | FIPCBuffer: PKosIPC; |
194 | FIPCBuffer: PKosIPC; |
193 | FIPCBufferSize: DWord; |
195 | FIPCBufferSize: DWord; |
194 | FTerminate: Boolean; |
196 | FTerminate: Boolean; |
195 | FOpened: Boolean; |
197 | FOpened: Boolean; |
196 | FOnAir : Boolean; |
198 | FOnAir : Boolean; |
197 | FKeyPressed: Word; |
199 | FKeyPressed: Word; |
198 | function ReceiveMessage(var Message: ShortString): Boolean; |
200 | function ReceiveMessage(var Message: ShortString): Boolean; |
199 | procedure ProcessMessage(Message: ShortString); |
201 | procedure ProcessMessage(Message: ShortString); |
200 | procedure ProcessKeyboard(Key: Word); |
202 | procedure ProcessKeyboard(Key: Word); |
201 | function GetRect(): TKosRect; |
203 | function GetRect(): TKosRect; |
202 | function GetKeyPressed(): Word; |
204 | function GetKeyPressed(): Word; |
203 | procedure Paint(BottomRow: Boolean = False); |
205 | procedure Paint(BottomRow: Boolean = False); |
204 | procedure Flush(); |
206 | procedure Flush(); |
205 | public |
207 | public |
206 | constructor Init(ACaption: String = ''); |
208 | constructor Init(ACaption: String = ''); |
207 | destructor Done(); |
209 | destructor Done(); |
208 | procedure Write(Message: ShortString); |
210 | procedure Write(Message: ShortString); |
209 | property KeyPressed: Word read GetKeyPressed; |
211 | property KeyPressed: Word read GetKeyPressed; |
210 | property Opened: Boolean read FOpened; |
212 | property Opened: Boolean read FOpened; |
211 | property ThreadID: TThreadID read FThreadID; {JustForFun, must be hidden, do not use} |
213 | property ThreadID: TThreadID read FThreadID; {JustForFun, must be hidden, do not use} |
212 | property ThreadSlot: TThreadSlot read FThreadSlot; {JustForFun, must be hidden, do not use} |
214 | property ThreadSlot: TThreadSlot read FThreadSlot; {JustForFun, must be hidden, do not use} |
213 | end; |
215 | end; |
214 | 216 | ||
215 | (* §à ¡®âª â¥à¬¨ « ¢ à ¬ª å RTL ¯à¥ªà é¥ . ¥à¬¨ « ¡ã¤¥â ¢ë¤¥«¥ ¨§ ª®¤ |
217 | (* §à ¡®âª â¥à¬¨ « ¢ à ¬ª å RTL ¯à¥ªà é¥ . ¥à¬¨ « ¡ã¤¥â ¢ë¤¥«¥ ¨§ ª®¤ |
216 | ª®á®«ì®£® ¯à¨«®¦¥¨ï ¨ ¤®«¦¥ ¡ëâì ॠ«¨§®¢ ª ª ®â¤¥«ìë© á¥à¢¨á á |
218 | ª®á®«ì®£® ¯à¨«®¦¥¨ï ¨ ¤®«¦¥ ¡ëâì ॠ«¨§®¢ ª ª ®â¤¥«ìë© á¥à¢¨á á |
217 | ¤¨ ¬¨ç¥áª¨¬ ¯®¤ª«î票¥¬, «¨¡® ª ª ®â¤¥«ìë© ¬®¤ã«ì FreePascal á® áâ â¨ç¥áª¨¬ |
219 | ¤¨ ¬¨ç¥áª¨¬ ¯®¤ª«î票¥¬, «¨¡® ª ª ®â¤¥«ìë© ¬®¤ã«ì FreePascal á® áâ â¨ç¥áª¨¬ |
218 | ¨«¨ ¤¨ ¬¨ç¥áª¨¬ ¯®¤ª«î票¥¬ â¥à¬¨ «ì®£® äãªæ¨® « . |
220 | ¨«¨ ¤¨ ¬¨ç¥áª¨¬ ¯®¤ª«î票¥¬ â¥à¬¨ «ì®£® äãªæ¨® « . |
219 | 221 | ||
220 | PTermKursor = ^TTermKursor; |
222 | PTermKursor = ^TTermKursor; |
221 | TTermKursor = object |
223 | TTermKursor = object |
222 | private |
224 | private |
223 | FVisible: Boolean; |
225 | FVisible: Boolean; |
224 | procedure SetVisbile(Value: Boolean); |
226 | procedure SetVisbile(Value: Boolean); |
225 | public |
227 | public |
226 | constructor Init; |
228 | constructor Init; |
227 | procedure Repaint; |
229 | procedure Repaint; |
228 | property Visible: Boolean read FVisible write SetVisbile; |
230 | property Visible: Boolean read FVisible write SetVisbile; |
229 | end; |
231 | end; |
230 | 232 | ||
231 | PTermKIO = ^TTermKIO; |
233 | PTermKIO = ^TTermKIO; |
232 | TTermKIO = object |
234 | TTermKIO = object |
233 | private |
235 | private |
234 | FBuffer: Pointer; |
236 | FBuffer: Pointer; |
235 | FBufferScreen: Pointer; |
237 | FBufferScreen: Pointer; |
236 | FBufferSize : Longword; |
238 | FBufferSize : Longword; |
237 | FBufferWidth: Longword; |
239 | FBufferWidth: Longword; |
238 | FBufferLines: Longword; |
240 | FBufferLines: Longword; |
239 | FIPCBuffer: PKosIPC; |
241 | FIPCBuffer: PKosIPC; |
240 | FIPCBufferSize: Longword; |
242 | FIPCBufferSize: Longword; |
241 | FCursor: TTermKursor; |
243 | FCursor: TTermKursor; |
242 | FCaption: String; |
244 | FCaption: String; |
243 | FThreadID: TThreadID; |
245 | FThreadID: TThreadID; |
244 | FThreadSlot: TThreadSlot; |
246 | FThreadSlot: TThreadSlot; |
245 | FTerminate: Boolean; |
247 | FTerminate: Boolean; |
246 | FOpened: Boolean; |
248 | FOpened: Boolean; |
247 | FWindowBounds: TKosRect; |
249 | FWindowBounds: TKosRect; |
248 | FWindowStyle : Longword; |
250 | FWindowStyle : Longword; |
249 | FClientBounds: TKosRect; |
251 | FClientBounds: TKosRect; |
250 | FMaxWidth : Longword; |
252 | FMaxWidth : Longword; |
251 | FFirstLine: Longword; |
253 | FFirstLine: Longword; |
252 | FDefaultChar: Word; |
254 | FDefaultChar: Word; |
253 | FPalette: array[0..15] of Longword; |
255 | FPalette: array[0..15] of Longword; |
254 | procedure MainLoop; |
256 | procedure MainLoop; |
255 | procedure ReallocBuffer(Size: Longword); |
257 | procedure ReallocBuffer(Size: Longword); |
256 | procedure ResizeBuffer(NewWidth, NewLines: Longword); |
258 | procedure ResizeBuffer(NewWidth, NewLines: Longword); |
257 | procedure FillDefaultChar(var X; Count: Longword); |
259 | procedure FillDefaultChar(var X; Count: Longword); |
258 | function GetLine(Index: Longint): Pointer; |
260 | function GetLine(Index: Longint): Pointer; |
259 | function PrevLine(Line: Pointer): Pointer; |
261 | function PrevLine(Line: Pointer): Pointer; |
260 | {function ReceiveMessage(var Message: ShortString): Boolean; |
262 | {function ReceiveMessage(var Message: ShortString): Boolean; |
261 | procedure ProcessMessage(Message: ShortString);} |
263 | procedure ProcessMessage(Message: ShortString);} |
262 | procedure ProcessKeyboard(Key: Word); |
264 | procedure ProcessKeyboard(Key: Word); |
263 | procedure DoPaint(const Bounds: TKosRect); |
265 | procedure DoPaint(const Bounds: TKosRect); |
264 | procedure DoResize; |
266 | procedure DoResize; |
265 | public |
267 | public |
266 | constructor Init(ACaption: String = ''); |
268 | constructor Init(ACaption: String = ''); |
267 | destructor Done; |
269 | destructor Done; |
268 | procedure Write(Message: ShortString); |
270 | procedure Write(Message: ShortString); |
269 | property Cursor: TTermKursor read FCursor; |
271 | property Cursor: TTermKursor read FCursor; |
270 | end;*) |
272 | end;*) |