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はエラーを出しませんが、プロシージャが返されないか、機能しません!

4

1 に答える 1

1

簡単な答えはproc32.inc、32ビットのプロテクトモードコード(16ビットのリアルモードブートセクターコードでは機能しない)の場合です。procマクロはebpフレームポインタとして使用し、BIOS関数13hもを使用することにも注意してくださいbp

嬉しい答えは、フラットアセンブラOSConstructionフォーラムには豊富な情報とヘルプがあるということです。

于 2012-07-22T16:14:40.883 に答える