你这个和另一位同学的完全一样,这里就复制一份
https://fishc.com.cn/thread-238114-1-1.html
我这边的masm汇编器不是很方便用,我就直接用gnu的as汇编器了
main.s .code16
.section .text
.global _start
_start:
# clear screen
movw $0x0003, %ax
int $0x10
# display string
movw $msg, %dx
movb $0x09, %ah
int $0x21
xorw %di, %di
1: xorw %si, %si
0: # delay 100ms
movw $0x0001, %cx
movw $0x86a0, %dx
movb $0x86, %ah
int $0x15
# move window
movw %di, %cx
movw %di, %dx
movb $0, %ch
movb $24, %dh
movb $0x07, %bh
movb $1, %al
movb $0x07, %ah
int $0x10
#incw %si
addw $1, %si
cmpw $25, %si
jb 0b
#incw $di
addw $1, %di
cmpw $msg_size, %di
jb 1b
# exit
0: movw $0x4c00, %ax
int $0x21
jmp 0b
msg: .ascii "Reading is a happy thing. For those who love reading, once they read it.$"
.equ msg_size, . - msg - 1
MakefileASFLAGS = --32 -g -mx86-used-note=no
LDFLAGS = -m elf_i386 -Ttext 0x100
LINK.o = $(LD) $(LDFLAGS)
all: main.com
main.com: main
objcopy -O binary -S -g $< $@
%: %.s
clean:
$(RM) main.com
$(RM) main
下面是效果图
考虑到你那边可能也没有我的环境,就发一下最终的可执行程序吧
把main.com文件复制到dosbox里面直接运行应该就可以
ms-dos.zip
(1.95 KB, 下载次数: 1)
|