A function is given:
;5X-15, X<=40
;160+X/8, 40<X<=200
;X+50, X>200
Program code.
.486
.model flat, stdcall
option casemap: none
.stack 100h
;=========================================
include <\masm32\include\kernel32.inc>
includelib <\masm32\lib\kernel32.lib>
;=========================================
.data
x db 41
y db ?
myerr db 0
;=========================================
.code
main:
cmp x, 40
JA int2
mov ax, 5
mul x
sub al, 15
jc osh
jmp exit
int2:
cmp x, 200
JA int3
; 160 + x / 8
mov bl, 8
mov al, x
div al, bl ;(error here)
add al, 160
jc osh
mov al, bl
jmp exit
int3:
add x, 50
jc osh
mov al, x
jmp exit
osh: mov myerr, 1
exit: mov al, myerr
invoke ExitProcess, al
end main
With the help of cmp I divide the code into three semantic parts. When x is compared with a constant, it jumps to the next section or calculation.
The code was written on subsidies from the textbook, but apparently I missed some detail or did not take into account some versions.
I get an error while compiling and I can't figure out what the problem is
task.asm(43) : error A2008: syntax error : ,