Assembly 汇编代码中的语法错误
我有这个代码,我想知道是否有人愿意帮助我让它工作Assembly 汇编代码中的语法错误,assembly,syntax,masm,irvine32,Assembly,Syntax,Masm,Irvine32,我有这个代码,我想知道是否有人愿意帮助我让它工作 TITLE MASM Template (main.asm) ; Description: this code is supposed to print out each letter followed by a space and then the capitalized version on seperate lines ; Revision date: INCLUDE Irvine32.inc .
TITLE MASM Template (main.asm)
; Description: this code is supposed to print out each letter followed by a space and then the capitalized version on seperate lines
; Revision date:
INCLUDE Irvine32.inc
.data
myArray byte 'l','s','d','t','h','c','f','u','c','k' ;my array of 10 characters
.code
main PROC
mov ecx,0 ;clears ecx
mov ecx,LENGTHOF myArray ;should be 10
mov edi,OFFSET myArray ;will point to the beginning of the array
mov eax,0 ;clears eax
mov esi,0 ;clears esi
LOne:
mov eax,myArray[esi] ;points the pointer at the beginning of myArray
WriteChar eax ;prints the designated value in the array
WriteChar 32 ;prints a space (32 is the ascii value for ' ')
sub eax,32 ;subtracts 32 from the ascii value of the char
;the capital version of each letter is -32 of its ascii value
WriteChar eax ;prints the capital version
call CLRF ;prints new line
inc esi ;increments esi to the next array value
dec ecx ;decrements ecx, moving it through the array
loop LOne ;loops back until ecx is equal to zero
exit
main ENDP
END main
如果给我语法错误,它将无法编译
1> main.asm(22):错误A2008:语法错误:eax1> main.asm(23):错误A2008:语法错误:WriteChar
1> main.asm(26):错误A2008:语法错误:eax
1> main.asm(21):错误A2022:指令操作数的大小必须相同
1> main.asm(27):错误A2006:未定义符号:CLRF
啊,基普·欧文的书。。。我记得我想写我自己的图书馆,这样我就不用用他的 您需要
调用那些库函数,在汇编语言中不是这样做的
假设他的库自第四版以来没有更改,WriteChar
要求您将要写入的字符移动到寄存器al
Crlf
不需要任何参数,所以您可以直接调用它,但拼写很重要
在语法正确后,您需要再次检查逻辑。好的,不管代码做什么,在一个单独的页面中看到LSD、THC和F*CK,所以post对我来说是第一次!发生了什么,它与您想要/期望的有何不同?我看不到你打印新行的地方,注释似乎表明你可能想要,但这是唯一一个立即跳出的问题。代码没有编译,它在第22,23,24,26行上说语法错误哦,是的,我遗漏了新行代码,调用CLRF works,对吗?并不是说它修复了代码,而是感谢它,它到底是怎么工作的?请提出简洁的问题。现在唯一阻止它编译的是“writeChar”行中缺少的运算符。我导入了irvine库,所以它们应该可以工作,为什么它说缺少运算符?这意味着什么呢?是的,很多人都在告诉我关于kip irvine的坏话,这让我觉得非常不方便,因为我的老师用这些材料来上课。他甚至使用基普的力量点!很显然,我对这门语言的全部理解都来自于这个家伙,我能找到的互联网资源很少……如果你想要其他资源,请查看。
mov al, BYTE PTR [edi + esi]
call WriteChar ; print the character found at [edi + esi]
call Crlf ; print a new line