Assembly language simple program -
i have write simple program in assembly language h8s. user enters 50 uint16 numbers, , after each number program should sort entered numbers , print them out. how can implement array , work it?
.text .global _start _start: mov.l #stck,er7 xor.l er6,er6 begin: inc.l #1,er6 mov.w #puts,r0 mov.l #par_o,er1 jsr @syscall mov.w #gets,r0 mov.l #par_i,er1 jsr @syscall jsr @insert jsr @sort jsr @write cmp.l #50,er6 bcs begin jmp @end insert: rts sort: rts write: rts end: jmp @end
suppose on masm, can use operator "dup" in
smallarray dword 10 dup (?)
this line define array 10 members of double words unknown initial values
for accessing it's members can use indirect access ,
mov eax, [smallarray] ;first member mov eax, [smallarray+4] ;second member mov eax, [smallarray+8] ;third member mov eax, [smallarray+12] ;fourth member mov eax, [smallarray+16] ;fifth member ;....... used 4 bytes because members dword (4 bytes long)
Comments
Post a Comment