SlideShare a Scribd company logo
1 of 12
Download to read offline
Need help with questions 2-4. Write assembly code to find absolute values of a data word (2 byte
word) stored at address $0200 and write the absolute value at $0300. Two 16-bit signed values
are stored at $0A00 (they each take 2 bytes). Please write assembly code to sort them in
descending order (so that $0A02 has the smallest, and $0A00 has the largest). Could you sort the
same way for 50 such words? Write a piece of Assembly code to (a) allocate a string named
message to contain good day! (all the underlined characters) at location $0F00; (b) How many
bytes would it need?; (c) The rest of the code you write should compare the contents in register
A with each character in this message. If a match is found, put the NULL character in register A,
and get register B to contain the character G (ascii value). Write HCS12 assembly code to do the
following. Using ORG and DC.W directives declare and initialize a data array of 8 words (1
word = 1 integer in I ICS 12 - 2 bytes) starting at address S0200. Their initial values are to be
A367, F238,0012, 1972, 1132, AB88, 7399, and 1864. You can name the array EightInts (see
class notes or text examples). Now start your program code at $4000 (ORG directive).
Configure the direction of port A, port B, and port H to be inputs (i.e. set data directional
registers). We are going to consider port A as the high byte, and port B as low byte of data words
we want to read and compare against eighties using a loop. The idea is to see whether port A and
port B values taken as a 2 byte integer is equal to any of the values in eightins. Before starting to
compare values, the program waits until port H is all 1's then it reads port A, and port B before
comparing against eighties. if a match is found, your program branches to label found and stay at
that instruction. If no match, the program should branch to no luck label and stay there.
Solution
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.util.*;
//Primary class for the game
public class Asteroids extends Applet implements Runnable, KeyListener{
/**
*
*/
private static final long serialVersionUID = 1L;
//the main thread becomes the game loop
Thread gameloop;
//use this as a double buffer
BufferedImage backbuffer;
//the main drawing object for the back buffer
Graphics2D g2d;
//toggle for drawing bounding boxes
boolean showBounds = false;
//create the asteroid array
int ASTEROIDS = 20;
Asteroid[] ast = new Asteroid[ASTEROIDS];
//create the bullet array
int BULLETS = 10;
Bullet[] bullet = new Bullet[BULLETS];
int currentBullet = 0;
//the player's ship
Ship ship = new Ship();
//create the identity transform (0.0)
AffineTransform identity = new AffineTransform();
//create a random number generator
Random rand = new Random();
//applet init event
public void init(){
//create the back buffer for smooth graphics
backbuffer = new BufferedImage(640, 480,BufferedImage.TYPE_INT_RGB);
g2d = backbuffer.createGraphics();
//set up the ship
ship.setX(320);
ship.setY(240);
//set up the bullets
for (int n = 0; n < BULLETS; n++) {
bullet[n] = new Bullet();
}
//Create the asteroids
for (int n = 0; n < ASTEROIDS; n++) {
ast[n] = new Asteroid();
ast[n].setRotationVelocity(rand.nextInt(3)+1);
ast[n].setX((double)rand.nextInt(600)+20);
ast[n].setY((double)rand.nextInt(440)+20);
ast[n].setMoveAngle(rand.nextInt(360));
double ang = ast[n].getMoveAngle() - 90;
ast[n].setVelX(calcAngleMoveX(ang));
ast[n].setVelY(calcAngleMoveY(ang));
}
//start the user input listener
addKeyListener(this);
}
// applet update event to redraw the screen
public void udpate(Graphics g) {
//start off the transforms at identity
g2d.setTransform(identity);
//erase the background
g2d.setPaint(Color.BLACK);
g2d.fillRect(0, 0, getSize().width, getSize().height);
//print some status information
g2d.setColor(Color.WHITE);
g2d.drawString("Ship: "+ Math.round(ship.getX()) + "," + Math.round(ship.getY()), 5 ,
10);
g2d.drawString("Move angle: " + Math.round(ship.getMoveAngle()) + 90, 5, 25);
g2d.drawString("Face angle: " + Math.round(ship.getFaceAngle()),5 , 40);
//draw the game graphics
drawShip();
drawBullets();
drawAsteroids();
//repaint the applet window
paint(g);
}
//drawShip called by applet udpate event
public void drawShip() {
g2d.setTransform(identity);
g2d.translate(ship.getX(), ship.getY());
g2d.rotate(Math.toRadians(ship.getFaceAngle()));
g2d.setColor(Color.ORANGE);
g2d.fill(ship.getShape());
}
//drawbullets called by applet udpate event
public void drawBullets() {
//iterate through the array of bullets
for (int n = 0; n < BULLETS; n++){
//is this bullet currently in use?
if (bullet[n].isAlive()) {
//draw bullet
g2d.setTransform(identity);
g2d.translate(bullet[n].getX(), bullet[n].getY());
g2d.setColor(Color.MAGENTA);
g2d.draw(bullet[n].getShape());
}
}
}
//drawAsteroids called by applet update event
public void drawAsteroids() {
for (int n = 0; n < ASTEROIDS; n++) {
//is this asteroid being used?
if (ast[n].isAlive()){
//draw asteroid
g2d.setTransform(identity);
g2d.translate(ast[n].getX(), ast[n].getY());
g2d.rotate(Math.toRadians(ast[n].getMoveAngle()));
g2d.setColor(Color.DARK_GRAY);
g2d.fill(ast[n].getShape());
}
}
}
//applet window repaint event draw the back buffer
public void paint(Graphics g) {
//draw the back buffer onto the applet window
g.drawImage(backbuffer, 0, 0, this );
}
// thread start event - start the game loop running
public void start() {
//create the gameloop thread for real - time updates
gameloop = new Thread(this);
gameloop.start();
}
// thread run event (game loop)
public void run() {
//acquire the current thread
Thread t = Thread.currentThread();
//keep going as long as the thread is alive
while (t == gameloop) {
try {
//update gameloop
gameUpdate();
//target framerate is 50fps
Thread.sleep(20);
}
catch(InterruptedException e) {
e.printStackTrace();
}
repaint();
}
}
//thread stop event
public void stop() {
//kill the gameloop thread
gameloop = null;
}
//move and animate the objects in the game
private void gameUpdate() {
updateShip();
updateBullets();
updateAsteroids();
checkCollisions();
}
//update the ship position based on velocity
public void updateShip() {
//update ships X position
ship.incX(ship.getVelX());
//warp around left/right
if (ship.getX() < -10)
ship.setX(getSize().width + 10);
else if (ship.getX() > getSize().width + 10)
ship.setX(-10);
//update ships Y position
ship.incY(ship.getVelY());
//wrap around top/bottom
if (ship.getY() < -10)
ship.setY(getSize().height + 10);
else if (ship.getY() > getSize().height + 10)
ship.setY(-10);
}
// update the bullets based on velocity
public void updateBullets() {
//move each of the bullets
for (int n = 0; n < BULLETS; n++) {
//is this bullet being used?
if (bullet[n].isAlive()) {
//update bullets x position
bullet[n].incX(bullet[n].getVelX());
//bullet disappears at left/right edge
if (bullet[n].getX() < 0 || bullet[n].getX() > getSize().width) {
bullet[n].setAlive(false);
}
//update bullets y position
bullet[n].incY(bullet[n].getVelY());
//bullet disappears at top/bottom edge
if (bullet[n].getY() < 0 || bullet[n].getY() > getSize().height) {
bullet[n].setAlive(false);
}
}
}
}
//update the asteroids based on velocity
public void updateAsteroids() {
//move and rotate the asteroids
for (int n = 0; n < ASTEROIDS; n++) {
//is this asteroid being used?
if (ast[n].isAlive()) {
//update asteroid X value
ast[n].incX(ast[n].getVelX());
//warp the asteroid at the screen edges
if (ast[n].getX() < -20)
ast[n].setX(getSize().width + 20);
else if (ast[n].getX() > getSize().width +20)
ast[n].setX(-20);
//update the asteroid Y value
ast[n].incY(ast[n].getVelY());
//warp around bottom and top of screen
if (ast[n].getY() < -20)
ast[n].setY(getSize().height + 20);
else if (ast[n].getY() > getSize().height +20)
ast[n].setY(-20);
//update the asteroids rotation
ast[n].incMoveAngle(ast[n].getRotationVelocity());
//keep the angle within 0-359 degrees
if (ast[n].getMoveAngle() < 0)
ast[n].setMoveAngle(360 - ast[n].getRotationVelocity());
else if (ast[n].getMoveAngle() > 360)
ast[n].setMoveAngle(ast[n].getRotationVelocity());
}
}
}
//test asteroids for collisions with ship or bullets
public void checkCollisions() {
//iterate through the asteroids array
for (int m = 0; m < ASTEROIDS; m++) {
// is this asteroid being used?
if (ast[m].isAlive()) {
//check for collision with bullet
for (int n = 0; n < BULLETS; n++) {
//is this bullet being used?
if (bullet[n].isAlive()) {
//perform the collision test
if (ast[m].getBounds().contains(bullet[n].getX(), bullet[n].getY())) {
bullet[n].setAlive(false);
ast[m].setAlive(false);
continue;
}
}
}
//check for collision with ship
if(ast[m].getBounds().intersects(ship.getBounds())) {
ast[m].setAlive(false);
ship.setX(320);
ship.setY(240);
ship.setFaceAngle(0);
ship.setVelX(0);
ship.setVelY(0);
continue;
}
}
}
}
//key listener events
public void keyReleased(KeyEvent k) {}
public void keyTyped(KeyEvent k) {}
public void keyPressed(KeyEvent k) {
int keyCode = k.getKeyCode();
switch (keyCode) {
case KeyEvent.VK_LEFT:
//left arrow rotates ship left 5 degrees
ship.incFaceAngle(-5);
if(ship.getFaceAngle() < 0) ship.setFaceAngle(360-5);
break;
case KeyEvent.VK_RIGHT:
//right arrow rotates ship right 5 degrees
ship.incFaceAngle(5);
if(ship.getFaceAngle() > 360) ship.setFaceAngle(5);
break;
case KeyEvent.VK_UP:
//up arrow thrust to ship (1/10 normal speed)
ship.setMoveAngle(ship.getFaceAngle() - 90);
ship.incVelX(calcAngleMoveX(ship.getMoveAngle()) * 0.1);
ship.incVelY(calcAngleMoveY(ship.getMoveAngle()) * 0.1);
break;
//CTRL ENTER OR SPACE used to fire weapon
case KeyEvent.VK_CONTROL:
case KeyEvent.VK_ENTER:
case KeyEvent.VK_SPACE:
//fire a bullet
currentBullet++;
if(currentBullet > BULLETS - 1) currentBullet = 0;
bullet[currentBullet].setAlive(true);
//point bullet in same direction as ship is facing
bullet[currentBullet].setX(ship.getX());
bullet[currentBullet].setY(ship.getY());
bullet[currentBullet].setMoveAngle(ship.getFaceAngle() - 90);
//fire bullet at angle of ship
double angle = bullet[currentBullet].getMoveAngle();
double svx = ship.getVelX();
double svy = ship.getVelY();
bullet[currentBullet].setVelX(svx + calcAngleMoveX(angle) * 2);
bullet[currentBullet].setVelY(svy + calcAngleMoveY(angle) * 2);
break;
}
}
//calculate X movement value based on direction angle
public double calcAngleMoveX(double angle) {
return (double) (Math.cos(angle * Math.PI / 180));
}
// calculate Y movement value based on direction angle
public double calcAngleMoveY (double angle) {
return (double) (Math.sin(angle * Math.PI / 180));
}
}

