Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
LINK + UNLK instructions
Posted by: Simon Sunnyboy / Paradize Mar,01.2009-14:02 

Insprired by a discussion on Atari-Forum, I experimented a bit with these instructions.
The main idea is to have easier access to my parameter stack.

I came up with the following test program which I traced with Bugaboo:

--snip--
;

; Test fuer LINK und UNLK Befehle

;

param1 EQU 0

param2 EQU 2

movea.l SP,A0

move.l #$CC000011,-(SP) ; param 2 (long)

move.w #$AABB,-(SP) ; param 1 (word)

bsr.s testroutine

addq.l #6,SP

illegal

testroutine:

link A6,#0 ; link stack frame to A6

move.w (8+param1)(A6),D0 ; get param1

move.l (8+param2)(A6),D1 ; get param2

unlk A6 ; unlink stackframe

rts

END
--snip--

A6 performs well sofar, however there is this offset of 8 bytes I don't like. For processing my stack parameters I won't need the old A6 value nor the return address of the routine call.

I tried doing LINK A6,#8 but this didn't gave me the right offset. Did I miss something?
All I want is to have A6 pointing at my call stack parameters without offset.
E.q. move.w 0(A6),D0 should load my first wordsized parameter into D0 instead of the current 8(A6).

Any ideas for this?

cheers,
ssb







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
LINK + UNLK instructions Simon Sunnyboy / Paradize Mar,01.2009-14:02
  Re: LINK + UNLK instructions ray Mar,01.2009-23:54
    Re: LINK + UNLK instructions Simon Sunnyboy / Paradize Mar,02.2009-00:34


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson