我发现这个GAS文件包含一些可以从CD引导的引导程序代码,我想研究一下并尝试制作属于我自己的文件,但是唯一的问题是它是AT&T语法而不是Intel语法,我对AT&T语法一无所知,我尝试使用Intel2gas转换器,但是它没有完全转换它,然后我尝试转换它不能转换的内容,结果程序变得一团糟。
这是intel2gas输出以及我尝试修复的代码:
;/* ISO-9660 boot sector
;* --------------------
;*
;* Copyright (c) 2008-2009 Frédéric Feret
;* All rights reserved.
;*
;* Features:
;* - supports ISO-9660 filesystem ("El Torito")
;* - supports multiples burning session
;* - no floppy emulation
;*
;* Limitations:
;* - supports only Joliet format
;*/
BITS 16
ORG 0x00
;/*
; * This is the main function of the boot sector, which loads the OS image
;* into memory at 1000:0000.
;*
;* Parameters:
;* …
Run Code Online (Sandbox Code Playgroud) 我一直在尝试编写一个引导加载程序,它可以从 CD 而不是软盘上读取扇区,并且我一开始只是读取第一个扇区,但是当我运行它时,进位标志仍然设置,并且根据此处的文档:http://en.wikipedia.org/wiki/INT_13H#INT_13h_AH.3D42h%3a_Extended_Read_Sectors_From_Drive 这意味着它无法从映像读取扇区这是我的完整启动代码:
BITS 16
ORG 0x00
Start: jmp main
;Colors for text
%DEFINE TEAL 0x03
%DEFINE RED 0x04
%DEFINE PURPLE 0x05
COL: db 0
ROW: db 0
;macro for print
%macro Print 2
xor dx, dx
mov dh, BYTE[ROW];puts the row into the dh register
xor bx, bx
mov bl, %2
mov si, %1
call cPrint
mov ah, 0x02 ;set cursor pos
mov bh, 0x00 ;page 00
inc dh ;row 00
mov dl, 0x00 ;col. 00
int …
Run Code Online (Sandbox Code Playgroud)