More Related Content

Similar to Need help with questions 2-4. Write assembly code to find absolute v.pdf

Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Codemotion
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
Adventures In Data Compilation
Adventures In Data CompilationAdventures In Data Compilation
Adventures In Data CompilationNaughty Dog
 
Im having trouble figuring out how to code these sections for an a.pdf
Im having trouble figuring out how to code these sections for an a.pdfIm having trouble figuring out how to code these sections for an a.pdf
Im having trouble figuring out how to code these sections for an a.pdfrishteygallery
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Sean May
 
Create a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfCreate a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfarihantmobileselepun
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchainedEduard Tomàs
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfarjuncorner565
 
Hive Functions Cheat Sheet
Hive Functions Cheat SheetHive Functions Cheat Sheet
Hive Functions Cheat SheetHortonworks
 
GDSC Flutter Forward Workshop.pptx
GDSC Flutter Forward Workshop.pptxGDSC Flutter Forward Workshop.pptx
GDSC Flutter Forward Workshop.pptxGDSCVJTI
 
Grokking Monads in Scala
Grokking Monads in ScalaGrokking Monads in Scala
Grokking Monads in ScalaTim Dalton
 
Please finish the codes in Graph.h class.#################### Vert.pdf
Please finish the codes in Graph.h class.#################### Vert.pdfPlease finish the codes in Graph.h class.#################### Vert.pdf
Please finish the codes in Graph.h class.#################### Vert.pdfpetercoiffeur18
 

