Reputation: 13
I'm writing assembly code with the GUI Turbo Assembler (a Turbo Assembler GUI environment for Windows that produces DOS programs that run in DOSBox). When I run the program the assembler gives this error:
x.asm Error x.asm(3) Illegal instruction
Line 3 is option casemap: none
. My code is:
.586
.model flat,stdcall ;
option casemap:none ; Line that is giving an error
.DATA ;
x db 2 ;
y db 1
z db 1
.data?
a db ? ;
b db ? ; b=2
c db ? ; c=2
d db ? ; d=2
e db ? ; e=23,5
f db ? ; f=4
g db ? ; g=-18,5
.code ;
beg: ;
mov ah,x ; AH:=x
mov bh,z ; BH:=z
imul bh ; AH:=xz:=2
mov b,ah ; b:=2
mov ah,x ; AH:=x
mov ch,y ; CH:=y
idiv ch ; AH:=AH/CH:=x/y:=2
mov ch,ah ; CH:=2
mov c,ch ; c=2
mov ah,y ; AH:=y
mul ah ; AH=1^2=1
mov bh,z ; BH:=z
imul bh ; AH:=yz:=1
mov ch,x ; CH=x
imul ch ; AH=AHCH=1x=2
mov d,ah ; d=2
mov AH,45 ; AH=45
mov BH, d ; BH=2
idiv BH ; AH=45/2=22,5
mov e, AH ; e=22,5
mov ah,b ; AH=b
mov ch,c ; CH=c
add ah,ch; AH=b+c=2+2=4
mov f, ah; AH=f
mov ah,f ; AH=f
mov ch, e ; CH=e
sub ah,ch; AH=4-22,5=-18,5
mov g,ah ; g=-18,5
mov ah,g ; AH=g
mov ch,5 ; CH=5
sub ah,ch; AH=-18,5-5=-23,5
mov a,ah ; a=AH=-23,5
end beg
Upvotes: 1
Views: 1190
Reputation: 47573
The OPTION
keyword wasn't introduced until TASM 5 according to the change logs. GUI Turbo Assembler currently uses TASM 4.1. You don't need the OPTION CASEMAP
feature since your code uses all the same case for the labels in your code. The fix is to remove:
option casemap:none
Since GUI Turbo Assembler targets running DOS programs you will need to change:
.model flat,stdcall
to something like:
.model small,stdcall
In DOS the memory models can be small
. medium
, compact
, large
, and huge
. flat
doesn't apply to DOS programs. Using flat
will result in a linker error under the GUI Turbo Assembler environment.
For DOS you will also want to add a stack and specify its size. Something like this should work:
.stack 256 ; Set stack size to 256 bytes
Upvotes: 3