Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

xterminenatorx

assembly help??

This topic is 6086 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
look here http://win32asm.rxsp.com/

example of a program that display an MessageBox (under Win32)

; ################################################
.386 ; compile for 386 (32 bits)
.model flat, stdcall ; memory model and call directive (param last to first)
option casemap :none ; case sensitive

; ################################################

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

; ################################################

.code
szDlgTitle db "Minimum MASM",0
szMsg db " --- Assembler Pure and Simple --- ",0

start:

invoke MessageBox,0,ADDR szMsg,ADDR szDlgTitle,MB_OK
invoke ExitProcess,0

end start


This code take 1.5ko when it is compiled.

Basically asm can just use processor function, like call (call a function), jmp (jump to an instruction), mov (mov memory to another place), add (add to register)....
(in this example invoke is a macro for severall push and a call)

As you can see, asm can call Win32 API, but it can make some complexe things like COM (yes asm can make object)


Why English rules?? C pas très malin tout ça!

Share this post


Link to post
Share on other sites
Assembly doesn''t really have "functions", ASM is a low level form of coding by manipulating CPU registers and bios interrupt request to get a certain task done. As for full windows ASM i don''t suggest it, waste of time a couple reasons:

1. Windows doesn''t send Win32 executible instructions directly to the processor, but to the kernel and other residing system dll''s to carry out most tasks I.E., create windows and so forth.

2. There are many languages such as C++ and Visual Basic that can create a Win32 project with just as much speed as an ASM Win32 project, mainly because windows is a system of interruptions as I put it, say you right click on a window, windows then knocks on the door of the program code and says hey this person click the right mouse button whats going to happen. So basically windows programs are behind a wall that catches events to be executed when something happens.

3. Assembly is outdated.

4. For a simple useful Win32 project it can take ages, and many lines of code that is very hard to understand.

Thats all I really have to say about that, I think you should learn ASM simply for the fact of understanding the CPU and how the computer works but for programming a huge task it would be just a big waste of time.

MOV AH,3h
INT 21Ch

Share this post


Link to post
Share on other sites
Shouldn''t that be "int 21h" not "int 21ch"?

Also, assembly is never really outdated, as compilers translate your C++ code into assembly, but usually not perfectly. Hand-written assembly allows for slightly better optimization, and most importantly, it allows you to take advantage of feature sets the compiler doesn''t use, such as MMX (PPro+) and XMM (PIII+).

If you were to go about learning assembly, xterminator, I strongly recommend you stick to DOS assembly for the time being... that way you don''t have to worry about using external functions at all; you can learn how to work with files and print text without relying on functions like fopen or printf.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
quote:
Original post by x86ASMRoutine

3. Assembly is outdated.




Not so.

Although assembly is not often used in modern games, it can still be applied in some scenarios. It all depends on what you''re project goals are. Japanese developers still use assembly language in modern console games (Tecmo, creators of the Dead or Alive series, often boast of their highly skilled assembly programmers.) Consoles are still a great playground for assembly language... Even though assembly is becoming less used in modern systems, it still yields benefits on complex systems such as the PS2, which cannot be pushed to the max without assembly (or so I''ve heard from certain developers.)

Nonwithstanding major changes to the concepts of computer architecture, assembly language is never outdated; in fact, it is always farther ahead of anything else simply because it _is_ the machine language.

quote:


Thats all I really have to say about that, I think you should learn ASM simply for the fact of understanding the CPU and how the computer works but for programming a huge task it would be just a big waste of time.




I agree that mastering assembly language _really_ helps out with understanding how computers work. It''s tough for a newcomer in this day and age to pick up on assembly language, simply because so much emphasis is placed on abstraction and high level programming nowadays. The warm world of assembly (where everyone knows your name) becomes a harsh and unforgiving place for beginners.

Assembly is often taught incorrectly. I haven''t seen any good tutorials suitable as an introduction. There are some good books out there, though, but even they aren''t completely sufficient. I started with "The Revolutionary Guide to Assembly Language" from Wrox. It wasn''t a very good book, but it helped a little.

I think Jeff Duntemann''s book would be a better starting place. Unfortunately, I didn''t have it when I was learning X86 assembly.

Another good, but very expensive and rare book is "The 80x86 IBM PC and Compatible Computers (Volumes I & II) Assembly Language, Design, and Interfacing" by Muhammad Ali Mazidi and Janice Gillispie Mazidi. It''s a wonderful book, but as with all assembly books, many of the topics it covers seem archaic -- but definitely worth learning, if you really want to learn about the IBM PC. So far, it''s the clearest book on the topic that I''ve seen. It''s packed with a lot of information on PC hardware interfacing, too.

The important thing to remember is that assembly is really just a bunch of mnemonics for processor instructions. You have a ton of power and flexibility at your disposal. Writing entire PC applications in assembly nowadays would usually be considered insane. Assembly is best used in very frequently executed performance-intensive code. Often times, the assembly implementation can be cleaner than a C implementation... it depends on the situation.

One of the greatest things about mastering an assembly language (especially X86) is that other assembly languages are a snap to learn! I''ve never had problems coding in assembly for PowerPC, 6502, 68K, i960, Z80, etc. A processor reference and an assembler are enough to get me going right away, with pretty much no time spent having to learn the language -- you just learn the mechanics of it as you go along.

IMHO, no high level language can give you such an understanding of the hardware you''re working with. It''s a tough subject to get into, but it''s all worth it once you look around and realize how much knowledge you''ve gained

quote:


MOV AH,3h
INT 21Ch




I''m assuming you meant INT 21h? There are only 256 interrupt vectors on the X86... Typeo

---
Bart

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!