Login
Back to forumReply to this topicGo to last reply

Posted By

JimmyCoupe
on 2024-09-30
08:13:17
 Newbie coder needs a little bit of help

I am getting into coding on my Commodore Plus4 and I am having an issue doing something relatively basic in Commodore basic. There doesn't seem to be a Print At command and I can't seem to find what I am looking for in the manual or internet. How would I go about printing something to a on-screen x & y position? I might have a few questions as a progress so I thought it a good idea to make myself a forum thread for my questions happy.

Sorry if some of my questions are obvious but I have never found Commodore basic as straight forwarded.

Posted By

SukkoPera
on 2024-09-30
08:27:03
 Re: Newbie coder needs a little bit of help

Have a look at the CHAR function.

Posted By

JimmyCoupe
on 2024-09-30
08:57:17
 Re: Newbie coder needs a little bit of help

Superstar, that is actually what I have been trying to do. Feel a bit useless as something like that should be pretty obvious but hiding the print at in a CHAR command is likely why I was suffering happy. Now I can get on with writing my master piece happy

Posted By

Csabo
on 2024-09-30
09:50:44
 Re: Newbie coder needs a little bit of help

Perhaps an even better answer would have been to take a look at the CHAR Statement happy (It's minor, but it's a statement, not a function, and we do have it detailed right here on the site.)

Good luck JimmyCoupe, can't wait to see what you will cook up happy

Posted By

JimmyCoupe
on 2024-09-30
10:42:11
 Re: Newbie coder needs a little bit of help

Thanks Csabo, it won't be anything like your master pieces but I'm excited and motivated. This will be my second attempt at a game for the Plus/4, last year I wrote myself a text adventure covering lots of the basics of programming the Plus4 including a game loading screen. This next game will be a slightly bigger challenge allowing me to learn more concepts allowing me to one day write a graphical game. I am a coder by day, I have been a VFP frontend developer for 30 years but Commodore and VFP are worlds a part but I am motivated and my end goal is to be able to write a graphic game with wall, sprites and everything happy.

Posted By

Lavina
on 2024-09-30
11:13:58
 Re: Newbie coder needs a little bit of help

hey, and where is that adventure? I can't find it on our site

Posted By

JimmyCoupe
on 2024-09-30
11:21:05
 Re: Newbie coder needs a little bit of help

I never released it, it was my first real attempt at having a proper go at writing a text adventure and learning how to use some of the key concepts and design for such a thing. If anyone would like a look at it, and if I can still find the source on my HDD then I will happily upload a copy happy. Its the classic, village, tavern, cave and dragon adventure happy

Posted By

Litwr
on 2024-09-30
11:42:13
 Re: Newbie coder needs a little bit of help

There are compilers for Basic - they can speed-up Bascic programs much. And BTW what does VFP mean?

Posted By

SukkoPera
on 2024-09-30
11:46:43
 Re: Newbie coder needs a little bit of help

I had actually checked if there was an entry in the Encyclopedia but I had erroneously looked under Programming/BASIC and of course I couldn't find anything, sorry for that.

And of course you are right, it's a statement, please forgive my C/C++ mindset grin.

Posted By

JimmyCoupe
on 2024-09-30
11:55:05
 Re: Newbie coder needs a little bit of help

Cool, could you point me at one of the compilers please?

VFP stands for Visual Fox Pro or the long name is Microsoft Visual Fox Pro. I am one of the rare ones left happy.

Posted By

Csabo
on 2024-09-30
12:18:02
 Re: Newbie coder needs a little bit of help

The Basic Compilers are listed here. (From the top menu, Software | Utility | BasicCompiler.) Out of these, AustroSpeed Compiler is the most well known.

Litwr wrote a cross compiler as well: CBCCWIF.

Posted By

JimmyCoupe
on 2024-10-01
04:07:01
 Re: Newbie coder needs a little bit of help

Thanks Csabo, I used AustroSpeed Compiler last night with good success. It was nice and simple to use.

