in reply to Re: Z80 Assembler -> Hex Opcode
in thread Z80 Assembler -> Hex Opcode
Hi Tachyon,
I did indeed realise this, however in the code as you have written it the declaration of %opcodes is in a different scope to that of the subroutine and hence, all you get returned is an error. I am not sure exactly how to access the hash from the subroutine's scope - %main::opcodes ???
I did also originally run the program without the encode routines as a separate sub and it didn't appear to run any faster.
Thanks,
Elgon
Update: I tried running the program as a simple loop, without the sub as before, and it took about 1 second instead of 36 or so to run. Must have declared the hash inside the loop the first time. Oops. Time to go back to the Blue Camel and re-read the sections on scoping and packages :-)
Update^2: I've been trying to do what you suggest by passing a reference to %opcodes to the subroutine along with the line and then saying local *hash = shift; a la blue camel page 294 but this isn't liked either. FYI I'm using Perl 5.005 so use of our is right out.
Update^3: See root node.
"What this book tells me is that goose-stepping morons, such as yourself, should read books instead of burning them."
- Dr. Jones Snr, Indiana Jones and the Last Crusade
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Z80 Assembler -> Hex Opcode
by tachyon (Chancellor) on Feb 09, 2003 at 14:18 UTC | |
by Elgon (Curate) on Feb 09, 2003 at 14:58 UTC | |
by tachyon (Chancellor) on Feb 09, 2003 at 15:41 UTC |