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 ???
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:
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.
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:
Quote:
Unhandled exception at 0x0040100c in att.exe: 0xC0000005: Access violation writing location 0x00000006.e]
the dissaembler showed:
Quote:
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 :(