-
April 18th, 2009, 03:05 AM
#1
operand type does not match
Im making a progam that ask for a value. The program than calculates values into a formula.
My problem MOV U, AX. It generates a error (OPERAND TYPES DO NOT MATCH)
here is my code
Code:
page 58, 132
name RUN
title RUN (Executes a program specified on the cmd line).
include consts.a
include stdin.a
include stdout.a
include misc.a
include memory.a
include strings.a
.list
include stdlib.a
includelib stdlib.lib
dseg segment public
I db 44
testtest db ?
u db ?
v db ?
w db ?
x db ?
y db ?
dseg ends
cseg segment public 'code'
cseg ends
CSEG segment public 'CODE'
assume cs:cseg, ds:cseg
; Variables used by this program. Okay, so I'm lazy and should have put
; them into their own segment. However, you will not that I do not assume
; that these variables are in the code segment.
geti equ <call _geti>
_geti proc
push es
push di
getsm
atoi
free
pop di
pop es
ret
_geti endp
Main proc
mov ax, dseg
mov ds, ax
mov es, ax
meminit
; If you want to do something before the execution of the command-line
; specified program, here is a good place to do it:
print
db "Abitrary expression program",cr,lf
db "---------------------------",cr,lf
db lf
db "Enter a value for u: ",0
geti
mov u, ax
;I HAVE NOT DONE THE FORMULA YET, BUT I WILL
; Okay, if you have any great deeds to do after the program, this is a
; good place to put such stuff.
; Return control to MS-DOS
Quit: ExitPgm
Main endp
cseg ends
sseg segment para stack 'stack'
dw 1024 dup (0)
endstk dw ?
sseg ends
; Seg aside some room for the heap.
zzzzzzseg segment para public 'zzzzzzseg'
public Heap
Heap db 200h dup (?)
zzzzzzseg ends
end Main
Im using TASM assembler. Also, Why can i not use WORD in my DSEG, I have to use DB or it will give me UNDEFINED SYMBOL: U.
Also.. the "mov u, ax" can be fixed with "mov WORD PTR U, ax"....but than i get (CANT ADDRESS WITH CURRENTLY ASSUMED SEGMENT REGISTERS.
Last edited by access1011; April 18th, 2009 at 03:16 AM.
-
April 18th, 2009, 03:24 AM
#2
Re: operand type does not match
DB stands for "define byte". If you want to use a WORD variable you should use "DW" (define word). In addition, you can also use DD (dword/float), DQ (int64/double precision float) and DT (extended precision float).
-
April 18th, 2009, 03:32 AM
#3
Re: operand type does not match
that fixes the OPERAND DOES NOT MATCH problem, but nowi get CANT ADDRESS WITH CURRENTLY ASSUMED SEGMENT REGISTERS error on my statments
let me repost my code with formula . I put comments on every line that causes a error
Code:
page 58, 132
name RUN
title RUN (Executes a program specified on the cmd line).
include consts.a
include stdin.a
include stdout.a
include misc.a
include memory.a
include strings.a
.list
include stdlib.a
includelib stdlib.lib
dseg segment public
I db 44
testtest db ?
u dw ?
v dw ?
w dw ?
x dw ?
y dw ?
dseg ends
cseg segment public 'code'
cseg ends
CSEG segment public 'CODE'
assume cs:cseg, ds:cseg
; Variables used by this program. Okay, so I'm lazy and should have put
; them into their own segment. However, you will not that I do not assume
; that these variables are in the code segment.
geti equ <call _geti>
_geti proc
push es
push di
getsm
atoi
free
pop di
pop es
ret
_geti endp
Main proc
mov ax, dseg
mov ds, ax
mov es, ax
meminit
; If you want to do something before the execution of the command-line
; specified program, here is a good place to do it:
print
db "enter value to add up",cr,lf
db "---------------------------",cr,lf
db lf
db "Enter a value for u: ",0
geti
mov u, ax ;RIGHT EHRE ERROR
print
db "Enter value for v",0
geti
mov v, ax ;RIGHT HERE ERROR
;this formula adds each other
print
db cr, lf
db "u + v is",0
mov ax, u ;RIGHT HERE ERROR
add ax, v ;RIGHT HERE ERROR
puti
putcr
puti
putcr
; Okay, if you have any great deeds to do after the program, this is a
; good place to put such stuff.
; Return control to MS-DOS
Quit: ExitPgm
Main endp
cseg ends
sseg segment para stack 'stack'
dw 1024 dup (0)
endstk dw ?
sseg ends
; Seg aside some room for the heap.
zzzzzzseg segment para public 'zzzzzzseg'
public Heap
Heap db 200h dup (?)
zzzzzzseg ends
end Main
Last edited by access1011; April 18th, 2009 at 03:36 AM.
-
April 18th, 2009, 03:43 AM
#4
Re: operand type does not match
This is the line that is causing the error.
Code:
assume cs:cseg, ds:cseg
-
April 18th, 2009, 03:48 AM
#5
Re: operand type does not match
if i try to edit " assume cs:cseg, ds:cseg " or take it out, i get a whole bunch of errors?
any suggestions?
-
April 18th, 2009, 03:57 AM
#6
Re: operand type does not match
The problem is that there is no assumption about dseg. It should be changed to
Code:
assume cs:cseg, ds:Dseg
-
April 18th, 2009, 04:03 AM
#7
Re: operand type does not match
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|