Good news, I found my game that I wrote for the plus4 last night but I got confused, the loading screen I made was for the Commodore 64 version as the game works on C64, C16+4 and Vic20. It was really easy to make a loading screen for the C64, if I remember they have a tool and you use an old C64 art program to make the picture happy.

The game is called Dragon Slayer and its a small classic text adventure with a village, dragon and a tavern. Would the plus4world like me to upload a copy? I will include the source code as it might be useful for other newbies.

Posted By

Harry Potter
on 2024-10-01
07:28:15
 Re: Newbie coder needs a little bit of help

JimmyCoupe: It's probably too late for this, but I have two text adventure codes for cc65 around which one can create text adventures. They are AdvSkelVic65 and AdvSkel65. AdvSkelVic65 is for low-end computers such as the Vic20 and unexpanded C16, while AdvSkel65 is designed for 64k and 128k 8-bit computers and has options to use almost all of the memory on most targets. I believe they're very efficient, as I use my CBMSimpleIO library, my memory extensions, my Cubbyhole optimization technique, lots of inline assembler and a lot of other optimizations. They are at https://sourceforge.net/projects/cc65extra/files/game/. If you want more information without downloading, they're on this website under Tools\Programming. BTW, they support text compression via PrintTok1, but it requires manual compression and only compresses tokens. sad

Posted By

Luca
on 2024-10-01
07:55:38
 Re: Newbie coder needs a little bit of help

Harry Potter, may I say that this weird fascination which pushes you to spam the same information by you on every other thread, probably is the reason why you gained a thread on the Lemon64 forum titled:" Harry Potter thread spam"? grin

Posted By

JimmyCoupe
on 2024-10-01
09:22:20
 Re: Newbie coder needs a little bit of help

Thanks for pointing at your resource Mr Potter but this project was more me learning the concepts, structure and approach of writing a text adventure so I had and wanted to write it from ground up with all my own code. From a background of coding its important for me to learn the hows and its not about the end product at the moment whilst I learn. The end result is just a side effect of the lesson happy.

Posted By

MMS
on 2024-10-01
14:59:47
 Re: Newbie coder needs a little bit of help

@JimmyCoupe:
The Plus/4 Programmer's Reference Guide is a great support:
Programmer's Reference Guide For The Commodore Plus/4

Not to mention SVS's great summary file (more focused on lower level programming)
Ultimate Map

For creating GFX you can easily load into your machine the (multi)Botticelli and Multipaint are great tools.
the file you saved from Botticelly, you can load directly, just the background color and color3 (in case of multicolorpic) need to be set.

Posted By

Crown
on 2024-10-02
02:21:32
 Re: Newbie coder needs a little bit of help

The download link doesn't really work on the download page of Ultimate Map

Posted By

JimmyCoupe
on 2024-10-02
04:21:07
 Re: Newbie coder needs a little bit of help

Thank you MMS that is really kind to point me at these useful resources. The programmers reference guide is essential reading for me and something I need at the moment and the graphic tool sounds like something I will need happy.

Posted By

gerliczer
on 2024-10-02
06:36:57
 Re: Newbie coder needs a little bit of help

@Crown: Strange. I checked it with FF, Vivaldi and Edge, and it took me every time to the actual download page, from where all three browsers could download it after a little convincing.

Posted By

Crown
on 2024-10-02
08:37:23
 Re: Newbie coder needs a little bit of help

I'm using Chrome on Mac and this is what's on the javascript error console if I just click that download link:

Mixed Content: The site at 'https://plus4world.powweb.com/' was loaded over a secure connection, but the file at 'https://plus4world.powweb.com/dl/tools/rommap/svs_rom_map_v2-1.zip' was redirected through an insecure connection. This file should be served over HTTPS. See https://blog.chromium.org/2020/02/protecting-users-from-insecure.html for more details.

