Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 21st, 2006, 05:52 AM
Balor Balor is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: Melbourne Australia
Posts: 3 Balor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 1 m 22 sec
Reputation Power: 0
MARIE Help: Multiplication SubRoutine

G'day all, newbie programmer here whose touching on a variety of differnet languages at the moment. I've come across the MARIE Machine Simulator and encountered some problems.

First off, some info on Marie:

"*MarieSim is an environment within which you can write your own programs and watch how they would run on a real "von Neumann architecture" computer system...MarieSim was written in the Java language so that the system would be portable to any platform for which a Java Virtual Machine (JVM) is available."

*Taken from: A Guide to the MARIE Machine Simulator Environment Accompanying The Essentials of Computer Organization and Architecture by Linda Null and Julia Lobur.

Basically i can't fix some Logical Bugs in this Multiplication Sub Routine (And MARIE isn't working for me so i'm down to trying to fix it without the program itself) and am asking for some feedback and guidence on what can be done without changing the code structure. I've personally fixed most of the problems involved but still cannot get the thing to work 100% correctly. Code as follows:

PHP Code:
/Multiplication SubRoutine Program

/Global Variables

         ORG          0200          
/GLOBAL data areas
X
,       DEC          0000          /Multiplicand
Y
,       DEC          0000          /Multiplier (Used as counterterminate if 0)
M,       DEC          0000          /Product (Used as Sum and receives outputs)
One,     DEC          1             /Constant “1”

/Multiply Subroutine

MPY
,     HEX          0000          /Entry Point and Return Address (guessing problem is here)
Load     X                          /Initialise Multiplicand
Store    M

MPY1
,    Load         Y             /Decrement Multiplier
Subt     One
Skipcond 01                         
/Skip if zer0
JumpI    MPY                        
/Multiply Complete: RETURN
Load     M                          /Add value X to sum in M
Add      X
Store    M
Jump     MPY1                       
/loop for next Iteration
END 


Example Input for x and y as 5 and 3 (Set above to 0 and 0 for ease sake) so that the program does the following calculation:

(x)5 * (y)3 = (m)15 or rather 5 + 5 (loop 1) + 5 (loop 2)

Using the good old pen and paper and follwing the algorithm, this is what the above code should do:

....................X..........Y..........M..........ONE
Initialised:......5...........3..........5............1
LOOP1:..........5...........2..........10..........1
LOOP2:..........5...........1..........15..........1
LOOP3:..........5...........0..........Loop Terminates.

Once the Loop Terminates, it jumps to MPY which doesn't make sense at the moment. If i move the MPY line to just above the End line, this should make the program work right?

For those who are familiar with MARIE, the error i'm recieving is that once i've downloaded it and placed it in a folder named MARIE i am meant to type in command prompt:

"jar xvf MarieSim.jar" to uncompress the program
and
"jar xvf MarieSource.jar" to uncompress the Source

However, it comes up with an error that it does not recognise the jar command even though i have installed Java SDK 1.4.0 which is what it requires.

Many thanks to those who read this and even more so to those that help out and i hope this post is coherent and through enough to convey the problem.

Cheers

Balor

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > MARIE Help: Multiplication SubRoutine

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap