FASM过程问题

3

我刚接触整个汇编FASM

我已经通过这个教程实现了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,则不可用(您很可能不想这样做)。请先尝试编写一个简单的可执行文件。 - Gunther Piez
不,我正在编写自己的迷你操作系统,并且我曾经将FASM的输出二进制文件刻录到USB键上,用作虚拟机器的主要VMDK :) - Ahmed Ghoneim
你尝试在远程调试器下运行过这个程序吗?比如说GDB + bochs: http://www.cs.princeton.edu/courses/archive/fall09/cos318/precepts/bochs_gdb.html - Necrolis
1个回答

1
简单来说,proc32.inc 用于 32 位保护模式代码(无法与 16 位实模式引导扇区代码一起使用)。还要注意,proc 宏使用 ebp 作为帧指针,而 BIOS 函数 13h 也使用 bp

令人高兴的是,在flat assembler操作系统构建论坛上有大量信息和帮助可供使用。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接