Assembly |
Computer Organization and Assembly Languages, Fall 2007
|
Jump to...
assignment #1
|
Assignment #2: TOY assemblyAssigned: 10/22/2007Due: 11/08/2007 11:59pm DescriptionIn this project, you will have a chance to practice TOY assembly programming by writing a program to count number of 0-bit in an array and display the count in BCD format. Note that you can only submit TOY assembly code but not TOY machine code. We provide an assembler and a linker for the TOY machine. You can download either Windows version or Linux version. TOY simulator can be downloaded from here (a local copy). This file also contain a README file and several examples. The below is a summary for toyasm and toylink.* Comments begin with semicolons. * Only support decimal literals or hexadecimal literals. Hexadecimal literals must begin with 0x * Two assembly directives for data declararion DUP for declaring array DW for defining a number Examples: A DUP 5 ; define an array of five words B DW 10 ; declare a variable B, initialized with 10 * Labels must start with a letter. It can contain letters and numbers. No colons after labels. * It is case-insensitive. * Program will start from the first instruction that the assembler meets * Instructions 0 hlt 1 add RD, RS, ST 2 sub RD, RS, ST 3 and RD, RS, ST 4 xor RD, RS, ST 5 shl RD, RS, ST 6 shr RD, RS, ST 7 lda RD, addr 8 ld RD, addr 9 st RD, addr A ldi RD, RT B sti RD, RT C bz RD, addr D bp RD, addr E jr RD F jl RD, addr * To use assembler toyasm < reverse.asm > reverse.toy * To generate an object file toyasm -o < mul.asm > mul.obj * To link several object files together to make an executable file toylink multest.obj mul.obj stack.obj > multest.toy Program will start from the first instruction of the first object file. SpecificationThe program is divided into three parts.
SubmissionSubmission system is online here. |
|||||||