We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,478 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

if statement relative out of range. HELP

.model small
.stack 64
.data
select db"Enter the your desired option$"
msg1 db "[1]display box and your name$"
msg2 db "[2]enter your name$"
msg3 db "[3]display d to l$"
msg4 db "[4]exit$"
msg5 db "JOSEPHINE P.VINAS$"
.code
mov ax,@data
mov ds,ax

mov ax,0003h
int 10h

mov ah,02
mov dh,0
mov dl,25
int 10h


mov ah, 09h
lea dx, select
int 21h

mov ah,02
mov dh,3
mov dl,5
int 10h

mov ah, 09h
lea dx, msg1
int 21h

mov ah,02
mov dh,4
mov dl,5
int 10h

mov ah, 09h
lea dx, msg2
int 21h

mov ah,02
mov dh,5
mov dl,5
int 10h


mov ah, 09h
lea dx, msg3
int 21h

mov ah,02
mov dh,6
mov dl,5
int 10h

mov ah, 09h
lea dx, msg4
int 21h

mov ah,02
mov dh,1
mov dl,40
int 10h

mov ah,0ah
int 21h

cmp al,'1'
je boxandyourname

cmp al,'2'
je enteryourname

cmp al,'3'
je displayDtoL



jmp exit




;--------------box code------------------------------------…
boxandyourname:
mov ah,02h
mov dh,12
mov dl,30
int 10h


mov ah,09h
mov al,'_'
mov bl,1eh
mov cx,10
int 10h

mov ah,02h
mov dh,17
mov dl,30
int 10h

mov ah,09h
mov al,'_'
mov bl,1eh
mov cx,10
int 10h

mov ah,02h
mov dh,13
mov dl,30
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,14
mov dl,30
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,15
mov dl,30
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,16
mov dl,30
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,17
mov dl,30
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,13
mov dl,39
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,14
mov dl,39
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,15
mov dl,39
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,16
mov dl,39
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h

mov ah,02h
mov dh,17
mov dl,39
int 10h

mov ah,09h
mov al,'|'
mov bl,1eh
mov cx,1
int 10h


;-------------------name under box-------------------------------------…

mov ah,02
mov dh,20
mov dl,27
int 10h

mov ah, 09h
lea dx, msg5
int 21h
jmp exit
;--------------------enter your name------------------------------------…

enteryourname:
mov ah,02
mov dh,15
mov dl,30
int 10h

mov ah,0ah
int 21h
jmp exit
;----------display d to L----------------------------------
displayDtoL:

mov ah,02
mov dh,10
mov dl,30
int 10h

mov ah,02h
mov cx,9
mov dl,'D'

X:
int 21h
inc dl
loop X


exit:
mov ah, 4ch
int 21h ;end of program
end

why I cannot out put this code it says "relative jump out of range"

3
Contributors
7
Replies
1 Day
Discussion Span
3 Years Ago
Last Updated
8
Views
masterjiraya
Posting Whiz
322 posts since Jul 2008
Reputation Points: 10
Solved Threads: 31
Skill Endorsements: 4

Just a guess..You have the model set up as small maybe your exceeding the allowed memory

or your using an eight bit register value for your jump - it can only jump 256 bytes

gerard4143
Nearly a Posting Maven
2,295 posts since Jan 2008
Reputation Points: 512
Solved Threads: 397
Skill Endorsements: 0

Just a guess..You have the model set up as small maybe your exceeding the allowed memory

or your using an eight bit register value for your jump - it can only jump 256 bytes

so what should i do?

masterjiraya
Posting Whiz
322 posts since Jul 2008
Reputation Points: 10
Solved Threads: 31
Skill Endorsements: 4

If you think it is exceeding the memory allowed then I would compile the program and do an object dump and verify that the jump is exceeding 256...

If it will not compile as is - try commenting out some of the code and see if this error goes away..

Again these are guesses because I'm really only comfortable with a flat memory model

gerard4143
Nearly a Posting Maven
2,295 posts since Jan 2008
Reputation Points: 512
Solved Threads: 397
Skill Endorsements: 0

If you think it is exceeding the memory allowed then I would compile the program and do an object dump and verify that the jump is exceeding 256...

If it will not compile as is - try commenting out some of the code and see if this error goes away..

Again these are guesses because I'm really only comfortable with a flat memory model

what do you mean flat memory model???

masterjiraya
Posting Whiz
322 posts since Jul 2008
Reputation Points: 10
Solved Threads: 31
Skill Endorsements: 4

what do you mean flat memory model???

Well this will probably explain it better than I can

http://en.wikipedia.org/wiki/Flat_memory_model

I run a Linux box so except for emulators, I run a flat memory model

gerard4143
Nearly a Posting Maven
2,295 posts since Jan 2008
Reputation Points: 512
Solved Threads: 397
Skill Endorsements: 0

Well this will probably explain it better than I can

http://en.wikipedia.org/wiki/Flat_memory_model

I run a Linux box so except for emulators, I run a flat memory model

it's still unsolvable.... the only thing here is if I don't use the if else... it will run smoothly but when I used the if else it goes to a problem

masterjiraya
Posting Whiz
322 posts since Jul 2008
Reputation Points: 10
Solved Threads: 31
Skill Endorsements: 4

Different ways to solve your problem, but first a near relative jump is +127....-128

You can use an inverse branch logic.

if ! NeedToJumpUP   goto next

jmp far above

next:

You can also call a function so the jump distance isn't so far!

wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0815 seconds using 2.79MB