Brian -- > Its not going to work, if I understand it correctly. I tried doing it > (even set up the symbol '*' to mean the current PC) and do it, but it > seems the ops take a relative offset. Take jump_i, for example: Taking this into account, I modivied jump.pasm and fixed the offsets. I tested it this way... $ assemble.pl --output t/jump.pbc --listing t/jump.list t/jump.pasm $ test_prog t/jump.pbc Jump test. Jumping to subroutine... $ perl disassemble.pl t/jump.pbc .... I also did 'vi t/jump.list'. With these hard-coded relative offsets, I think the program should be producing the desired output, but it doesn't. If it did, I could do some tricks in jakoc and/or assemble.pl to create a pseudo-op for jumping to any label, and another for setting up the return-offset based on the end-label of the destination block and the label we want it to return to. It sure would be nice, though, to have a real 'absjump_i' opcode (really start-of-bytecode- relative rather than current-program-counter relative). It would also be helpful to have jump_ic and absjump_ic, rather than having to load these things into registers. Anyway, I'm attaching the revised jump.pasm example. Maybe I still don't have the offsets calculated right, but I stared at jump.list and the disassembly listing for a while and I *think* they are right. I wish I had a tracing mode where I could watch exactly where it was jumping to and what ops it was executing. I still wonder if somehow its jumping out of the bytecode and landing on an op zero (end). Jumping out of the bytecode *should* raise an error, though, no? If I'm not using this right, I sure would like to see an example of the correct use of jump_i... Regards, -- _____________________________________________________________________ / 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, 20 jump I1 RET: print "Returned from subroutine!\n" end SUB: print "Entered subroutine...\n" set I2, -32 jump I2