Similar to Need help with questions 2-4. Write assembly code to find absolute v.pdf (20)

Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
Rust
RustRust
Rust
 
Adventures In Data Compilation
Adventures In Data CompilationAdventures In Data Compilation
Adventures In Data Compilation
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015
 
OpenGL L06-Performance
OpenGL L06-PerformanceOpenGL L06-Performance
OpenGL L06-Performance
 
Revision1schema C programming
Revision1schema C programmingRevision1schema C programming
Revision1schema C programming
 
Im having trouble figuring out how to code these sections for an a.pdf
Im having trouble figuring out how to code these sections for an a.pdfIm having trouble figuring out how to code these sections for an a.pdf
Im having trouble figuring out how to code these sections for an a.pdf
 
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)Super TypeScript II Turbo - FP Remix (NG Conf 2017)
Super TypeScript II Turbo - FP Remix (NG Conf 2017)
 
Create a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfCreate a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdf
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
 
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdfModify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
Modify HuffmanTree.java and HuffmanNode.java to allow the user to se.pdf
 
Hive Functions Cheat Sheet
Hive Functions Cheat SheetHive Functions Cheat Sheet
Hive Functions Cheat Sheet
 
J slider
J sliderJ slider
J slider
 
Game dev 101 part 3
Game dev 101 part 3Game dev 101 part 3
Game dev 101 part 3
 
