我正在尝试在程序集中以图形模式打印一条消息,但控制台 d:\ 仍然存在
I am trying to print a message in graphic mode in assembly but the console d:\ is still there
这是我写的代码,除了我不知道如何删除控制台的东西(d:\)外,它工作得很好。
代码在屏幕中间打印 hello。
IDEAL
MODEL small
STACK 100h
DATASEG
; --------------------------
msg db 'hello'
; --------------------------
CODESEG
start:
mov ax, @data
mov ds, ax
; --------------------------
;fullscreen
MOV AL, 13H
MOV AH,0
INT 10H
mov si,@data;moves to si the location in memory of the data segment
mov ah,13h;service to print string in graphic mode
mov al,0;sub-service 0 all the characters will be in the same color(bl) and cursor position is not updated after the string is written
mov bh,0;page number=always zero
mov bl,00001111b;color of the text (white foreground and black background)
; 0000 1111
;|_ Background _| |_ Foreground _|
;
mov cx,5;length of string
;resoultion of the screen is 244x126
mov dh,63;y coordinate
mov dl,122;x coordinate
mov es,si;moves to es the location in memory of the data segment
mov bp,offset msg;mov bp the offset of the string
int 10h
; --------------------------
exit:
mov ax, 4c00h
int 21h
END start
有预期的黑色背景和中间的白色文本,但在左上角有 d:\
感谢您的帮助!
当您的程序完成显示消息时,您可以通过使用 DOS 函数 4Ch 将其 return 交给操作系统。这意味着 DOS 将再次在屏幕上显示它的提示符。这就是您看到的 "d:\"。
要获得足够的时间查看邮件,您需要推迟 return进入 DOS。
只需等待用户按下任意键:
mov ah, 07h ;Input from keyboard without echo to the screen
int 21h
mov ax, 4C00h ;Terminate
int 21h
;resoultion of the screen is 244x126
mov dh,63;y coordinate
mov dl,122;x coordinate
我不知道你从哪里得到这个奇怪的分辨率数据。
您正在使用的屏幕 13h 的图形分辨率为 320x200,但是您用于显示文本的 BIOS 函数 13h 需要 cursor coordinates in the DL
and DH
寄存器。列的范围为 0 到 39,行的范围为 0 到 24。
要在屏幕中间显示文本 "hello",您需要:
mov dl, 18 ;Column
mov dh, 12 ;Row
这是我写的代码,除了我不知道如何删除控制台的东西(d:\)外,它工作得很好。 代码在屏幕中间打印 hello。
IDEAL
MODEL small
STACK 100h
DATASEG
; --------------------------
msg db 'hello'
; --------------------------
CODESEG
start:
mov ax, @data
mov ds, ax
; --------------------------
;fullscreen
MOV AL, 13H
MOV AH,0
INT 10H
mov si,@data;moves to si the location in memory of the data segment
mov ah,13h;service to print string in graphic mode
mov al,0;sub-service 0 all the characters will be in the same color(bl) and cursor position is not updated after the string is written
mov bh,0;page number=always zero
mov bl,00001111b;color of the text (white foreground and black background)
; 0000 1111
;|_ Background _| |_ Foreground _|
;
mov cx,5;length of string
;resoultion of the screen is 244x126
mov dh,63;y coordinate
mov dl,122;x coordinate
mov es,si;moves to es the location in memory of the data segment
mov bp,offset msg;mov bp the offset of the string
int 10h
; --------------------------
exit:
mov ax, 4c00h
int 21h
END start
有预期的黑色背景和中间的白色文本,但在左上角有 d:\
感谢您的帮助!
当您的程序完成显示消息时,您可以通过使用 DOS 函数 4Ch 将其 return 交给操作系统。这意味着 DOS 将再次在屏幕上显示它的提示符。这就是您看到的 "d:\"。
要获得足够的时间查看邮件,您需要推迟 return进入 DOS。
只需等待用户按下任意键:
mov ah, 07h ;Input from keyboard without echo to the screen
int 21h
mov ax, 4C00h ;Terminate
int 21h
;resoultion of the screen is 244x126 mov dh,63;y coordinate mov dl,122;x coordinate
我不知道你从哪里得到这个奇怪的分辨率数据。
您正在使用的屏幕 13h 的图形分辨率为 320x200,但是您用于显示文本的 BIOS 函数 13h 需要 cursor coordinates in the DL
and DH
寄存器。列的范围为 0 到 39,行的范围为 0 到 24。
要在屏幕中间显示文本 "hello",您需要:
mov dl, 18 ;Column
mov dh, 12 ;Row