Message board for the users of flat assembler.
> Windows > Hi,I'm New To The FASM Assembler.Need Some Help.
tinman47 02 May 2007, 02:37
Hi,I'm new to the forum and the FASM Assembler and I have been a long time programmer.I started learning about the FASM Assembler a few weaks ago,and I am very confused. I read the manual like 7 times. I really want to learn about Assembly because it allows me to tell my computer to do whatever I want it to do,and I am designing my own Interpreter,so I need answers to the following questions:
1.What are registers and what are they supposed to do?I keep seeing ax,bx,eax.I'm scared that these are Registry Files.
2.I understand how the commands and bytes work,but how do I put it all together?
3.When I write the code,it works...But it doesn't show,how do I display results graphically?Like I type the code like mov ax,bx,which I means to move the bx register to the ax,so can I put like a window that displays the results?
|02 May 2007, 02:37||
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....
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 :
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
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.
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)
it would be like
mov ax, param1
mov bx, param2
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.
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
1. This is DOS code
2. It will print garbage at best, not "value" of BX or DX
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:
AL - Low Byte of the AX register AH - High byte of the AX register
The 16-bit registers (8086+) are:
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:
EAX - Extended AX EBX - Extended BX ECX - Extended CX EDX - Extended DX
The 64-bit registers (x86-64) are:
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 >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.