Struct examples
Struct examplesStruct examples
Struct examples
 
GDSC Flutter Forward Workshop.pptx
GDSC Flutter Forward Workshop.pptxGDSC Flutter Forward Workshop.pptx
GDSC Flutter Forward Workshop.pptx
 
Grokking Monads in Scala
Grokking Monads in ScalaGrokking Monads in Scala
Grokking Monads in Scala
 
Please finish the codes in Graph.h class.#################### Vert.pdf
Please finish the codes in Graph.h class.#################### Vert.pdfPlease finish the codes in Graph.h class.#################### Vert.pdf
Please finish the codes in Graph.h class.#################### Vert.pdf
 

More from feelinggifts

Chapter 22. Problem 3BCP0 Bookmark Show all steps ON Problem Eminent.pdf
Chapter 22. Problem 3BCP0 Bookmark Show all steps ON Problem Eminent.pdfChapter 22. Problem 3BCP0 Bookmark Show all steps ON Problem Eminent.pdf
Chapter 22. Problem 3BCP0 Bookmark Show all steps ON Problem Eminent.pdffeelinggifts
 
D Question 11 1 pts A fundamental feature of money that BitCoin fulfi.pdf
D Question 11 1 pts A fundamental feature of money that BitCoin fulfi.pdfD Question 11 1 pts A fundamental feature of money that BitCoin fulfi.pdf
D Question 11 1 pts A fundamental feature of money that BitCoin fulfi.pdffeelinggifts
 
connect instructions I helg dule 7 Connect seve & Exit ..pdf
connect instructions I helg dule 7 Connect seve & Exit ..pdfconnect instructions I helg dule 7 Connect seve & Exit ..pdf
connect instructions I helg dule 7 Connect seve & Exit ..pdffeelinggifts
 
COMPUTER ETHICSDiscuss the local and global impact of malware and .pdf
COMPUTER ETHICSDiscuss the local and global impact of malware and .pdfCOMPUTER ETHICSDiscuss the local and global impact of malware and .pdf
COMPUTER ETHICSDiscuss the local and global impact of malware and .pdffeelinggifts
 
You’re helping a group of ethnographers analyze some oral history da.pdf
You’re helping a group of ethnographers analyze some oral history da.pdfYou’re helping a group of ethnographers analyze some oral history da.pdf
You’re helping a group of ethnographers analyze some oral history da.pdffeelinggifts
 
A man with type B blood type claims to be biological father of a typ.pdf
A man with type B blood type claims to be biological father of a typ.pdfA man with type B blood type claims to be biological father of a typ.pdf
A man with type B blood type claims to be biological father of a typ.pdffeelinggifts
 
why should filtrate be used to transfer the residue when the desired.pdf
why should filtrate be used to transfer the residue when the desired.pdfwhy should filtrate be used to transfer the residue when the desired.pdf
why should filtrate be used to transfer the residue when the desired.pdffeelinggifts
 
Winch of the following is NOT one of the reasons an IO Exception is t.pdf
Winch of the following is NOT one of the reasons an IO Exception is t.pdfWinch of the following is NOT one of the reasons an IO Exception is t.pdf
Winch of the following is NOT one of the reasons an IO Exception is t.pdffeelinggifts
 
Why is attending to the full scope of drivers critical in implementi.pdf
Why is attending to the full scope of drivers critical in implementi.pdfWhy is attending to the full scope of drivers critical in implementi.pdf
Why is attending to the full scope of drivers critical in implementi.pdffeelinggifts
 
Which of the following is not a function of interest groups A. to i.pdf
Which of the following is not a function of interest groups A. to i.pdfWhich of the following is not a function of interest groups A. to i.pdf
Which of the following is not a function of interest groups A. to i.pdffeelinggifts
 
When explaining civil law one would say that it is concemed with disp.pdf
When explaining civil law one would say that it is concemed with disp.pdfWhen explaining civil law one would say that it is concemed with disp.pdf
When explaining civil law one would say that it is concemed with disp.pdffeelinggifts
 
What is the difference between a short and long branchSolution.pdf
What is the difference between a short and long branchSolution.pdfWhat is the difference between a short and long branchSolution.pdf
What is the difference between a short and long branchSolution.pdffeelinggifts
 
