简体   繁体   中英

Printing out value of array of numbers-Assembly

Alright so I have this code

SortScore PROC
call clrscr

 mov ecx, LENGTHOF studentsAverage
 dec ecx

L1: push ecx                                                                
mov esi, OFFSET studentsAverage             
L2: mov eax,[esi]                               
cmp [esi+4],eax                             
jge L3                                      ;jump to L3 if greater 

xchg eax,[esi+4]                            ;exchange values
mov [esi],eax                               ;

L3: add esi,4                                   ;move to next value 
loop L2                                     ;go back to L2
pop ecx                                     ;bring back the ecx
loop L1                                     ;go back to L1

L4: ret

I'm pretty sure it works, I just need to know how to modify it to display the values.

I suppose that you want to convert from a number to ASCII ? I've replied that in another answer :

Converting an ascii character into decimal in Assembly for use with WriteConsoleA and readConsoleA

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM