I know that error a2088 is the missing END main at the end of the file and it is the i dont understand.
TITLE Find the Minumum and Maximum min_max.ASM
COMMENT |
Objective: to find the min and max of an array of ints
Input: array of ints and the size.
Output: returns two values by reference.
.MODEL SMALL
.STACK 100H
.DATA
.CODE
INCLUDE io.mac
main PROC
.STARTUP
sub DX,DX ; number count := 0
nwln
sub BX, 2*CX ;set the array back too the front
find_min_max:
cmp [BX],0 ; if array is done
je done
EBX = [BX]
ECX = [BX]
add BX,2 ; BX points to the next element
cmp EBX,[BX] ;
jg greater_then ; There is a new min
cmp ECX,[BX]
jl less_then ; There is a new Max
jmp increment ; no new max or min
greater_then:
move EBX,[BX]
jmp increment
less_then:
move ECX,[BX]
jmp increment
increment:
inc DX
cmp DX,CX ; if the array has reached full capacity
je done
jmp find_min_max ; loops back to continue through the array
done:
.EXIT
main ENDP
END main
Breeyon,
Welcome to MASMforum! :U
Read around the different areas and get a feel for the place. :dance:
Read the help files and tutorials of MASM32. It's best, if you download the most recent MASM32 package and install it.
'Search' & Google are your friends for programming. Then ask your questions.
Remove the last 'main' after your 'END' and it will assemble just fine.
'END main' would have been proper form, if you started coding that way in the beginning.
Regards, P1 :8)
> Remove the last 'main' after your 'END' and it will assemble just fine.
? why ? Seems ok to me.
It's a guess, but possibly the problem is the "COMMENT |" line, because MASM is unable to find the end of the comment
Quote from: Gustav on November 22, 2005, 11:30:19 AM? why ? Seems ok to me.
Because that's how I assembled it.
I got this with the 'main' in place.
C:\Masm32\Test32\test16.asm(49) : error A2088: END directive required at end of fileRegards, P1 :8)
> I got this with the 'main' in place.
> C:\Masm32\Test32\test16.asm(49) : error A2088: END directive required at end of file
I got this error too, but regardless if I delete the "main" behind end or not. So Im still confused about your claims.
my suggestion was:
TITLE Find the Minumum and Maximum min_max.ASM
COMMENT |
Objective: to find the min and max of an array of ints
Input: array of ints and the size.
Output: returns two values by reference.
|
.MODEL SMALL
.STACK 100H
.DATA
.CODE
INCLUDE io.mac
main PROC
I added 1 line (the '|'" just before ".model small") to finish the comment
and then I get error "cannot open file io.mac", which is ok AFAICS.
Gustav,
I can not duplicate, what I thought, I had done earlier. So I will assume, I made a mistake. I had several MASM projects open at the time.
Breeyon, I apologize for the inconvience.
Regards, P1
I get a lot more errors that just the 2088.
Here is my output.
Assembling: C:\masm32\programs\masm32\test1.asm
C:\masm32\programs\masm32\test1.asm(25) : error A2008: syntax error : nwln
; nwln
commented this one out.
C:\masm32\programs\masm32\test1.asm(29) : error A2070: invalid instruction operands
cmp [BX],0 ; if array is done
; shouldn't this be [EBX],0
C:\masm32\programs\masm32\test1.asm(31) : error A2085: instruction or register not accepted in current CPU mode
EBX = [BX]
; 32 bit equal to 16 bit?
C:\masm32\programs\masm32\test1.asm(32) : error A2085: instruction or register not accepted in current CPU mode
ECX = [BX]
; 32 bit with 16 bit?
C:\masm32\programs\masm32\test1.asm(34) : error A2085: instruction or register not accepted in current CPU mode
cmp EBX,[BX] ;
; 32 bit with 16 bit?
C:\masm32\programs\masm32\test1.asm(36) : error A2085: instruction or register not accepted in current CPU mode
cmp ECX,[BX]
; 32 bit with 16 bit?
C:\masm32\programs\masm32\test1.asm(41) : error A2085: instruction or register not accepted in current CPU mode
move EBX,[BX]
; 32 bit with 16 bit?
C:\masm32\programs\masm32\test1.asm(45) : error A2085: instruction or register not accepted in current CPU mode
move ECX,[BX]
C:\masm32\programs\masm32\test1.asm(58) : warning A4003: start address on END directive ignored with .STARTUP
Lookup how .STARTUP is used.
C:\masm32\programs\masm32\test1.asm(23) : error A2006: undefined symbol : DGROUP
; Dgroup again with Startup
C:\masm32\programs\masm2\test1.asm(26) : error A2032: invalid use of register
I
C:\masm32\programs\masm32\test1.asm(58) : warning A4023: with /coff switch, leading underscore required for start address : main
This requires _main if I remeber right.
it seems as if you are mixing 32 and 16 bit code. I would look up how you need to set this up as I'm not sure anymore.
Volume in drive C is DRV1_VOL1
Volume Serial Number is 0000-1097
Directory of C:\masm32\programs\masm32
TEST1 ASM 1,474 01-02-06 11:00p test1.asm
1 file(s) 1,474 bytes
0 dir(s) 118,822.25 MB free
> ; 32 bit with 16 bit?
it is a 16-bit program using 32bit registers, which is absolutely legal. But it would require a ".386" directive *after* the ".model" directive.
I try not to guess what people are doing. I seem to get in trouble. :bg So I ran the program as it was typed in and got these errors. Thanks for the help with the .386 directive. Any advice on MASM 5.1 compatability problems? Other than that I'm going through the tutorials and trying to get back to speed on Windows, Unix, and Linux.
using masm's /coff switch surely doesn't work here, output must be in OMF format.
If you are using masm version >= 7, you will have to add switch /omf to masm's cmdline.
Thanks Gustov :U
I'll print that out, reference it, and see where my errors are.