Author Topic: ASM starter questions  (Read 9648 times)

0 Members and 1 Guest are viewing this topic.

Offline staticgerbil

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 8
    • View Profile
ASM starter questions
« on: February 24, 2011 »
Ok guys. 

I've been finding some time to do some code at home lately (thanks to a move back to the country and a new job) and I'm thinking about doing some ASM inbetween my actual projects.

I'm hoping to be a bit more active here and enter some comps and if I'm going to do some demos I want them to be in ASM :)

I just have a couple of questions for you ASM vets out there before I crack open my old text books...

Firstly do you guys do more x86 or 68k ASM?  I'm not particularly fussed what system I target but x86, 68k and ARM are probably the most interesting and useful to me.

Any recommendations for IDEs / compilers?  For x86, I used to have something that looked kind of like VS for my IDE (but I can't remember what it was) and I've played with NASM and VBASM.  It's been many years since I've played with any ASM.

I think that's my starting point.  Once I have the right tools I just need a concept and to find the box with my old books :)

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: ASM starter questions
« Reply #1 on: February 24, 2011 »
I think from amount of people coding here in ASM, most of them are coding x86 ASM, because its AMD/Intel architecture where Windows and Linux are based on! The 680x0 Motorola architecture was used on Amiga, Atari ST, old Macintosh and SUN workstations!

So the question is, what system is your target to code for? If you want to code 680x0 on Amiga, just look out for AsmPro (which is coded by scene guys and afaik the lastest free and great ASM compiler)... The older versions are AsmOne, SekaAsm... If you want to code for x86 look out for FASM which seems to be very nice and free!

IDE for asm coding? Probaly just a simple and nice editor... maybe with syntax highlighting.
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline staticgerbil

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 8
    • View Profile
Re: ASM starter questions
« Reply #2 on: February 24, 2011 »
Thanks for the tips va!n.

I do actually still have a few Amigas and I do still get a bit nostalgic when I fire them up :)

My pride and joy is an A1200 with an 030, 16mb RAM, CD drive and a 2.1gb hard drive.

I used to have a copy of DevPac on it which I remember to be great.

I might have a tinker with both 68k and x86 and just see which takes my interest.

As much as I used to love coding in notepad I like to have buttons like compile, run and help docs for the language.  Emacs might work, at least it has a command line built in for running build and execute commands :)

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: ASM starter questions
« Reply #3 on: February 24, 2011 »
Amiga:
AsmPro: http://members.home.nl/m.reestman/asmpro.html
AsmOne: http://www.theflamearrows.info/documents/asmone.html

Windows:
FASM: http://flatassembler.net/

For Amiga, AsmPro is really great and comes with a nice GUI/IDE!
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: ASM starter questions
« Reply #4 on: February 24, 2011 »
If you're already familiar with C and want to start gently, you can try the inline assembler and stay in your accustomed IDE.
Challenge Trophies Won:

Offline staticgerbil

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 8
    • View Profile
Re: ASM starter questions
« Reply #5 on: February 24, 2011 »
I grabbed FASM tonight.  I think I'll run with x86 to save me having to worry about emulation or keeping my Amiga setup to develop.  Also it means all my friends can run my stuff native on their machines too.

I like the IDE it came with.  Basically it's notepad with syntax highlighting and a button for compile and run :)

I look forward to my first batch of actual code questions!

hellfire: 
I don't really like learning anything gently :)
I'm not a complete ASM n00b, I've written some basic pong style games, some really crappy demo's on x86 and arm and had some fun modifying games to get me more lives / money / etc.  It's just been a long time since I've done any of that so I'm going to approach it as a new learning experience and start from the very beginning again.

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2755
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: ASM starter questions
« Reply #6 on: March 07, 2011 »
You can call me "FASM lover" :), I already did alot of little demos/intros with it and I don't want to stop.

The buit-in IDE is simple and nice, the problem is when your project became bigger and bigger you will be lost to manage all those files.

For now on I'm using WinASM studio, it's nice editor which can be configured for masm/fasm/nasm etc, it resembles a little bit of MSVC, which is awesome, it sure will make your life easier.

Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: ASM starter questions
« Reply #7 on: March 07, 2011 »
I never liked the FASMW editor it always clears the undo buffer when when it needs to assemble link run. Many a time I have cursed Tomasz for unleashing such evil on his fellow assemblers.

Because of this I always use UltraEdit and batch files when working with FASM, which makes up about 25% of all my programming. Also has the added advantage of allowing be to view the binary output in hex mode all from the same IDE.

Challenge Trophies Won:

Offline staticgerbil

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 8
    • View Profile
