Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this task, you need to write MARIE code that can print any string (no matter how long) using the Output instruction. Start by using

image text in transcribed
For this task, you need to write MARIE code that can print any string (no matter how long) using the Output instruction. Start by using a label PrintString that holds the start address of the string. 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). To receive full marks, your code needs to be in the form of a subroutine that can be called using the InS instruction. You can start from the following template, which will print FIT1047 once you add the correct printing code. Load StrAddr / Get start address of string Store PrintString Store as argument of subroutine Jns Print Execute printing subroutine Halt PrintString, HEX 0/argument: address of string Print, HEX 0/ subroutine start your code goes here StrAddr, Jns FIT1047 / Address of the string FIT1047, HEX 046 Start of string data HEX 049 HEX 054 HEX 031 HEX 030 HEX 034 HEX 037 HEX 000 This code uses an interesting trick: The label FIT1047 represents the address where the string starts. Unfortunately, there is no MARIE instruction to load the address of a label into the ACregister but we need to pass the start address to the Print subroutine! Luckily there is a workaround. The JnS instruction has opeode 0. This means that in memory, Jns FIT1047 will be represented as 0000xxxXXXXXXNKre XXXXXXxxxxxx is the address of label FIT1047. That is exactly what we wanted! Subnnit your MARIE code, eatending the abone template, and where the string has been replaced by your name from the previous task For this task, you need to write MARIE code that can print any string (no matter how long) using the Output instruction. Start by using a label PrintString that holds the start address of the string. 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). To receive full marks, your code needs to be in the form of a subroutine that can be called using the InS instruction. You can start from the following template, which will print FIT1047 once you add the correct printing code. Load StrAddr / Get start address of string Store PrintString Store as argument of subroutine Jns Print Execute printing subroutine Halt PrintString, HEX 0/argument: address of string Print, HEX 0/ subroutine start your code goes here StrAddr, Jns FIT1047 / Address of the string FIT1047, HEX 046 Start of string data HEX 049 HEX 054 HEX 031 HEX 030 HEX 034 HEX 037 HEX 000 This code uses an interesting trick: The label FIT1047 represents the address where the string starts. Unfortunately, there is no MARIE instruction to load the address of a label into the ACregister but we need to pass the start address to the Print subroutine! Luckily there is a workaround. The JnS instruction has opeode 0. This means that in memory, Jns FIT1047 will be represented as 0000xxxXXXXXXNKre XXXXXXxxxxxx is the address of label FIT1047. That is exactly what we wanted! Subnnit your MARIE code, eatending the abone template, and where the string has been replaced by your name from the previous task

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions