News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Error while console compiling

Started by silentenigma, October 29, 2009, 07:20:50 AM

Previous topic - Next topic

silentenigma

this is a hello world console codes i used:
;  A 16-bit DOS HelloWorld program originally by RedOx.  Produces a small model .EXE executable.

; To assemble and link from within WinAsm Studio, you must have a special 16-bit linker,
; such as the one in the archive at this URL- http://win32assembly.online.fr/files/Lnk563.exe
; Run the archive to unpack Link.exe, rename the Link.exe file to Link16.exe and copy it
; into the \masm32\bin folder.

.MODEL small
.stack 100h

.data
msg db "This is a 16-bit DOS .EXE executable",13,10,"Hello, World!",13,10,"$"; The string must end with a $

.code
start:
mov ax,@data ; Get the address of the data segment
mov ds,ax ; Set the DS segment
     
mov dx,offset msg ; Get the address of our message in the DX
mov ah,9 ; Function 09h in AH means "WRITE STRING TO STANDARD OUTPUT"
int 21h ; Call the DOS interrupt (DOS function call)


mov ax,0C07h ; Function 0Ch = "FLUSH BUFFER AND READ STANDARD INPUT"
int 21h ; Waits for a key to be pressed.

mov ax, 4C00h ; the exit fuction  [4C+no error (00)]
int 21h ; call DOS interrupt 21h
end start


But when i want to compile it in Radasm it gives that error:
Assembling: HelloA.asm
D:\Masm32\Bin\doslnk.exe /NOLOGO "HelloA.obj" "",,,,,""
Object Modules [.obj]: /NOLOGO HelloA.obj+
LINK : fatal error L1093: HelloA.obj : object file not found


so i opened quickeditor and tried "Project Menu>Console Assemble & Link" but it didnt work either. It gave the error:
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: D:\masm32\aa.asm
D:\masm32\aa.asm(16) : error A2006: undefined symbol : DGROUP-------------------------------------------->what is that???
D:\masm32\aa.asm(28) : warning A4023: with /coff switch, leading underscore requ
ired for start address : start
_
Assembly Error
Devam etmek için bir tuşa basın . . .


Thanks for your help..!
My heart is ripped out,
Chained on my boots
Look deep inside mey soul with pain,
Witness the fall of a hero

BlackVortex

First of all, are you sure you wanna deal with 16-bit assembly ? You can make console programs in 32-bit, too. You only need 16-bit if you're gonna program for DOS !!!

japheth

COFF output format doesn't know "groups". You have to remove the -coff cmdline switch from the line which launched the assembler.

In case you wonder where a "group" is defined in your source code: .MODEL SMALL will make the assembler define such a group (DGROUP), and symbol @data will become a text equate with value <DGROUP>.

silentenigma

Quote from: BlackVortex on October 29, 2009, 07:40:02 AM
First of all, are you sure you wanna deal with 16-bit assembly ? You can make console programs in 32-bit, too. You only need 16-bit if you're gonna program for DOS !!

Oh dude, you are extremely right. I wanna make 32bit console programs :red
My heart is ripped out,
Chained on my boots
Look deep inside mey soul with pain,
Witness the fall of a hero

BlackVortex

Quote from: silentenigma on October 29, 2009, 09:23:42 PM
Quote from: BlackVortex on October 29, 2009, 07:40:02 AM
First of all, are you sure you wanna deal with 16-bit assembly ? You can make console programs in 32-bit, too. You only need 16-bit if you're gonna program for DOS !!

Oh dude, you are extremely right. I wanna make 32bit console programs :red
That's better   :bg

If youget stumped search around or post a thread,I recently learned how to nicely read and write to the console (not too easy, at first)