as i am reading another tuturial than icztual's(or something like that) i didnt post in that forum..

i have the following code:
; file: first.asm

; First assembly program. This program asks for two integers as
; input and prints out their sum.
;
; To create executable:
; Using djgpp:
; nasm -f coff -d COFF_TYPE first.asm
; gcc -o first first.o driver.c asm_io.o
;
; Using Borland C/C++
; nasm -f obj -d OBJ_TYPE first.asm
; bcc32 first.obj driver.c asm_io.obj

%include "asm_io.inc"
;
; initialized data is put in the .data segment
;
segment .data
;
; These labels refer to strings used for output
;
prompt1 db "Enter a number: ", 0 ; don't forget nul terminator
prompt2 db "Enter another number: ", 0
outmsg1 db "You entered ", 0
outmsg2 db " and ", 0
outmsg3 db ", the sum of these is ", 0


;
; uninitialized data is put in the .bss segment
;
segment .bss
;
; These labels refer to double words used to store the inputs
;
input1 resd 1
input2 resd 1


;
; code is put in the .text segment
;
segment .text
global _asm_main
_asm_main:
enter 0,0 ; setup routine
pusha

mov eax, prompt1 ; print out prompt
call print_string

call read_int ; read integer
mov [input1], eax ; store into input1

mov eax, prompt2 ; print out prompt
call print_string

call read_int ; read integer
mov [input2], eax ; store into input2

mov eax, [input1] ; eax = dword at input1
add eax, [input2] ; eax += dword at input2
mov ebx, eax ; ebx = eax
dump_regs 1
dump_mem 2, outmsg1, 1
;
; next print out result message as series of steps
;
mov eax, outmsg1
call print_string ; print out first message
mov eax, [input1]
call print_int ; print out input1
mov eax, outmsg2
call print_string ; print out second message
mov eax, [input2]
call print_int ; print out input2
mov eax, outmsg3
call print_string ; print out third message
mov eax, ebx
call print_int ; print out sum (ebx)
call print_nl ; print new-line

popa
mov eax, 0 ; return back to C
leave
ret

now i can't compile it
what should i do? i can't find a place to put the following args in the IDE (nasm -f obj -d OBJ_TYPE first.asm
; bcc32 first.obj driver.c asm_io.obj
)

any help appreciated
Posted on 2003-11-24 15:10:24 by chimaira
You must create a project first. When you have created a new project then you copy or paste the code into the asm file. The Project Options selection in the Project menu can be used to modify the build parameters. By default it uses the following:

[b]Assemble:[/b]

3,OT,$B\NASMW -fobj,2

This generates the command line:

C:\Nasm\NASMW -fobj Project.asm

[b]Link:[/b]

RadAsm assumes you will be using ALink
5,OT,$B\ALINK -oPE,3,$L\win32.lib,4

C:\Nasm\ALINK -oPE "Project.obj" "C:\Nasm\Lib\win32.lib" "Project.res"

If you want [b]nasm -f obj -d OBJ_TYPE first.asm[/b]

Enter the following in assemble

[b]3,O,$B\NASM -f obj OBJ_TYPE,2[/b]
Posted on 2003-11-24 16:28:30 by donkey
still not working and i think i understood your post..here is the pic of it:
Posted on 2003-11-24 16:33:57 by chimaira
Put the NASM command in the assemble box. NASM is an assembler not a linker.
Posted on 2003-11-24 17:04:41 by donkey
still getting some error...and i dont even know if its from the config or the code/files as it just says there is some error
Posted on 2003-11-24 17:07:36 by chimaira
Have yo tried to assemble the file using a bat file ? that will tell you if it is nasm that is the poblem. If not then you will have to fiddle with the command lines. Zip up the project and tell me which version of NASM you are using and I will look at it. Do not post it here yet, click my www button and you will find a contact link on my web page, email it to me.

Actually I will PM you a URL to download the correct nasm configuration. Just download the file and extract it to drive C:, RadASM is preset to use the configuration I have set up.
Posted on 2003-11-24 17:18:09 by donkey
I had a chance (my first) to look at NASM. How bizarre is the only phrase that comes to mind. I spent a good deal of time looking at an example that had used ? (question mark) as a symbol name and that threw me until I realized that ? had been set to 0. I could find no PROC or similar statement but it may well exist as the manual is long and rambling branching out in many directions at once. I saw this :
push	byte 103

push dword [hInst]
call LoadMenuA

that made me smile, must be a different x86 family of processors because as far as I know you can't do quarter-stack operations. It obviously pushed a DWORD as that is necessary so why the non-existant BYTE prefix?

Generally from a quick look, a really huge thumbs down on this one.
Posted on 2003-11-24 23:25:30 by donkey
Donkey,

If I remember correctly push immediate comes in 2 form. The first being 6A xx which is push immediate 8bit and is signed extent to 32bit, the other being 68 xx xx xx xx which is used to push immediate 32bit and the derive of the 68h is the push immediate 16bit which is 66 68 xx xx.

Therefore I think this is to tell the compiler (or rather nasm) which variation to use. Of course I infer that nasm does not optimise your code for you.
Posted on 2003-11-24 23:52:24 by roticv
Hi Roticv,

I wasn't aware of the 6A version of the opcode. You are right however, though the Intel reference does not mention bytes (just WORD and DWORD) there is an entry for imm8.
Posted on 2003-11-24 23:59:28 by donkey
Yes, nasm dont optimize your code, you get what you code :).


By the way, you already can assemble a file or not?

I can do it, if you whan I can sen you my configuration file.

I use a external command for call gorc for the resources..., the link line y only remove the final ,4 if I only whan assemble my file.


Nice day or night.
Posted on 2003-11-26 23:54:27 by rea