Re: ASM starter questions
« Reply #8 on: March 08, 2011 »
For now on I'm using WinASM studio

Thanks rbz, that's the one I used to use!  I couldn't remember the name :)

I always use UltraEdit

I'll check that one out too rain_storm.  I'm always keen to try out a tool I haven't seen.  For many years I was stuck in the same IDE (visual studio) convinced it was the best thing around and eventually I found something that suits me much better.
The right tool can certainly make a huge difference to my productivity.

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: ASM starter questions
« Reply #9 on: March 08, 2011 »
If you do go down the UltraEdit road let me know and I'll post my wordfile so you can have syntax highlighting.

Edit: I will give you a copy of my include file. its a port of the MASM include files to FASM so its much more extensive (but still has a long way to go to be complete) To use this include file all you need do is
Code: [Select]
include "windows.inc"

Also has many higher level macros to save you a lot of typing the following is valid.
Code: [Select]
m2m [destination_memory], [source_memory]

.while (eax <> 0)
.wend

.while (eax <> 0)
.endwhile

.if (ebx = eax)
.elsif (edx = eax)
.else
.endif

.if (ebx = eax)
.elseif (edx = eax)
.fi

.for (edx, 0 to 10)
.next

.repeat
.until (edx = 0)

.switch (ecx)
.case 0
.break
.send

.switch (ecx)
.case 0
.break
.endswitch

try
; do something thats likely to crash the PC
catch
; deal with any exceptions
finally
; clean up
endt
« Last Edit: March 08, 2011 by rain_storm »

Challenge Trophies Won:

Offline staticgerbil

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 8
    • View Profile
Re: ASM starter questions
« Reply #10 on: March 09, 2011 »
Thanks rain!

I'll grab that, UltraEdit and WinAsm right now.

I don't think I have anything planned this weekend so I'm going to try and get something (not sure what yet) written so that I can have more problems for your all to sort out :)

Btw, I've always had a natural fear of try / catch.  Is it pretty common for people to use them in asm?

I think my fear comes from the first time I saw try / catch.  It was some java apps that used them for program flow and I really think that's a bad idea just because I found it hard to read and hard to visualise what was actually going to happen.  Java developers would probably think the same thing about some of my horrible c hacks though :)
« Last Edit: March 09, 2011 by staticgerbil »

Offline staticgerbil

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 8
    • View Profile
Re: ASM starter questions
« Reply #11 on: March 09, 2011 »
Ok,  I decided against UltraEdit just because I didn't want to pay for it :)

As for WinASM Studio, I downloaded an alternate FASM build from the forum which my AV picked up as a couple of viruses.

I searched their forum and found that other people had the same thing and they decided it was a false positive.

I'm just hoping you can confirm that it's safe rbz.  Or is it easy enough for me to just setup FASM myself? (the MASM build didn't show any potential viruses).

Lastly I also went and downloaded MASM from Microsoft and found that it requires VS2005 to be installed!  So I'll be sticking with FASM :)

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2755
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: ASM starter questions
« Reply #12 on: March 09, 2011 »
@staticgerbil: It's safe to use it, the file causing this problem was "dlg2fasm.exe" inside "addins" folder, its used to convert dialog resource to fasm resource format, since I don't want to use it, I just deleted it.

Btw, you can download "dlg2fasm.exe" tool from here without problems.
« Last Edit: March 09, 2011 by rbz »
Challenge Trophies Won:

Offline rain_storm

  • Here comes the Rain
  • DBF Aficionado
  • ******
  • Posts: 3088
  • Karma: 182
  • Rain never hurt nobody
    • View Profile
    • org_100h
Re: ASM starter questions
« Reply #13 on: March 09, 2011 »
Yup, its a false positive, Also from time to time you will get false positives with the executables you produce using FASM. A quick look through a disassembler will tell you that the file was assembled exactly as you coded it. AntiVirus like to err on the side of caution.

The try catch construct is there for the sake completeness. Rarely if ever do you need to use it, True it makes the code more robust, but when it does crash its catastrophic, and since you have replaced the default exception handler with your own this crash could potentially crash windows, I crashed windows once and that was the last time I used a try catch statement.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: ASM starter questions
« Reply #14 on: March 09, 2011 »
Quote
I think my fear comes from the first time I saw try / catch.  It was some java apps that used them for program flow and I really think that's a bad idea just because I found it hard to read and hard to visualise what was actually going to happen.
Yes, using exception handling for control flow is utterly the work of satan. It leads to spaghetti code.
Sometimes though you need to use them, for instance whoever wrote the file handling APIs in .Net uses them to indicate success/failure instead of using return values, so you need them.
Useful in asm too.

Jim
Challenge Trophies Won: