The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: Fatboy on January 01, 2005, 12:37:59 AM

Title: I'm a beginner, I was a higher level language programmer, this is a beginner que
Post by: Fatboy on January 01, 2005, 12:37:59 AM
This is the code.................


dosseg
.model small
.stack 200h
.data
.code

start:
mov ax, 0a000h
mov es, ax

mov ax, 100
mov bx, 100
mov cx, 200

sub cx, ax
mov di, ax
mov dx, bx
shl bx, 8h
shl dx, 6h
add dx, bx
add di, dx

mov al, 1
rep stosb
end start


The assembler is masm32, the file name is simple.asm, and here is my problem................


Assembling: simple.asm
simple.asm(18) : error A2070: invalid instruction operands
simple.asm(19) : error A2070: invalid instruction operands






Please help, it's easy right? Thanks.
Title: Re: I'm a beginner, I was a higher level language programmer, this is a beginner
Post by: hutch-- on January 01, 2005, 12:41:51 AM
The MASM32 project is for 32 bit Windows where the code you have posted is 16 bit DOS code. You can build old code if you get the linker from the forum web site and learn its syntax.
Title: Re: I'm a beginner, I was a higher level language programmer, this is a beginner que
Post by: tenkey on January 01, 2005, 06:01:14 AM
The error messages give you the line numbers (18 and 19) where the errors are.
The default processor is the original 8086 (16-bit) and it only allows a shift count of 1.
For other counts, either use the CL register, or add a line at the beginning of the program that says...

.286

; The following instructions are not available on the 8086/8088
shl bx, 8h
shl dx, 6h
Title: Re: I'm a beginner, I was a higher level language programmer, this is a beginner que
Post by: Fatboy on January 01, 2005, 12:47:36 PM
Thanks Tenkey, where exactly should I add the .286?
Title: Re: I'm a beginner, I was a higher level language programmer, this is a beginner
Post by: Bieb on January 01, 2005, 01:12:53 PM
Very top of the file, before .model.  I'm not sure if it goes above or below dosseg, you might have to mess around a little.
Title: Re: I'm a beginner, I was a higher level language programmer, this is a beginner que
Post by: MichaelW on January 01, 2005, 10:05:10 PM
Quote from: Bieb on January 01, 2005, 01:12:53 PM
Very top of the file, before .model.  I'm not sure if it goes above or below dosseg, you might have to mess around a little.
Although placing a .286 directive before the .MODEL directive will work OK, if you place a .386 or later directive before the .MODEL directive (instead of after it), the segment word size will be set to USE32. See Using Full Segment Definitions, Setting Segment Word Sizes (80386/486 Only) here:

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_02.htm
Title: Re: I'm a beginner, I was a higher level language programmer, this is a beginner que
Post by: Fatboy on January 02, 2005, 11:44:53 AM
Thanks y'all!