c - Can't seem find the largest float in an array, using inline assembly -
c - Can't seem find the largest float in an array, using inline assembly -
i have been tasked doing assembly work. going good, until had convert programme using int floats. i'm missing simple in attempts, have suggestion? i'll provide int version works.
#include <stdio.h> int n; int i; int arr[50]; int output; int main(void) { scanf("%d", &n); (i = 0; < n; i++) { scanf("%d", &arr[i]); } __asm { jmp start switching: mov eax, ebx jmp looping looping: mov ebx, arr[ecx*4] inc ecx cmp ebx, eax jg switching cmp ecx, n jl looping ret start: mov ecx, 0 mov eax, 0 phone call looping mov output, eax } printf("%d", output); scanf("%d", &n); }
you need rewrite of solution. if new floats , want utilize x87, here guide read.
to test floats need conditional jump:
fld <float compare> fcom <maximum value> fnstsw ax test ah,$1 jnz <notbigger>
c assembly x86 inline-assembly
Comments
Post a Comment