#### Archived

This topic is now archived and is closed to further replies.

This topic is 5965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I working a section of tight code (right now it runs that section at 40,000,000 times/second, goal is 100,000,000 on an Athlon 1200). What I need to do is create a special purpose jump table. Unfortunately I can't find the syntax that will work. Here's the gist what I'm trying
var P: Pointer;
begin
Some Code
Some Code
end;

What I've tried to do is P:=CodeAddress , and P:=@CodeAddress and P:=Addr(CodeAddress) , but all of these report an error, assuming that either I'm declaring the label or that I'm trying to redeclare it. (BTW this is all within the same scope). My second problem comes in here:
goto P;

This will not work, I could rewrite it in plain asm but is there another way to do it (the asm statement will mess up the optimizer [Delphi Enterprise]) Finally anyone know a way I could declare the array as a constant such that
label CodeAddress1,CodeAddress2;

Edited by - Michalson on March 21, 2002 4:34:07 PM

##### Share on other sites
I''m guessing that the compiler does not support the address-of operator on labels. I did not even know labels existed. I may have known about the goto statement, but had never used it. Probably your best bet would be on the Borland newsgroups in borland.public.delphi.objectpascal.

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers

##### Share on other sites
You can get pointer to label this way:

asm
mov eax, offset SomeCode
mov P,eax
end;

Compiler doesn''t allow you to use goto with pointer. You must use assembler:

asm
jmp P
end;

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
17
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631773
• Total Posts
3002265
×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!