Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > ASM to C
2018-08-08 10:37
Mixer

Registered: Apr 2008
Posts: 422
ASM to C

Are there tools to convert a) disassembler output to some sort of C? b) macro assembler listings to C?

Such a thing can be done by substituting opcodes with their C-statement equals. Has anyone written more sophisticated tools for this?
 
... 11 posts hidden. Click here to view all posts....
 
2018-08-12 11:04
Mixer

Registered: Apr 2008
Posts: 422
@Ozipanthom, true that the decompiler itself does not know that the lookup is a multiplication, and does not know what the multiplier is.

But this is already pretty good for my uses.

thing=mem[table[x]]+mem[otherTable[y]]
2018-08-12 15:05
chatGPZ

Registered: Dec 2001
Posts: 11136
Quote:
What was the major blocker on basic to C? I would think it mostly has a 1:1 relationship.

not at all. you can do terrible things in basic v2 which just wont translate to C at all. like GOSUB somewhere, but never RETURN. or reuse parts of one subfunction from another. even after building a control flow graph and duplicating the things that would collide, you'd still end up with dead ends. not worth the trouble, easier to just convert by hand :)

Quote:
READ would be the tricky part.

no not really, thats one of the easier parts infact :=P
2018-08-12 18:55
DanPhillips

Registered: Jan 2003
Posts: 30
Yay back on the forum :)


We once used a bunch of macros to convert 65816 to c.
All the object handling/ai was converted when going from Snes to PC dos.


I don't have a copy of the macros, but I do remember they were "horrendous" :)


Cheers

Dan
2018-08-12 19:19
chatGPZ

Registered: Dec 2001
Posts: 11136
ah i did this once when i converted 6502 code to gameboy :)

however - this doesnt make the code more readable at all =D
2019-02-28 07:39
Remdy

Registered: Feb 2019
Posts: 26
I did it for (a subset) of DOS/PMODEW 386 TASM assembly code: https://github.com/frranck/asm2c
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
A3/AFL
Berluskåni/The Gump..
Flex/Artline Designs
tlr
E$G/hOKUtO fOrcE
JEZ
Twilight/Excess/Arcade
blitzed
Brush/Elysium
Guests online: 130
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.039 sec.