# Skipcond in MARIE assembly lang.

Discussion in 'Homework Help' started by Evilsithgirl, Nov 8, 2009.

1. ### Evilsithgirl Thread Starter New Member

Nov 8, 2009
3
0
Hello. I was wondering if i could get some help with SKIPCOND for MARIE aseemble language. Here is my problem

I need to write a program that takes 8 numbers and finds the lowest and highest of the 8 numbers. I'm getting stuck on the skipcond. for example here is the psuedo code i've come up with

Input
Store A
Input
Store B
Input
etc for all 8 numbers
//Compare using skipcond
If A < B
Store Lowest
Else
Store Lowest

And i would do this for all 8 numbers until i found the lowest. And then i would go back through and use the same code in reverse for finding the highest. Trouble is i don't know how to compare the two numbers to eachother using Skipcond. Can anybody provide some insight into this? I've read my book and still don't quite understand fully.

2. ### Papabravo Expert

Feb 24, 2006
12,292
2,728
The SKIPCOND instruction is actually 4 instructions in one. It examines the AC register for one of the three conditions
1. Less than 0
2. Equal to 0
3. Greater than 0
If the condition, selected in the SKIPCOND instruction, is TRUE the next instruction is skipped. In your pseudo code you have written "If A < B" which is not something that SKIPCOND knows how to handle. What you must do is perform some arithmetic operation on A and B leaving the result in the AC register. Then you can apply SKIPCOND to the result and act accordingly. The instruction to be skipped should be a jump to the instructions to the instructions for the false case. When you become better at coding and arranging things to your advantage you might find a way to use the single instruction in the "skip slot" [my terminology -- not the authors of MARIE's terminology] so that it falls into the instruction sequence for the true case.

The forth case of the SKIPCOND instruction is to do nothing at all, essentially a NOP(no operation) instruction.