implementation
var
screen_page : byte;
screen_width: byte;
procedure gotoXY (x,y:integer);
begin
ASM
{GOTORC proc ;position cursor according to DH, DL}
DEC X {Pascal from 1, bios from 0}
DEC Y
MOV AH, $02 { ;BIOS service "position cursor"}
MOV BH, screen_page { ;page 0 or as set by clearscreen}
MOV DH, BYTE PTR Y { ;row and column are passed by caller }
MOV DL, BYTE PTR X
INT $10 {;call BIOS video services}
END; {asm}
end;{gotoRC endp}
procedure clrScr; { proc ;clear screen, store page and segment address}
label done;
begin
{;Test video mode, change pageseg for colour if necessary}
ASM
MOV AH, $0F { ;read video mode }
INT $10 { ;Call BIOS }
mov Screen_page, bh { information enabling us to write directly}
mov Screen_width,ah { ; to video memory}
CMP AL,7 {AL is mode, is it monochrome?}
JA DONE {probably graphics, do nothing }
MOV AX, $0600 { CLEAR SCREEN function, all lines}
MOV BH,TextAttr {black bkgd, white chars unless changed}
MOV CX, 0 {;upper left }
MOV DH,24 {;assume 25 lines }
MOV DL,screen_width
dec dl
INT $10 { call BIOS video services}
end; {asm}
{; position cursor at upper left}
GotoXY(1,1);
done:
END; {clearScreen endp}
Partager