ASM Question

Everything else that doesn't fall into one of the other PB categories.
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

ASM Question

Post by Xombie »

... or questions.

1. What registers can I use in PB3.94/PB4 without worrying about PB trying to use them internally at the same time? Like, can I freely modify ecx in a procedure without worrying that PB will also try to use it? I've had some instances of that happening but I can't remember which register(s) it was.

2. Are there any good books (reference or tutorials) on programming in ASM. Something that can be geared towards FASM. Although I suspect ASM compilers are *somewhat* similar. Are there any "bibles" that I should look into?

Any other general ASM tips, tricks or whatnot would also be appreciated. I've dabbled a little bit but it's really basic stuff. I'd be especially curious about string handling stuff.

3. Almost forgot about this one. How can I create a "variable" in ASM in PB? I use the "!" rather than inline if that makes any difference.

Thanks!
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

1.
remi_meier wrote:Eax, Ecx, Edx should be available.
3.

Code: Select all

;example use
n.l
m.l
k.w
d.d

! fld tword [a]
! fld qword [b]
! fstp qword [v_d]
! mov eax,dword [c]
! mov [v_n],eax
! mov ax,word [d]
! cwde ;convert word in eax to dword
! mov [v_m],eax
! mov al,byte [e]
! cbw  ;convert byte in al to word in ax
! mov [v_k],ax
Debug n
Debug m
Debug k
Debug d
End ;put an end so program wont't run into data section

!section '.data' code readable writeable 
!a: dt 6.938827757238428549483e-9 	;80 bit real
!b: dq 0.57823984700423848847388532e-11 ;double
!c: dd 123				;long integer (32 bits)
!d: dw 456				;word integer (16 bits)
!e: db 78				;byte         (8  bits)
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

2

In general, which will help with doing inline:

iczelion's tutorials at http://win32assembly.online.fr/ - masm - His is probably the most used set of tutorials and samples available. Very good stuff. Tons of great links as well.

If you can find Randy Hyde's original (versus his HLA) Art of Assembly Language, that was awesome. The HLA version is good but biased towards HLA. Randy Hyde's stuff here: http://webster.cs.ucr.edu/

These and the boards at fasm and www.masmforum.com should cover most things. Lots of similarities fasm to masm, it is the differences that sneak up and bite you. :)
@}--`--,-- A rose by any other name ..
Xombie
Addict
Addict
Posts: 898
Joined: Thu Jul 01, 2004 2:51 am
Location: Tacoma, WA
Contact:

Post by Xombie »

Thanks a lot, fellas. Some good info to get me started. I hope to be able to dig into this stuff in the near future. I like ASM :D In a way, it seems simpler than C to me. In a way.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Xombie wrote:In a way, it seems simpler than C to me.
I agree! :)

I'm no expert but I can get things happening in masm - I have yet to get anything decent happening in any C implementation. Some C's I can't even understand the development environment. :?

One reason I prefer PureBasic uber alles - I understand how to actually write and compile something, however crappy my code may be! :)
@}--`--,-- A rose by any other name ..
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

asm is like getting under the hood of your car/truck and see what makes it tick :)
Post Reply