Assembly Language Programming ACSL PDF
Document Details
Uploaded by NicerUtopia
ACSL
Tags
Related
- Assembly Language Programming I: Introduction PDF
- Assembly Language Programming Lecture 7 PDF
- Lecture 02 Introduction to Assembly Language PDF
- ARM Assembly Language Programming PDF
- COE 205 Lab 2: Introduction to Assembly Language Programming (PDF)
- Lecture 2 Assembly Language Programming 2024-2025 PDF
Summary
This document is an overview of Assembly Language Programming, specifically for the ACSL competition. It includes a reference manual, sample problems, and useful video resources. The document aims to give a high-level understanding of the subject and relevant examples, targeting undergraduate students and potential entrants to competitions.
Full Transcript
2024/5/26 下午3:36 Assembly Language Programming - ACSL Category Descriptions Assembly Language Programming Programs written in high-level languages are traditionally converted by compilers into assembly language, which is turned into machine lang...
2024/5/26 下午3:36 Assembly Language Programming - ACSL Category Descriptions Assembly Language Programming Programs written in high-level languages are traditionally converted by compilers into assembly language, which is turned into machine language programs – sequences of 1’s and 0’s – by an assembler. Even today, with very good quality compilers available, there is the need for programmers to understand assembly language. First, it provides programmers with a better understanding of the compiler and its constraints. Second, on occasion, programmers find themselves needing to program directly in assembly language in order to meet constraints in execution speed or space. ACSL chose to define its own assembly language rather than use a “real” one in order to eliminate the many sticky details associated with real languages. The basic concepts of our ACSL topic description are common to all assembly languages. Contents Reference Manual Sample Problems Problem 1 Problem 2 Video Resources Reference Manual Execution starts at the first line of the program and continues sequentially, except for branch instructions (BG, BE, BL, BU), until the end instruction (END) is encountered. The result of each operation is stored in a special word of memory, called the “accumulator” (ACC). The initial value of the ACC is 0. Each line of an assembly language program has the following fields: LABEL OPCODE LOC The LABEL field, if present, is an alphanumeric character string beginning in the first column. A label must begin with an alphabetic character(A through Z, or a through z), and labels are case-sensitive. Valid OPCODEs are listed in the chart below; they are also case-sensitive and uppercase. Opcodes are reserved words of the language and (the uppercase version) many not be used a label. The LOC field is either a reference to a label or immediate data. For example, “LOAD A” would put the contents referenced by the label “A” into the ACC; “LOAD =123” would store the value 123 in the ACC. Only those instructions that do not modify the LOC field can use the “immediate data” format. In the following chart, they are indicated by an asterisk in the first column. https://www.categories.acsl.org/wiki/index.php?title=Assembly_Language_Programming 1/5 2024/5/26 下午3:36 Assembly Language Programming - ACSL Category Descriptions OP DESCRIPTION CODE *LOAD The contents of LOC are placed in the ACC. LOC is unchanged. STORE The contents of the ACC are placed in the LOC. ACC is unchanged. The contents of LOC are added to the contents of the ACC. The sum is stored in the ACC. LOC is *ADD unchanged. Addition is modulo 1,000,000. The contents of LOC are subtracted from the contents of the ACC. The difference is stored in the *SUB ACC. LOC is unchanged. Subtraction is modulo 1,000,000. The contents of LOC are multiplied by the contents of the ACC. The product is stored in the ACC. *MULT LOC is unchanged. Multiplication is modulo 1,000,000. The contents of LOC are divided into the contents of the ACC. The signed integer part of the quotient is stored in the ACC. LOC is unchanged. *DIV. BG Branch to the instruction labeled with LOC if ACC>0. BE Branch to the instruction labeled with LOC if ACC=0. BL Branch to the instruction labeled with LOC if ACC