What is the maximum file size in a FAT32 systemSolutionFirst .pdf
What is the maximum file size in a FAT32 systemSolutionFirst .pdfWhat is the maximum file size in a FAT32 systemSolutionFirst .pdf
What is the maximum file size in a FAT32 systemSolutionFirst .pdffeelinggifts
 
View transaction list Journal entry worksheet The company paid $510 c.pdf
View transaction list Journal entry worksheet The company paid $510 c.pdfView transaction list Journal entry worksheet The company paid $510 c.pdf
View transaction list Journal entry worksheet The company paid $510 c.pdffeelinggifts
 
The numeric data types in C++ can be broken into two general categori.pdf
The numeric data types in C++ can be broken into two general categori.pdfThe numeric data types in C++ can be broken into two general categori.pdf
The numeric data types in C++ can be broken into two general categori.pdffeelinggifts
 
The capillaries at the alveoli Form a respiratory membrane Are spe.pdf
The capillaries at the alveoli  Form a respiratory membrane  Are spe.pdfThe capillaries at the alveoli  Form a respiratory membrane  Are spe.pdf
The capillaries at the alveoli Form a respiratory membrane Are spe.pdffeelinggifts
 
Select the word or phrase which best matches the description of it..pdf
Select the word or phrase which best matches the description of it..pdfSelect the word or phrase which best matches the description of it..pdf
Select the word or phrase which best matches the description of it..pdffeelinggifts
 
Robin Hood has hired you as his new Strategic Consultant to help him.pdf
Robin Hood has hired you as his new Strategic Consultant to help him.pdfRobin Hood has hired you as his new Strategic Consultant to help him.pdf
Robin Hood has hired you as his new Strategic Consultant to help him.pdffeelinggifts
 
Research indicates that online news seekers tend to access topics of.pdf
Research indicates that online news seekers tend to access topics of.pdfResearch indicates that online news seekers tend to access topics of.pdf
Research indicates that online news seekers tend to access topics of.pdffeelinggifts
 
Read Case Study Room 406 and answer the following questions in 2.pdf
Read Case Study Room 406 and answer the following questions in 2.pdfRead Case Study Room 406 and answer the following questions in 2.pdf
Read Case Study Room 406 and answer the following questions in 2.pdffeelinggifts
 

More from feelinggifts (20)

Chapter 22. Problem 3BCP0 Bookmark Show all steps ON Problem Eminent.pdf
Chapter 22. Problem 3BCP0 Bookmark Show all steps ON Problem Eminent.pdfChapter 22. Problem 3BCP0 Bookmark Show all steps ON Problem Eminent.pdf
Chapter 22. Problem 3BCP0 Bookmark Show all steps ON Problem Eminent.pdf
 
D Question 11 1 pts A fundamental feature of money that BitCoin fulfi.pdf
D Question 11 1 pts A fundamental feature of money that BitCoin fulfi.pdfD Question 11 1 pts A fundamental feature of money that BitCoin fulfi.pdf
D Question 11 1 pts A fundamental feature of money that BitCoin fulfi.pdf
 
connect instructions I helg dule 7 Connect seve & Exit ..pdf
connect instructions I helg dule 7 Connect seve & Exit ..pdfconnect instructions I helg dule 7 Connect seve & Exit ..pdf
connect instructions I helg dule 7 Connect seve & Exit ..pdf
 
COMPUTER ETHICSDiscuss the local and global impact of malware and .pdf
COMPUTER ETHICSDiscuss the local and global impact of malware and .pdfCOMPUTER ETHICSDiscuss the local and global impact of malware and .pdf
COMPUTER ETHICSDiscuss the local and global impact of malware and .pdf
 
You’re helping a group of ethnographers analyze some oral history da.pdf
You’re helping a group of ethnographers analyze some oral history da.pdfYou’re helping a group of ethnographers analyze some oral history da.pdf
You’re helping a group of ethnographers analyze some oral history da.pdf
 
A man with type B blood type claims to be biological father of a typ.pdf
A man with type B blood type claims to be biological father of a typ.pdfA man with type B blood type claims to be biological father of a typ.pdf
A man with type B blood type claims to be biological father of a typ.pdf
 
why should filtrate be used to transfer the residue when the desired.pdf
why should filtrate be used to transfer the residue when the desired.pdfwhy should filtrate be used to transfer the residue when the desired.pdf
why should filtrate be used to transfer the residue when the desired.pdf
 
Winch of the following is NOT one of the reasons an IO Exception is t.pdf
Winch of the following is NOT one of the reasons an IO Exception is t.pdfWinch of the following is NOT one of the reasons an IO Exception is t.pdf
Winch of the following is NOT one of the reasons an IO Exception is t.pdf
 
Why is attending to the full scope of drivers critical in implementi.pdf
Why is attending to the full scope of drivers critical in implementi.pdfWhy is attending to the full scope of drivers critical in implementi.pdf
Why is attending to the full scope of drivers critical in implementi.pdf
 
