すべての文字がそのCと同じ方法で定義されている場合、カーソルセットは正しい開始行を設定するだけですが、13,10行の新しい行はカーソルを次の行の先頭にリセットします。
また、DOSの終了行は13,10であり、10,13ではありません。これについて
mov ah,02h
mov bh,00
mov dx,043h
; set the cursor position where "04 is y coordinate"
; and "3 is x coordinate"
int 10h
、カーソル位置がDH
=行、DL
=列であるべきです。しかし、43hは列= 3、行= 4ではありません。それは列67、行= 0です。 DH=4, DL=3
をロードするには、mov dx,403h
を実行するか、より良いバイトバイトと比較する必要があります。mov dx,0403h
16進数フォーマットの1桁= 4ビットなので、2桁= 8ビット(1つの小さなレジスタ)です。 "43h"は単一のレジスタ(DL
)をカバーし、DH
は00h
です。または、16進1桁= 4ビットという考えが得られない場合は、mov dx,3 + 4*256
(上位バイトは* 256値)を使用できます。
このような文字を特定の位置に出力したい場合は、改行文字を含まないように定義を変更する必要があります。私は:
c label byte
db " лллл "
db " лллллл "
db "лл лл"
db "лл "
db "лл "
db "лл "
db "лл "
db "лл "
db "лл "
db "лл лл"
db " лллллл "
db " лллл "
そして、1文字としてah = 9ではなく、8x12回、charごとに出力します。
そして、あなたの手紙は8つの文字幅であり、単一の印刷可能な文字で、あなたが実際にビットとして、それらのデータを保存することができ、あなたは8文字以上(「ドット」をしたい場合、すなわち
; C letter, 8x12 bitmask
c db 03Ch, 07Eh, 0C3h, 0C0h, 0C0h, 0C0h
db 0C0h, 0C0h, 0C0h, 0C3h, 07Eh, 03Ch
これが壊れるなど)私はあなたの "数"の定義が使用されるのを恐れているが、あなたは別の数字からそれを構築することができますが、比例フォント、すなわちビットマスクよりも先にもう一つの値を加え、 ...それをやりましょう、それを16ビット値と比例/サイズ情報でバンプしてください:
; C letter, proportional width + 16x12 bitmask
c dw 0C09h ; width is 9 dots, height is 12 lines
dw 03Ch, 07Eh, 0C3h, 0C0h, 0C0h, 0C0h ; 16x12 bitmask
dw 0C0h, 0C0h, 0C0h, 0C3h, 07Eh, 03Ch
そして、私は最後にビットデータを "ミラーリング"していますので、一番左のドットは画面の最下位ビット(バイナリ/ 16進数で "右端"です)にあるので、 "C" 。そして私は、印刷ルーチンを検証するために、いくつかの黒四角とスペースを追加しました:
; file: BIGLETER.ASM
; author: Peter Ped7g Helcmanovsky, (C) 2017
; license: CC0 (public domain)
; builded with TASM v4.1, TLINK v5.0 under dosbox v0.74 by commands:
; tasm /m5 /w2 /t /l bigleter
; tlink bigleter.obj
.model small
.stack
.data
; C letter, proportional width + 16x12 bitmask
; bitmask is "mirrored", the bottom (right) bit goes out first
; (left side of letter)
c dw 0C0Ah ; width is 10 dots (8 dots have pixels), height is 12 lines
dw 03Ch, 07Eh, 0C3h, 003h, 003h, 003h ; 16x12 bitmask
dw 003h, 003h, 003h, 0C3h, 07Eh, 03Ch
square12x12 LABEL WORD
dw 0C0Ch ; width is 12 dots, height is 12 lines
dw 0FFFh, 0FFFh, 0FFFh, 0FFFh, 0FFFh, 0FFFh ; 16x12 bitmask
dw 0FFFh, 0FFFh, 0FFFh, 0FFFh, 0FFFh, 0FFFh
space2d LABEL WORD
dw 0C02h ; width is 2 dots, height is 12 lines
dw 12 DUP (0) ; 16x12 bitmask
; (12 lines to clear screen over full common letter height)
space1d LABEL WORD
dw 0C01h ; width is 1 dot, height is 12 lines
dw 12 DUP (0) ; 16x12 bitmask
; (12 lines to clear screen over full common letter height)
.286
.code
start:
mov ax,@data
mov ds,ax
mov ax,3 ; ah=0, al=3 => VGA text mode 80x25
int 10h ; (expensive "clear screen")
; print 2x big C at specific position
mov dx,0604h ; row=6, column=4 starting position
mov si,OFFSET c ; data of "C" letter
call PrintBigLetter
mov si,OFFSET c ; data of "C" letter
call PrintBigLetter
; print white squares and different type of spaces
; (to test print routine well, including proportional feature)
mov si,OFFSET square12x12 ; data of filled square 12x12
call PrintBigLetter
mov si,OFFSET space2d ; data of 2 dots "space"
call PrintBigLetter
mov si,OFFSET square12x12 ; data of filled square 12x12
call PrintBigLetter
mov si,OFFSET square12x12 ; data of filled square 12x12
call PrintBigLetter
mov si,OFFSET space1d ; data of 1 dot "space"
call PrintBigLetter
mov si,OFFSET square12x12 ; data of filled square 12x12
call PrintBigLetter
; return to DOS with exit code 0
mov ax,4c00h
int 21h
; in: dh:dl = row:column, ds:si = letter definition
; out: dh:dl = row:column adjusted for next letter
; modifies: ax, bx, cx, si, di (basically ALL except dx and bp)
PrintBigLetter PROC
mov cx,[si] ; ch = line count, cl = column size
add si,2
; store next letter position on stack
add dl,cl
push dx
sub dl,cl ; restore position back for this letter
PBL_row_loop:
; set cursor to start of next line
mov ah,2
xor bh,bh
int 10h ; dh:dl = row:column to set (left dot on line)
; load "mirrored" bitmask and prepare for printing line
mov di,[si] ; di = bitmask of line
add si,2
mov ah,0Eh ; int 10h 0E service
; print CL-many dots on screen
push cx
PBL_dot_loop:
mov al,' ' ; space
shr di,1 ; bottom bit into CF
jnc PBL_dot_empty
mov al,0DBh ; 0xDB = '█' filled rectangle character
PBL_dot_empty:
; ah=0E, al=dot_char, bh=0, bl=? => ready to call int 10h
int 10h ; print single "dot" of char
dec cl ; print column-size many dots
jnz PBL_dot_loop
pop cx
; move to next line
inc dh ; next row
dec ch
jnz PBL_row_loop; CH-many rows
pop dx ; set dx to position of next letter
ret
ENDP
END start
私がいない場合は、見て(最初のデバッガを試してみてください。..ので、うまくいけば、ビットマスクデータが印刷されているかの仕組みが理解できる、広範囲のソースをコメント印刷ループ内のレジスタで値がどのように変化するか)、まだ混乱している場合は、ここで躊躇しないでください。
各文字の冒頭にCR-LFがありますか? – prl
あなたはどんな文字を意味しますか? –