- Problem with Brass's .relocate directive [SOLVED]
- 12 Feb 2014 02:38:59 pm
- Last edited by Iambian on 12 Feb 2014 03:22:23 pm; edited 3 times in total
This problem is no longer an issue. See this post
I probably should have investigated this problem some more across different compilers, but that list.html file had me going. Anyway. The old post stays to show what I thought was a problem, and its solution.
Known to affect Brass 1.0.5.3
While coding a semi-secret project, I ran into an issue with Brass involving the .relocate directive. On second (and presumably further) use of the .relocate directive, the addresses within are incorrectly modified.
The list.html file indicates that it should have been correctly assembled, but the information provided by the .echoln directives scattered throughout the code says otherwise, and the app that is generated and inspected under an emulator's debugger matches what the console window says.
The batch script I use to build this is as follows:
Code:
The code that demonstrates this problem is as follows:
Code:
I probably should have investigated this problem some more across different compilers, but that list.html file had me going. Anyway. The old post stays to show what I thought was a problem, and its solution.
Known to affect Brass 1.0.5.3
While coding a semi-secret project, I ran into an issue with Brass involving the .relocate directive. On second (and presumably further) use of the .relocate directive, the addresses within are incorrectly modified.
The list.html file indicates that it should have been correctly assembled, but the information provided by the .echoln directives scattered throughout the code says otherwise, and the app that is generated and inspected under an emulator's debugger matches what the console window says.
The batch script I use to build this is as follows:
Code:
@echo off
%cd%\brass -e -d %cd%\test.asm %cd%\test.8xk -l list.html
pause
The code that demonstrates this problem is as follows:
Code:
.binarymode ti8xapp
.variablename "TeSTAPP"
.include "ti83plus.inc"
.deflong bjump(label)
call bRT_JUMP0
.dw label
.enddeflong
.deflong bcall(label)
rst rBR_CALL
.dw label
.enddeflong
.defpage 0,16*1024,$4000
.page 0
.block 128
di
jr $ ;halts app to allow inspection
bjump(_JForceCmdNoChar)
jp JUMP_1
jp JUMP_2
nop
nop
rollingVariable = $9D95
.echoln "ROLLING VAR TAKE 1:",rollingVariable
JUMP_1_BASE:
.relocate rollingVariable
JUMP_1_START:
JUMP_1:
ld hl,0
-:
dec hl
ld a,h
or L
jr nz,{-}
ret
JUMP_1_END:
.endrelocate
rollingVariable = rollingVariable + (JUMP_1_END-JUMP_1_START)
.echoln "ROLLING VAR TAKE 2:",rollingVariable
.echoln $
JUMP_2_BASE:
.relocate rollingVariable
JUMP_2_START:
JUMP_2
ld hl,0
ld (currow),hl
ld hl,JUMP_2_LABEL
bcall(_PutC)
ret
JUMP_2_LABEL:
.db "HELLO WORLD",0
JUMP_2_END:
.endrelocate
rollingVariable = rollingVariable + (JUMP_2_END-JUMP_2_START)
.echoln "ROLLING VAR TAKE 3:",rollingVariable
.echoln "JUMP_1_BASE:",JUMP_1_BASE," JUMP_1_START:",JUMP_1_START," JUMP_1_END:",JUMP_1_END
.echoln "JUMP_2_BASE:",JUMP_2_BASE," JUMP_2_START:",JUMP_2_START," JUMP_2_END:",JUMP_2_END
.end