What I'm trying to do in Brass is have a large variable that's created using .var and try to relocate a routine that needs to be in RAM into it. I'm trying to take the idea of allocating memory to variables and apply it to entire RAM routines. The code I have in attempts to do this is as follows:


Code:
.var 66,offPageCall

.module ROMCALL
InitDevMem:
 ld hl,OPC_START
 ld de,offPageCall
 ld bc,OPC_END-OPC_START
 ldir
 ;other routines
 ret

OPC_START:
.relocate offPageCall

 jr $
 ld hl,0
 ld (currow),hl
 ld hl,STR
 bcall(noname._PutS)
 ret
STR:
.db "HELLO WORLD",0
 
.endrelocate
OPC_END:
.endmodule


Note: The code above was designed to test the idea.

Note: Brass didn't like that I used _PutS alone. Doing "noname._PutS" fixed that. The "jr $" is there so I can figure out what's going on.

When I do "call offPageCall", PC correctly jumps to one of the possible locations I have defined, which happens to be $9A01 in this instance. This tells me that OPC_END and OPC_START are correct, and are copying the information to RAM correctly. But here's the problem. "STR" resolves to a value as though .relocate was a .org 0

Here's output from Wabbitemu's debugger:

Code:

9A01:18fe: jr $9A01   ;2 bytes 12 clocks
9A03:210000: ld hl,$00   ;3 bytes 10 clocks
9A06:224b84:  ld ($844B),hl   ;3 bytes 16 clocks
9A09:210f00: ld hl,$0F   ;3 bytes 10 clocks
9A0C:ef0a45: bcall(_PutS)   ;3 bytes
9A0F:c9:  ret   ;1 bytes 10 clocks

After that stretch of code is the string "HELLO WORLD"

I can't figure out how to work around this problem without having to define a definite address for the routine to reside. Any thoughts?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement