ASM 板


LINE

看板 ASM  RSS
请问各位高手 我在写一个 PCI SCAN 的程式 可以 SCAN 到所有的 DEVICE 但是当我按 pgdn 到最後一个 DEVICE 然後再按 pgdn 程式就会死当... 可以请各位帮我 DEBUG 一下吗? 我看了很久,觉得我的逻辑并没有错误 还是我有语法哪里错了呢?感谢各位! 以下为程式码: .model small .586 .stack .data bus db 'Bus_num: $' device db 'Device_num:$' function db 'Function_num:$' test1 db 'test****************$' bus_num dd 0 dev_num dd 0 func_num dd 0 reg_num dd 0 row db ? count db 4 col_flag db 0 msg_flag db 0 .code begin: mov ax, @data mov ds, ax mov dl,0 main_func: call clear_bot call clear_head mov bus_num,0 .REPEAT mov dev_num,0 .REPEAT mov func_num,0 .REPEAT mov reg_num,0 mov msg_flag,0 mov row,3 reg_count: mov ah,02 .IF(col_flag == 0) mov dl,0 .ENDIF mov dh,row mov bh,0 int 10h mov eax,reg_num mov edx,func_num shl edx,8 or eax,edx mov edx,dev_num shl edx,11 or eax,edx mov edx,bus_num shl edx,16 or eax,edx or eax,80000000h mov dx,0cf8h out dx,eax mov cx,0cfch .REPEAT push cx mov dx,cx in ax,dx mov bx,ax ;--------- decide whether the PCI exists or not--------- .IF bx == 0ffffh .IF func_num == 0 && reg_num == 0 ;the PCI doesn`t exist jmp dev_loop .ELSEIF func_num != 0 && reg_num == 0 ;the PCI exists, and scan its functions jmp func_loop .ELSEIF func_num == 0 && reg_num != 0 || func_num !=0 && reg_num != 0 call print_hex mov dl,' ' mov ah,2 int 21h .ENDIF .ELSE .IF (reg_num == 0 && msg_flag == 0) call msg mov msg_flag,1 jmp reg_count .ENDIF call print_hex mov dl,' ' mov ah,2 int 21h .ENDIF ;------------------------------------------------------- pop cx add cx,2 .UNTIL(cx == 0d00h) mov ah,03h mov bh,0 int 10h add reg_num,4 dec count mov col_flag,1 jnz reg_count mov count,4 call clear_tail inc row mov col_flag,0 .IF row == 23 || reg_num == 256 call clear_r2 call press_key .ELSE jmp reg_count .ENDIF func_loop: inc func_num .UNTIL(func_num == 8) dev_loop: inc dev_num .UNTIL(dev_num == 32) inc bus_num .IF bus_num == 256;----------- mov dx,offset test1 mov ah,9 int 21h .ENDIF .UNTIL(bus_num == 256) exit: mov ax,4c00h int 21h press_key proc near ;------- press button to act --------- print_page: mov eax,0 int 16h cmp ah,01h; esc_key je exit cmp ah,51h; pgdn_key je func_loop ;------------------------------------- ;pgdn: func_loop ret press_key endp ;********** print out where the PCI locates on *********** ;------------------------------------ msg proc near mov ah,2 mov dl,0 mov dh,1 mov bh,0 int 10h mov dx,offset bus mov ah,9 int 21h call print_bus_num mov dx,' ' mov ah,2 int 21h mov dx,offset device mov ah,9 int 21h call print_dev_num mov dx,' ' mov ah,2 int 21h mov dx,offset function mov ah,9 int 21h call print_func_num ret msg endp ;------------------------------------- ;-------- print out BUS# --------- print_bus_num proc near mov ecx,bus_num rol cl,4 call print_out rol cl,4 call print_out ret print_bus_num endp ;--------------------------------- ;-------- print out DEVICE# --------- print_dev_num proc near mov ecx,dev_num rol cl,4 call print_out rol cl,4 call print_out ret print_dev_num endp ;--------------------------------- ;-------- print out FUNCTION# --------- print_func_num proc near mov ecx,func_num rol cl,4 call print_out rol cl,4 call print_out ret print_func_num endp ;--------------------------------- print_out proc near mov dx,cx and dl,0fh add dl,30h cmp dl,3ah jb print2 add dl,7 print2: mov eax,0 mov ah,2 int 21h ret print_out endp ;******************************************************** ;********** print out the value of registers ************ print_hex proc near rol bx,8 rol bx,4 call print_4_bits rol bx,4 call print_4_bits mov ah,2 mov dl,' ' int 21h rol bx,4 call print_4_bits rol bx,4 call print_4_bits ret print_hex endp print_4_bits proc near mov dx,bx and dl,0fh add dl,30h cmp dl,3ah jb print1 add dl,7 print1: mov eax,0 mov ah,2 int 21h ret print_4_bits endp ;******************************************************** ;****************** clear monitor *********************** clear_r2 proc near mov ah,2 mov dl,0 mov dh,2 mov bh,0 int 10h mov cx,50 clr: mov dl,' ' mov ah,2 int 21h loop clr ret clear_r2 endp clear_tail proc near mov ah,2 mov dh,row mov bh,0 int 10h mov cx,40 clr: mov dl,' ' mov ah,2 int 21h loop clr ret clear_tail endp clear_head proc near mov ah,2 mov dh,0 mov dl,0 mov bh,0 int 10h mov cx,50 clr: mov dl,' ' mov ah,2 int 21h loop clr ret clear_head endp clear_bot proc near mov ah,2 mov dh,19 cont: mov dl,0 mov bh,0 int 10h mov cx,50 clr: mov dl,' ' mov ah,2 int 21h loop clr inc dh cmp dh,25 jne cont ret clear_bot endp ;******************************************************** end begin --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 124.9.5.2 ※ 编辑: morganc 来自: 124.9.5.2 (11/01 17:39)
1F:→ eentut:function 3 bit : range 0x00~0x07 11/05 22:54
2F:→ eentut:device 5 bit : range 0x00~0x1F 11/05 22:54
3F:→ eentut:bus 8 bit : range 0x00~0xFF 11/05 22:55
4F:→ eentut:Register range : 0x00~0xFF 11/05 22:55
5F:→ eentut:你知道自己错在哪了吗? 11/05 22:56







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Soft_Job站内搜寻

TOP