I'm a beginner, I was a higher level language programmer, this is a beginner que

Started by Fatboy, January 01, 2005, 12:37:59 AM

Previous topic - Next topic

Fatboy

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.

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

tenkey

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
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

Fatboy


Bieb

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.

MichaelW

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
eschew obfuscation