We received a project to make calculator in assemly
I want to check the result of the numbers actually in the range. that I don't have pverflow or undeflow.
But it does not work .. Can you let me know where the problem so I could fix?

here is my code.
res - is the result of two numbers that was entered by the user. the result is fine i would put here all the code but it is 8 pages.. and temp_num1 and temp_num2 is the numbers.

STEP5,          CLA                 //
            BSA     OVERUNDER       //
            BUN     STEP6           //
OVERUNDER,      HEX     0           //
CLA                 //
STA      V          // V = 0
LDA      TEMP_NUM1      //
            CIL                 //SHIFT LEFT
CLA                     //
CIL                 //SHIFT LEFT 
STA      MSB_NUM1       // MSB_NUM1 = MSB OF NUM1
LDA      TEMP_NUM2      //
CIL                 //SHIFT RIGHT
CLA                     //
CIL                  // SHIFT RIGHT ; =MSB OF NUM2
CMA                 //
INC                 //
ADD      MSB_NUM1       //
SZA                  // IF (MSB OF NUM1 == MSB OF NUM2)
BUN      FINAL           // ELSE, GOTO FINAL
BUN         MSB_RES         //
MSB_RES,        LDA      RES            // 
CIL                 //SHIFT RIGHT
CLA                     //
CIL                  // SHIFT RIGHT; = MSB OF RES
CMA                 //
INC                 //
ADD      MSB_NUM1       //
SZA                 // IF (MSB OF RES != msb of NUM1)
BUN      NOTINRANGE     //  ELSE, GOTO NOTINRANGE
BUN      FINAL           // THEN, GOTO FINAL
NOTINRANGE,         LDA     FLAG7           //
STA      V           // V = 1
FINAL,          BUN     OVERUNDER   I   // RETURN

//DATA//
MSB_NUM1,       DEC      0          // 
V,          DEC          0           // 
FLAG7,          DEC      1           // 


STEP6,          HLT                 //

Recommended Answers

All 4 Replies

Could you tell us what system this assembly code is for? Unlike high-level languages, every type of computer has it's own specific assembly language, so we would have to know what it is for before we could answer the question.

I know this isn't assembly for x86 (that is to say, an ordinary PC), nor is it MIPS, ARM (the types of CPUs most common in phones and other small devices), 68K, 6502, Z80 or any of the others I am at least passingly familiar with. From what I've gathered after some Googling, this looks like PDP-8 code, which probably means you'r probably using the PEP-8 emulator. Is that correct?

Sorry I forgot to mention it's mano and we are using mano simulator

Just to be clear, do you mean this?

EDIT: Looking around the web a bit more, I see that there are several simulators for the Mano machine design. Can you tell us which one you are using?

I tried to send the like to you but i can't it's a pogram my teacher wrote.
It looks like the like you sent...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.