0

would anyone be able to help me convert this c function to an assembler function? Any help would be greatly appreciated thanks.

void load(char x[][1000], int collum, int row, char ln)
{
   int i =0;
   int j =0;

   for( i = 0; i < row; i++ )
   {
      for( j = 0; j < collum; j++)
      {
         scanf("%c",&x[i][j]);
      }
      scanf("%c",&ln);
   }
}
1
Contributor
2
Replies
3
Views
7 Years
Discussion Span
Last Post by legendarya49
0

I have gotten this far

%define maze ebp-24
%define collum ebp-20
%define row ebp-16
%define doorx ebp-12
%define doory ebp-8
%define trash ebp-4


section .data
outJ db "Jamie - Position(%d,%d): %c",0
infmt db "%d ",0
in_fmt db "%c",0

section .text
main:
enter 1024,0

lea ebx,[row]
push ebx
push infmt
call scanf
add esp,8

lea ebx,[collum]
push ebx
push infmt
call scanf
add esp,8

lea ebx,[doory]
push ebx
push infmt
call scanf
add esp,8

lea ebx,[doorx]
push ebx
push infmt
call scanf
add esp,8

lea ebx,[trash]
push ebx
push in_fmt
call scanf
add esp,8

leave

ret

0

global load
extern printf
extern scanf

%define row ebp+24
%define column ebp+20
%define doorx ebp+16
%define doory ebp+12
%define maze ebp+8
%define i ebp+4
%define j ebp-4
%define trash ebp-8
section .data
infmt db "%d ",0
in_fmt db "%c",0

load:
enter 8,0

lea ebx,[row]
push ebx
push infmt
call scanf
add esp,8

lea ebx,[column]
push ebx
push infmt
call scanf
add esp,8

lea ebx,[doory]
push ebx
push infmt
call scanf
add esp,8

lea ebx,[doorx]
push ebx
push infmt
call scanf
add esp,8

lea ebx,[doory]
push ebx
push infmt
call printf
add esp,8


mov dword,0
outer:
mov edi,
cmp edi,[row]
jge odone
mov dword[j],0
inner:

mov ecx,[j]
cmp ecx,[column]
jge idone

mov edx,[maze]
mov eax,[column]
mul edi
add eax,[j]

mov ebx,[edx+eax]
push dword [ebx]
push in_fmt
call scanf
add esp,8


idone:
push dword [trash]
push in_fmt
call scanf
add esp,8

odone:

leave
ret

please help me load this array!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.