2

Well first off this is Marie Assembly Language.

Here what i have so far : I can easily accept input from user etc....

now what i want to do is each time the user enter a char suppose an integer i would like to compare it to '0' and then increment counterzero by one each time the user enters a zero

here's a simple piece of code as im trying to grasp the idea.

My problem i believe is understand how the skip condition works i think once i know that i'll know how to compare to my initialized variable

Thanks Everyone who took the time to read this.

  start,    load prom
    output prom
    input
    store num1

    subt ex
    skipcond 400

    jump counterzero




counterzero, Skipcond 400 if AC = 0,
             store county + one
             jump done




done,   load county
            output
            halt



plus,   dec 43
eq,     dec 61
prom,   dec 62
num1,   dec 0
num2,   dec 0
county, dec 0

zero, dec 0
one,  dec 1
sum,    dec 0
nul,    dec 0
h30,    dec 48
ex, dec 33

Edited : My test is that i enter zero '0' and the counter is suppose to increment instead it gives me some weird square box :S

Jens Björnhager
  • 5,632
  • 3
  • 27
  • 47
Shawn ricshawnawic
  • 147
  • 2
  • 5
  • 13

1 Answers1

0

skipcond jumps over one instruction if a condition is met. So, you have

skipcond 400
jump counterzero

This means, if AC is equal to zero, skip to the instruction after the jump. If not, execute the jump.

Now, since the instruction after the jump is located at the address counterzero, in your code that doesn't do much, there's no difference.

I'm not sure it matches your intentions, but before the jump counterzero (which you could leave out) I would add a jump done. Then it jumps to the address counterzero only if AC <> 0.

If it doesn't work, please clarify your intentions, and I can elaborate.

Johan Bezem
  • 2,582
  • 1
  • 20
  • 47