Current location: Hot Scripts Forums » Programming Languages » Other Languages » MARIE Code


MARIE Code

Reply
  #1 (permalink)  
Old 11-23-09, 04:27 PM
JoGo1 JoGo1 is offline
New Member
 
Join Date: Nov 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation MARIE Code

I have to write this in MARIE Assemble Code:

M = 1;
N = 1;
while M < 16
{ M = M + N:
N = N + 1;
} end while

This is what I have: Can you please make adjustments as needed. Thank You in Advance!!

Org 100 / This starts the program at address 100
Load N / Load N into the AC
Add One / Increment
Store Next / Store this address as out Next pointer
Load M / Load M into the AC
Add N / Add N to M
Store Ctr / Store this value in Ctr to control looping
Loop, Load Sum / Load the Sum into AC
AddI Next /Add the value pointed to by location Next
Store Sum / Store this Sum
Load Next / load Next
Add One / Increment by one to point to next address address
Store Next / Store in our pointer Next
Load Ctr / Load the loop control variable
Add Next / Add the value pointed to by location Next
Store Ctr / Store thie new value in loop control variable
Skipcond 000 / if control variable < 16 then skip next instruction
Jump Loop / Otherwise, go to Loop
Halt / Terminate Program
M, Dec 1 / M = 1
N, Dec 1 / N = 1
One, Dec 1 / Used to Increment or Decrement
Next, Hex 0 / A pointer to the next number to add
Ctr, Hex 0 / The loop control variable
Sum, Dec 0 / The sum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-23-09, 04:55 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
This look like homework.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-23-09, 04:59 PM
JoGo1 JoGo1 is offline
New Member
 
Join Date: Nov 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Yes

This homework I just need help..I put what I did to do and I put what I did...I just want some help to make sure it is correct!!! thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-24-09, 07:29 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
The best thing to do is run it.

Much of software engineering is iteration - doing things over and over again until they work the way you want them to.

Most people can't look at assembly language and quickly assess it, it really has to be run and then checked. Take the time to find any debugging capabilities in the MARIE environment, such as stepping through the code one instruction at a time and reviewing the register contents.

It looks like there are a lot of resources on the web (I Googled) - but for the amount of code you have, your best bet is to sort it out on your own.

Good luck.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-24-09, 09:05 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
You seem to have a problem here:

AddI Next /Add the value pointed to by location Next
__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Match code in link with code with one in file and extract line peuplarchie PHP 3 10-24-09 02:23 AM
Freeze columns in a table Rita Negi Script Requests 1 09-01-09 09:23 AM
OTO Redirect Code Placement Tony S. HTML/XHTML/XML 7 07-25-09 10:31 AM
Need captcha for html+php contact form sujata_ghosh PHP 6 03-22-09 04:46 PM
Explanation of Code... Please davidk19380 Perl 1 02-26-06 02:50 PM


All times are GMT -5. The time now is 07:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.