View Full Version : Pascal decoder?
ricco32097
10-22-2006, 07:53 PM
Is such a thing available? I made a program and compiled it. I would like to get my source code back, or at least some of it.
Could anyone convert this little program back to code for me? 43KB
Minuous
10-22-2006, 10:08 PM
There are no decompilers available for Amiga.
This is one of the more glaring holes in the Amiga software range.
Methanoid
10-23-2006, 01:28 AM
Makes me think.. For a time I ran a BBS on /X and then on a PC using PC Express. I wonder if I could decompile PCE and update it?
I wonder if I could decompile PCE and update it?
If you need to ask, no.
ricco32097
10-23-2006, 04:42 PM
@Piru Could you decode a 43KB .exe file, or find the password for me? It was a program I made long time ago. It asks for a password, but I can't remember it. When correct password is entered, a menu comes up with some stuff, like jokes, system info and such.
Minuous
10-23-2006, 09:16 PM
Better would be to ask if he could write and release a decompiler. Rather than to ask him to decompile 43K of code by hand :-)
Methanoid
10-24-2006, 01:47 AM
Got many friends Piru (real ones not imaginary ones) ??
No, didn't think so and can understand why. There was no need to be so rude.
@ricco32097
Could you decode a 43KB .exe file, or find the password for me?
Possibly. I have never decoded a pascal program before, but I doubt it makes any difference really. It won't give you the src though, but I could either figure out the password or bypass it.
Karlos
10-24-2006, 04:18 AM
Isn't Pascal compiled? If so, I assume you'd only be able to get as far as dissassembling it? Or is it converted to some sort of bytecode representation that's executed by an interpreter?
Pascal is compiled, so yes it's m68k asm disassembly. Shouldn't be too hard.
Karlos
10-24-2006, 04:40 AM
Piru wrote:
Pascal is compiled, so yes it's m68k asm disassembly. Shouldn't be too hard.
Aye, not for you but the guy who wanted his source back might balk at the sight of 40 pages of 68K mnemonics :-D
Aye, not for you but the guy who wanted his source back might balk at the sight of 40 pages of 68K mnemonics
That's why I opted for the "or find the password for me" part.
Karlos
10-24-2006, 05:02 AM
Piru wrote:
Aye, not for you but the guy who wanted his source back might balk at the sight of 40 pages of 68K mnemonics
That's why I opted for the "or find the password for me" part.
:lol: I must have missed that bit...
ricco32097
10-24-2006, 06:38 AM
@Piru
File send
Excuse me, but this is a MS-DOS program.
As this is amiga.org I thought the program would have been compiled to AmigaOS binary... I'm afraid I can't do much about the DOS app. Sorry.
Karlos
10-24-2006, 08:10 AM
Just how do you say "D'Oh!" in Finnish?
ricco32097
10-24-2006, 09:18 AM
Anyone else want to give it a try?
Karlos
10-24-2006, 09:21 AM
ricco32097 wrote:
Anyone else want to give it a try?
Perhaps someone over on the AROS sites would be better to ask? There are probably (just guessing) more x86 coders there?
Minuous
10-24-2006, 09:23 AM
Then just use an MS-DOS decompiler.
Of course you will end up with C source rather than Pascal source, but that is actually an improvement :-)
Karlos
10-24-2006, 09:37 AM
Arent there fundamental differences in the handling of variables etc in Pascal? I thought strings were represented differently than they are in Cfor example?
@Minuous
Of course you will end up with C source rather than Pascal source
Uh?
Karlos
10-24-2006, 09:55 AM
Piru wrote:
@Minuous
Of course you will end up with C source rather than Pascal source
Uh?
I was thinking it would be an x86 dissassembly, myself ;-)
Well, I know there are apps that try to convert binaries to C code, but I doubt they produce any more readable code than x86 disassembly, anyway. :-)
Karlos
10-24-2006, 10:04 AM
I suppose it depends how stripped the binaries are, I guess. I also expect OS calling mechanisms can be spotted and properly labelled.
As for the rest...
Try decompiling a duffs device loop to see what you get :-D
Minuous
10-24-2006, 10:43 AM
If you use a disassembler, you'll get x86 source.
But if you use a decompiler you'll get source in a high-level language.
See http://en.wikipedia.org/wiki/Decompiler
Decompiler and disassembler aren't the same. Disassembler stops when it has created assembly code. Decompiler keeps processing and ends up with high-level language source. Of course there are many disassemblers on the Amiga but no decompilers AFAIK.
Most of the decompilers I've heard about produce C output, but in theory you could make one that produced Pascal output.
Karlos
10-24-2006, 10:51 AM
I doubt a C decompiler would work well with code not written in C to start with.
There are certain programming constructs you can engineer in assembler that have absolutely no equivalent in C.
I wrote a small emulation core which was optimised in assembler, where each operation calculated the jump to the next code block directly and went there. A bit like having a big switch/case where the switch itself is never executed, but the code in each case clause is able to work out which one to jump to next relative to a base address (each block is padded to a certain 2^n size). There's absolutely no way to represent that in C.
So, code produced by pascal, could in theory contain machine level constructs that have no equivalent in C (not likely given their similarities).
Oh well, I still believe decompiler output is far from usable (at least the outputs I've seen, though I must admit it was years ago. Technology has gone forward since then I suppose).
Minuous
10-24-2006, 11:46 AM
Yeah, they are far from perfect, but they automate some of the process: less hand-editing required to convert from assembler to C than if you did the whole thing by hand.
I wrote a program (Aminet:dev/cross/Annotate.lha) that comments Signetics 2650 assembly source with pseudo-C equivalents...a similar principle but not exactly a decompiler in the strictest sense.
ricco32097
10-24-2006, 12:25 PM
File send...good luck, and thanks.
TheMagicM
10-24-2006, 02:07 PM
decompile it with a AmigaBASIC like decompiler.. LOL.. get a couple of BASIC lines of code then a whole bunch of DATA statements... that should keep you busy. LOL
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.