Click to See Complete Forum and Search --> : simple assembly program


hkboy313
November 14th, 2004, 12:24 PM
i programmed some instructions... i was wondering if it is right...that it would copy the value FF into memory locations 50 to 6F

mov a, #ff
mov r0,#50 ; load pointer
mov r2,#32 ; load counter to go 32 times ( was more concerned about this)
again: mov@r0, a
inc r0
djnz r2, again

i think it will have to be 32 loops because from 50 to 5F it is 16 bits...and from 60 to 6F is another 16 bits..so it would have to go 32 bits or times to load up all in memory...right?

Lican
January 23rd, 2005, 08:58 AM
Hi!

Maybe try using stosb or something like that. I'm not saying it's good, but I would try doing something like that:

xor eax,eax
dec eax
mov ecx,(how many times)
shr ecx,2
mov edi,(address)
rep stosd

I'm not sure if it's correct. I was doing asm for some time 'till I discovered c++ :P but I still love asm anyway :) If you need something feel free to ask: lican@wp.pl