Which of the following is not a function of interest groups A. to i.pdf
Which of the following is not a function of interest groups A. to i.pdfWhich of the following is not a function of interest groups A. to i.pdf
Which of the following is not a function of interest groups A. to i.pdf
 
When explaining civil law one would say that it is concemed with disp.pdf
When explaining civil law one would say that it is concemed with disp.pdfWhen explaining civil law one would say that it is concemed with disp.pdf
When explaining civil law one would say that it is concemed with disp.pdf
 
What is the difference between a short and long branchSolution.pdf
What is the difference between a short and long branchSolution.pdfWhat is the difference between a short and long branchSolution.pdf
What is the difference between a short and long branchSolution.pdf
 
What is the maximum file size in a FAT32 systemSolutionFirst .pdf
What is the maximum file size in a FAT32 systemSolutionFirst .pdfWhat is the maximum file size in a FAT32 systemSolutionFirst .pdf
What is the maximum file size in a FAT32 systemSolutionFirst .pdf
 
View transaction list Journal entry worksheet The company paid $510 c.pdf
View transaction list Journal entry worksheet The company paid $510 c.pdfView transaction list Journal entry worksheet The company paid $510 c.pdf
View transaction list Journal entry worksheet The company paid $510 c.pdf
 
The numeric data types in C++ can be broken into two general categori.pdf
The numeric data types in C++ can be broken into two general categori.pdfThe numeric data types in C++ can be broken into two general categori.pdf
The numeric data types in C++ can be broken into two general categori.pdf
 
The capillaries at the alveoli Form a respiratory membrane Are spe.pdf
The capillaries at the alveoli  Form a respiratory membrane  Are spe.pdfThe capillaries at the alveoli  Form a respiratory membrane  Are spe.pdf
The capillaries at the alveoli Form a respiratory membrane Are spe.pdf
 
Select the word or phrase which best matches the description of it..pdf
Select the word or phrase which best matches the description of it..pdfSelect the word or phrase which best matches the description of it..pdf
Select the word or phrase which best matches the description of it..pdf
 
Robin Hood has hired you as his new Strategic Consultant to help him.pdf
Robin Hood has hired you as his new Strategic Consultant to help him.pdfRobin Hood has hired you as his new Strategic Consultant to help him.pdf
Robin Hood has hired you as his new Strategic Consultant to help him.pdf
 
Research indicates that online news seekers tend to access topics of.pdf
Research indicates that online news seekers tend to access topics of.pdfResearch indicates that online news seekers tend to access topics of.pdf
Research indicates that online news seekers tend to access topics of.pdf
 
Read Case Study Room 406 and answer the following questions in 2.pdf
Read Case Study Room 406 and answer the following questions in 2.pdfRead Case Study Room 406 and answer the following questions in 2.pdf
Read Case Study Room 406 and answer the following questions in 2.pdf
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

