Assembly 如何在特定列上打印多行的整个字符串?
这是我的代码:Assembly 如何在特定列上打印多行的整个字符串?,assembly,dos,x86-16,bios,ascii-art,Assembly,Dos,X86 16,Bios,Ascii Art,这是我的代码: data segment letter_a db ' __ _ ',10,13 db ' / _` | ',10,13 db '| (_| | ',10,13 db ' \__,_| ',10,13 db ' ' opening_end db 0
data segment
letter_a db ' __ _ ',10,13
db ' / _` | ',10,13
db '| (_| | ',10,13
db ' \__,_| ',10,13
db ' '
opening_end db 0
pointer db 10
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
mov ax, data
mov ds, ax
mov es, ax
call print_opening
; wait for any key....
mov ah, 1
int 21h
call print_opening
; wait for any key....
mov ah, 1
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
proc print_opening
pusha
mov al, 1
mov bh, 0
mov bl, 3
; I calculate length
lea cx, opening_end
lea dx, letter_a
sub cx, dx
mov dh, 3 ; row
mov dl, [pointer] ; col
lea bp, letter_a
mov ah, 13h
int 10h
mov ah, 8
int 21h
add [pointer], 10
popa
ret
endp print_opening
end start
问题是它只从我所选列中字符串的第一行开始,然后返回到第0列。有没有一种方法可以随时缩进整个字符串?我希望能够在代码中更改它,而不仅仅是在数据段中设置缩进。
我真的希望这是可能的。提前谢谢 在数据行中使用换行符和回车符是没有用的,因为要实现这一点需要一个循环
letter_a db ' __ _ '
db ' / _` | '
db '| (_| | '
db ' \__,_| '
db ' '
opening_end db 0
pointer db 10
循环将在其读取到开口端的终止0后立即结束
嘿,非常感谢您的回复,但是,我运行了您的代码,它仍然只显示到字符串的第一行,而现在其余的不在第一列,它只是不在那里。@SurfingSky the
cm[bp],ch
使用的是SS:
段,但您的数据位于ES:
。更正!抱歉,如果我很烦人,但现在它只是显示了错误的参数错误,@SurfingSky您可能需要使用另一种语法,如cmp-es:[bp],ch
或将es:
放在单独的行上。如果需要,请查阅汇编手册。非常感谢,您刚刚保存了我的学校项目(您可以告诉我汇编不是我的入门语言),谢谢!
mov cx, 8 ; Every row has 8 characters
mov dh, 3 ; row on the screen to start
mov dl, [pointer] ; col on the screen is fixed
lea bp, letter_a
Again:
mov bx, 0003h ; display page 0 and attribute 03h
mov ax, 1301h ; function 13h and write mode 1
int 10h
add bp, cx ; To next line in the data
inc dh ; To next row on the screen
cmp [es:bp], ch ; CH=0
jne Again