Labels in inline command in TPascal

Door Leo

Paragon (1236)

afbeelding van Leo

22-03-2003, 11:35

Hello,Smile

Is it possible to put labels in pascal, I have a table of precalculated values I converted
in inline statements ( $34/$45/ .... )
But in the same inline command I want to know the starting address of this table !

I have tried some "@label:" or "label:" like in TP7 for PC's but it does not seem
to work.

PS: I use MSXPAD. Wink

Thanks if you know,

Leo

Aangemeld of registreer om reacties te plaatsen

Van snout

Ascended (15187)

afbeelding van snout

24-03-2003, 12:34

I'm not quite sure, but I'm afraid it can't be done

Van BiFi

Enlighted (4348)

afbeelding van BiFi

24-03-2003, 18:02

Snout is right. It can't be done on MSX. TP7 has a built-in assembler which TP for MSX hasn't and lables can't be used in inline commands.

Van Leo

Paragon (1236)

afbeelding van Leo

24-03-2003, 20:32

I have checked on my Z80 hand book there is not any " LD HL,PC " command
that could allow to use current location as base address for table.

Is there a trick to do this ?

I though at "CALL xxxx" then "POP (SP)" command but the CALL needs also an absolute
address , no relative CALL is possible....

Van anonymous

incognito ergo sum (116)

afbeelding van anonymous

24-03-2003, 23:04

Z380 has a relative call (CALR), but that's of little use to you Smile

If you cannot use labels, you can use a small routine in a fixed memory location. The hex numbers are the opcodes so you can poke them in memory somewhere.

; fixed routine on $8000:
POP HL ; $E1
PUSH HL ; $E5
RET ; $C9

; inline code here:
CALL $8000
; HL now holds current PC

Van SLotman

Paragon (1240)

afbeelding van SLotman

01-11-2004, 15:41

Hello,Smile

Is it possible to put labels in pascal, I have a table of precalculated values I converted
in inline statements ( $34/$45/ .... )
But in the same inline command I want to know the starting address of this table !

It's a workaround, but you can do like this:

Const DataArea: array[0..4] of byte=(12,2,7,15,80);

And to know the address where it's stored you can use Addr(DataArea);
Store this value somewhere and then pass it on to whatever inline you want
to use in your program.