Using the read function with an offset

Lolbassett_at_aol.com
Date: 03/30/04


Date: Tue, 30 Mar 2004 12:34:18 EST
To: beginners@perl.org

Hi!

I'm writing some 68k modules, for disassembly, assembly, reading
instructions, analysing instructions, etc.

The package I'm stuck on is supposed to read a 16bit instruction, and then
break it down into an array, with each element seperated.

So far, I'm trying to read 16bits, at an offset specified by the user, but
for some reason, all I get is more white spaces infront of the first 16bits in
the file.

open SOURCE, "$File" or
    die "Cannot open $File\n";

binmode SOURCE;

read SOURCE, $Instr, 2, $Offset;

return $Instr;

I find that if I read from the first byte, I get the first two bytes in my
file, but if I read from the 5, I just get three white spaces, and then the
first two bytes.

Can anybody help?

Thanks,

Lewis AS Bassett



Relevant Pages

  • Creating a Win32 exe from a Java project?
    ... How do I create a Win32 exe from a Java project? ... but they're not Open source. ... Any ideas and/or instructions? ... Prev by Date: ...
    (comp.lang.java.programmer)
  • Re: disassembly of Debug.exe?
    ... which is open source (NASM) and which can ... decode/encode 386 instructions: ...
    (comp.lang.asm.x86)
  • Re: [Error number: 0x800700B6] Cannot Update...Dont know why????
    ... instructions and I now see the new error message. ... Once again I am stuck and ... To avoid confusion I am currently seeing this ... Prev by Date: ...
    (microsoft.public.windowsupdate)
  • Re: After For..Next..Go to Next Row Data
    ... The script below runs but always ... > stuck at Row A and does not proceed to row ..b..c..d..till end of Rows? ... > groups of instructions for different rows..so i cannot use the same ... > Sub SR ...
    (microsoft.public.excel.programming)
  • Re: Broken Schlumpf Crank
    ... contact Ken Looi (Gizmoduck on the ... board) and ask him for instructions on how to remove the button. ... If they are both stuck, I am not sure how you would remove them. ...
    (rec.sport.unicycling)