如何将字母置于图形模式中我想要的位置。我可以在图形模式下显示字母,还是应该在二维表中逐个像素地定义字母? 你能举个例子吗,因为我试图在窦上写动画字母。任何指南?
DOS上的架构NASM。它可能是16位或32位。 我在Windows上使用DOSBOX。 并通过此脚本编译代码: nasm -f obj -g -F borland%1.asm tlink / v%1.obj io.obj,%1.exe
好的,我使用论坛中的片段:
segment .data
msg db "Hello world!$"
segment .code
..start:
mov ax, 13h
int 10h
mov ax, 0a000h
mov es, ax
xor di, di
mov al, 15
mov cx, 100
; start fragment from forum
mov si,msg_text
call print_colored
print_colored:
.loop:
lodsb
cmp al,0
je .done
inc bl
mov ah,0x0E
Int 0x10
jmp .loop
.done:
ret
;end fragment from forum
xor ah, ah
int 16h
mov ax, 3
int 10h ; go to text mode
mov ax, 4c00h
int 21h
; variables
msg_text DB "abc" ;Text
msgCol DB 0x07,0x08,0x09,0x0A,0x0B ;Colours
msgXY DW 0x0E26 ;Col/Row
msgLen DB 0x05 ;Length
它不能像我想的那样工作。当我在键盘上写时,它会显示当前时间的文本。 此程序仅显示:http://i62.tinypic.com/e898q8.jpg
在我的程序中,我想将字符串放入psp甚至代码中,然后在图形模式屏幕上显示。所以首先我想知道如何在我想要的位置上显示字母,因为稍后我会尝试将此字符串放在正弦上并尝试为其设置动画。
答案 0 :(得分:0)
在显示设备的BIOS内部有一些字体表,我们可以得到它的指针。
RBIL->inter61a.zip->INTERRUP.A
--------V-101130-----------------------------
INT 10 - VIDEO - GET FONT INFORMATION (EGA, MCGA, VGA)
AX = 1130h
BH = pointer specifier
00h INT 1Fh pointer
01h INT 43h pointer
02h ROM 8x14 character font pointer
03h ROM 8x8 double dot font pointer
04h ROM 8x8 double dot font (high 128 characters)
05h ROM alpha alternate (9 by 14) pointer (EGA,VGA)
06h ROM 8x16 font (MCGA, VGA)
07h ROM alternate 9x16 font (VGA only) (see #00021)
11h (UltraVision v2+) 8x20 font (VGA) or 8x19 font (autosync EGA)
12h (UltraVision v2+) 8x10 font (VGA) or 8x11 font (autosync EGA)
Return: ES:BP = specified pointer
CX = bytes/character of on-screen font (not the requested font!)
DL = highest character row on screen
Note: for UltraVision v2+, the 9xN alternate fonts follow the corresponding
8xN font at ES:BP+256N
BUG: the IBM EGA and some other EGA cards return in DL the number of rows on
screen rather than the highest row number (which is one less).
SeeAlso: AX=1100h,AX=1103h,AX=1120h,INT 1F"SYSTEM DATA",INT 43"VIDEO DATA"
Format of alternate font table [array]:
Offset Size Description (Table 00021)
00h BYTE character to be replaced (00h = end of table)
01h N BYTEs graphics data for character, one byte per scan line
第一个指针的示例:
RBIL->inter61b.zip->INTERRUP.E
--------B-1F---------------------------------
INT 1F - SYSTEM DATA - 8x8 GRAPHICS FONT
Desc: this vector points at 1024 bytes of graphics data, 8 bytes for each
character 80h-FFh
Notes: graphics data for characters 00h-7Fh stored at F000h:FA6Eh in 100%
compatible BIOSes
Under PhysTechSoft's PTS ROM-DOS this table is fictitious.
SeeAlso: INT 10/AX=5000h,INT 43
但我们也可以使用自己的:
;-------------------------------------- ────────────────┤
T34 DB 1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1 ;* ** *│
DB 1,1,0,0,0,0,0,1,1,0,0,0,0,0,1,1 ;** ** **│
DB 0,1,0,0,0,1,1,1,1,1,1,0,0,0,1,0 ; * ****** * │
DB 0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,0 ; ** ****** ** │
DB 0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0 ; ** ** ** │
DB 0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,0 ; ** ** ** │
DB 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0 ; * * │
DB 0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0 ; *** *** │
DB 0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0 ; **** │
DB 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0 ; ****** │
DB 0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0 ; ** ** │
DB 0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0 ; ** ** │
DB 0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0 ; ** ** │
DB 0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0 ; ** ** │
DB 0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0 ; ** ** │
DB 0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0 ; **** **** │
;-------------------------------------- ────────────────┤
目标位置的地址计算=(yposition * scanline)+(xposition *每像素字节数)
模式13h:扫描线= 320;每像素字节数= 1
示例:
mov ax, yposition
mov bx, 320
mul bx
add ax, xposition
mov di, ax ; Now DI contains the offset address of the target position
从屏幕上读取字体的基本示例(80x30; 640x480; 16种颜色):
SCREEN 12
B = -1
G = 2
W = 90
A = 11 * B
R = 140
IF B = 1 THEN R = R - G * 13
P = 3.141592654# / 180
Z$ = "DOS DIE PC-Zeitschrift"
FOR I = 1 TO LEN(Z$)
LOCATE 1, 1: PRINT MID$(Z$, I, 1)
FOR X = 0 TO 6
FOR Y = 1 TO 14
IF POINT(X, Y) = 15 THEN GOSUB Schreib
NEXT Y
NEXT X
W = W - A
NEXT I
END
Schreib:
FOR X1 = 1 TO G
FOR Y1 = 1 TO G
IF B = 1 THEN X2 = X * G + X1: Y2 = (Y * G + Y1) + R
IF B = -1 THEN X2 = X1 - X * G: Y2 = (Y1 - Y * G) + R
XS = X2 * COS(P * W) - Y2 * SIN(P * W)
YS = X2 * SIN(P * W) + Y2 * COS(P * W)
PSET (XS + 320, YS + 240), 15
NEXT Y1
NEXT X1
RETURN