本文主要是介绍nas汇编程序的调试排错方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
nas汇编程序的调试排错方法:
1、查找是哪一步错了
2、查看对应的*.lst文件,本例中是"asmhead.lst"
3、根据*.lst文件的[ERROR #002]提示查看源码,改错。
4、重新运行编译,OK
1、查找是哪一步错了:
nask.exe编译汇编程序时出错了
//----------------------------
//运行boyI报错:
E:\techdoc\30dayOS\code\day03\boyI>..\..\tolset\z_tools\make.exe
make.exe -r img
make.exe[1]: Entering directory `E:/techdoc/30dayOS/code/day03/boyI'
make.exe -r haribote.img
make.exe[2]: Entering directory `E:/techdoc/30dayOS/code/day03/boyI'
nask.exe ipl10.nas ipl10.bin ipl10.lst
nask.exe asmhead.nas asmhead.bin asmhead.lst
NASK : 1 errors.
make.exe[2]: *** [asmhead.bin] Error 1
make.exe[2]: Leaving directory `E:/techdoc/30dayOS/code/day03/boyI'
make.exe[1]: *** [img] Error 2
make.exe[1]: Leaving directory `E:/techdoc/30dayOS/code/day03/boyI'
..\..\tolset\z_tools\make.exe: *** [default] Error 2E:\techdoc\30dayOS\code\day03\boyI>
2、查看对应的"asmhead.lst"文件:
在文件中根据关键字"[ERROR"查找就可以了。
E:\techdoc\30dayOS\code\day03\boyI\asmhead.lst
23 0000C20B C7 06 0FF4 0140 MOV WORD [SCRNX],32024 0000C211 MOV WROD [SCRNY],200>> [ERROR #002] parameter error.25 0000C211 66 C7 06 0FF8 000A0000 MOV DWORD [VRAM],0x000a000026 0000C21A ;用BIOS取键盘上各种指示灯的状态27 0000C21A B4 02 MOV AH,0x02
3、根据"asmhead.lst"文件的[ERROR]提示查看源码
24 0000C211 MOV WROD [SCRNY],200
>> [ERROR #002] parameter error.
查看"asmhead.nas"汇编程序源码:MOV WROD [SCRNY],200
错误原因:WORD写成了WROD
修改为:MOV WORD [SCRNY],200
4、重新运行编译,OK
E:\techdoc\30dayOS\code\tolset\day03_boyI>makeE:\techdoc\30dayOS\code\tolset\day03_boyI>..\z_tools\make.exe
../z_tools/make.exe -r img
make.exe[1]: Entering directory `E:/techdoc/30dayOS/code/tolset/day03_boyI'
../z_tools/make.exe -r haribote.img
make.exe[2]: Entering directory `E:/techdoc/30dayOS/code/tolset/day03_boyI'
../z_tools/nask.exe ipl10.nas ipl10.bin ipl10.lst
../z_tools/nask.exe asmhead.nas asmhead.bin asmhead.lst
../z_tools/cc1.exe -I../z_tools/haribote/ -Os -Wall -quiet -o bootpack.gas bootpack.c
../z_tools/gas2nask.exe -a bootpack.gas bootpack.nas
../z_tools/nask.exe bootpack.nas bootpack.obj bootpack.lst
../z_tools/obj2bim.exe @../z_tools/haribote/haribote.rul out:bootpack.bim stack:3136k map:bootpack.map \bootpack.obj
../z_tools/bim2hrb.exe bootpack.bim bootpack.hrb 0
copy /B asmhead.bin+bootpack.hrb haribote.sys
asmhead.bin
bootpack.hrb
已复制 1 个文件。
../z_tools/edimg.exe imgin:../z_tools/fdimg0at.tek \wbinimg src:ipl10.bin len:512 from:0 to:0 \copy from:haribote.sys to:@: \imgout:haribote.img
make.exe[2]: Leaving directory `E:/techdoc/30dayOS/code/tolset/day03_boyI'
make.exe[1]: Leaving directory `E:/techdoc/30dayOS/code/tolset/day03_boyI'E:\techdoc\30dayOS\code\tolset\day03_boyI>
(全文完)
这篇关于nas汇编程序的调试排错方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!