Now if I right click and select download link, then it starts the download but still triggers the unsafe download process, so you have to massage it a bit to get the file. At the same time downloading any zipped TAP file works ok anywhere on the site, which should be the expected behaviour here as well. I assume this might coming from exeternal hosted site, but in that case the direct link would be better on the page.

Posted By

Csabo
on 2024-10-02
08:46:40
 Re: Newbie coder needs a little bit of help

The download link for the Ultimate Map has been fixed.

I turned off that feature in FF, since all the Othersi links are HTTP only as well.

Posted By

JimmyCoupe
on 2024-10-04
08:43:16
 Re: Newbie coder needs a little bit of help

Is there a tool like "petscii-compositor" that works on the Plus4? this program says it has experimental plus4 color compatability but the saved .prg doesn't load on a Plus4. It can consume a .png etc and output it as a .prg.

*** UPDATE *** Don't worry people I am sorted, I found the awesome "sic-p4", works really well :-)


HELP PLEASE:- How would I go about loading a .prg picture, waiting for a keypress and then loading my main game.prg?

I want to have a loading screen and then run my adventure, pretty much what I get when I download a text adventure from plus4 world. I do have a picture.prg that I have created with the Sic P4 tool.


Posted By

Csabo
on 2024-10-04
11:11:57
 Re: Newbie coder needs a little bit of help

From BASIC, that's pretty easy:

0 IFA=1THEN1:ELSEA=1:LOAD"GFX",8,1
1 GRAPIC1:GETKEYA$:DLOAD"GAME"

Assuming your picture is saved from $1800 and it's called "GFX" and the main program is called "GAME", this will do exactly what you described.

Posted By

JimmyCoupe
on 2024-10-04
14:37:28
 Re: Newbie coder needs a little bit of help

*** post correction ***

Thanks for the help Csabo.

The code does work but the second line fails to pick up a key press. (I thought it had crashed but it just takes a while to load the graphic :-)).

Would this be due to the picture not being saved in $1800? this is what the sic-p4 tool says:

"The program outputs a .prg file for plus4 or a .png image for viewing on PC. The .prg file has the bitmap data at $4000 and the color data starting from $6000. It also has an assembler code for showing the picture at $2000 and a basic code that calls the assembler code included. Exception to this is the normal graphic mode, which can be loaded on c16."

Update: its the graphics fault. I can see why its not picking up the key press as the package is making a runtime that does let me escape from its routine so the 2nd line of your code doesn't fire. Is there a better tool or should I be doing something else to the file sic-p4 creates?


*** Update ***
I have made another picture using DFLICONV2GUI, which came out excellent but I get the same effect as above. The first line of code loads the picture but then I am not getting the second line of code to fire and it just sits on the picture. DFLICONV2GUI does do an excellent job of the conversion I must say :-)

Posted By

Csabo
on 2024-10-04
14:54:18
 Re: Newbie coder needs a little bit of help

The issue is very likely that you're not switching back from GRAPHIC 1 (or 3, if it's a multicolor picture) to the text screen. Somewhere in your program (e.g in the first line of your main game) you should do a GRAPHIC 0.

Posted By

JimmyCoupe
on 2024-10-04
15:18:33
 Re: Newbie coder needs a little bit of help

I have just added a graphic 0 as the first line in my game but its not the issue sadly. The code is just loading the picture. Even when I just load the pictures created by sic-p4 and DFLICONV2GUI I have to reset the plus4 as you can't crash out of them. The .prg the programs make are like they have there own runtime loop.

I get no disk drive activity light once the picture loads and I am pushing keys with the code.

Posted By

MMS
on 2024-10-05
03:40:25
 Re: Newbie coder needs a little bit of help

We had a similar case beforehand, and while this was pretty common to load the starting screen (like on ZX Spectrum), why you do not integrate the picture loading routine into your program to do everything alone?
The linked routine was the common work of gerliczer, George (who needed a loader routin for his planned gfx adventure) and me (needed a loader for my pictures).

