Here are a couple BASLOAD examples to show the setup of doing KERNAL calls from BASIC, and how to pass along register settings to those calls.
Also shows using the POINTER keyword on a BASIC-string and passing that pointer into a KERNAL call.
KDEMO1 uses GOLDEN-RAM ($0400), populating that and then dumping the content to a file.
KDEMO2 uses the BANK region ($A000), similarly populating that and dumping to a file. Since this a higher address region, a little extra steps are needed to pass the HI/LO portions of the address.
KDEMO3 shows using MCIOUT to write out a full copy of all of VRAM (in a couple seconds), followed by another approach that copies VRAM to BANK RAM and then BSAVE back to disk (which is much slower, like >5 minutes to write the 128KB).
Intended as an introduction to the general concepts of interfacing with X16 KERNAL calls from BASIC (using the "memory-mapped" register proxies in the $03XX region used by KERNAL). For instructive/discussion purposes, not intended as the optimal (performance) approach. The general processing flow can be applied to other languages (of where to POKE/PEEK).
Note, seems to me that CHKOUT ($FFC9) isn't yet documented at the X16 Tech Ref page.
Example of doing KERNAL calls (using MCIOUT) and POINTER on Strings
Example of doing KERNAL calls (using MCIOUT) and POINTER on Strings
- Attachments
-
- KDEMO3.BASL.TXT
- (6.09 KiB) Downloaded 18 times
-
- KDEMO2.BASL.TXT
- (4.58 KiB) Downloaded 20 times
-
- KDEMO1.BASL.TXT
- (4.44 KiB) Downloaded 16 times
Re: Example of doing KERNAL calls (using MCIOUT) and POINTER on Strings
Updated to include example of using MCIOUT to interact with VRAM.