Easy Code & Bill Aitken's Tutorial's

Started by stevenp, April 11, 2008, 10:12:13 PM

Previous topic - Next topic

vmars

The leftclick on my mousepad could use some fixin.
Yes, Aitkens, not Aikens.

Turns out, it is the same Aitkens that writes Euphoria code and book.
Book possibly called "Euphoric Mysteries -A Beginners Guide to Euphoria" .
...Vern




Yusuf

Hi guys,

I'm probably one of many that too have found Bill's tutorial extremely helpful in starting out with assembly, I can't wait for another installment  :U

In the mean time can you guys recommend any other guides / tutorials / learning materials? I've been trying to follow others on the net, like the Iczellion's ones but am finding it difficult trying to convert the masm code to goasm, also with converting the .if .else nested structures.

I've been following the discussion on the conditionals and hope this is implemented soon into goasm, and so the thread here that guides us on how to convert the masm tutorials to goasm, but am stumped when it comes to converted nested .if structures, any advice here would be much appreciated :)

Yusuf

dedndave

Hi Yusuf,
   Welcome to the forum
Don't feel bad about Iczelion's tutorials
Some of the examples have little mistakes and do not assemble with MASM
Working through assembly errors is a good experience, too, and needs to be learned
If you post some of the errors you are getting and the example code, I am sure many here will be glad to help

Yusuf

Hi dedndave, glad to be here :)

I've been following a couple threads with much anticipation:

http://www.masm32.com/board/index.php?topic=11180.30 - E^Cube's preprocessor / SDK with support for conditionals
and
http://www.masm32.com/board/index.php?topic=11097.0 - The pact Jeremy made to include support for conditionals in Goasm in the near future :)

As soon as any one of these are ready I'll be on the GoASM learning train going full steam ahead!

stevey2al

Hello,
I am starting to learn Assembler and using WinXP SP2, MASM32, Easy Code.
I am trying Bill's tutorials and I am stuck on tutorial #2.
I am not sure if it is because his tutorials are written for GoASM or I am doing
something wrong.
Thanks for any help.
Steve
Here is the code...

.Const

.Data?

.Data
MESSAGES DD WM_CREATE, OnCreate
         DD WM_CLOSE, OnClose
         DD WM_SIZE, OnResize

clientRect RECT
clientDimensions DB 11 Dup 0

.Code
OnResize:
      UseData winMainProcedure

      Invoke GetClientRect, [hWnd], Addr clientRect

      Invoke String, [clientRect.right], Addr clientDimensions, ecDecimal

      Invoke SetText, [hWnd], Addr clientDimensions

      Return (TRUE)

   EndU
   ; End OnResize
winMainProcedure Proc Private hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
   .If uMsg == WM_CREATE

   .ElseIf uMsg == WM_CLOSE
      Invoke IsModal, hWnd
      .If Eax
         Invoke EndModal, hWnd, IDCANCEL
         Return TRUE
      .EndIf
   .EndIf
   Return FALSE

winMainProcedure EndP

Here are the error messages...

============== resizeHandler - Debug ==============

Compiling resources...
Assembling: winMain
winMain.asm(10) : error A2008: syntax error : in structure
winMain.asm(11) : error A2065: expected : (
winMain.asm(11) : error A2065: expected : )
winMain.asm(15) : error A2008: syntax error : UseData
winMain.asm(17) : error A2006: undefined symbol : clientRect
winMain.asm(17) : error A2114: INVOKE argument type mismatch : argument : 2
winMain.asm(17) : error A2006: undefined symbol : hWnd
winMain.asm(17) : error A2114: INVOKE argument type mismatch : argument : 1
winMain.asm(19) : error A2006: undefined symbol : clientDimensions
winMain.asm(19) : error A2114: INVOKE argument type mismatch : argument : 2
winMain.asm(19) : error A2006: undefined symbol : clientRect
winMain.asm(19) : error A2114: INVOKE argument type mismatch : argument : 1
winMain.asm(21) : error A2006: undefined symbol : clientDimensions
winMain.asm(21) : error A2114: INVOKE argument type mismatch : argument : 2
winMain.asm(21) : error A2006: undefined symbol : hWnd
winMain.asm(21) : error A2114: INVOKE argument type mismatch : argument : 1
winMain.asm(25) : error A2008: syntax error : EndU
winMain.asm(6) : error A2006: undefined symbol : OnCreate
winMain.asm(7) : error A2006: undefined symbol : OnClose

Errors ocurred.

dedndave

clientRect RECT
clientDimensions DB 11 Dup 0

usually, when you get a long list of errors, fixing the first ones will fix the rest
that gives you a clue

i am not an "easy-coder", but try this...

clientRect RECT <>
clientDimensions DB 11 Dup(0)

in masm, this doesn't look right, but may be ok in easy code - i dunno

winMainProcedure Proc Private hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM

for a masm program, it might look like this

winMainProcedure Proc  hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD

welcome to masm32 forum

Ramon Sala

Hi stevey2al,

Welcome to masm32 forum and to Easy Code.


Thie Bill Aitken's Chapter 2 code tanslated to MASM is the following:

.Const

.Data?

clientRect         RECT <?>
clientDimensions   DB 11 Dup(?)


.Data

.Code

winMainProcedure Proc Private hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
   .If uMsg == WM_CREATE

   .ElseIf uMsg == WM_SIZE
      Invoke GetClientRect, hWnd, Addr clientRect

      ; Convert the width into a string and store it in clientDimensions
      Invoke String, clientRect.right, Addr clientDimensions, ecDecimal

      ; Append a comma and space to the string "clientDimensions"
      Mov Ebx, ", "
      Add Eax, Offset clientDimensions
      Mov [Eax], Ebx

      ; Calculate where in the string the height should be stored
      Add Eax, 2

      ; Convert the width into a string and append it to clientDimensions
      Invoke String, clientRect.bottom, Eax, ecDecimal

      ; Now set the caption of winMain to clientDimensions
      Invoke SetText, hWnd, Addr clientDimensions

      ; All done - return to the main event loop
      Return TRUE
   .ElseIf uMsg == WM_CLOSE
      Invoke IsModal, hWnd
      .If Eax
         Invoke EndModal, hWnd, IDCANCEL
         Return TRUE
      .EndIf
   .EndIf
   Return FALSE
winMainProcedure EndP


Regards,

Ramon
Greetings from Catalonia