flat assembler
Message board for the users of flat assembler.
Index
> Main > Help with memory management |
Author |
|
guignol 24 Aug 2010, 13:02
what segments, camarada?
|
|||
24 Aug 2010, 13:02 |
|
DJ Mauretto 24 Aug 2010, 13:56
Hello,
Is not simple and not easily explained with a few examples, we say that if you want to program in asm in flat mode you need to know how your computer and the processor if you intend to program for the windows operating system is not much to learn about memory management. The first thing to do is choose between programming 16bit, 32bit, 64bit, then study the instructions of the processor and the addressing methods used by the processor... Some Example: 16bit: Code: mov ax,0xb800 ; Load in ax Address of VGA video memory for text mode 80*25 mov es,ax ; Copy in es ax xor di,di ; Register di = 0 ; now the two register es:di are used like a pointer mov bl,'T' ; Load char 'T' in register bl mov [es:di],bl ; this put the char 'T' in video memory ; es = 0xb800 di = 0 ; the processor in 16bit mode compute the address in this way ; 0xb800 * 0x10 + 0x0 ; we have wrote the 'T'char at phisical address 0xb8000 32bit: Code: mov esi,offset x ; load in esi register address of variable x mov eax,[esi] ; load in eax register variable x I think there are many tutorials on the internet about the first steps with assembly programming,otherwise you can start directly with the manuals that explain the operation of Intel processors or start from the classic 'Hello World' in asm _________________ Nil Volentibus Arduum |
|||
24 Aug 2010, 13:56 |
|
DOS386 26 Aug 2010, 22:54
> mov esi, offset x ; load in esi register address of variable x
Does this compile ??? > I know a few things about segments and registers Segments are needed for real mode. In PM they still exist but work differently and you usually won't touch them from an application. |
|||
26 Aug 2010, 22:54 |
|
DJ Mauretto 27 Aug 2010, 10:21
> Does this compile ???
IN MASM yeah, in FASM no but if you add this in EQU section: Code:
offset EQU
mov si,offset x
MASM = Intel sintax,it is bad ok but this is more clear that Code:
mov si,x _________________ Nil Volentibus Arduum |
|||
27 Aug 2010, 10:21 |
|
edfed 27 Aug 2010, 11:10
mov si,x ; mov si, offset x
mov si,[x] ; mov si,memory x mov si,[si+x] ; mov si,memory (pointer + offset) x |
|||
27 Aug 2010, 11:10 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.