.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"

Recommended Answers

All 7 Replies

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

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?

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

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???

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

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!

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.