From: Krogg
Subject: Re: 3D game engine for PB?
Brianster wrote:
>
> Ok, now I'm pretty confused here. I'm not a professioanl programmer on the
> level you guys are and no very little about assembler. (I usually learn
> something about it only when I see some code and I want to know how it
works.)
> But I'm really confused about what instruction PB's inline can handle. On
one
> had, if you're doing stright inline assembly programming, you have to
conform
> to the 8086 instruction set, right? If you want to use 32-bit
nstructions,
> you need to link .obj files compiled in a seperate assembler compiler
Masm,
> Tasm, Nasm...the debate rages on :)...) But, if I'm following this
correctly,
> everyone is saying that I can write 386 assembly code, put it in PB but
ust
> put a !db in front of it and it will work? Somehow this seems a little to
easy
> to me and I think I'm missing something here...
> Brian
Brian,
Powerbasic uses only 8086 instructions and It just converts the
asm statements to machine code for the exe.The asm statement db
just tells the compiler to NOT translate anything,JUST add the
next byte right into the exe just as "dw" would add the next word
to the exe.You can put any thing you want after the db as long as its
a byte,but if you are doing it in the middle of your code then you
might want the byte to be a machine code for some instruction.
Dont quote me but i think pusha and popa are 186 opcodes and are not
supported by powerbasic's inline asm support.but you can use them in
your program just like anyother asm code because the machine code for
pusha=&h60 and
popa=&h61 (this is from memory,hope its right)
and by using this line
!db &h60
I can push all general registers
and by doing this
!db &h61
I can pop all general registers and as you can see
its not just as simple as adding a db infront of a non 8086
instruction,you must also have the machine code for the op code
you want to use.
I hope this helps you to understand and isnt confusing.
--
___________ THE ___________
/ _________ \ / _________ \
/ / __ \/ \\ // \/ __ \ \
/ / / \ \\ // / \ \ \
/ / / /\/ /""""""\ \/\ \ \ \
\ \ / / SEE HIS ( / \ \ SEE HIS \ \ / /
\ \ \ \ FACE \/ \/ SMILE / / / /
\ \ \ \ / W \ / / / /
/ / \ \ /\_|||||_/\ / / \ \
/ / / \ // ||| \\ / \ \ \
/ / / /\ \ // ' \\ / /\ \ \ \
/ / / / / / \ \ \ \ \ \
/ / / \/ \_______________________/ \/ \ \ \
\ \ / /\_________________________________/\ \ / /
\ \/ / krogg.no.to.spam@inspace.net \ \/ /
\__/ Remove no.to.spam to reply \__/
http://www.inspace.net/~carcher/krogg/aani.htm
Gory javascript animations for your enjoyment
*** QwkNews (tm) v2.1
* [TN71] alt.lang.powerbasic POWER_BAS Gateway
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/560.2)
|