CIRCLE/OVAL in BASIC

For posting library code and examples.
User avatar
ahenry3068
Posts: 1134
Joined: Tue Apr 04, 2023 9:57 pm

CIRCLE/OVAL in BASIC

Post by ahenry3068 »

Until someone comes along and does an ML module for this or Oval is implemented in ROM.
This is as good as it gets. :)

Implementation of Breshenham Circle Algorithm in Basic. Heavily modified at the cost of a little speed to do Clipping (Can draw a circle thats only partially on screen). Ovals (Using XSquish & YSquish modifiers), Can do filled or open Circles. and by Modifiying Q1,Q2,Q3,Q4 variables prior to calling Partial Circles and limited Arcs can be drawn.
(Its not a TRUE Arc algorithm. But by playing with XSquish & YSquish and the Q variables, I've been able to do anything I've needed to draw)

Line Numbered and BASLOAD version in the archive.

The Line Numbered version is also a little example program. The BASLOAD version is just the Routine.

Heres the code.
CIRCLE.zip
(1.94 KiB) Downloaded 510 times

An additional Example program.
Draws a Smiley Face Calling only BCircle
SMILEY.BAS
(2.47 KiB) Downloaded 376 times
SMILEY.PRG
(1.23 KiB) Downloaded 378 times
smiley.png
smiley.png (6.26 KiB) Viewed 12747 times
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: CIRCLE/OVAL in BASIC

Post by funkheld »

Hi good afternoon.

What kind of basic is this written with?
the basic has no line numbers?

Thanks.
greeting
kelli217
Posts: 531
Joined: Sun Jul 05, 2020 11:27 pm

Re: CIRCLE/OVAL in BASIC

Post by kelli217 »

There is a program for the X16 called BASLOAD. This program will take text files that do not use line numbers, and can use long variable names, and will convert it into a proper CBM BASIC 2.0 (with X16 extensions) program. The resulting program will have line numbers, and will also make use of those line numbers in place labeled entry points for GOTO and GOSUB statements. Also, all of the variable names will be converted into the standard variable name format, which is only two characters.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: CIRCLE/OVAL in BASIC

Post by funkheld »

hello thanks for info.
Where is the executable basload program please?

greeting
User avatar
ahenry3068
Posts: 1134
Joined: Tue Apr 04, 2023 9:57 pm

Re: CIRCLE/OVAL in BASIC

Post by ahenry3068 »

funkheld wrote: Fri Mar 01, 2024 8:38 pm hello thanks for info.
Where is the executable basload program please?

greeting
There are two versions of BASLOAD. One resides in RAM. That version is here viewtopic.php?t=6322

The other version resides in ROM and is available in the latest pre-release ROM. (You have to download and compile it from github).
https://github.com/X16Community/x16-rom


The RAM version works but I'm using the ROM version for my code which is required for some more advanced features (Long variable
names).
mortarm
Posts: 298
Joined: Tue May 16, 2023 6:21 pm

Re: CIRCLE/OVAL in BASIC

Post by mortarm »

ahenry3068 wrote: Fri Mar 01, 2024 10:12 pm The RAM version works but I'm using the ROM version for my code which is required for some more advanced features (Long variable names).
According to another post, the variable names are still reduced to two characters at execution, which would make such a feature meaningless.
User avatar
ahenry3068
Posts: 1134
Joined: Tue Apr 04, 2023 9:57 pm

Re: CIRCLE/OVAL in BASIC

Post by ahenry3068 »

mortarm wrote: Sat Mar 02, 2024 2:21 pm
ahenry3068 wrote: Fri Mar 01, 2024 10:12 pm The RAM version works but I'm using the ROM version for my code which is required for some more advanced features (Long variable names).
According to another post, the variable names are still reduced to two characters at execution, which would make such a feature meaningless.
This is true in the Ram version. In the ROM version ALL variables are remapped in the tokenized code and Long Variable names are kept unique even though they are reduced to 2 chars when Tokenized. Believe me it is very useful
mortarm
Posts: 298
Joined: Tue May 16, 2023 6:21 pm

Re: CIRCLE/OVAL in BASIC

Post by mortarm »

As long as the names remain unique, I agree. I wasn't aware of any distinction between the two versions.
User avatar
ahenry3068
Posts: 1134
Joined: Tue Apr 04, 2023 9:57 pm

Re: CIRCLE/OVAL in BASIC

Post by ahenry3068 »

mortarm wrote: Sun Mar 03, 2024 4:37 am As long as the names remain unique, I agree. I wasn't aware of any distinction between the two versions.
If you are doing any BASIC development I strongly recommend downloading and using the Pre R47 ROM. I've been using it almost exclusively for quite some time. It's also what the Production boards are currently shipping with. To use the ROM version its a very simple matter of BASLOAD "MYSOURCE.BAS" in immediate mode.

Very good documentation also.
mortarm
Posts: 298
Joined: Tue May 16, 2023 6:21 pm

Re: CIRCLE/OVAL in BASIC

Post by mortarm »

ahenry3068 wrote: Sun Mar 03, 2024 4:40 am I strongly recommend downloading and using the Pre R47 ROM.
What's wrong with the R47 ROM?
Post Reply