computer organization & assembly language...

13
1 CSE 2312 Assembler Installation and Usage Computer Organization & Assembly Language Programming

Upload: others

Post on 06-Apr-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

1

CSE 2312

Assembler Installation and Usage

Computer Organization &

Assembly Language Programming

Page 2: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

2

Introduction to Assembler

• From source code to executable

. We will use the Tanenbaum Assembler from the textbook

Page 3: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

3

Essential tools

Page 4: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

4

File formats

Page 5: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

5

The tracer (t88)

Page 6: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

6

The tracer (t88)

Page 7: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

7

Tracer (t88) Commands

Page 8: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

8

For more guideline

● All the previous information can be found in the textbook

● Refer to Appendix “C.5 Assembler” for more information

Page 9: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

9

Install your telnet Client and Log in

▪ Download and install putty from

http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.ht

ml

▪ Use the following information to login to the server:

address: 141.217.24.182

port: 8001

username: <your-NetID>

password: <your-NetID>

▪ After you log in, immediately use “passwd” command to

change your password.

Page 10: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

10

Assemble and Run

▪ There are several sample assembly files in the example

directory

$ cd 8088

$ cd examples

$ ls

▪ Assemble helloworld (the .s suffix should be omitted):

$ as88 HlloWrld

This will generate a few new files, in which HlloWrld.88 is the

executable

▪ Run the assembled code with s88 (also omitting its suffix)

$ s88 HlloWrld

Page 11: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

11

Step-by-step Run

$ t88 HlloWrld

The CPU registers and the source code will be shown in a

window. An arrow will point to the next instruction to be

executed.

Hit “Enter” key to execute the pointed instruction. You can

continue the steps until the execution is complete. To terminate

the execution at any time, type “q” and hit “Enter”.

Page 12: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

12

Edit

To edit a source code:

$ nano HlloWrld.s

Use “Ctrl + X” to exit editing. Other commands are listed at the

bottom of the screen. Note that “^X” means “Ctrl + X”.

You may also install WinSCP

(https://winscp.net/eng/download.php) and login to the server,

so you can edit programs locally and then upload/download

to/from the server.

Page 13: Computer Organization & Assembly Language Programmingranger.uta.edu/~sjiang/CSE2312-fall-17/CSE2312_lab-Tutorial.pdf · Assembler Installation and Usage Computer Organization & Assembly

13

Organize your Directories

To make your code and files well organized, please create a few directories

at your home directory:

$ cd

$ mkdir Practice

$ mkdir Lab1

$ mkdir Lab2

$ ls

8088 Lab1 Lab2 Practice

Now you have separate directories for different lab projects and one for you

to practice your coding and debugging skills

$ cp 8088/examples/HlloWrld.s Practice/

$ cd Practice

$ as88 HlloWrld

$ s88 HlloWrld