我需要创建一个简单的x96-64汇编语言程序来计算数字列表的最小值,中间值,最大值,总和和整数平均值。当我尝试组装它给我错误。到目前为止我的代码:
; -----
; Define constants.
NULL equ 0 ; end of string
TRUE equ 1
FALSE equ 0
EXIT_SUCCESS equ 0 ; successful operation
SYS_exit equ 60 ; call code for terminate
; -----
lst dd 4220, -1116, 1542, 1240, 1677
dd -1635, 2426, 1820, 1246, -333
dd 2315, -215, 2726, 1140, 2565
dd 2871, 1614, 2418, 2513, 1422
dd -119, 1215, -1525, -712, 1441
dd -3622, -731, -1729, 1615, 2724
dd 1217, -224, 1580, 1147, 2324
dd 1425, 1816, 1262, -2718, 1192
dd -1435, 235, 2764, -1615, 1310
dd 1765, 1954, -967, 1515, 1556
dd 1342, 7321, 1556, 2727, 1227
dd -1927, 1382, 1465, 3955, 1435
dd -225, -2419, -2534, -1345, 2467
dd 1615, 1961, 1335, 2856, 2553
dd -1035, 1835, 1464, 1915, -1810
dd 1465, 1554, -267, 1615, 1656
dd 2192, -825, 1925, 2312, 1725
dd -2517, 1498, -670, 1475, 2030
dd 1223, 1883, -1173, 1350, 2415
dd -335, 1125, 1118, 1713, 3020
length dd 100
lstMin dd 0
lstMid dd 0
lstMax dd 0
lstSum dd 0
lstAve dd 0
evenCnt dd 0
evenSum dd 0
evenAve dd 0
tenCnt dd 0
tenSum dd 0
tenAve dd 0
; *****************************************************************
section .text
global _start
_start:
; ----------------------------------------------
mov rcx, 0
mov ecx, dword [length]
mov eax, dword[lst]
mov dword, [lst +lstMin] eax
mov dword, [lst +lstMax] eax
mov rsi, 0
mov dword [lst +lstSum],0
sumLp:
mov eax, dword [lst+rsi]
add dword [lst + lstSum],eax
cmp eax, dword [lst+lstMin]
jge minDone
mov dword[lstMin],eax
minDone:
cmp eax,dword [lstMax]
jle maxDone
mov dword[lstMax],eax
maxDone:
add rsi, 4
dec rcx
cmp rcx, 0
jne sumLp
mov eax, dword [lstSum]
cdq
idiv dword [length]
mov dword[lstAve],eax
; *****************************************************************
; Done, terminate program.
last:
mov eax, SYS_exit ; call call for exit (SYS_exit)
mov ebx, EXIT_SUCCESS ; return code of 0 (no error)
syscall
与YASM组装时出现的错误类似于:
myprog.asm:60: error: unexpected `,' after instruction
myprog.asm:61: error: unexpected `,' after instruction
为什么我会收到这些错误,如何解决?