View Single Post
Old 08 July 2015, 22:39   #3
Registered User

Join Date: Jul 2015
Location: UK
Posts: 10
Some progress --

uint32_t foo(uint32_t x, int8_t y)
    return (x | (1 << 17)) + y;

; GLOBAL foo
foo	PROC                            ; @foo
; BB#0:                                 ; %entry
	move.l	8(a6), 4(a6)
	move.b	12(a6), d0
	move.b	d0, 3(a6)
	move.b	d0, d1
	ext.w	d1
	ext.l	d1
	move.l	#131072, d0
	or.l	4(a6), d0
	add.l	d1, d0

int main()
	uint32_t b = foo(10,12);

; GLOBAL main
main	PROC                            ; @main
; BB#0:                                 ; %entry
	move.l	a7, 4(a6)
	subi.l	#6, a7
	move.l	a7, d0
	movea.l	d0, a0
	move.l	#10, (a0)
	addq.l	#4, d0
	movea.l	d0, a0
	move.b	#12, (a0)
	call	#foo
	subi.l	#-6, a7
	move.l	d0, (a6)
	moveq	#0, d0
	move.l	4(a6), a7
It's some seriously dodgy looking code, but it does some call-like stuff. Once I've got something a bit less crap working I'll submit the code to the git repo.
SainT is offline  
Page generated in 0.03857 seconds with 10 queries