Beginners looking for support

All aspects of programming on the Commander X16.
Post Reply
Kaldarin
Posts: 2
Joined: Mon Mar 27, 2023 5:03 pm

Question Beginners looking for support

Post by Kaldarin »

I owned an original ViC20 and C64 in the 80s, but never really dealt with Basic at the time. I would like to get into programming. Have "a little" C++ and Java experience. As a practice project, I thought about a Pen&Paper D&D calculator that simulates simple battles between players and monsters using simulated dice results. But even with designing a simple interface for entering character stats, I don't even know where to start.

Is there a documentation or other assistance to get along with something like that. Positioning text and cursor input on the screen is a bit overwhelming for me.

Can someone give me a little help with this?
TomXP411
Posts: 1783
Joined: Tue May 19, 2020 8:49 pm

Re: Beginners looking for support

Post by TomXP411 »

Are you going to do this in BASIC, C, or assembly language?

The methods of doing things like positioning the cursor are a little different in each language:

BASIC has the LOCATE command:

Code: Select all

LOCATE ROW, COL
LOCATE with just the ROW keeps the same column. Consider this:

Code: Select all

10 LOCATE 5,5
20 PRINT "HELLO";
30 LOCATE 6
40 PRINT "WORLD"
The output looks like this:




     HELLO
          WORLD

READY.
█


C:
Using a C compiler, you could use the function gotoxy(), located in the conio library. There are also gotox() and gotoy() variants.

Assembly:
In assembly, you need to call the PLOT routine. Much like LOCATE, the .X and .Y are reversed, so you'd do something like

PLOT = $FFF0 ; sets an assembler variable

LDX row
LDY col
JSR PLOT


(check out https://www.pagetable.com/c64ref/kernal/ for a great listing of all the KERNAL routines. We don't have them all on the X16, but PLOT is there.)

Personally, I'd start with BASIC, since it's the easiest way to get your feet wet, and it doesn't require installing any extra tools. We're always happy to help here, or you can hit us up on the Discord (the link is on the commanderx16.com home page.)
c64c46c
Posts: 9
Joined: Thu Mar 16, 2023 3:09 am

Re: Beginners looking for support

Post by c64c46c »

Similar boat, different language choices over the years. What I am doing about it is going back to being like a child. of the 80s and doing what everyone did back then, copy in BASIC program after BASIC program until enought sneaks in through osmosis that I get it. I intend to do the same for ASM, but I'm not there yet. I am working on real C64c, but at some point I'll be on to other cool things like the x16.

There is an immense number of books with programs ready for typing here, https://archive.org/details/commodore_c64_books. I am sure others can recommend other "listings" copy in, there is no shortage of example programs out there to cut your teeth on.

There is this cool "CHEXSUM" program I found in https://archive.org/details/commodore-6 ... k/mode/2up that helps with verifying you copied in the correct stuff, per line (for this book only) - though this program itself demonstrates some interesting concepts.
Kaldarin
Posts: 2
Joined: Mon Mar 27, 2023 5:03 pm

Re: Beginners looking for support

Post by Kaldarin »

TomXP411 wrote: Mon Mar 27, 2023 10:08 pm Are you going to do this in BASIC, C, or assembly language?
I would like to start with simple Basic to lern the routines.
TomXP411 wrote: Mon Mar 27, 2023 10:08 pm BASIC has the LOCATE command:
Yes, such hints help
User avatar
Cyber
Posts: 482
Joined: Mon Apr 27, 2020 7:36 am

Re: Beginners looking for support

Post by Cyber »

EbonHawk
Posts: 17
Joined: Thu Mar 16, 2023 10:37 am

Re: Beginners looking for support

Post by EbonHawk »

Oh wow, c64c46c, that's exactly what I've been looking for..

Got a little overwhelmed with the "Programming the 65816, etc.." mainly because I couldn't find a single emulator/monitor combo that worked for the 65816, not without spending a bunch of cash and not knowing if it would even work.

I think I'll just dive into that huge list of C64 stuff and see how that goes..

Thanks!!
kimmi9413
Posts: 3
Joined: Sat Apr 01, 2023 6:29 pm

Re: Beginners looking for support

Post by kimmi9413 »

Hello EbonHawk,

the 65816 is not used in this project. Instead, a wicked fast :twisted: version of the 6502 is used. Actually much faster than any 6502 System of the 80's. It was explained in the latest Video (in the end there is a Q&A section called "Why not a Z80?"):


Anyway you can use all the principles and most Kernal routines just like on a C64 - as many have pointed out here already.

You could also try a "more comfortable" basic crosscompiler. For example you can use your favorite text editor on Win/Mac - and you don't need to worry about line numbers.
I'm sure there are probably more of them, but I just got started with https://xc-basic.net/doku.php?id=v3:com ... 16_support
Post Reply