They are separated into three different categories. We will begin our study of the lc3 assembly language by means of an example. There are 15 instructions in lc3 assembly language. R0 10r1 halt xor registers r1 and r2 set r3 to r1 r2 i. Assembly language is a lowlevel programming language for a computer, or other programmable device specific to a particular computer architecture in contrast to most high level programming languages, which are generally portable across multiple systems. Lc3 assembly examples multiply by 10 set r0 to 10r1. It is not important to know how these instructions. In lc3 assembly language, a label consists of from on e to 20 alphanumeric characters i. Assembly language is very low level, an d depends on the computer architecture. Shorthand for using decimal and hexadecimal numbers.
Stringz initialize memory with ascii values, 0terminated. Another example count the occurrences of a character in a file program begins at location x3000 read character from keyboard load each character from a file file is a sequence of memory locations starting address of file is stored in the memory location immediately after the program 512. Add takes in two numbers and stores their sum in the destination register. High level languages were developed, that were relatively machine independent, and more like the notation of mathematics. Chapter 6 programming the lc3 information and computer. Lc 3 instructions page 1 of 16 lc 3 instruction summary 15 14 12 11 10 9 8 7 6 5 4 3 2 1 0 add 0001 dr sr1 0 0 0 sr2 add 0001 dr sr1 1 imm5 and 0101 dr sr1 0 0 0 sr2 and 0101 dr sr1 1 imm5 br 0000 n z p pcoffset9 jmp 1100 0 0 0 baser 0 0 0 0 0 0. The above listing is a typical hello world program written in lc3 assembly language.
933 238 452 237 972 172 615 12 464 1063 970 1251 1480 1081 1261 1333 361 178 661 790 779 1531 1058 1106 238 1020 521 1001 1346 861 1152 757