在哪里学习 LC3 并提供适当的完整解释?
Where to learn LC3 with proper full explanations?
这可能看起来很愚蠢,但实际上几乎没有任何学习 LC-3 的资源。我似乎无法找到对该主题的适当深入分析并解释事情是如何工作的,我的意思是当然,你可以找到简单的定义和某些 op/pseudo-op 代码的作用,但没有完整和完整的内容解释。
如果有人可以对以下内容进行全面分析:
; Hello name in LC-3 assembler
.orig x3000
lea r0, what
puts
lea r1, name
; typical assembly language hack coming up
add r1, r1, #-1
char getc
putc
add r2, r0, #-10
brz completed; was a newline
str r0, r1, #0
add r1, r1, #1
brnzp char
completed lea r0, hello
puts
halt
这可能会非常冗长,但也非常感谢。 (也许这是完整分析 LC-3 代码资源的第一个堆栈 post?)
p.s 我不希望回答的人解释每个 op/pseudo 操作代码的作用,但至少要非常具体地说明 如何 操作员执行并执行其操作工作
我主要通过插入代码和单步执行来了解 LC3 的工作原理。尽管我会在书中引用很多 Appendix A。
; Hello name in LC-3 assembler
.orig x3000 ; Starting place in memory for our code
lea r0, what ; Load the memory address of variable what
puts ; Print the string who's memory address is stored in R0
lea r1, name ; Load the memory address of the variable name into R1
; typical assembly language hack coming up
add r1, r1, #-1 ; Subtract 1 from R1, then store into R1
char getc ; Get a single char from the user, store into R0
putc ; Print that same char to the console
add r2, r0, #-10 ; R2 = R0 - 10
brz completed ; If the user presses ENTER (Ascii 10)
; and we've subtracted 10 then we'll get a 0, exit program
str r0, r1, #0 ; Store the value of R0 into memory[R1 + 0]
add r1, r1, #1 ; R1 = R1 + 1
brnzp char ; Jump to Clear no matter what
completed lea r0, hello ; Load the memory address of variable hello into R0
puts ; Print the string stored in hello
halt ; Stop the program
这可能看起来很愚蠢,但实际上几乎没有任何学习 LC-3 的资源。我似乎无法找到对该主题的适当深入分析并解释事情是如何工作的,我的意思是当然,你可以找到简单的定义和某些 op/pseudo-op 代码的作用,但没有完整和完整的内容解释。
如果有人可以对以下内容进行全面分析:
; Hello name in LC-3 assembler
.orig x3000
lea r0, what
puts
lea r1, name
; typical assembly language hack coming up
add r1, r1, #-1
char getc
putc
add r2, r0, #-10
brz completed; was a newline
str r0, r1, #0
add r1, r1, #1
brnzp char
completed lea r0, hello
puts
halt
这可能会非常冗长,但也非常感谢。 (也许这是完整分析 LC-3 代码资源的第一个堆栈 post?) p.s 我不希望回答的人解释每个 op/pseudo 操作代码的作用,但至少要非常具体地说明 如何 操作员执行并执行其操作工作
我主要通过插入代码和单步执行来了解 LC3 的工作原理。尽管我会在书中引用很多 Appendix A。
; Hello name in LC-3 assembler
.orig x3000 ; Starting place in memory for our code
lea r0, what ; Load the memory address of variable what
puts ; Print the string who's memory address is stored in R0
lea r1, name ; Load the memory address of the variable name into R1
; typical assembly language hack coming up
add r1, r1, #-1 ; Subtract 1 from R1, then store into R1
char getc ; Get a single char from the user, store into R0
putc ; Print that same char to the console
add r2, r0, #-10 ; R2 = R0 - 10
brz completed ; If the user presses ENTER (Ascii 10)
; and we've subtracted 10 then we'll get a 0, exit program
str r0, r1, #0 ; Store the value of R0 into memory[R1 + 0]
add r1, r1, #1 ; R1 = R1 + 1
brnzp char ; Jump to Clear no matter what
completed lea r0, hello ; Load the memory address of variable hello into R0
puts ; Print the string stored in hello
halt ; Stop the program