hi, next example is compiled without errors but produces wrong results due debug.
;------------------------------------------------------------ ; Test program about bug of relocatable calculations ;------------------------------------------------------------ ; allocate buffer in XDATA ?XD?BUFFER SEGMENT XDATA RSEG ?XD?BUFFER BUFFER: DS 512 ; here may be any number ;------------------------------------------------------------ ; Main program ?PR?MAIN SEGMENT CODE RSEG ?PR?MAIN ; load high byte of the buffer address +1 into accumulator MOV A,#(HIGH(BUFFER)+1) ; !!! accumulator contains high byte without +1 !!! MOV A,#(HIGH(BUFFER+256*1)) ; here we obtain the correct result JMP $ END