flat assembler
Message board for the users of flat assembler.
Index
> Windows > Hi,I'm New To The FASM Assembler.Need Some Help. |
Author |
|
revolution 02 May 2007, 06:38
You might like to try using a debugger (like ollydbg, google it) to help you see what happens as each instruction is executed. Start with some of the examples given in the Win32 package and follow through them one instruction at a time with the debugger.
|
|||
02 May 2007, 06:38 |
|
thanatosor 07 Jun 2007, 16:00
you should read the tutorial at www.flatassembler.net for the basic info and instruction set.
about the "mov ax,bx",i can explain a little(because i 've just start 1 day): ax,bx,cx,dx .... are called registers(not registry) they have their work.... ax=main register, bx=base register, cx=code register, dx=data register, and that all are 16 bit register,each have 2 register:h & l, ex: ax have ah,al ,bx, have bh,bl...etc... if you want to see result, u should use : ------------------------ org 100h mov ax,9 mov dx,bx int 21h mov ax,4C00h int 20h ------------------------ that code will print to screen the value of bx register.......for more info, go tutorial at that link... |
|||
07 Jun 2007, 16:00 |
|
resoftw 09 Aug 2007, 13:22
thanatosor wrote:
AX = Accumulator Register BX = Base Register CX = Counter Register DX = Data Register ESI = Source Index EDI = Destination Index EBP = Base Pointer ESP = Stack Pointer _________________ Loading my signature, please wait... ^_^ |
|||
09 Aug 2007, 13:22 |
|
sleepsleep 09 Aug 2007, 14:27
basically, the processor provided u with limited count of variable, they are named as ax,bx,cx and bla bla bla
each of them at good at particular purpose, eg. cx = for counter loop increase. eax, ebx, ecx, edx = 32 bits version of those processor variables. if u do some javascript or php before or even visual basic, u would know eg. function, sub or etc (sort of grouped code that to be executed from time to time). in assembly, they are in the form of INT (interrupt) (they are just the same thing, just in different format). if in visual basic Function Int21 ( param1 as double, param2 as double) End Function in assembly, it would be like mov ax, param1 mov bx, param2 int 21h see ... , they are just the same except only they are wrapped using different packages. good luck on ur adventure into assembly world !! and welcome to this awesome fasm board |
|||
09 Aug 2007, 14:27 |
|
ManOfSteel 09 Aug 2007, 15:13
1. Registers have nothing to do whatsoever with the registry, the former being tiny storage space in your CPU used for fast data processing, the latter being a database containing general software and system settings.
2. look at '\your_fasm_directory\EXAMPLES\' for different program structures. 3. Code: include '%fasminc%\win32ax.inc' .data ; %u means unsigned integer szStr db '%u',0 ; reserve 100 bytes for output string szOutputBuffer db 100 dup (?) .code start: ; ebx<-2007 mov ebx,2007 ; eax<-ebx mov eax,ebx ; format character string with 'wsprintf' invoke wsprintf,szOutputBuffer,szStr,eax ; show message box invoke MessageBox,0,szOutputBuffer,'Caption',MB_OK ; terminate program invoke ExitProcess,0 .end start Hope this helps. |
|||
09 Aug 2007, 15:13 |
|
DOS386 09 Aug 2007, 16:11
Quote:
NO 1. This is DOS code 2. It will print garbage at best, not "value" of BX or DX Code: format binary as "COM" use16 org $100 mov al,$7D ; Our value mov ah,al and ah,$0F ; & Low 4 bits // reversed : LITTLE ENDIAN shr al,4 ; & High 4 bits add ax,$3030 ; Convert 0 -> ASCII "0" cmp al,$3A jb @f ; "b":below // OK, a number add al, 7 @@: cmp ah, $3A jb @f ; "b":below // OK, a number add ah, 7 @@: mov [bufjunk+2],ax mov ah,9 mov dx,bufjunk int $21 mov ax,$4C00 int $21 ; Exit to DOS ;-------------- bufjunk: db $0D,$0A,0,0,$0D,$0A,$24 This will print value of AL in HEX P.S. : move to MAIN please _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
09 Aug 2007, 16:11 |
|
Adam Kachwalla 19 Aug 2007, 06:17
To give you an idea of some of the registers (yes they are confusing):
The 8-bit registers are simply derivatives of the 16-bit registers. This allows you to access the two bytes of word registers separator. The low-byte ends in "L", and the high byte ends in "H". For example: Code: AL - Low Byte of the AX register AH - High byte of the AX register The 16-bit registers (8086+) are: Code: AX - Accumulator Register (Often used for mathematical operations, and is used in instructions like MUL (multiplication). BX - Base Register (Often used to store address location pointers) CX - Count Register (Often used as a counter) DX - Data Register (Self explanatory, and is used to store anything) The 32-bit registers (80386+) are: Code: EAX - Extended AX EBX - Extended BX ECX - Extended CX EDX - Extended DX The 64-bit registers (x86-64) are: Code: RAX RBX RCX RDX R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 Don't quite remember what the "R" at the beginning stands for though. And that's not all of the registers! In fact, there are many more you may not encounter, such as the 128-bit multimedia use registers, and the like! |
|||
19 Aug 2007, 06:17 |
|
madmatt 19 Aug 2007, 10:16
Hi tinman47, welcome aboard!,
It's very tough to find a decent modern assembly tutorial, or book for that matter, most are old 16-bit DOS assembly. I assume you want to do windows programming? I would start by learning the 32-bit registers (EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP) and what there purpose are, "ESP" and "EBP" I wouldn't use or worry about for now. Then learn how to define your ".data", ".code", and dll imports section's. Your best material right now IS the fasmw manual, the fasmw examples folder, and the intel reference manuals. Learn how to define the "%fasminc%" variable to compile the examples. I'd use the intel manuals for a reference to the instruction set to find out what they do. If I find anything else usefull on the internet, I'll pass it along. Maybe I should post the intel manual links so you can download them and use them while your learning. Do you have them already? |
|||
19 Aug 2007, 10:16 |
|
Adam Kachwalla 19 Aug 2007, 21:04
And as an addition of what madmatt said, many tutorials are written in MASM or TASM or something else other than FASM, making it even harder to follow.
|
|||
19 Aug 2007, 21:04 |
|
MichaelH 20 Aug 2007, 21:44
tinman47, I think the funniest was "What are registers and what are they supposed to do?I keep seeing ax,bx,eax.I'm scared that these are Registry Files."
Quite a funny thread IMHO |
|||
20 Aug 2007, 21:44 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.