[HELP] Recover assembler code from .p file

Discussion about ZX80 / ZX81 Software
User avatar
DOAs_fan
Posts: 17
Joined: Tue Oct 09, 2012 4:06 am

[HELP] Recover assembler code from .p file

Post by DOAs_fan »

Hi everybody!

I am trying to recover the assembler code from a .p file.

I had tried with zxpclist pack,P2TXT.exe but it converts to BASIC CODE :(

Someone knows any application to achieve my goal???

Thanks!

Bye.
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

Re: [HELP] Recover assembler code from .p file

Post by bobs »

You should just be able to load the file into an emulator (EightyOne or No$ZX81) and use the debug option to list the assembler mnemonics.

But it won't be perfect, as it'll list data as assembler and also not list the code correctly if the commands are offset from where it thinks they start. Really you need to run the program and work through the disassembly extracting the code as you go.
dr beep
Posts: 2079
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: [HELP] Recover assembler code from .p file

Post by dr beep »

I did the same with my lost sources where I had a .P

I imported the .P in ZXSPIN at 49161 (#C009), 32768 above normal loading. Then exported the disassembly to a TXT.
As stated by Bob, data is shown as code, but you can work it out.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: [HELP] Recover assembler code from .p file

Post by sirmorris »

I have had a plan for a while now to add a disassemble on execute funtion to EO. As it executes it will build a file containing the code, and attempt to create labels for targets of jumps and calls. It will be able to work out where data areas lie as these addresses will be accessed by instructions but not themselves executed.

The only problems I can see are code paths which don't get executed very often and data which is rarely accessed. Self modifying code should be easy to spot as there will be multiple instructions located at a single address.

As with everything I post you'll have to realise that I load my plate far too heavily and rarely get time to work on things that I dream up, so this may never materialise :( :(

C
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: [HELP] Recover assembler code from .p file

Post by PokeMon »

sirmorris wrote: As with everything I post you'll have to realise that I load my plate far too heavily and rarely get time to work on things that I dream up, so this may never materialise :( :(

C
I think I know exactly what you mean. ;)
User avatar
DOAs_fan
Posts: 17
Joined: Tue Oct 09, 2012 4:06 am

Re: [HELP] Recover assembler code from .p file

Post by DOAs_fan »

bobs wrote:You should just be able to load the file into an emulator (EightyOne or No$ZX81) and use the debug option to list the assembler mnemonics.

But it won't be perfect, as it'll list data as assembler and also not list the code correctly if the commands are offset from where it thinks they start. Really you need to run the program and work through the disassembly extracting the code as you go.
Hi bobs!

It is true, but the problem is the EightyOne shows the instruction list but It didn´t let you save it :(

I can not belive there not exist a Tool to save ALL memory segments in mnemonics :x
dr beep wrote:I did the same with my lost sources where I had a .P

I imported the .P in ZXSPIN at 49161 (#C009), 32768 above normal loading. Then exported the disassembly to a TXT.
As stated by Bob, data is shown as code, but you can work it out.
Hi dr beep!

I didn´t know about the existence of ZXSPIN emulator. It seems to be the solution to my problems.

I spend time investigating it but I couldn´t open a .p file.

Can you tell me how can I do this?

Another question:

You use the option
"Tools-> Debugger..." and then "File->Save Disassembly..."

to recover the assembler code in a text file. Right?

Thanks!
dr beep
Posts: 2079
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: [HELP] Recover assembler code from .p file

Post by dr beep »

Working on a tablet so I can't check it.

By heart:
On menu under file is a load binary file.
Use this to load and then export the file again.

BTW ZXspin is a spectrumemulator
dr beep
Posts: 2079
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: [HELP] Recover assembler code from .p file

Post by dr beep »

dr beep wrote:Working on a tablet so I can't check it.

By heart:
On menu under file is a load binary file.
Use this to load and then export the file again.

BTW ZXspin is a spectrumemulator
Now on a laptop. Above is OK for loading.
Saving through
tools, debugger
then file, save disassembly and enter filename with start and length (length unknown, use 16384)
User avatar
dbolli
Posts: 5
Joined: Thu Nov 15, 2012 10:52 pm
Location: Sydney, Australia
Contact:

Re: [HELP] Recover assembler code from .p file

Post by dbolli »

I had success with the Vb81_XuR.exe emulator

http://zx81.vb81.free.fr/

LOAD ""
Click Pause icon on Toolbar to Freeze CPU
Select .P file
Disassemble .P file that has not run in BASIC

LIST INFO FILE $4009 to End of .p file + $0F -> FILENAME.LIST.TXT
TAS FILE $4082 to End of .p file + $0F -> FILENAME.TAS.TXT
STRINGS FILE $4082 to End of .p file + $0F -> FILENAME.STRINGS.TAS.TXT
TAS DATA FILE $4082 to End of .p file + $0F -> FILENAME.DATA.TAS.TXT

Regards,
Derek
North Sydney, Australia
1985: ZX Spectrum+ 48K Interface 1 ZX81 16KB ASZMIC/SP ROM Philips 12" B/W TV Epson Dot Matrix Printer ZX Printer
Now: Late 2012 iMac 27" 3.4GHz i7 16GB RAM OS X 10.10.4 1TB Fusion Drive USB 3 HDs Ext iPad Air 32GB iPhone 6 64GB Apple TV v2
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: [HELP] Recover assembler code from .p file

Post by XavSnap »

Hi,

"I'm Happy !!!"
Or binary "*.BIN" the right icon "Load/Save/export binnary...", to export or import binary as is.
Only the selected code will be write (listview contant), select de good REM number in the line selector, or change and refresh the upper and lower address.

In a text format, just type SAVE"MYPR.TXT" in the ZX81 editor. (".TXT" will redirect the emulator to a text file, not to a 'P' file)
You can select a DECimal format too... (Basic tools frame)
It will write a text file using the Vb81 (ZxBASIC) text format.(in selected path, last selected P path)
1 REM [HEX:00,1F,3D,3D]
Note: the TXT file can be reloaded using the "Files selector" frame (As is)

Vb81 XUR updated to 29-02-14.
Have Fun.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply