Jump to content
IGNORED

IntyBASIC/JLP - guarantees on storage capacity?


Recommended Posts

 

I wonder if we should create IntyBASIC macros to encapsulate the segment switches? If we consider that there's, say, five segments, we could have a macro that says "SwitchRomSegment(x)" and automatically insert the "ASM ORG $xxxx" appropriate for the argument.

 

It's not automatic, but at least it'll be easier to explain to programmers. Instead of Tarzilla's detailed but highly technical explanation above, you can say:

 

 

I posted an example of this in another thread. I modified intybasic_prologue.asm and intybasic_epilogue.asm to use cart.mac. I also then modified 42k.bas to use ASM ROMSEG x, which does pretty much exactly what you propose: Switch to the current running position in a numbered ROM segment.

 

Not fully automatic, but still a lot easier.

 

In the intybasic_epilogue.asm, I also tagged each of the elements (procedures, tables, etc.) with ROMSEGSZ size, which is a macro that picks a ROM segment with at least size words available. That way, you don't need to end your program with a ROMSEG statement pointing to a segment big enough for a huge blob of stuff; rather, it'll semi-intelligently fill the remaining space. Not as smart as a proper linker, but smarter than what currently happens.

 

The key is that the macros need to be assembler macros, not DEF FN macros. Without extending IntyBASIC, they still need to be ASM statements, then.

 

Alternately, if IntyBASIC wants to make this more automated, it can batch up instructions and count the codesize itself, and then issue its own equivalent to ROMSEGSZ ahead of each of those segments. That's a bit more work on the IntyBASIC internals, but it would make things a bit more automated. It might make it slightly more difficult to squeeze every last drop out of a ROM, but it's a tradeoff.

Link to comment
Share on other sites

 

You wouldn't want CPU executable code to be emitted while you checked parameter x (from your example) to decide which asm org $xxxx directive to emit. You'd want that done by the equivalent of C/C++ preprocessor directives.

Ah! DOH! :dunce:

 

I was thinking of multi-line macros like the ones for the Assembler pre-processor, complete with conditional directives. I forgot that IntyBASIC macros are more limited.

 

dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...