Project 4 help

11 messages
Open this post in threaded view
|

Project 4 help

 I have programmed in assembly before so I understnad low level languages, but I dont understand what im supposed to do for Mult.asm, im just not sure what hte assignment is for that. And for Fill.asm im not sure: 1. how to check for input from the keyboard 2. how to change the entire screen, not just one pixel, to black from white 3. how to change it from black to white once input has stopped from the keyboard. I do know how to make an infinite loop, but doesnt that usually cause a compiler error?
Open this post in threaded view
|

Re: Project 4 help

 Mult.asm implements multiplication in software (Hack Assembly language). Given a number in one register, and another number in a second register, place their product in a third register. Review the book chapter for how to read the keyboard - it's one register in Memory. Which register? If you know how to change one pixel, do you know how to change, say, 16 pixels? #3) That's part of the challenge you'll have to think about some more. Write it in pseudocode first. Solve the problem, then write the solution as asm. An infinite loop is not a compilation error - sometimes we want an infinite loop in our program. When we don't want an infinite loop, but we end up with one in a program, it is, at most, a logic error.
Open this post in threaded view
|

Re: Project 4 help

 I want to make sure I understand this correctly. D represents the address of the register and m represents the value? so for changing the color of the screen, 1 pixel at a time would be (infinite loop) d=d+1 m=1 (end loop) correct?
Open this post in threaded view
|

Re: Project 4 help

 Administrator D is the Data register and A is the Address register. I've written an introduction to Hack programming that you might find helpful. Introduction to Hack Assembly Language--Mark
Open this post in threaded view
|

Re: Project 4 help

 Im afraid I still don't understand the hack assembly language. I don't understand how to do NON infinite loop for MULT. All I understand is that when you use the @ symbol, that is what A is set to. I also dont understand what D and M are used for, they look like they are used for the same things.
Open this post in threaded view
|

Re: Project 4 help

 dmoeller, how much time have you spent with the chapter in the book? The Hack CPU has two registers: A and D, plus access to a bunch of registers in Memory.
Open this post in threaded view
|

Re: Project 4 help

 My instructors lecture las night cleared alot of things up for me. I do wonder, after I change the color of 16 pixels at a time, how do I move to the next 16? say I store the address of the begining of the screen at R0. Would: @0 D=M+1 move me just one pixel, or all 16? If it moves just one, would: @16 D=A A=D+A work?
Open this post in threaded view
|

Re: Project 4 help

 Try it.
Open this post in threaded view
|

Re: Project 4 help

 I can run my program but the screen does not turn black when i push a key.