News:

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

I don't understand rules of include files in EasyCode

Started by LogicRules, July 01, 2007, 07:12:49 PM

Previous topic - Next topic

LogicRules

I am trying to learn assembly but I am having a problem in Easycode. I seems that some include files can be placed in the project include file section but others cannot.
I was running the hello world pgm, and when I wanted the CLS function to work I placed the "Include   \masm32\include\masm32.inc\" in the code it worked OK. So I decided to try placing it in the project include section, and all went well.

Another include file " \masm32\include\masm32rt.inc" is in the code but when I try to place it in the project section it gives me a slew of errors.
While I get a warning on masm32.inc (it must be there to get a CLS before printing to the screen) the removal of masn32rt.inc in the code fails completely.

What's the scoop on this?   :dazzled:  Any help will be appreciated. TX


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
Include \masm32\include\masm32rt.inc
; Include \masm32\include\masm32.inc\
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .code

start:
    call main
    inkey
    exit

main proc
    cls
    print " ",10, "Hello World",10,10

    ret

main endp

end start

hutch--

Hi LogicRules,

Welcome on board. The code you have posted is console code to build in the default editor in masm32 where I think Ramon's Easy Code is really designed for GUI code where you are using normal windows and controls etc ...
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

LogicRules

Hi Hutch,
I appreciate a response from such a notable as you. I have been using your MASM32 Editor in my efforts to learn Assembly but up pops EasyCoder, and I thought I would give it a shot.
I loaded the "Bare Console Template" from the MASM32 Editor into EasyCoder so I could see the how EasyCoder handled it. Since EasyCoder does have a bit more "GUI" it is a little easier for the NOOB, and any means that will provide an easier learning curve is good.
I don't mean to detract from the MASM32 Editor. It is a great IDE, and I have been using it quite a while in my efforts to learn Assembly.
I find it very hard to find ASM 32 bit console code examples; there is a plethora of DOS code examples out there. The DOS code all has segment statements in them, and I am not accomplished enough yet to be able to convert them to 32 bit code but I keep plugin'.
I keep downloading tutorials on ASM but they all get, immediately, to Windows in the assumption that everyone wants to follow that path. Eventually I may do just that but for now I would just like to delve into console programs until I feel at ease with them so as to be able to move into Windows programming at a later stage.
Don't mention books, I can't afford them. I'm having enough trouble just trying to keep up with hardware updates. A URL to a good site that has 32 bit console code would be great.
Maybe señor Sala can give me the cause for the problem I am having.

Thanks again,

hutch--

LogicRules,

Console  mode is one of the simpliest forms of assembler you can write. Apart from screen IO, the rest of it works the same as any other windows code, its just that it does not have any graphic interface. File IO, memory allocation, data processing and the like all look the same when there is no user interface to construct. The MASM32 macro system is designed so you can do many simple things without having to write your own runtime library so its much like starting with a compiler as it will already do the basic stuff like screen display, data input at the console, basic file IO and a whole host of other things.

Easy Code is a gui designer style IDE and it is designed to make constructing graphics mode interfaces a lot easier. There is no reason why you have to use one or the other, you can write your console code in masm32 and gui in Easy Code. The real trick with assembler coding is to get the swing of the basics so you can test out ideas and bits of code and keep learning by trying out different things. There are a lot of examples around in varying degrees from very simple to very complex so you should not have any real problems getting enough examples to work from.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

LogicRules

Hi Hutch,
In discussing this with you I have discovered my fault; I am looking for an easier method of learning Assembly. I have to go back to the 16 bit language for now, and it will be  somewhat easier to move on to 32 bit.
It was a little easier with 8 bit computers but that was long ago.
I will have to reconfigure MASM32 to handle 16 bit pgms.
Again, thanks

hutch--

LogicRules,

Just a suggestion from an old timer who was around back in the days of 16 bit code for DOS. 16 bit code is a lot more complicated due to its segment / offset mode of addressing, it has far fewer instructions and many limitations on how you use those instructions. Much of the technology you learn in 16 bit code is effectively useless for 32 bit FLAT memory model and DOS style interrupts do not work in 32 bit protected mode programming.

Win32 and the coming 64 bit code have a very similar architecture which is simpler, far more powerful and produces much faster and wider ranging code. The console template you can dump into the masm32 editor is a good starting point for very simple code that allows you to experiment with assembler instructions without the hassle of having to work out how to display the results or convert numbers to string data for display.

Try stuff like this below.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

comment * -----------------------------------------------------
                        Build this  template with
                       "CONSOLE ASSEMBLE AND LINK"
        ----------------------------------------------------- *

    .code

start:
   
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    call main
    inkey
    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

main proc

    cls

  ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
  ;                           experiment here
  ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    mov ecx, 100
    mov edx, 45
    add ecx, edx

    print str$(ecx),13,10

    xor edx, edx
    mov eax, 1000
    mov ecx, 125
    mul ecx

    print str$(eax),13,10

  ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    ret

main endp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php