Page 1 of 1

Native BASIC

Posted: Sun May 04, 2025 5:00 pm
by NibbleNut
Hi all...noob here but learning fast. I should say...relearning LOL.
For commodore Basic, which program do I launch? The commodore emulator doesn't recognize some commands such as for loops and commodore OS basic program doesn't do some graphics commands. Nedither of these look like the emulators I see online for programming examples.

Please help

Re: Native BASIC

Posted: Mon May 05, 2025 3:37 am
by LeoNigro
Hi NibbleNut,

To use Commodore OS BASIC at the moment, you need to run the specific editor for it.
From the top menu:
Applications --> Programming --> Commodore OS BASIC Studio
This is broken on COS3 Beta 6 and will be fixed as part of the update coming soon.
If you downloaded COS3 you have beta 8.
If you are programming in Commodore OS BASIC I would urge you to save files outside of it's application base path, like say to your Documents folder, as I may have to delete or clobber application files on updates.

The retro interface version, which is the first option in the programming menu is still in the very, very early development stage.

Please let us know how you go in your BASIC development even if it is small.
My focus will soon be shifting to enhancing the experience and developing the multi platform part.
That doesn't involve enhancing BASIC on the C64 as such, so you won't be able to use the new BASIC on classic machines.
Rather you would develop in BASIC on Commodore OS and compile a binary to run on the classic machines.
Please note, that only a subset of the commands in Commodore OS BASIC will be available for this process and the commands and language will evolve.

Re: Native BASIC

Posted: Tue May 06, 2025 12:04 pm
by NibbleNut
I do have beta 8 and that's what I've been using (basic studio). Now I know it's broken, I can wait that's fine, however, since I got C64 forever to run, I'm able to run the original C64 basic. I just can't figure out how to save my programs.

Everywhere says you have to setup a D64 drive.

btw.....love what you do here. The nostalgia you bring is amazing.

Re: Native BASIC

Posted: Tue May 06, 2025 5:01 pm
by LeoNigro
You might want to try out CBM prg Studio from the programming menu.
It lets you program in BASIC via an editor and then run it in an emulator.
You must run the Cloanto 8-bit ROM setup from the Settings Manager for it to work.

BTW Commodore OS BASIC Studio should not be broken in Beta 8. Try running the Beast demo project under graphics examples.

Re: Native BASIC

Posted: Wed May 07, 2025 12:28 am
by NibbleNut
ok..ya, that works. Ok, awesome. There were just some commands that didn't work like boxfill, etc but beast runs well so I'll go with that.

\Thanks again.

Re: Native BASIC

Posted: Thu May 08, 2025 6:52 pm
by NibbleNut
NibbleNut wrote: Wed May 07, 2025 12:28 am ok..ya, that works. Ok, awesome. There were just some commands that didn't work like boxfill, etc but beast runs well so I'll go with that.

\Thanks again.
Update: Working well. Learning lots. I can see that this is a new basic though and not the original C64 with Sprites. Recall, I can run the original under C64 forever but cannot save my programs.

Anyway, here is what I've been playing around with. Still early stages but makes me smile. Replace sounds and images as you see fit OR comment them out.
SNAKE GAME
Dim intNumSquares
Dim intX
Dim intY
Dim X
Dim Y

Dim SnakeX[6]
Dim SnakeY[6]

Dim Count
Dim Code

Sub Delay(lngDelay)
For i=1 to lngDelay:next
End sub

Sub GameOver()
Clearcanvas()
Loadimage(0,"Untitled.xcf")
Drawimage(0,0,0)
Rect(0,0,600,400)
Update()

Waitkey()
end
End sub

intX=10:intY=0 '**Direction
X=50 '** Location
Y=50
intNumSquares=6
Count=0

WindowOpen(0, "Snake Game", 1, 0, 620, 420, WINDOW_VISIBLE, 1)
CanvasOpen(0, 620, 800, 10, 10, 620, 420, 0)
Canvas(0)

SnakeX[0]=10:SnakeY[0]=10
SnakeX[1]=-1:SnakeY[1]=-1
SnakeX[2]=-22:SnakeY[2]=-22
SnakeX[3]=-33:SnakeY[3]=-33

Loadimage(1,"ixc59ldr3cd91.xcf")

SetColor(RGB(255,0,0))
Update()

While True
Rect(0,0,600,400)
Drawimage(1,100,100)
Drawimage(1,400,300)
Drawimage(1,50,300)
Drawimage(1,400,75)

Rectfill(SnakeX[0],SnakeY[0],10,10)
Rectfill(SnakeX[1],SnakeY[1],10,10)
Rectfill(SnakeX[2],SnakeY[2],10,10)
Rectfill(SnakeX[3],SnakeY[3],10,10)

Update()

Code=Inkey$
select case Code
case K_RIGHT
intX=10
intY=0
case K_DOWN
intX=0
intY=10
case K_UP
intX=0
intY=-10
case K_LEFT
intX=-10
intY=0
Default

end select

SnakeX[3]=SnakeX[2]
SnakeY[3]=SnakeY[2]
SnakeX[2]=SnakeX[1]
SnakeY[2]=SnakeY[1]
SnakeX[1]=SnakeX[0]
SnakeY[1]=SnakeY[0]
SnakeX[0]=SnakeX[0]+intX
SnakeY[0]=SnakeY[0]+intY

ClearCanvas()

'***** Check for boundaries
if SnakeX[0]>=600 or SnakeX[0]<=1 then
Loadsound(0,"hitWall.wav")
Playsound(0,1,1)
Delay(8000000)
Gameover()
end if
if SnakeY[0]>=400 or SnakeY[0]<=1 then
Loadsound(0,"hitWall.wav")
Playsound(0,1,1)
Delay(8000000)
Gameover()
end if

'***** Check for collision
Print Getpixel(SnakeX[0],SnakeY[0]);SnakeX[0];SnakeY[0]
if Getpixel(SnakeX[0]-intX,SnakeY[0])<>4278190080 and Getpixel(SnakeX[0]-intX,SnakeY[0])<>4294901760 then
Print Getpixel(SnakeX[0],SnakeY[0])
Loadsound(0,"hitWall.wav")
Playsound(0,1,1)
Delay(8000000)
Gameover()
end if

Delay(5000000)
wend