Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bank start/end/firstfree symbols #195

Open
justarandomgeek opened this issue Jan 9, 2024 · 0 comments
Open

bank start/end/firstfree symbols #195

justarandomgeek opened this issue Jan 9, 2024 · 0 comments

Comments

@justarandomgeek
Copy link

justarandomgeek commented Jan 9, 2024

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...?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants