x16lib - Library for BASIC and Assembly

For posting library code and examples.
Post Reply
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

x16lib - Library for BASIC and Assembly

Post by unartic »

In order to make developing for x16 as easy and convenient as possible, I've started working on a library that goes far beyond what the kernal currently offers. It sits in a rambank of choice and offers the programmer easy to use functions for common tasks.

For BASIC it taps directly into the BASIC variable space to ensure maximum performance.

x16lib is fully documented and with ready to use examples.

The current version offers only a few functions. I would like the community to suggest functions that needs to be in this library. So if you have idea's please post them below.

Please download here:
x16lib.zip
(171.24 KiB) Downloaded 155 times
userguide.pdf
(192.25 KiB) Downloaded 260 times


The current version of x16lib has the following functions:

Printcenter
Print a string in the center of the screen on a specific line

Swapveralayers
Swap the z-order of layer0 and layer1 of vera

Highmem functions
Quickly and easily save and read strings in/from any highram rambank.

Fading
Fades out the screen to all black and fade the screen back to normal operatingmode

String functions
Several well know string functions: trim, ltrim, rtrim, tally, instr and split

Custom keyboard handler
Custom keyboard handler which enables to get the state of individual keys and therefor can work with simultanious keypresses.


NOTE: As the ROM-version of BASLOAD remaps all variable names, BASIC programs loaded via the ROM-version of BASLOAD will not be compatible with x16lib at this moment.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: x16lib - Library for BASIC and Assembly

Post by funkheld »

Hi good afternoon.

the demos here from asm are wonderful.

Which assembler are they written for?
acme is not.

Thanks.
greeting
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: x16lib - Library for BASIC and Assembly

Post by unartic »

They are written for ca65.
User avatar
MADRAFi
Posts: 4
Joined: Thu Apr 13, 2023 9:10 am

Re: x16lib - Library for BASIC and Assembly

Post by MADRAFi »

Can you share source code for the lib? If someone wants to use these procedures in higher level languages, it would be better to wrap them in native procedures executing assembly, instead loading a binary and call the function.
I would like to add them to the Pascal unit.
ATARI
User avatar
Jakebullet70
Posts: 15
Joined: Sat Nov 21, 2020 8:18 pm

Re: x16lib - Library for BASIC and Assembly

Post by Jakebullet70 »

Really like this. Would like to see it work with BASLOAD as that is how I am writing all my code now.

As a new feature would like to see:
Save and restore parts of a screen. That way you could save part of screen, show a messagebox and then just restore the part that was overwriten.

Really nice work.
If you do not see any flak... Your not on target!
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: x16lib - Library for BASIC and Assembly

Post by unartic »

Jakebullet70 wrote: Fri May 31, 2024 4:07 pm Really like this. Would like to see it work with BASLOAD as that is how I am writing all my code now.

As a new feature would like to see:
Save and restore parts of a screen. That way you could save part of screen, show a messagebox and then just restore the part that was overwriten.

Really nice work.
I already have a solution for basload, however implementing is a bit complex and timeconsuming. It is on my list of of todo's, but that list is not very short at the moment ;-) As soon as I've made the changes, I'll post it here, so if you subscribe to this topic, you'll know asap.

You suggestion is also noted ;-)
User avatar
Jakebullet70
Posts: 15
Joined: Sat Nov 21, 2020 8:18 pm

Re: x16lib - Library for BASIC and Assembly

Post by Jakebullet70 »

Good deal. I have subscribed. Looking forward to seeing new features. :D
If you do not see any flak... Your not on target!
User avatar
Jakebullet70
Posts: 15
Joined: Sat Nov 21, 2020 8:18 pm

Re: x16lib - Library for BASIC and Assembly

Post by Jakebullet70 »

How about a way to run (chain / load) to a new PRG while being able to still see the STRINGS in HIGHRAM memory.

I have been looking at the HANGMAN PRG on the SDCARD and the author wrote out VAR's to an INI file before he ran another program.

---> My brain is in overdrive as I am writing code. :)
Last edited by Jakebullet70 on Sun Jun 02, 2024 7:59 pm, edited 1 time in total.
If you do not see any flak... Your not on target!
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: x16lib - Library for BASIC and Assembly

Post by unartic »

If you use the highram routines from x16lib, they will persist when chaining basic programs.
Post Reply