Answer to Question #324201 in Computer Networks for hamudi

Question #324201

a) Write an assembly program using MARIE's assembly Instruction set that prompts the user to enter a non-negative integer that is less than 10. The program should include a subroutine that keeps prompting until a valid value is obtained. When a valid number is entered, it will be displayed. (Hint: Use JNS & JUMPI instructions to implement the subroutine)

N.B: You should include the MARIE code in your Answer, with an explanation of each instruction in your code beside it. Example: Subt One /Subtract 1 from AC

b) Add a screenshot of the simulation, showing the result (A screenshot of the MARIE Simulator window after running the program). Instructions: - Use “ORG” instruction to start your program at address equivalent to 25610. - Use your last university ID number to input the value of X. For example, if your ID is1915161678234, then you will use the number 4 as the value of x. - Do not forget to change the representation of the Input and Output windows in the simulator to Decimal. 


1
Expert's answer
2022-04-05T13:17:49-0400

Solution

Code:

ORG 100
JNS checkint
OUTPUT
HALT

checkint, HEX 000
INPUT
SKIPCOND 000
JUMPI checkint
JNS checkint


This only applies the condition for non-negative. Can anyone pls help me how to apply condition for less than 10 as well?


Code:

ORG 100
JNS checkint
OUTPUT
HALT

checkint, HEX 000
INPUT
SKIPCOND 000
JUMPI checkint
JNS checkint


This only applies the condition for non-negative. Can anyone pls help me how to apply condition for less than 10 as well?


Code:

/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 * 
 * @param value
 *     Java instance representing xml element's value.
 * @return
 *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 */
@XmlElementDecl(namespace = "", name = "serialNumber", scope = CertificateType.class)
public JAXBElement<String> createCertificateTypeSerialNumber(String value) {
    return new JAXBElement<String>(_CertificateTypeSerialNumber_QNAME, String.class, CertificateType.class, value);
}

/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 * 
 * @param value
 *     Java instance representing xml element's value.
 * @return
 *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 */
@XmlElementDecl(namespace = "", name = "subjectDN", scope = CertificateType.class)
public JAXBElement<String> createCertificateTypeSubjectDN(String value) {
    return new JAXBElement<String>(_CertificateTypeSubjectDN_QNAME, String.class, CertificateType.class, value);
}

/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 * 
 * @param value
 *     Java instance representing xml element's value.
 * @return
 *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 */
@XmlElementDecl(namespace = "", name = "issuerDN", scope = CertificateType.class)
public JAXBElement<String> createCertificateTypeIssuerDN(String value) {
    return new JAXBElement<String>(_CertificateTypeIssuerDN_QNAME, String.class, CertificateType.class, value);
}

/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 * 
 * @param value
 *     Java instance representing xml element's value.
 * @return
 *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 */
@XmlElementDecl(namespace = "", name = "subjectKeyIdentifier", scope = CertificateType.class)
public JAXBElement<String> createCertificateTypeSubjectKeyIdentifier(String value) {
    return new JAXBElement<String>(_CertificateTypeSubjectKeyIdentifier_QNAME, String.class, CertificateType.class, value);
}

/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 * 
 * @param value
 *     Java instance representing xml element's value.
 * @return
 *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 */
@XmlElementDecl(namespace = "", name = "authorityKeyIdentifier", scope = CertificateType.class)
public JAXBElement<String> createCertificateTypeAuthorityKeyIdentifier(String value) {
    return new JAXBElement<String>(_CertificateTypeAuthorityKeyIdentifier_QNAME, String.class, CertificateType.class, value);
}

/**
 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 * 
 * @param value
 *     Java instance representing xml element's value.
 * @return
 *     the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
 */
@XmlElementDecl(namespace = "", name = "certString", scope = CertificateType.class)
public JAXBElement<String> createCertificateTypeCertString(String value) {
    return new JAXBElement<String>(_CertificateTypeCertString_QNAME, String.class, CertificateType.class, value);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS