Code prompts user for an input when an input isn't in the code

41 Views Asked by At

So i wrote this MARIE code and every time I try to run it it prompts me to enter an input when I never put Input anywhere in the code. The code is supposed to call 2 subroutines PUSH and POP where push pushes the elements 4,6,8 into the stack and POP, removes them

Here is the code:

ORG 000

PTR, HEX 0002

STACK, HEX 1111
      HEX 2222
      HEX 3333
      HEX 4444
      HEX 5555
      HEX 6666
      HEX 7777

A,    HEX 0004
B,    HEX 0006
C,    HEX 0008

ONE,  HEX 0001
PBUFF,HEX 1234

Load A
Store PBUFF
JnS PUSH

Load B
Store PBUFF
JnS PUSH

Load C
Store PBUFF
JnS PUSH

Halt

PUSH, HEX 000
     Load PBUFF
     StoreI PTR
     Output

     Load PTR
     Add ONE
     Store PTR
     JUMP PUSH  // Use a regular JUMP instead of JUMP I (0)

POP,  HEX 000
Load PTR        // Load the current value of PTR
Subt ONE        // Decrement PTR
Store PTR       // Store the updated value back in PTR

LoadI PTR       // Load the value from the stack at the updated address
Output          / Output the value

Halt

I've been working with a tutor for 2 days know and neither of us know whats wrong with the code and why its doing that.

0

There are 0 best solutions below