Relative jump of range by 0001h bytes

Viewed 30

I captured the 3 number variable in the register. But when want to display in console program. I found out that the value of "tempTotal" variable is exceed and cause the error "Relative jump of range by 0001h bytes", how doI fix it? (btw, i using doxbox ver.0.74).

.....
    temp        DB  ?                   ;
    remainder   DB  ?                   ;
    quotient    DB  ?                   ;
    tempRebate  DB  ?                   ;
    tempSST     DB  ?                   ;
    tempTotal   DB  ?                   ;
....
    MOV AL, totalPrice
    MOV BL, tempRebate
    ADD AL, BL
    MOV BL, tempSST
    ADD AL, BL
    MOV     tempTotal, AL

    MOV     AL, tempTotal                       ; 
    AAM
    ADD     AX, 3030H                           ; 
    PUSH    AX                                  ; 
    MOV     DL, AH                              ; 
    INT     21H
    POP     DX                                  ; 
    MOV     AH, 02H                             ; 
    INT     21H             
1 Answers

The code that you show does not contain any jumps, so the error message "Relative jump of range by 0001h bytes" must originate from somewhere else.

What the code does have is an error in the way you invoke the DOS.PrintCharacter function 02h. You forgot to write mov ah, 02h prior to the first invokation! The first int 21h therefore will have executed some random DOS function (numbers 30h and up) with an unpredictable result. Anything could happen and it did happen...

MOV     AL, tempTotal                       ; 
AAM
ADD     AX, 3030H                           ; 
PUSH    AX                                  ; 
MOV     DL, AH                              ; 
???     ???????    <== missing MOV AH, 02H
INT     21H
POP     DX                                  ; 
MOV     AH, 02H                             ; 
INT     21H            

Your code is valid for tempTotal in the range [0,99].

Related