Nand2Tetris Questions and Answers Forum
›
Architecture
›
Project 4
Login
Register
Search
everywhere
only in this topic
Advanced Search
mult.asm
Classic
List
Threaded
♦
♦
Locked
3 messages
Options
Loading...
Subscribe via email
Move topic
Pin topic
Unpin topic
Lock topic
Unlock topic
Delete this topic
Delete this topic
Change title and meta tags
Embed post
Permalink
sharmaankush347
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
More
Loading...
Reply to author
Edit post
Move post
Delete this post
Delete this post and replies
Change post date
Print post
Permalink
Raw mail
Aug 28, 2020; 2:56pm
mult.asm
5 posts
mult is showing 0x0=-1 with script otherwise no such issue without script. Here's screenshot...kindly tell me mistake if any
Thanks
multquery.jpg
WBahn
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
More
Loading...
Reply to author
Edit post
Move post
Delete this post
Delete this post and replies
Change post date
Print post
Permalink
Raw mail
Aug 28, 2020; 10:06pm
Re: mult.asm
Administrator
1541 posts
I can't evaluate your code if I can't see all of your code.
Have you walked through the code execution by hand to see what it does?
sharmaankush347
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
More
Loading...
Reply to author
Edit post
Move post
Delete this post
Delete this post and replies
Change post date
Print post
Permalink
Raw mail
Aug 28, 2020; 11:43pm
Re: mult.asm
5 posts
ya,even its working without script, I modified the repeat 20 to some higher value in script. Here's my code-
@R2 //making R2 =0
M=0
@R0
D=M
@ZERO
D;JEQ //if R0=0, goto ZERO
@R1
D=M
@ZERO
D;JEQ //if R1=1, goto ZERO
@i
M=1 //i=1
@Prod // Product
M=0 // Product=0
(LOOP)
@i
D=M
@R0
D=D-M //D=i-RAM[0]
@STOP
D;JGT //IF i-n>0, GOTO STOP
@Prod
D=M
@R2
M=D
@R1
D=D+M // D=Prod+m
@Prod
M=D //Prod=Prod+m
@i
M=M+1 //i=i+1
@LOOP
0;JMP //UNCONDITIONAL JUMP
(ZERO)
@R2
M=0
//@R2
D=M
@END
0;JMP
(STOP)
@Prod
D=M
@R2
M=D // RAM[2]=Prod
@END
0;JMP
(END)
@END
0;JMP
Free forum by Nabble
Edit this page