unit NewCRT;
{$A+,B-,D-,E-,F-,G+,I-,L+,N-,O-,P-,Q-,R-,S-,T-,V+,X+}
interface
procedure norm8x10;
procedure tele8x10;
const
curfont:pointer=@norm8x10;
PutMode:byte=1;
maxx=79;
maxy=34;
fonth=10;
procedure SetM10;
procedure TextMode;
procedure PrintAt;
procedure writechar(c:char; f,x,y:byte);
procedure WrStr(const s:String;f,xx,yy:byte);
function KeyPressed:Boolean;
function ReadKey:Char;
implementation
procedure norm8x10; external;
{$L norm8x10}
procedure tele8x10; external;
{$L tele8x10}
procedure SetM10; assembler;
asm
mov ax,10h
int 10h
end;
procedure TextMode; assembler;
asm
mov ax,3
int 10h
end;
procedure PrintAt; assembler;
{Globale Variable ist PutMode: 02h - Doppelte Höhe
04h - Vierfache Höhe
10h - Ohne Hintergrund
20h - Gesplitterte Zeichen
{al:Char, ah:Color, dl:Spalte, dh:Zeile; global:Curfont-Pointer}
asm
cmp dl,maxx+1
jnc @@e
cmp dh,maxy+1
jnc @@e ;{Sicherheitscheck gegen Überlauf}
push es
pusha
mov bp,0a000h
mov bl,ah
mov ah,fonth
mul ah
add ax,word [CurFont]
mov si,ax ;{aufs richtige Zeichen bitte}
mov al,dh
shl al,2 ;{vervierfachen}
mov ah,fonth*(maxx+1)/4
mul ah
add al,dl
adc ah,0
mov di,ax ;{aufs richtige Ziel}
cli
mov dx,3ceh
mov al,5
out dx,al
inc dx
mov al,2
out dx,al
dec dx
mov al,8
out dx,al
inc dx
mov cl,fonth
mov bh,PutMode
cld
@@a: {Schleife mit al=CharRow, bl=Farbe, dx=3cfh,
cl=Zeilenzähler, ch=Verdopplungszähler}
mov ch,bh
mov es,word ptr [CurFont+2]
seges lodsb
test bh,20h
jz @@c ;{contiguous}
and al,66h
cmp cl,fonth
jz @@s ;{separated}
cmp cl,fonth-3
jz @@s
cmp cl,4
jz @@s
cmp cl,1
jnz @@c
@@s:
xor al,al
@@c:
mov es,bp ;{auf 0a000h}
@@l:
out dx,al
mov ah,[es:di]
mov ah,bl
and ah,0fh
mov [es:di],ah
test ch,10h
jnz @@b
not al
out dx,al
mov ah,[es:di]
mov ah,bl
shr ah,4
mov [es:di],ah
not al
@@b:
add di,maxx+1 ;{nächste Pixelzeile}
dec ch ;{Fonthöhe}
test ch,0fh
jnz @@l
dec cl
jnz @@a
mov al,0ffh
out dx,al
dec dx
mov al,5
out dx,al
inc dx
xor al,al
out dx,al
sti
popa
pop es
@@e:
end;
procedure writechar; assembler;
asm
mov al,c
mov ah,f
mov dl,x
mov dh,y
call PrintAt
end;
procedure WrStr; assembler;
asm
les si,s
seges lodsb
mov ah,0
mov cx,ax
jcxz @@e
mov ah,f
mov dl,xx
mov dh,yy
@@l:
seges lodsb
call PrintAt
inc dl
loop @@l
@@e:
end;
function KeyPressed; assembler;
asm
mov ah,1
int 16h
mov al,false
jz @@e
mov al,true
@@e:
end;
function ReadKey; assembler;
asm
mov ah,8
int 21h
end;
end.
Detected encoding: OEM (CP437) | 1
|
|