Note that there are some explanatory texts on larger screens.

plurals
  1. POPorting Assembly to C/C++?
    text
    copied!<p>I would like to have <a href="http://www.pouet.net/prod.php?which=7051" rel="nofollow noreferrer">this</a> x86 ASM code ported to C or C++, as I don't understand ASM =)</p> <p>Searching Google it seams <a href="http://www.microapl.co.uk/asm2c/" rel="nofollow noreferrer">Relogix</a> and IDA Pro can do it. But I don't suppose they are cheap, given I only have this one source.</p> <p>Understanding the math or the algorithm how it works would be just as good, as I am going to use OpenGL anyway.</p> <p>Are there other methods?</p> <pre><code>; ; a n d r o m e d a ; ; a 256b demo ; by insomniac/neon ; code SEGMENT ASSUME CS:code, DS:code p386 LOCALS ORG 100h max = 4096 maxZ = 5000 b EQU byte ptr Start: lea di,vars mov ch,60 rep stosw mov al,13h int 10h p al: mov al,cl mov dx,3c8h out dx,al inc dx cmp al,64 jb b64_1 mov al,63 b64_1: out dx,al mov al,cl shr al,1 out dx,al out dx,al loop pal .main: push 8000h pop ES mov si,max .loop: mov ax,Z[si] cmp ax,maxZ-(maxZ/4) jg NewStar cmp ax,2 jg Zok NewStar: mov ax,bp mov X[si],ax imul ax,8405h inc ax mov bp,ax shr ax,6 sub ax,400 mov Y[si],ax mov Z[si],maxZ-(maxZ/2) Zok: mov ax,X[si] movsx dx,ah shl ax,8 mov cx,Z[si] idiv cx add ax,320/2 cmp ax,320-1 jge NewStar cmp ax,1 jle NewStar mov di,ax mov ax,Y[si] movsx dx,ah shl ax,8 idiv cx add ax,200/2 imul ax,320 add di,ax mov al,127 stosb mov ax,X[si] cmp ax,00 jge .add neg ax shr ax,6 add Y[si],ax jmp .notadd .add: shr ax,6 sub Y[si],ax .notadd: add Z[si],ax mov ax,Y[si] sar ax,3 add X[si],ax .NextStar: dec si dec si jnz .loop push DS push ES pop DS xor di,di xor cx,cx .blur: movzx ax,DS:[di] movzx dx,DS:[di+1] add ax,dx mov dl,DS:[di-320] add ax,dx mov dl,DS:[di+321] add ax,dx shr ax,2 cmp al,0 je .skip dec ax .skip: stosb loop .blur push 0a000h pop ES mov si,di mov ch,81h rep movsw pop DS mov dx,3dah .vrt: in al,dx test al,8 jz .vrt in al,60h dec ax jnz .main endprog: mov al,3 int 10h ret LABEL vars X dw max DUP (?) Y dw max DUP (?) Z dw max DUP (?) code ENDS END Start </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload