Machine Forth primitives for x86

Machine Forth primitives for x86

Author

Message

dirn..#1 / 4

Machine Forth primitives for x86

Recently, I have been dabbling in Intel assembly language. I came up with the following primitives for Machine Forth. I have not tested these, so they are probably horribly broken and/or don't work. Also, I used a free assembler called NASM. ( http://www.*-*-*.com/ ) I am an assembly newbie, so if you know a better and/or working way to do these, please tell me.

Sent via Deja.com http://www.*-*-*.com/ Share what you know. Learn what you don't.

Thu, 15 Nov 2001 03:00:00 GMT

Julian V. Nob#2 / 4

Machine Forth primitives for x86

I think it would be easier to make EBX the TOS. Then we have

CODE ! [EBX] POP EBX POP etc

Then you can use EAX for your NEXT, mechanism. Depending on your threading mechanism. I believe someone has noted on this thread that on pentium-class machines one can schedule the instructions so that indirect threading is faster than direct or subroutine threading. (That is, what would be extra overhead on 286-486 cpu's executes in 0 time because of the superscalar architechture.)

-- Julian V. Noble

"Elegance is for tailors!" -- Ludwig Boltzmann

Mon, 19 Nov 2001 03:00:00 GMT

dirn..#3 / 4

Machine Forth primitives for x86

Quote:

> I think it would be easier to make EBX the TOS. Then we have

> CODE ! [EBX] POP EBX POP etc

> Then you can use EAX for your NEXT, mechanism. Depending on your > threading mechanism. I believe someone has noted on this thread > that on pentium-class machines one can schedule the instructions > so that indirect threading is faster than direct or subroutine > threading. (That is, what would be extra overhead on 286-486 cpu's > executes in 0 time because of the superscalar architechture.)

In Machine Forth, you have the A register, which contains addresses for fetches and stores. I put the A register in EBX. TOS is in EAX, because you don't need to access memory from a pointer in TOS. Also, Machine Forth generally uses subroutine-threaded code with inlining of primitives, so you're not going to be using LODSD. There's a better description somewhere on Jeff Fox's page.

I know that on Pentiums ITC is faster than DTC, but I seriously doubt that it is faster than STC w/primitive inlining. (If ITC really is faster, I need to get a Mac. :)

I am also pretty sure that the primitives T=0 and C=0 are broken. If anyone knows how to make them work, please tell me.

Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.

Mon, 19 Nov 2001 03:00:00 GMT

Julian V. Nob#4 / 4

Machine Forth primitives for x86

Quote:

James Hague writes:

> >I think it would be easier to make EBX the TOS. Then we have

> >CODE ! [EBX] POP EBX POP etc

> >Then you can use EAX for your NEXT, mechanism.

> In 32-bit x86 code, all registers can be used for memory addressing. > There's no need to go through BX, SI, DI, and BP as in the olden days.