Jump to content
IGNORED

Display a picture from fastBasic


shaoth

Recommended Posts

Hello, I have returned to programming for a few weeks on the Atari 800XL.
I started with the original Basic, the management of DLI and PMG.
It's way too slow!
So I started to fastBasic, it's really an incredible language and easy to learn.
Today I would like to display an image on the screen, for the title screen for example, but I don't know how to do it.
Either from an image made with the Atari Touch Tablet or even better from an image of my PC that would have been adapted for the Atari.
Could you tell me if it is possible and how to do it, with what tools.
Thanks for your feedback.

  • Like 1
Link to comment
Share on other sites

First of all, I make or convert an image with Atari Graphics Studio (download on the left side of that page).

 

I export the image as FastBasic (author kindly added that format for me).

 

In FastBasic (I use Mad Studio IDE), I paste the exported data in the code.

Then I write, for example

graphics 8+16
setcolor 2,0,0:setcolor 1,14,14
move adr(background),dpeek(88),7680 (this number is image's size in bytes)

 

 

Link to comment
Share on other sites

Download CC65 here: http://cc65.github.io/cc65/getting-started.html#Windows
Unzip all folders in C
Download fastbasic-windows here: https://github.com/dmsc/fastbasic/releases/
Unzip it in C:\cc65\fb

Download MadStudio here: https://atariage.com/forums/topic/258728-mad-studio/?do=findComment&comment=4331488

Unzip it in C:\madstudio

 

Double click on madstudio.exe, click on Source Code Editor, select FastBasic where you see Mad Pascal, go in Tool/Options/FastBasic, write C:\cc65\fb in FastBasic user definited location.
Now you can code.

If you click on Play icon, your program is compiled and runs with your emulator (if you have associated .xex extension with it).

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Hi!

 

I could not reply earlier, too much work this week :) 

 

Quote

I can not paste the 600 lines of datas in FB on Altira...

I got this :

Annotation 2020-01-21 065027.png

So, you found a bug in the FastBasic IDE: the editor does not check if adding a new line to the text will overflow the buffer.

 

I added a check for this and also a check when loading a new file, so next version will not crash when trying to enter programs that are too long - as always new source code is on github.

 

Have Fun!

Edited by dmsc
  • Like 2
Link to comment
Share on other sites

Hi!

On 1/19/2020 at 8:03 AM, shaoth said:

Hello, I have returned to programming for a few weeks on the Atari 800XL.
I started with the original Basic, the management of DLI and PMG.
It's way too slow!
So I started to fastBasic, it's really an incredible language and easy to learn.
Today I would like to display an image on the screen, for the title screen for example, but I don't know how to do it.
Either from an image made with the Atari Touch Tablet or even better from an image of my PC that would have been adapted for the Atari.
Could you tell me if it is possible and how to do it, with what tools.
Thanks for your feedback.

 

There are a few ways to display an image from your program, from "easier" to "harder":

 

1) You can save the binary image data to disk and load it when you need to display:

 OPEN #1, 4, 0, "D:MYIMAGE.BIN"
 BGET #1, dpeek(88), 7680   ' replace with the real size of your image
 CLOSE #1

This is great when you plan to distribute your program on a disk image (as you can distribute multiple files) and when developing, as you can change the image without recompiling your program, also you will have more memory available as you will only load the data on demand; but the disadvantage is that you can't then produce a single self contained file and that your program will only work from "D:".

 

2) As @Philsan already said, you can include the image directly in the source code. This is great for small graphic data, but has the disadvantage of making your source code very large (as you already discovered) and using a lot of memory in the main executable - this memory will also be used by the program.


3) You can append the image data to the compiled binary afterwards, to a specific location. This has the advantage of allowing the data to reside at a fixed memory location, so you can display it by simply changing to a custom display list and as the method 2 the resulting program will be self-contained; the disadvantage is that it is more difficult to produce the compiled program, and that you also will use the memory all the time.

 

Have Fun!

 

  • Like 4
Link to comment
Share on other sites

Thank you very much for all these informations.

 

I have a new question, about Players and Missiles this time.

I can display and move a Player with the Joystick and shoot a Missile.

I would like to shoot multiple Missiles on multiples Enemies.

Is it possible to display the same Missile on different positions on the screen ?

And by the same, multiples Players for Enemies ?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...