All --

> Anyone care to post a subcall.pasm example file that shows the
> implementation of a subroutine and a call to it? I was thinking
> of starting from euclid.pasm (since it has two args), but I'm
> not sure I understand what the calling convention is really
> supposed to look like...

Here are a couple of attempts using just jump_i. I've played a bit
with the assembler locally to try to make it allow 'set I0, LABEL',
followed by 'jump I0', but I think it always calculates relatative
offsets for labels as needec by branch, et al. Do we need an
assembler syntax for 'absolute location of this label'?

I think jump.pasm should work (I've hardcoded the jump-to locations
as hex numbers), but it doesn't.

The jumpsub.pasm example is closer to what I'd really like to do...
 
Any thoughts?


Regards,

-- Gregor
 _____________________________________________________________________ 
/     perl -e 'srand(-2091643526); print chr rand 90 for (0..4)'      \

   Gregor N. Purdy                          [EMAIL PROTECTED]
   Focus Research, Inc.                http://www.focusresearch.com/
   8080 Beckett Center Drive #203                   513-860-3570 vox
   West Chester, OH 45069                           513-860-3579 fax
\_____________________________________________________________________/
#
# jump.pasm
#
# Copyright (C) 2001 Gregor N. Purdy. All rights reserved.
# This program is free software. It is subject to the same
# license as Perl itself.
#

MAIN:       print "Jump test.\n"
            print "Jumping to subroutine...\n"
            set I1, 0x30
            jump I1

RET:        print "Returned from subroutine!\n"
            end

SUB:        print "Entered subroutine...\n"
            set I2, 0x24
            jump I2

#
# jumpsub.pasm
#
# Copyright (C) 2001 Gregor N. Purdy. All rights reserved.
# This program is free software. It is subject to the same
# license as Perl itself.
#

MAIN:       print "Jump test.\n"
            set I1, SUB
            set I2, RET
            print "Jumping to subroutine...\n"
            jump I1
RET:        print "Returned from subroutine!\n"
            end

SUB:        print "Entered subroutine...\n"
            jump I2

Reply via email to