{ unit Atari Portfolio Crt } unit AU_CRT; interface var hod, min, sek, ssek, mesic, den, dent : byte; rok : word; procedure AtGetTime; procedure AtGetDate; procedure AtDelay(cas : word); function AtKeyPressed:boolean; function AtReadKey:char; procedure AtClrScr; procedure AtGoToXY(x,y : byte); procedure AtText(text : string); procedure AtTextLn(text : string); function InPortA:byte; function InPortB:byte; function InPortC:byte; procedure OutPortA(ven:byte); procedure OutPortB(ven:byte); procedure OutPortC(ven:byte); procedure OutPortCW(ven:byte); implementation procedure AtGetTime; begin asm mov ah,$2C {precti cas ze systemu} int $21 mov hod,ch {hodiny} mov min,cl {minuty} mov sek,dh {sekundy} mov ssek,dl {setiny sekundy} end; end; procedure AtGetDate; begin asm mov ah,$2A {precti datum ze systemu} int $21 mov rok,cx {rok} mov mesic,dh {mesic} mov den,dl {den} mov dent,al {den v tydnu 0=nedele, 1=pondeli..} end; end; procedure AtDelay(cas : word); var a : word; begin for a := 1 to cas do begin asm mov bx,205 {16000 pro 486DX66} @l1: dec bx jnz @l1 end; end; end; function AtKeyPressed:boolean; var key : byte; begin AtKeyPressed := false; asm mov ah,$01 {zjisteni pritomnosti znaku na vstupu} int $16 jz @nokey {ZERO = nic} mov key,$FF jmp @end @nokey: mov key,$00 @end: end; If key=$FF then AtKeyPressed := true; end; function AtReadKey:char; var key : byte; begin asm mov ah,$00 {cteni znaku ze vstupu} int $16 mov key,al end; AtReadKey := chr(key); end; procedure AtClrScr; begin asm mov ah,$0f {ziskani rezimu zobrazeni} int $10 {rezim zobrazeni v AL} mov ah,0 {smazani obrazovky a nastaveni rezimu zobrazeni} int $10 end; end; procedure AtGoToXY(x,y : byte); begin asm mov dl,x {sloupec} mov dh,y {radek} mov bh,0 {cislo videostranky} mov ah,2 {nastaveni pozice kurzoru} int $10 end; end; procedure AtText(text : string); var del, a, tisk : byte; znak : char; begin del := length(text); for a := 1 to del do begin znak := text[a]; asm mov al,znak mov ah,$0e {zapis znaku s posuvem kurzoru} int $10 end; end; end; procedure AtTextLn(text : string); var textln : string; begin AtText(text + Chr(13) + Chr(10)); end; function InPortA:byte; begin asm mov dx,$8078 in al,dx mov @Result,al end; end; {function InPortA} function InPortB:byte; begin asm mov dx,$8079 in al,dx mov @Result,al end; end; {function InPortB} function InPortC:byte; begin asm mov dx,$807A in al,dx mov @Result,al end; end; {function InPortC} procedure OutPortA(ven:byte); begin asm mov dx,$8078 mov al,ven out dx,al end; end; {procedure OutPortA} procedure OutPortB(ven:byte); begin asm mov dx,$8079 mov al,ven out dx,al end; end; {procedure OutPortB} procedure OutPortC(ven:byte); begin asm mov dx,$807A mov al,ven out dx,al end; end; {procedure OutPortC} procedure OutPortCW(ven:byte); begin asm mov dx,$807B mov al,ven out dx,al end; end; {procedure OutPortCW} end.