﻿ Case Studies代写 Assembly Language代写 - Assembly代写, 作业代写

Case Studies代写 Assembly Language代写

2020-08-11 14:54 星期二 所属： Assembly代写 浏览：21

Computer Architecture & Assembly Language Final Project – Case Studies

Case Studies代写 Basically, this program execute a snake xenzia game. The player can control the direction of snake by the keyboard

Snake game     Case Studies代写

Basically, this program execute a snake xenzia game. The player can control the direction of snake by the keyboard. Once the snake eat 10 applees, the speed would be increased.

The flowchart can seen as follow.

1. How the programmers use registers? Do they use sub-registers?    Case Studies代写

Registers used in the program:

• eax, esi, edx, ebx, ecx, edx
• ax, bx, al , dl, dh, ah

Classification of registers:

• EAX, AX, AH, AL: They are used as the accumulator registers. They are used for input and output. They also carry out arithmetic instructions.
• EBX, BX: They are used as the base registers. They are the basic pointer address to access memory.
• ECX: They are used as the Counter registers. They are used as the loop counter for shifting values.
• EDX, DH and DL: They are used as the Data registers. Used to store data and arithmetic instructions.
• ESI: It is used as memory array addressing and setting out values to the pointer memory address
Yes, they do use sub-register. Such as AH, AL, DH and DL.

For the EAX, EBX, ECX, and EDX registers, subsections may be used. For example, the least significant 2 bytes of EAX can be treated as a 16-bit register called AX. The least significant byte of AX can be used as a single 8-bit register called AL, while the most significant byte of AX can be used as a single 8-bit register called AH.

These names refer to the same physical register. When a two-byte quantity is placed into DX, the update affects the value of DH, DL, and EDX. These sub-registers are mainly hold-overs from older, 16-bit versions of the instruction set. However, they are sometimes convenient when dealing with data that are smaller than 32-bits.

1. Which addressing modes the programmers use?     Case Studies代写

Except the basic addressing, also use some advanced way. Such as register indirect, indexed, base-index and stack.

1. Do the programmers use procedures? How they implement parameter passing?

Yes, they use, show as follow

1)Main Procedure

2)Move

3) EatApple (obstacle)

5) Configure

6) CrashSnake

7) GameSpeed

1. Do the programmers use the stack?

Yes, they use stack.

1. Do the programmers use constants and macros?

No, they do not use.

1. Do the programmers use the FPU? How the programmers handle I/O?

No, they donot use. Use keyborad as input and screen as output.

1. Are there any procedures or instructions that you did learn in the class? Can you figure out what they do?

Quite a lot. Such as:

jne, Jump is not equal.

mov edx, 0A523h

cmp edx, 0A523h

jne    L5

1. Are there any graphics? How the programmers implement graphics?

Yes, use GUI console and implement function such as WriteString and WriteInt.

1. Do the programmers include enough documentation?

Yes. I think so.

Bugs:

• Speed function does not work properly as it works after 11th apple is eaten

The solution is to modify the program in GameSpeed, show as follow

cmp edx, 1 => cmp edx, 0

When {1st, 11th , 21th …} apple is eaten, the score would increment one more point.

The solution is to call the GameSpeed function later than GameScore. Also, delete the code below in GameSpeed function.

mov eax, score

mov score, eax

• When running snake to the obstacle it leaves the shadow of the previous snake movement

The solution is to use delete function to clear out the shadow of the previous movement.

Battleship     Case Studies代写

The game Battleship is a guessing game played by player and computer. The game is based on a 5×5 board of square grids. Each ship occupies a number of consecutive squares on the board, arranged either horizontally or vertically, but not overlapping each other.

In the game, the players take turns choosing a single square from the opponent’s board, and shooting at it. The player whose ships are being shot at then announces whether any ship was hit. If all the grids that a single ship occupies have been hit, that ship is sunk. If all of a player’s ships are sunk, that player loses.

The flowchart can seen as follow.
1. How the programmers use registers? Do they use sub-registers?

Registers used in the program:

• eax, esi, edx, ebx, ecx, edx

Classification of registers:

• EAX: They are used as the accumulator registers. They are used for input and output. They also carry out arithmetic instructions.
• EBX: They are used as the base registers. They are the basic pointer address to access memory.
• ECX: They are used as the Counter registers. They are used as the loop counter for shifting values.
• EDX: They are used as the Data registers. Used to store data and arithmetic instructions.

No, they do not use sub-register.

1. Which addressing modes the programmers use?

Except the basic addressing, also use some advanced way. Such as register indirect, indexed, base-index and stack.

1. Do the programmers use procedures? How they implement parameter passing?

Yes, they use, show as follow

• Main Procedure
• Intro

3)    fillboard

4)    display

5)    plc3ship

6)    plc2ship

7)    plc1ship

8)    cplc3ship

9)    cplc2ship

10)    cplc1ship

11)    plyrtrn

12)    comptrn

13)    chckbrd

1. Do the programmers use the stack?

Yes, they use stack.

1. Do the programmers use constants and macros?

Yes, they use.

They set max =25

1. Do the programmers use the FPU? How the programmers handle I/O?

No, they do not use. Use keyboard as input and screen as output.

1. Are there any procedures or instructions that you did learn in the class? Can you figure out what they do?

Quite a lot. Such as:

jne, Jump is not equal.

mov edx, 0A523h

cmp edx, 0A523h

jne    L5

1. Are there any graphics? How the programmers implement graphics?

Yes, use GUI console and implement function such as WriteString, WriteDec and WriteInt.

1. Do the programmers include enough documentation?

Yes. I think so.

Bugs:

Basically. The function is correct.

The suggestion is to increase the game difficulty. For example, once the computer hit one of my ship. He should guess the next one around the hitted ship rather than choose a random one.