My task was to create a program that would copy a file. Ok, didn't look too hard using the textbook and class notes, heavily borrowing from the textbook.


However these 2 errors have me stumped.

invalid instruction operands


segment, group, or register expected.

The first one refers to this:

mov Values, ax

Values is declared as:
Values db ?

The second one refers to the ReadString Procedure:
call Read:proc

I did equ it to Read.

Read equ _ReadString@0

The first error could be because of two things. If you're using MASM, it probably has to do with operand sizes (AX is a WORD while Values is a BYTE). In that case, use one of the following lines to replace you're old lines:

Values dw ?       ; Declare 'Values' as a WORD
mov Values,al     ; Move lower bits of AX into Values

If you're not using MASM, then the problem could be that you have no square brackets ('') around 'Values' in you're mov instruction.

For the second problem, I think you shouldn't use 'Read:proc', just 'Read'. None of the assemblers I have ever worked with uses the ':proc' notation for common procedures.

you cannot copy from a word (ax) to byte (Values)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.