Nand2Tetris Questions and Answers Forum
›
Architecture
›
Chapter 4
Search
everywhere
only in this topic
Advanced Search
If-Else Logic
Classic
List
Threaded
♦
♦
Locked
3 messages
Joe
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
If-Else Logic
Is there a way to implement If-Else logic in the Hack Assembly Language? I've used a while loop for Fill.asm to fill the screen, but I want to use some kind of conditional logic to check and see if KBD == 0 or KBD == 1.
Thanks!
Joe
Joe
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: If-Else Logic
Well, if KBD == 0 at any rate. Supposedly, that RAM location gets filled with the ASCII value of a key when it's pressed.
cadet1620
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: If-Else Logic
Administrator
In reply to
this post
by Joe
This is what the Jump Specification in C-Instructions is all about. (4.2.3, p.68)
Load KBD into a register and do a conditional jump.
--Mark
Free forum by Nabble
Edit this page