0

Prepare a MARIE subroutine called printStringName that can print any name containing two ASCII ‘0’ terminated strings (using the “Output” instruction). Start by using a label “PrintName” that holds the start address of a name string (like, myNameAdd in the example above). The code should then load a character from that address, output it if it is not ‘0’, then increment the address by one, and keep doing that until the character loaded from the address is a ‘0’ (which signals the end of the string). Then, print an ASCII “Space” character, and proceed to print the second part of the name string, i.e. Last Name until the character loaded from the address is a ‘0’ (which signals the end of the string). Then, when you load the second ASCII ‘0’ which marks the “end of a name”, print an ASCII “New Line” character and proceed to print the next name. For this task, you may use two or three names (your First Name and Last Name, your teacher’s name, your tutor’s name etc. minimum two names) to print, each name hard coded and assigned a label to identify.

                JnS Print
                Halt


Print,          HEX 2
PrintString,    LoadI PrintName
                Skipcond 800
                JumpI Print
                Output
                Clear
                Load PrintName
                Add Increment
                Store PrintName
                Clear
                Jump PrintString

PrintName,      DEC 0   
                HEX 043
                HEX 048
                HEX 045
                HEX 041
                HEX 048
                HEX 030
                HEX 030
                HEX 030
Increment,      DEC 1 
                Load PrintName
                Store Print_Arg
                JnS Print
                Halt
PrintName,      hex 04A


Print_Arg,      DEC 0
Print,          Hex 0
                Load Print_Arg
                Output
                Skipcond 000
                JumpI Print
                Output
                Clear
                Load PrintName
                Add Increment
                Store PrintName
                Clear
                Jump 0

Increment,      DEC 1

The code keeps on repeating and im not sure whats the problem

Erik Eidt
  • 23,049
  • 2
  • 29
  • 53
  • It seems that you're looking for a mentor to help you through your homework, help explaining and debugging; you'll probably have more luck at a site like [codementor.io](https://www.codementor.io/erikeidt). – Erik Eidt Sep 11 '19 at 19:05
  • I don't know how you are able to get past the basic assembly errors. There are two duplicated labels: `Increment`, and `PrintName`. The same label name can only be defined once. Either you are not running this code, or it seems to me that the code you've posted and the code your running are not the same. – Erik Eidt Sep 11 '19 at 19:35
  • I think u r looking at 2 sets of codes ive posted. Im not sure which is the right one to use. Hence, posted both – Chris Cheah Jun Hao Sep 12 '19 at 11:09

0 Answers0