You can copy and paste as a subroutine (and you can find the examples how to use for different GFX formats):
Load HIRES/MULTI Bitmap To The Screen

It will not load it faster, but a more elegant way than this strange spaghetti code required in Commodore computers (although I know some sceners here like the Italian food happy ), and you can load anything anywhere without the need to restart your program. Your own fontset, gfx, music or small assembly code. In fact, C128 has a specific command for this task, BLOAD, does exactly the same.

The simplest use (as you can see in the examples just to use this loader to load to $1800-3fff the gfx originally created and positioned at this place, or somewhere else.
(Multipaint, Botticelli, Microillustrator saves the pictures to the default $1800-$3fff area")

There is a second routine allows to copy a part of the picture (you may load it to eg. at $5800 with the above routine), then copy only the required elements to the main gfx screen with this:
How To Display A Multicolor Bitmap

Posted By

siz
on 2024-10-05
06:45:23
 Re: Newbie coder needs a little bit of help

There was a bug in the original code snippet which @Csabo posted. He already fixed it in his post, you should try the updated one.

Posted By

Csabo
on 2024-10-05
07:53:22
 Re: Newbie coder needs a little bit of help

The problem is likely with the GFX file you're loading. I assumed it would be a picture only, saved from $1800. You are probably loading a program file - which will completely overwrite your code and won't be able to continue.

(With the A=1 flag missing from the code, the code would be in an infinite loop and it would keep loading the picture nonstop, without ever showing it.)

Posted By

JimmyCoupe
on 2024-10-05
11:09:40
 Re: Newbie coder needs a little bit of help

Many thanks MMS and Csabo for your kind help. Forgive me for being at the basic level but your right I am loading a program file which is what comes out of those tools so its not going to work so I have decided to spin things on its head to make things less challenging and complicated for me at the moment. I can use my cool picture as the finishing screen so its not going to waste.

I have decided to take a different approach and I would like to understand why this fails to load my game. The game file on the disk is called dragon.prg and its opening code lines are these:

10 rem ***dragon slayer***
20 graphic0
30 cr=2:dm=1:ok=0:gc=0:br=0
40 sw=0:bs=0:sk=0:bo=1
50 gosub 5000:gosub 6000:gosub 500
60 rem ***main loop***

if I load the game as normal with either load"dragon",8,1 or dload"dragon" the game loads fine with no error. Now if I write the following in basic to load the game:

0 dload"dragon"
or
0 load"dragon",8,1
and then run the code I get the following error:
"?OUT OF DATA ERRROR IN 5005"

If I also use:
0IFA=1THEN1:ELSEA=1:LOAD"DRAGON",8,1
I get the above error.

What am I not understanding?

Posted By

Csabo
on 2024-10-05
11:50:31
 Re: Newbie coder needs a little bit of help

Hey, have you been getting my PMs? happy

Posted By

JimmyCoupe
on 2024-10-05
12:52:09
 Re: Newbie coder needs a little bit of help

Just replied, sorry had my head in CBM Studio happy

Posted By

Csabo
on 2024-10-06
13:53:03
 Re: Newbie coder needs a little bit of help

Title:DragonSlayer
Category:Game/Adventure
Release Date:2024-10-06
Language:English
Size:16K
Machine:PAL & NTSC
Code Type:Basic
Distribution:Freeware
DragonSlayer Screenshot


The game has been released! Congrats to JimmyCoupe for the first completed project! happy

Posted By

TCFS
on 2024-10-06
14:08:40
 Re: Newbie coder needs a little bit of help

Congrats, keep up the good work...

Posted By

JimmyCoupe
on 2024-10-06
14:44:10
 Re: Newbie coder needs a little bit of help

Thank you, its my first proper attempt at making a little game. Many thanks must also go to Csabo for his time and patience teaching me where I am blind.

Posted By

BSZ
on 2024-10-06
15:37:58
 Re: Newbie coder needs a little bit of help

@JimmyCoupe: Congratulations on your first game on this machine! happy



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon