【发布时间】:2012-06-07 18:13:45
【问题描述】:
我是整个装配 FASM 的新手
我已经通过 tutorial 实现了 WriteString
INT 10h / AH = 13h - write string.
input:
AL = write mode:
bit 0: update cursor after writing;
bit 1: string contains attributes.
BH = page number.
BL = attribute if string contains only characters (bit 1 of AL is zero).
CX = number of characters in string (attributes are not counted).
DL,DH = column, row at which to start writing.
ES:BP points to string to be printed.
这样
include 'proc32.inc'
org 0x7c00
mov ax,ds
mov es,ax
jmp start
start:
ccall puts,message,0x000c,attribute,0x02,0x00,0x00,0x00
stop:
jmp stop
attribute db 0x0F
message db 'hello world!','$'
proc puts,string,length,attribute,mode,page,row,column
mov al,byte [mode]
mov bh,byte [page]
mov bl,byte [attribute]
mov dl,byte [column]
mov dh,byte [row]
mov cx,word [length]
lea bp,[string]
mov ah,0x13
int 0x10
ret
endp
问题:
FASM 没有给出错误,但过程没有返回或工作!
【问题讨论】:
-
这是一个旨在作为 BIOS (org 0x7c00) 运行的程序。但是您正在使用 BIOS 中断,如果您编写自己的 BIOS(您很可能不想这样做),则该中断将不可用。尝试先编写一个简单的可执行文件。
-
不,我正在编写自己的迷你操作系统,我曾经将 FASM 的输出二进制文件闪存到用作虚拟机的主要 VMDK 的 USB 密钥 :)
-
你试过在远程调试器下运行它吗?类似 GDB + bochs:cs.princeton.edu/courses/archive/fall09/cos318/precepts/…
标签: assembly interrupt procedure bios fasm