I'm trying to use the "leftover" range in a bank to implement a dynamic memory allocator, and it would be handy to have symbols for the bank's start/end addresses, and the first unused address from it.
It's pretty easy to fake start and first-free with properly placed labels, but i haven't found a way to get the bank's size or end address as a symbol other than hardcoding it, or putting a symbol in the adjacent unrelated bank.
#bankdef data
{
#bits 32
#addr 0x0c00
#size 0x7400
}
#bankdef program
{
#bits 32
#addr 0xa000
#size 0x2000
#outp 0
}
#bank data
; *some* of `data` is allocated now...
foo: #res 1
bar: #res 1
;... etc
#bank program
; ... but later on i want to use "the rest"
ld __data_firstfree, rA ; address
ld __data_end - (__data_firstfree), rB ; size...?
I'm trying to use the "leftover" range in a bank to implement a dynamic memory allocator, and it would be handy to have symbols for the bank's start/end addresses, and the first unused address from it. It's pretty easy to fake start and first-free with properly placed labels, but i haven't found a way to get the bank's size or end address as a symbol other than hardcoding it, or putting a symbol in the adjacent unrelated bank.