Page 1 of 1

BASLOAD and other general X16 usage

Posted: Mon Nov 11, 2024 6:02 am
by voidstar
As I recall, the initial launch (pre-orders) of the X16 production boards was October 1st 2023. We were still testing BASLOAD then and weren't yet quite sure if it would make it as part of the System ROM. In part of that testing, I recall writing a TexElec Pre-Order Simulator using BASLOAD, to help us train for that day that web-site would go live. I think that remains as a Discord-exclusive :) Well, it might have also snuck onto the SD-card (POSIM!).

Last year around this time, we were prepping the SD-card content -- I still haven't finished the last levels of Vault of Vindicator or Scumbotron!! I do get close though, so close.

To celebrate this sort-of 1-year anniversary of the system (technically deliveries started in January), I made time to put together this video about BASLOAD. I thought it would be a brief <10 minute thing, but I ended up touching on several related topics (since I tried to present it from a perspective of someone who had never used a CBM system before). It may not answer all the questions out there, but I hope it helps at least a few people get started on their own X16 journey!





Also, attached is how I ended up "BASLOAD enhancing" the first sample program covered in this discussion. Use the mouse wheel to change the offset of the sine wave, and the arrow keys left/right to adjust the amplitude.

Also attached is the original PROJECTILE.PRG that is also discussed at the end.

Feel free to spin your own enhancements!

Re: BASLOAD and other general X16 usage

Posted: Tue Nov 12, 2024 5:05 am
by voidstar
For reference, here is the original IBM 5100 BASIC example that was (briefly) discussed. I didn't have this manual with me at the time of the video, I don't think it has been digitized in full yet (SR30-0076-0 from 1975).
IBM5100example32.jpg
IBM5100example32.jpg (737.31 KiB) Viewed 359 times

Re: BASLOAD and other general X16 usage

Posted: Tue Nov 19, 2024 7:33 pm
by mobluse
If one used the row numbers of the built in Nano like editor as line numbers of the BASLOAD generated BASIC program, it would be easier to find runtime errors in the source file.

Great video!

Re: BASLOAD and other general X16 usage

Posted: Tue Nov 19, 2024 7:59 pm
by Stefan
Yes, we need a solution to that. The #include option complicates things. Maybe a reverse lookup function in BASLOAD

Re: BASLOAD and other general X16 usage

Posted: Wed Nov 20, 2024 5:16 am
by voidstar
Ah, true - that is one thing I didn't cover: tips on tracing X16 KERNAL BASIC syntax errors of tokenized BASIC back to your original BASLOAD project.

Another BASLOAD-option is the #REM feature, to preserve your original REM comments.

This is off by default since technically "REM" content does slow down interpreted-BASIC runtime. But when " #REM 1 " is used and you have a good amount of comments in your code, then having those REM's repeated in the tokenized BASIC can help narrow down where an error is at.

So, if the KERNAL ROM BASIC says some Syntax Error in line 180.... then I just do " LIST 150-200 " (basically the nearest group of 5 lines around the error, but not so much that it scrolls off the screen at whatever text-mode I'm working at) and look for REM content as a guide to search for back in the BASLOAD plain-text.

In more complex cases, like nested GOSUBs - I've actually not looked into how GOSUB stack is handled on the X16 (not sure if it uses the system stack region or its own reserved spot; wouldn't be too hard to reverse engineer into). But insight to this could help formulate a kind of "call stack" that can be examined just after a syntax or runtime error.

Re: BASLOAD and other general X16 usage

Posted: Wed Nov 20, 2024 5:17 am
by voidstar
For additional BASLOAD tutorial "stuff" and starter sample exercises, refer to:
viewtopic.php?p=34302#p34302


Once mastered all those starter examples, then next step up to consider:
(mortgage calculator, in BASLOAD) [practice GOSUB]
viewtopic.php?p=34440#p34440
(coinflip exercise, in BASLOAD) [practice DIM arrays and BANK]
viewtopic.php?p=34588#p34588
(very basic program launcher, in BASLOAD) [practice using DOS commands from within BASIC]
viewtopic.php?p=33780
(velocity target practice, in BASLOAD) [initial example of using audio commands]
viewtopic.php?p=30571#p30571
(solar system calculator, in BASLOAD) [R48 RING example]
viewtopic.php?p=34654#p34654

Then for even more advanced stuff:
(bigfont and semi-bigfont, in BASLOAD)
viewtopic.php?p=34439#p34439
(base64 encoding/decoding, in BASLOAD)
viewtopic.php?p=33895#p33895
(radix converter, in BASLOAD) [practice DATA sequence usage]
viewtopic.php?p=33864#p33864
(memory matching game, in BASLOAD) [puts a lot of things together, then add audio!]
viewtopic.php?p=33960#p33960
(on-system font editor, in BASLOAD) [practice bit-twiddling and VPEEK/VPOKE]
viewtopic.php?t=6814


Then for even larger stuff that incorporate more inline assembler via POKEs, seek out these BASLOAD projects:
- X16 Synth (keyboard ISR)
- Lower Decks projects (mouse, joystick stuff)
- Zener ESP Test, BASTERM (serial I/O interaction)


Then beyond that is Tony's more full-fledged applications (including video, image viewers, audio playback) also largely done using BASLOAD: Hangman, Slideshow, Volume Control, and now Slots and many others.


As a project, I'd love to see someone evolve (using BASLOAD and sprites and such) a rendition of Wheel of Fortune that was done in 1984 BASIC:
viewtopic.php?p=28950&hilit=fortune#p28950
(but alas I only get to play around on weekends, and a project like this likely would take over a week)


Also, semi-related: I came across the following as a pretty excellent overview about all things related to PETSCII (including the relation to "display codes"):

https://www.masswerk.at/nowgobang/2020/petscii