Need help with questions 2-4. Write assembly code to find absolute v.pdf

  • 1. Need help with questions 2-4. Write assembly code to find absolute values of a data word (2 byte word) stored at address $0200 and write the absolute value at $0300. Two 16-bit signed values are stored at $0A00 (they each take 2 bytes). Please write assembly code to sort them in descending order (so that $0A02 has the smallest, and $0A00 has the largest). Could you sort the same way for 50 such words? Write a piece of Assembly code to (a) allocate a string named message to contain good day! (all the underlined characters) at location $0F00; (b) How many bytes would it need?; (c) The rest of the code you write should compare the contents in register A with each character in this message. If a match is found, put the NULL character in register A, and get register B to contain the character G (ascii value). Write HCS12 assembly code to do the following. Using ORG and DC.W directives declare and initialize a data array of 8 words (1 word = 1 integer in I ICS 12 - 2 bytes) starting at address S0200. Their initial values are to be A367, F238,0012, 1972, 1132, AB88, 7399, and 1864. You can name the array EightInts (see class notes or text examples). Now start your program code at $4000 (ORG directive). Configure the direction of port A, port B, and port H to be inputs (i.e. set data directional registers). We are going to consider port A as the high byte, and port B as low byte of data words we want to read and compare against eighties using a loop. The idea is to see whether port A and port B values taken as a 2 byte integer is equal to any of the values in eightins. Before starting to compare values, the program waits until port H is all 1's then it reads port A, and port B before comparing against eighties. if a match is found, your program branches to label found and stay at that instruction. If no match, the program should branch to no luck label and stay there. Solution import java.applet.*; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.awt.image.*; import java.util.*; //Primary class for the game public class Asteroids extends Applet implements Runnable, KeyListener{ /** * */ private static final long serialVersionUID = 1L;
  • 2. //the main thread becomes the game loop Thread gameloop; //use this as a double buffer BufferedImage backbuffer; //the main drawing object for the back buffer Graphics2D g2d; //toggle for drawing bounding boxes boolean showBounds = false; //create the asteroid array int ASTEROIDS = 20; Asteroid[] ast = new Asteroid[ASTEROIDS]; //create the bullet array int BULLETS = 10; Bullet[] bullet = new Bullet[BULLETS]; int currentBullet = 0; //the player's ship Ship ship = new Ship(); //create the identity transform (0.0) AffineTransform identity = new AffineTransform(); //create a random number generator Random rand = new Random(); //applet init event public void init(){ //create the back buffer for smooth graphics backbuffer = new BufferedImage(640, 480,BufferedImage.TYPE_INT_RGB); g2d = backbuffer.createGraphics();
  • 3. //set up the ship ship.setX(320); ship.setY(240); //set up the bullets for (int n = 0; n < BULLETS; n++) { bullet[n] = new Bullet(); } //Create the asteroids for (int n = 0; n < ASTEROIDS; n++) { ast[n] = new Asteroid(); ast[n].setRotationVelocity(rand.nextInt(3)+1); ast[n].setX((double)rand.nextInt(600)+20); ast[n].setY((double)rand.nextInt(440)+20); ast[n].setMoveAngle(rand.nextInt(360)); double ang = ast[n].getMoveAngle() - 90; ast[n].setVelX(calcAngleMoveX(ang)); ast[n].setVelY(calcAngleMoveY(ang)); } //start the user input listener addKeyListener(this); } // applet update event to redraw the screen public void udpate(Graphics g) { //start off the transforms at identity g2d.setTransform(identity); //erase the background g2d.setPaint(Color.BLACK); g2d.fillRect(0, 0, getSize().width, getSize().height); //print some status information
  • 4. g2d.setColor(Color.WHITE); g2d.drawString("Ship: "+ Math.round(ship.getX()) + "," + Math.round(ship.getY()), 5 , 10); g2d.drawString("Move angle: " + Math.round(ship.getMoveAngle()) + 90, 5, 25); g2d.drawString("Face angle: " + Math.round(ship.getFaceAngle()),5 , 40); //draw the game graphics drawShip(); drawBullets(); drawAsteroids(); //repaint the applet window paint(g); } //drawShip called by applet udpate event public void drawShip() { g2d.setTransform(identity); g2d.translate(ship.getX(), ship.getY()); g2d.rotate(Math.toRadians(ship.getFaceAngle())); g2d.setColor(Color.ORANGE); g2d.fill(ship.getShape()); } //drawbullets called by applet udpate event public void drawBullets() { //iterate through the array of bullets for (int n = 0; n < BULLETS; n++){ //is this bullet currently in use? if (bullet[n].isAlive()) { //draw bullet g2d.setTransform(identity); g2d.translate(bullet[n].getX(), bullet[n].getY()); g2d.setColor(Color.MAGENTA); g2d.draw(bullet[n].getShape());
  • 5. } } } //drawAsteroids called by applet update event public void drawAsteroids() { for (int n = 0; n < ASTEROIDS; n++) { //is this asteroid being used? if (ast[n].isAlive()){ //draw asteroid g2d.setTransform(identity); g2d.translate(ast[n].getX(), ast[n].getY()); g2d.rotate(Math.toRadians(ast[n].getMoveAngle())); g2d.setColor(Color.DARK_GRAY); g2d.fill(ast[n].getShape()); } } } //applet window repaint event draw the back buffer public void paint(Graphics g) { //draw the back buffer onto the applet window g.drawImage(backbuffer, 0, 0, this ); } // thread start event - start the game loop running public void start() { //create the gameloop thread for real - time updates gameloop = new Thread(this); gameloop.start(); } // thread run event (game loop)
  • 6. public void run() { //acquire the current thread Thread t = Thread.currentThread(); //keep going as long as the thread is alive while (t == gameloop) { try { //update gameloop gameUpdate(); //target framerate is 50fps Thread.sleep(20); } catch(InterruptedException e) { e.printStackTrace(); } repaint(); } } //thread stop event public void stop() { //kill the gameloop thread gameloop = null; } //move and animate the objects in the game private void gameUpdate() { updateShip(); updateBullets(); updateAsteroids(); checkCollisions(); }
  • 7. //update the ship position based on velocity public void updateShip() { //update ships X position ship.incX(ship.getVelX()); //warp around left/right if (ship.getX() < -10) ship.setX(getSize().width + 10); else if (ship.getX() > getSize().width + 10) ship.setX(-10); //update ships Y position ship.incY(ship.getVelY()); //wrap around top/bottom if (ship.getY() < -10) ship.setY(getSize().height + 10); else if (ship.getY() > getSize().height + 10) ship.setY(-10); } // update the bullets based on velocity public void updateBullets() { //move each of the bullets for (int n = 0; n < BULLETS; n++) { //is this bullet being used? if (bullet[n].isAlive()) { //update bullets x position bullet[n].incX(bullet[n].getVelX()); //bullet disappears at left/right edge if (bullet[n].getX() < 0 || bullet[n].getX() > getSize().width) { bullet[n].setAlive(false);
  • 8. } //update bullets y position bullet[n].incY(bullet[n].getVelY()); //bullet disappears at top/bottom edge if (bullet[n].getY() < 0 || bullet[n].getY() > getSize().height) { bullet[n].setAlive(false); } } } } //update the asteroids based on velocity public void updateAsteroids() { //move and rotate the asteroids for (int n = 0; n < ASTEROIDS; n++) { //is this asteroid being used? if (ast[n].isAlive()) { //update asteroid X value ast[n].incX(ast[n].getVelX()); //warp the asteroid at the screen edges if (ast[n].getX() < -20) ast[n].setX(getSize().width + 20); else if (ast[n].getX() > getSize().width +20) ast[n].setX(-20); //update the asteroid Y value ast[n].incY(ast[n].getVelY()); //warp around bottom and top of screen
  • 9. if (ast[n].getY() < -20) ast[n].setY(getSize().height + 20); else if (ast[n].getY() > getSize().height +20) ast[n].setY(-20); //update the asteroids rotation ast[n].incMoveAngle(ast[n].getRotationVelocity()); //keep the angle within 0-359 degrees if (ast[n].getMoveAngle() < 0) ast[n].setMoveAngle(360 - ast[n].getRotationVelocity()); else if (ast[n].getMoveAngle() > 360) ast[n].setMoveAngle(ast[n].getRotationVelocity()); } } } //test asteroids for collisions with ship or bullets public void checkCollisions() { //iterate through the asteroids array for (int m = 0; m < ASTEROIDS; m++) { // is this asteroid being used? if (ast[m].isAlive()) { //check for collision with bullet for (int n = 0; n < BULLETS; n++) { //is this bullet being used? if (bullet[n].isAlive()) { //perform the collision test if (ast[m].getBounds().contains(bullet[n].getX(), bullet[n].getY())) { bullet[n].setAlive(false); ast[m].setAlive(false); continue; }
  • 10. } } //check for collision with ship if(ast[m].getBounds().intersects(ship.getBounds())) { ast[m].setAlive(false); ship.setX(320); ship.setY(240); ship.setFaceAngle(0); ship.setVelX(0); ship.setVelY(0); continue; } } } } //key listener events public void keyReleased(KeyEvent k) {} public void keyTyped(KeyEvent k) {} public void keyPressed(KeyEvent k) { int keyCode = k.getKeyCode(); switch (keyCode) { case KeyEvent.VK_LEFT: //left arrow rotates ship left 5 degrees ship.incFaceAngle(-5); if(ship.getFaceAngle() < 0) ship.setFaceAngle(360-5); break; case KeyEvent.VK_RIGHT: //right arrow rotates ship right 5 degrees ship.incFaceAngle(5); if(ship.getFaceAngle() > 360) ship.setFaceAngle(5); break; case KeyEvent.VK_UP: //up arrow thrust to ship (1/10 normal speed) ship.setMoveAngle(ship.getFaceAngle() - 90);
  • 11. ship.incVelX(calcAngleMoveX(ship.getMoveAngle()) * 0.1); ship.incVelY(calcAngleMoveY(ship.getMoveAngle()) * 0.1); break; //CTRL ENTER OR SPACE used to fire weapon case KeyEvent.VK_CONTROL: case KeyEvent.VK_ENTER: case KeyEvent.VK_SPACE: //fire a bullet currentBullet++; if(currentBullet > BULLETS - 1) currentBullet = 0; bullet[currentBullet].setAlive(true); //point bullet in same direction as ship is facing bullet[currentBullet].setX(ship.getX()); bullet[currentBullet].setY(ship.getY()); bullet[currentBullet].setMoveAngle(ship.getFaceAngle() - 90); //fire bullet at angle of ship double angle = bullet[currentBullet].getMoveAngle(); double svx = ship.getVelX(); double svy = ship.getVelY(); bullet[currentBullet].setVelX(svx + calcAngleMoveX(angle) * 2); bullet[currentBullet].setVelY(svy + calcAngleMoveY(angle) * 2); break; } } //calculate X movement value based on direction angle public double calcAngleMoveX(double angle) { return (double) (Math.cos(angle * Math.PI / 180)); } // calculate Y movement value based on direction angle public double calcAngleMoveY (double angle) { return (double) (Math.sin(angle * Math.PI / 180)); }
  • 12. }