unit conio; {$I-,R-,S-,V-} interface const unitID: string[18] = 'conio #1.1 (wiz.)'#0; FKEY_ON = $6c31; FKEY_OFF = $6831; CSR_ON = $6c35; CSR_OFF = $6835; CURSOR_ON = $6c35; CURSOR_OFF = $6835; var csrlin: byte absolute $0060:$0110; csrpos: byte absolute $0060:$011c; csrstat: byte absolute $0060:$011b; fkeystat: byte absolute $0060:$0111; attribute: byte absolute $0060:$011d; procedure clrscr; procedure console(c: word); procedure locate(x, y: byte); procedure color(c: byte); procedure putch(c: char); inline($58/ $cd/$29); procedure cputs(s: string); function getch: char; inline($b4/$08/ $cd/$21); function getche: char; inline($b4/$01/ $cd/$21); function getkey: char; inline($b4/$06/ $b2/$ff/ $cd/$21); function kbhit: boolean; inline($b4/$0b/ $cd/$21/ $f6/$d8); implementation const constr: string[5] = #$1b'[>@@'; colorstr: string[7] = #$1b'[0;37m'; colorcode: array[0..7] of char = '04152637'; procedure _cputs; assembler; asm cld lodsb mov cl,al mov ch,0 jcxz @2 @1: lodsb int 29h loop @1 @2: end; procedure cputs(s: string); assembler; asm push ds lds si,s call _cputs pop ds end; procedure clrscr; assembler; asm mov al,1bh int 29h mov al,'*' int 29h end; procedure console(c: word); assembler; asm mov si,offset constr mov ax,c mov word ptr [si][4],ax call _cputs end; procedure locate(x, y: byte); assembler; asm mov al,1bh int 29h mov al,'=' int 29h mov al,byte ptr y add al,1fh int 29h mov al,byte ptr x add al,1fh int 29h end; procedure color(c: byte); assembler; asm mov si,offset colorstr mov al,c mov bx,ax and bx,7 test al,8 mov al,'0' jz @@1 mov al,'7' @@1: mov byte ptr [si][3],al mov al,byte ptr colorcode[bx] mov byte ptr [si][6],al call _cputs end; end.