首页 > 解决方案 > 使用 dosbox 调试程序集 x-86

问题描述

因为我仍然不知道通过 ide 编写和编译汇编 x-86 链表程序的方法(据我所知,emu8086 不支持链表结构)我在记事本中编写并使用 dosbox 编译代码编译没有错误和当我通过g4e运行时(mov ah,4ch的地址,我输入了一个数字,程序就卡住了

这是我的代码

node struc

 value db ?
 next dw ?

node ends


dseg segment

list node <'1',3h>
    ORG 3h
    node <'3',6h>
    ORG 6h
    node <'7',9h>
    ORG 9h
    node <'9',-1> 
searchInt db 0
counter1 db 0
welcome db 'Please enter a number between 1-10$'

dseg ends          

sseg segment stack
db 10h dup (?)    
sseg ends

cseg segment
assume cs:cseg,ds:dseg,ss:sseg

start:
   mov ax,dseg
   mov ds,ax
   lea si,list
   mov dx,offset welcome
   call print
   userInput:
   xor ax,ax
   mov ah, 1
   int 21h

   cmp al,30h
   jb userInput
   cmp al,39h
   ja userInput
   jmp searching

   searching: 
   lea si,list
   cmp [si].value,al
   je counter
   cmp [si].value,-1
   je sof
   mov si,[si].next
   jmp searching

   counter:
   inc counter1
   cmp [si].value,-1
   je sof
   jmp searching


   print proc ;procedure for printing messages 
   mov ah,9h
   int 21h
   MOV dl, 10
   MOV ah, 02h
   INT 21h
   MOV dl, 13
   MOV ah, 02h
   int 21h ;start a new line
   ret
   print endp

   sof:
   mov ah,4ch
   int 21h

 cseg ends
 end start

有人能指出我的问题在哪里吗?

标签: assemblylinked-listdosbox

解决方案


推荐阅读