打印出数字数组的值 - 汇编

时间:2011-05-05 23:04:57

标签: assembly masm x86-16

好吧我有这个代码

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

我很确定它有效,我只需要知道如何修改它来显示值。

1 个答案:

答案 0 :(得分:0)

我想你想要从一个数字转换为ASCII?我在另一个答案中回复说:

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