IN THE KNOW
Go to bottomPage: 1
TOPIC:
#1024
Offset exceeded warning 10 Months ago Karma: 1
Hi Everyone,
I have created a function in assembly language, that gives a warning "(863) : WARNING (435) Offset has exceeded its range - JR Instruction replaced". Kindly let me know the reason for this warning and what can I do to get rid of this warning.

Regards,
Nick.

Sample code of the function is as following.

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_OUT_FROM_Q:
PUSH IX
LD IX,0
ADD IX,SP
PUSH BC
PUSH BC
PUSH BC

LD A,(_rd_ptr_sub_q)
LD HL,_wr_ptr_sub_q
CP A,(HL)
JR Z,L_43

LD A,(_rd_ptr_sub_q)
LD (IX+-1),A

L_40:

LD A,(IX+-1)
UEXT HL
LD L,A
LD BC,_opr_sub_q
ADD HL,BC
LD (IX+-9),HL

LD A,(HL)
LD (IX+-3),A

CP A,(IX+6)
JR NZ,L_39

L_33:

LD A,(IX+-1)
LD (IX+-2),A

INC (IX+-1)

LD A,(IX+-1)
AND A,15
LD (IX+-1),A

LD BC,_opr_sub_q
LD (IX+-6),BC

LD A,(IX+-1)
UEXT HL
LD L,A
LD BC,(IX+-6)
ADD HL,BC
LD A,(HL)
LD (IX+-3),A

LD A,(IX+-2)
UEXT HL
LD L,A
LD BC,_opr_sub_q
ADD HL,BC
LD A,(IX+-3)
LD (HL),A

LD A,(_wr_ptr_sub_q)
CP A,(IX+-1)
JR NZ,L_33

LD A,(_wr_ptr_sub_q)
DEC A
LD (IX+-2),A

AND A,15
LD (IX+-2),A

LD (_wr_ptr_sub_q),A

JR L_43

L_39:
LD A,(IX+-3)
CP A,(IX+6)
JR Z,L_41

INC (IX+-1)

LD A,(IX+-1)
AND A,15
LD (IX+-1),A
L_41:

LD A,(_wr_ptr_sub_q)
CP A,(IX+-1)
JR NZ,L_40

L_43:

LD SP,IX
POP IX
RET
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Nick Abraham (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1025
Re: Offset exceeded warning 10 Months ago Karma: 1
The warning appears at
JR Z,L_43
Nick Abraham (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1026
Re:Offset exceeded warning 10 Months ago Karma: 4
Nick,
The JR instruction is "Jump Relative" and uses a signed 8 bit offset.
The maximum offset is 129 bytes forward (0-128) and 128 bytes backwards.
The warning just informs you the offset is greater than what is allowed, so the instruction is replaced with a JP instruction, which uses 16/24 bit addressing.
Tom Ormiston (Admin)
Admin
Posts: 168
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1