因为我仍然不知道通过ide编写和编译汇编x-86链接列表程序的方法(据我所知,emu8086不支持链表结构) 我在记事本中写了它并使用dosbox编译 代码编译没有错误,当我运行时 g4e(mov啊,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
有人可以指出我的问题在哪里吗?