Results 1 to 9 of 9

Thread: For God's Sake ... Help !!!!!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    170

    For God's Sake ... Help !!!!!

    i am starting to learn assembly,
    but i am getting really frustrated !!!!!!!!!!!

    the problem is with the assembler !!!

    nthn seems right !!!

    i have downloaded four assemblers so far, but
    none seems to work fine !!!!

    one is called a86, masm32v8, RadASM, AsmStudio.

    well, all the examples wont assemble, syntax error are found.
    if nnot link errors occur, especially "unresolved external symbol _mainCRTStartup"
    this sucks guys !!!!!!

    ok, lets say i just want the example in the FAQ to work:
    Code:
    	jmp	start
    Message1	db "Hello World!$"
    
    start:
    	mov	ah, 09h
    	mov	dx, offset Message1
    	int	21h
    
    	mov	ax, 4c00h
    	int	21h
    well, it worked once on a86, but nthn else worked.
    also i am using RadASM most of the time,
    how can i get that code to work on that assembler ???!

    for god's sake just one thing that assembles and link !!!

    i am taking aoa.pdf tutorial seriously, but cannot make any example
    work ... what is the recommended assembler for that tutorial ???

  2. #2
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    Each assembler has its little quirks. Some of NASM's syntax is different than MASM's syntax.

    However, I do remember that this topic has been discussed in this forum already. Do a search in this forum for some of that code. (Sorry, I cannot remember the thread off the top of my mind. )
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    170

    Unhappy

    well, i searched,
    but..........
    all the topics tell you there are different assemblers,
    but none talked about "specific" syntax or instructions for
    a specific assembler !!!!
    or a specific assembler for a specific tutorial !!!!!!!

    specifically, i'd like info for
    art of assembly tutorial,
    and\or RadASM (it specifies more than one assembler, i use masm and choose console application).

    information about anyother tutorial or assembler appreciated
    (but please just be ""specific"" )

    also, any idea of how to specify __mainCRTStartup
    to avoid linking problems (using RadASM/masm, to be specific )
    (i guess this the same when you compile C++ code without
    main() fuction, correct me if i am wrong )
    Last edited by ZaidGS; Aug 28th, 2003 at 02:35 AM.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    170

    maybe this will help someone helping me ;)

    ok, maybe darkwraith talked about http://www.vbforums.com/showthread.p...hreadid=171253 thread.
    i didnt find it very helpfull
    ok, maybe its worth it to show some of my attempts to make it
    work.

    this code is for a windows application example found
    in RadASM:
    Code:
    .386
    .model flat, stdcall  ;32 bit memory model
    option casemap :none  ;case sensitive
    
    include Test Project.inc
    ;--------------------------------------------------------------------------------
    ;If you are doing source code breakpoints, this file must be included.
    ;You don't need it with int 3 breakpoints.
    include \radasm\masm\inc\radbg.inc
    ;--------------------------------------------------------------------------------
    
    .code
    
    start:
    
    	invoke GetModuleHandle,NULL
    	mov		hInstance,eax
    
        invoke InitCommonControls
    	invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
    	invoke ExitProcess,0
    
    ;########################################################################
    
    DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
    
    	mov		eax,uMsg
    	.if eax==WM_INITDIALOG
    
    	.elseif eax==WM_COMMAND
    		pushad
    		invoke GetParent,0
    		mov		eax,1
    		invoke SetLastError,0
    		mov		ebx,2
    		mov		ecx,3
    		xor		ebx,ebx
    		popad
    	.elseif eax==WM_CLOSE
    		pushad
    		xor		eax,eax
    		dec		eax
    		add		eax,2
    		mov		ebx,2
    		mov		ecx,3
    		mov		edx,4
    		mov		esi,5
    		mov		edi,6
    		mov		ebp,7
    		popad
    		invoke EndDialog,hWin,0
    	.elseif eax==WM_SIZING
    		mov		edx,lParam
    		mov		eax,[edx].RECT.top
    		add		eax,204
    		mov		[edx].RECT.bottom,eax
    		mov		eax,[edx].RECT.right
    		sub		eax,[edx].RECT.left
    		.if eax>400
    			mov		eax,[edx].RECT.left
    			add		eax,400
    			mov		[edx].RECT.right,eax
    ;			mov		eax,TRUE
    ;			ret
    		.endif
    	.else
    		mov		eax,FALSE
    		ret
    	.endif
    	mov		eax,TRUE
    	ret
    
    DlgProc endp
    
    end start
    this code only has a button on a form, and i see nothing that happen
    when i click on it.

    accordingly, i tried to make a code like it:
    Code:
    ; This is a simple program which displays "Hello World!"
    ; on the screen.
     
    .386
    .model flat, stdcall  ;32 bit memory model
    option casemap :none  ;case sensitive
    
    Message db "Hello World!$" 	; message to be display
    
    .code 
    
    start:
    
    mov edx,OFFSET Message 	; offset of Message is in DX 
    mov eax,SEG Message 	; segment of Message is in AX
    mov ds,ax 		; DS:DX points to string 
    
    mov ah,9 		; function 9 - display string 
    int 21h 		; call dos service 
    mov ax,4c00h 		; return to dos DOS 
    int 21h 
    
    END start 		;end here
    but the line:
    Message db "Hello World!$" ; message to be display
    produced this error:
    proj3.asm(9) : error A2034: must be in segment block

    so i made this code:
    Code:
    ; This is a simple program which displays "Hello World!"
    ; on the screen.
     
    .386
    .model flat, stdcall  ;32 bit memory model
    option casemap :none  ;case sensitive
    
    ;Message db "Hello World!$" 	; message to be display
    
    .code 
    
    start:
    
    mov edx,OFFSET "Hello World!$" 	; offset of Message is in DX 
    mov eax,SEG "Hello World!$" 	; segment of Message is in AX
    mov ds,ax 		; DS:DX points to string 
    
    mov ah,9 		; function 9 - display string 
    int 21h 		; call dos service 
    mov ax,4c00h 		; return to dos DOS 
    int 21h 
    
    END start 		;end here
    replacing the db command with the text itself.
    but the lines:
    mov edx,OFFSET "Hello World!$" ; offset of Message is in DX
    mov eax,SEG "Hello World!$" ; segment of Message is in AX

    produced this error each:
    proj3.asm(15) : error A2084: constant value too large
    proj3.asm(16) : error A2084: constant value too large


    for my good the only code that assembles that i could make was:
    Code:
    END
    it didnt even link, because :
    LINK : error LNK2001: unresolved external symbol _mainCRTStartup
    proj2.exe : fatal error LNK1120: 1 unresolved externals



    could you with the help of the example make one that works ???

    PS: i wrote that code for console application, not windows application.
    Last edited by ZaidGS; Aug 29th, 2003 at 04:36 AM.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    170

    another hopeless attempt

    today, i tried:
    Code:
    ; This is a simple program which displays "Hello World!"
    ; on the screen.
     
    .386
    .model flat, stdcall  ;32 bit memory model
    option casemap :none  ;case sensitive
    
    .data
    Message1 db "Hello World!$" 	; message to be display
    
    .code 
    
    start:
    
    	mov	ah, 09h
    	mov	edx, offset Message1
    	int	21h
    
    	mov	ax, 4c00h
    	int	21h
    
    
    END start 		;end here
    which assembled, and linked, but produced the suck
    message, known on windows,
    proj.exe encountered a problem and needs to close,
    we are sorry for the inconvieniece
    i chose debug (in c++ dessambler):
    it said:
    Unhandled exception at 0x00401017 in proj3.exe: 0xC0000005: Access violation reading location 0xffffffff.
    the disassembler showed:
    @ILT+0(_start):
    00401005 jmp _start (401010h)
    0040100A int 3
    0040100B int 3
    0040100C int 3
    0040100D int 3
    0040100E int 3
    0040100F int 3
    _start:
    00401010 mov ah,9
    00401012 mov edx,offset _start-10h (404000h)
    00401017 int 21h ;this line produced error
    00401019 mov ax,offset _start+0Bh (40101Bh)
    0040101D int 21h
    0040101F int 3
    00401020 int 3
    00401021 int 3
    00401022 int 3
    00401023 int 3
    00401024 int 3
    with (int 21h) that produced the error.
    what gives ??

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    170

    another beginners problem !!! [Resolved]

    this is another odd thing that happened to me:

    i considered another tutorial,
    which for the good's sake used the "debug" in MS-dos
    for its first example.

    one of its examples was to type in command prompt:
    debug
    a 100
    Code:
    mov ax,2
    mov bx,4
    add ax,bx
    nop
    then use ""t"" to trace the process.

    that worked fine.

    i tried to use that for the RadASM/masm:
    Code:
    .386
    .model flat, stdcall  ;32 bit memory model
    option casemap :none  ;case sensitive
    
    .code
    start:
    mov ax,2
    mov bx,4
    add ax,bx
    nop
    END start
    and this problem happened as described by the c++ disassembler:
    Unhandled exception at 0x0040100c in att.exe: 0xC0000005: Access violation writing location 0x00000006.e]
    the dissaembler showed:
    00400FF2 add byte ptr [eax],al
    00400FF4 add byte ptr [eax],al
    00400FF6 add byte ptr [eax],al
    00400FF8 add byte ptr [eax],al
    00400FFA add byte ptr [eax],al
    00400FFC add byte ptr [eax],al
    00400FFE add byte ptr [eax],al
    00401000 mov ax,2
    00401004 mov bx,4
    00401008 add ax,bx
    0040100B nop
    0040100C add byte ptr [eax],al ;this line caused the error
    0040100E add byte ptr [eax],al
    00401010 add byte ptr [eax],al
    00401012 add byte ptr [eax],al
    00401014 add byte ptr [eax],al
    00401016 add byte ptr [eax],al
    00401018 add byte ptr [eax],al
    0040101A add byte ptr [eax],al
    0040101C add byte ptr [eax],al
    0040101E add byte ptr [eax],al
    strangely enough (at least strange for me) this line is
    AFTER the end of the program !!!!

    any explanation of why this happens, and how to get around
    this ????!!!

    help apreciated over this question, or any of my previous questions !

    ==================
    ==================
    ohh, i solved this one by adding "ret" command before the "end" command.
    STUPID ME !!!!
    but still need help in other stuff
    Last edited by ZaidGS; Aug 29th, 2003 at 07:11 AM.

  7. #7
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Okinawa, Japan
    Posts
    271
    ZaidGS,

    Hi
    Let me start by saying that doing asm for DOS and Windows are alot different.
    In DOS you have alot more to worry about, like segments, and Windows is alot easier.

    I think RadAsm was developed around creating windows apps.
    Couldnt give you any pointer in doing the DOS apps as Ive only did windows apps.

    A good tutorial for windows applications is Iczelion's Win32 Assembly Tutorial available at:
    http://win32assembly.online.fr/tutorials.html

    Best Regards

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    170
    so thats why (int 21h) produces an exception ???

  9. #9
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    I found that you cannot do interrupts in VC++ (probably because it is in Windows still. This aspect has been discussed, but we are not quite certain as of yet. ) I also tried it in Borland C++ 5.02 and I got the same results.

    Try doing the code in NASM or MASM and it should work. (However if you do find a way to do interrupts in VC++, please post. )
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width