frranck / asm2c Goto Github PK
View Code? Open in Web Editor NEWTool to convert DOS Assembly code to C code
License: MIT License
Tool to convert DOS Assembly code to C code
License: MIT License
...set to /Users/franck/dev/mrboom_pi/tasm2cpp/asm2c.xcodeproj when obtained through master as of 2017-09-25.
I would like to have some program on my 64 bit Windows 7 that takes the current C Runtime Library files that has ASM implementations and get a version in C so I can understand them more (I dont fully get ASM).
Here is an example ASM Code from the CRT that is some stack checking that I need in C:
page ,132
title chkstk - C stack checking routine
.xlist
include vcruntime.inc
.list
; size of a page of memory
_PAGESIZE_ equ 1000h
CODESEG
page
public _alloca_probe
_chkstk proc
_alloca_probe = _chkstk
push ecx
; Calculate new TOS.
lea ecx, [esp] + 8 - 4 ; TOS before entering function + size for ret value
sub ecx, eax ; new TOS
; Handle allocation size that results in wraparound.
; Wraparound will result in StackOverflow exception.
sbb eax, eax ; 0 if CF==0, ~0 if CF==1
not eax ; ~0 if TOS did not wrapped around, 0 otherwise
and ecx, eax ; set to 0 if wraparound
mov eax, esp ; current TOS
and eax, not ( _PAGESIZE_ - 1) ; Round down to current page boundary
cs10:
cmp ecx, eax ; Is new TOS
bnd jb short cs20 ; in probed page?
mov eax, ecx ; yes.
pop ecx
xchg esp, eax ; update esp
mov eax, dword ptr [eax] ; get return address
mov dword ptr [esp], eax ; and put it at new TOS
bnd ret
; Find next lower page and probe
cs20:
sub eax, _PAGESIZE_ ; decrease by PAGESIZE
test dword ptr [eax],eax ; probe page.
jmp short cs10
_chkstk endp
end
So would this work on ASM code like this for my needs?
swift build
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.5.0
Fetching https://github.com/crossroadlabs/Regex.git
Fetching https://github.com/frranck/Expression
error: because no versions of Expression match the requirement 0.13.2..<1.0.0 and root depends on Expression 0.13.2..<1.0.0, version solving failed.
'asm2c' /Users/appveyor/projects/asm2c: error: Source files for target asm2cTests should be located under 'Tests/asm2cTests', or a custom sources path can be set with the 'path' property in Package.swift
???
Hi,
( i have Starred this project).
as far as i understand this tool can handle upto 32bit x86 code ?
can/does it also support AMD64 based Assembly
into ANSI C
?
i need to convert "Go" into "C" , or "Go" into "C++" , i have posted some solutions here (in SO) & mentioned this project there too , & also here . Please upvote my Q+A both in SO (or vote "Converting/transpiling..." topic here to Undelete), if you want to . ( Google Crimes1, 2, 3, 4, 5, 6. Problems in "Go"1, 2, 3, 4, 5, 6, 7. )
Output of below commands are in "Main.s" file , which has Golang/Google based"Assembly"
, not general/standard or GNU/GAS-Assembly
, not NASM-Assembly
.
cmd: go tool compile -S Main.go
or
cmd: go build -gcflags -S Main.go
can this "asm2c" tool produce ANSI C
output from Go-Assembly
?
if not, would you please add such option/feature ?
or, what would you suggest i should use ?
EDIT : added a sentence on upvoting in SO.
EDIT : added links for 'Go'-problems.
EDIT : added a link to new Transpiler-List project site, etc.
I'm developing similar project using Python (masm2c) because I don't know Swift.
I have ported i386 instructions tests from qemu.
You can reuse it too:
_qemu_tests.zip
It can be run directly on hardware or translated using masm2c. So you can compare output of instructions (regs and flags) and make sure all instructions calculate well as hardware.
Don't know how much of the classic Impulse Tracker would be handled successfully by asm2c, but would sure love to find out! I'm unable to use the Mac xcodeproj, is the source OS-independent otherwise or does it require Mac-specific APIs?
I want to convert some assembly code to rough c / c++ code (human readable ) and i came across this but i am not sure wow can i create a usable binary or executable from this code (Windows) so that i can use that to convert my assembly code to c/c++
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.