2

Click here to load reader

EE180-LAB2 JNS and JUMPI

Embed Size (px)

DESCRIPTION

Using JNS and JUMPI in Marie assemble Language

Citation preview

Page 1: EE180-LAB2 JNS and JUMPI

Results:

Conclusion:

In this program, I successfully implemented a jump and store command and the jump to address command to execute iteration of the given function using Marie assemble language implementation.

Page 2: EE180-LAB2 JNS and JUMPI

John Neil C. Bibera EE180 – F34 Microprocessor Systems Laboratory Friday 1:30PM – 4:30PM

Objective:Using A combination of JUMPI and JNS Instruction write the following codes segment in Marie assembly

language.

SUM = (((input from user)-5)*2)+3for X: 1 to sum(input from user * 3 - 2 > 1)do SUM := sum + X;X++/display sum for every iteration

START, INPUT // ask for inputSTORE IN // store input to INADD IN // x2 INADD IN // x3 INSUBT TWO // -2 INSTORE I // store I **SUBT ONE // -1SKIPCOND 800 // check if CT > 1JUMP START // else restartLOAD IN // starting programSUBT FIVE // -5STORE TEMP // store for multADD TEMP // *2ADD THREE // +3STORE SUM // value for SUM **

GAME, LOAD SUM // starting phase 2ADD X // add X to sumOUTPUT // show output **STORE SUM // Store SUM to SUMJNS IT // jump and store for iterationLOAD X // load xADD ONE // add 1STORE X // store xJUMP GAME // jump back to phase 2

IT, HEX 0 // save next address here to go backLOAD X // load xLOAD I // load ISUBT X // subt I to X to check if still a goSKIPCOND 800 // if I > X skip nextJUMP END // if I = X, then jump to haltJUMPI IT // if X is less than I, go back

END, HALT // terminate the programX, DEC 1 // value of current XI, DEC 0 // number of iterationIN, DEC 0 // input valueSUM, DEC 0 // value of SUMTEMP, DEC 0 // value of TEMP dataFIVE, DEC 5 // #5THREE, DEC 3 // #3TWO, DEC 2 // #2ONE, DEC 1 // #1