1. Re: Not too important asm beginner question.... (asm programming)

Eduardo Uemura Okada wrote:
>
> >Ask me more questions like this and I might have enough content to put
> >together an asm tutorial :)
>
> He, in this case you could be prepared, because a brazilian, 16 years boy,
> trying to learn assembler without a course, well it's ALMOST impossible, but
> if some like you that are (very) more familiar with this strange language
> help me, well, it could be pretty possible.
> Thank you man, but now there is another doubt that is putting me crazy... In
> the tutorial I am using, the autor says in some part that we can't move a
> byte(or word) from a part of memory to another,

here the author means that you cannot do something like:

mov byte ptr [ADDRESS1], byte ptr [ADDRESS2]

-- instead, you must do --

mov al, byte ptr [ADDRESS2]
mov byte ptr [ADDRESS1], al

> but in another place, he
> explains the MOVS(B or W) function that moves a byte/word from SI to DI, so
> this isn't moving a byte/word directly from an adress to another ??? It's
> confuse.

Yes this does sound contradictory, but movs instructions are for a
specific case.  The above example could use movsb, but it requires
slightly more work.

mov esi, byte ptr [ADDRESS1]
mov edi, byte ptr [ADDRESS2]
movsb

The movs instructions actually stand for "move string" so you can move
around chunks of memory.  The source address goes in the esi register, the
destination address goes in the edi register, and the count goes in the
ecx register.  Then the block of memory can be moved all with this one
prefix and instruction:

rep movsb

-- which is equivalent to --

while ecx > 0 do
    poke(edi, peek(esi))
    edi = edi + 1
    esi = esi + 1
    ecx = ecx - 1
end while

> So, to keep you "happy" (reads like "very angry with bother of a beginner"),
> there is some diference programming in asm in protected mode (it's Euphoria,
> right ? ) and directly (via debug program, for example ?).

Debug uses real mode which is different than protected mode.  Debug
doesn't allow 32-bit addressing, nor the e-?? registers, nor other 32-bit
instructions such as movsd, stosd, etc, and you must always take care of
segment registers.  Euphoria does indeed run in protected mode.  You can
tell which asm is for protected mode by the "e" at the beginning to
indicate a 32-bit register.

> Hey you all who know asm (and Pete), if you mind about writing an asm tutor,
> a sugestion is to explain the commands by an example program to each
> command, very simple, that will ilustrate better the functions of asm
> language,

The tutorial I've been slowly working on will show asm instructions and
an equivalent Euphoria code sample (if such exists)

> and more one of the beginner: how to access mode 13h (graphics
> mode 19 in euphoria 320x200x256)

mov ax, #0013
int #10

> and put a colored pixel in asm ?

mov ebx, x_position
mov edx, y_position
mov cl, pixel_color

lea edx, [edx + edx*4]
lea edx, [edx*4]
mov [ebx + edx*4 + #A0000], cl

> Thanks.
>
> Eduardo Uemura Okada
> e-mail: du at genius.com.br
> homepage: <DragonZeoSoft Euphoria Programming Page is moving to>
>                  http://www.geocities.com/TimesSquare/Labyrinth/8480

I'm glad to offer any assistance in asm so don't worry about asking
questions...  (read like "hurry up and learn something from this so you
can finish your game!" :)



--
                   _____         _____        _____
    ________      /\    \       /\    \      /\    \
   /   \    \    /  \____\     /  \____\    /  \____\
  /  _  \____\  /   / ___/_   /   /____/   /   / ___/_
 /  / \  |____|/   / /\____\ /    \    \  /   / /\____\
 \  \_/ /    / \   \/ / ___/_\     \    \ \   \/ / ___/_
  \    /____/   \    / /\    \\/\   \    \ \    / /\    \
   \   \    \    \   \/  \____\  \   \    \ \   \/  \____\
    \   \    \    \      /    /   \   \____\ \      /    /
     \   \____\    \    /    /     \  /    /  \    /    /
      \  /    /     \  /    /       \/____/    \  /    /
       \/____/       \/____/xseal at harborside.com\/____/

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu