RENUM utility BETA

Talk about your programs in progress. Discuss how to implement features, etc.
Forum rules
This section is for testing Commander X16 programs and programs related to the CX16 for other platforms (compilers, data conversion tools, etc.)

Feel free to post works in progress, test builds, prototypes, and tech demos.

Finished works go in the Downloads category. Don't forget to add a hashtag (#) and the version number your program was meant to run on. (ie: #R41).
novemix
Posts: 18
Joined: Wed Jan 27, 2021 10:47 pm

Re: RENUM utility BETA

Post by novemix »

Hmm, yeah, if they're checking for F2 with a "reverse-shift-i" though, this could be a problem, hmm...
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: RENUM utility BETA

Post by TomXP411 »

novemix wrote: Thu Jan 19, 2023 12:18 am Hmm, yeah, if they're checking for F2 with a "reverse-shift-i" though, this could be a problem, hmm...
The good news there is that, to check F2, you're likely to do something like this:
GET A$:IF A$=CHR$($89) THEN do something
So I think you're safe on this one. Just noting that it's possible, and suggesting people use CHR$(89) and CHR$(8D), rather than entering the character code in reverse text, should be enough to prevent this from happening. (For the record, $8D is SHIFT+RETURN, so it's not something you can or should ever have in a quote string, either.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: RENUM utility BETA

Post by TomXP411 »

Hi, Novemix. I was wondering if you ever made any progress on this?

I am working on a program that works in the banked memory, so I was hoping to talk you into assembling a version that loads into $400
nighthawk1961
Posts: 3
Joined: Tue Mar 28, 2023 4:13 pm

Re: RENUM utility BETA

Post by nighthawk1961 »

I tried this utility but it doesn't seem to work correctly after the developers instructions were followed. I use v42 both since it is the newest version and because it allows the local file system to be drive 8 rather than the sdcard.img file. Any help I could get to use this wonderful utility would be greatly appreciated. Thanks.
novemix
Posts: 18
Joined: Wed Jan 27, 2021 10:47 pm

Re: RENUM utility BETA

Post by novemix »

Hey, @nighthawk1961, I'll have to see what the issue is with R42.

And @TomXP411, $0400 probably isn't possible, I don't think the code is even small enough to fit, plus it needs space to build a table. But I'm sure I could change things where it could use a bank that the user specifies rather than what's currently active at runtime.
BruceRMcF
Posts: 224
Joined: Sat Jan 07, 2023 10:33 pm

Re: RENUM utility BETA

Post by BruceRMcF »

novemix wrote: Mon Apr 10, 2023 12:07 am Hey, @nighthawk1961, I'll have to see what the issue is with R42.

And @TomXP411, $0400 probably isn't possible, I don't think the code is even small enough to fit, plus it needs space to build a table. But I'm sure I could change things where it could use a bank that the user specifies rather than what's currently active at runtime.
$0400 could be used for the main program entry point and to store the HighRAM segment number that contains the rest of the code.

Indeed, you could have a common prefix that generates a syntax error and a linked list of routine names and the HighRAM segment & routine addresses, and the $0400 code is just the syntax error entry point which parses the name, runs through the linked list looking for the matching name, and when found does a long call to that address in that HighRAM segment. Then once you have the base code for the $0400 routine, the only LowRAM overhead for adding another command line function is the name of the command and the segment & address of the code that implements the function.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: RENUM utility BETA

Post by TomXP411 »

novemix wrote: Mon Apr 10, 2023 12:07 am Hey, @nighthawk1961, I'll have to see what the issue is with R42.

And @TomXP411, $0400 probably isn't possible, I don't think the code is even small enough to fit, plus it needs space to build a table. But I'm sure I could change things where it could use a bank that the user specifies rather than what's currently active at runtime.
As Bruce suggested, you can use another bank for the bulk of the code, or at least your table, but you can't have the Syntax Error hook pointing into a bank, because if the selected bank changes, the system will crash.

I'm going to suggest querying MEMTOP to see how much RAM is installed, then subtract one from the returned value as your bank number. Realistiaclly, you're going to get 0 (which is 256), or $40, which is 64.

So your routine would
  • read the active bank
  • save it to the stack
  • switch to bank $FF or bank $3F to perform the renumber
  • pop the previous bank back off the stack and switch back to that bank.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: RENUM utility BETA

Post by TomXP411 »

FYI, @MooingLemur has added a RENumber command to the system ROM, so this has probably become redundant.
novemix
Posts: 18
Joined: Wed Jan 27, 2021 10:47 pm

Re: RENUM utility BETA

Post by novemix »

TomXP411 wrote: Mon Apr 10, 2023 5:17 am FYI, @MooingLemur has added a RENumber command to the system ROM, so this has probably become redundant.
Ah, very good. Is it in R42?
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: RENUM utility BETA

Post by TomXP411 »

It's not in R42. He just checked it in yesterday, so it will be in the next major release.

If you want it sooner, you can go to the project page and look in the "Actions" tab for the latest build of the ROM. This ROM should work on the R42 emulator.

https://github.com/X16Community/x16-rom/actions
Post Reply