我花了整整一个晚上试图弄清楚Compiler先生给我的错误。
它说
0 Warning Errors
0 Severe Errors
...if errorlevel 1 goto stop
...link /co asciihexNew,,,console;
我一直在寻找答案,但网上没有很多关于MASM的资料。 这是我的代码
page 55,80
.model small
.stack 100h
.data
msg1 db 0DH,0AH, "Enter the any key",0DH,0AH,"$" ; this is a alphanumeric variable
num db 0 ; this is a numeric variable
.code
main proc
mov ax,@data ; set up data segment
mov ds,ax
mainloop:
MOV NUM, 0
mov dx,offset msg1 ; dx gets the location of the variable msg1
call string_display ; calls string_display procedure
call keyin ;calls keyin procedure
mov num, al ; saving the first number
MOV BL, 8
MOV DL, 3DH ; DISPLAY THE = SIGN, it has value 3D in hexadecimal , according to ASCII table
CALL DISPLAY ; calls procedure DISPLAY
loop1:
RCL num, 1 ; Rotate Left with Carry Flag by 1 bit
JNC DISPLAY0
MOV DL, 31H
call display
DEC BL
JZ Hex_disp
JMP LOOP1
DISPLAY0:
MOV DL, 30H
call display
DEC BL
JZ Hex_disp
JMP LOOP1
Hex_disp:
RCL NUM, 1
MOV DL, 3DH
call display
MOV BL, NUM
SHR BL,1
SHR BL,1
SHR BL,1
SHR BL,1
AND BL,0FH
MOV DL, BL
ADD DL, 30H
call display
MOV BL, NUM
AND BL, 0FH
MOV DL, BL
ADD DL, 30H
CMP DL, 3AH
JNS ABC
call display
mov dl, 68h
call display
JMP MAINLOOP
ABC:
ADD DL, 7; (dISPLAY HEX CHR)
CALL DISPLAY
mov dl, 68h ; DISPLAY H
call display
JMP MAINLOOP
mov ax,4C00h ; return to DOS and terminate the program
int 21h
display proc ; display of a single character
mov ah, 6
int 21h
ret
display endp
keyin proc
mov ah, 1 ; getting a key from the keyboard
int 21h
ret
keyin endp
string_display proc
mov ah,9 ; send message string to the screen
int 21h
ret
string_display endp
main endp
end main
如果您知道如何修复它,请写一篇文章!谢谢!