A VERY simple 6502 programming language
A VERY simple 6502 programming language
Hello everyone,
I have a 4 year old daughter who has been using my 6502 computer daily for her math (and reading/typing) lessons. We use a program I made called the "Scratchpad" which allows you to type and move around the screen, very simple.
She is progressing in her math very quickly, and it makes me wonder if she could at least start programming some very basic things on the 6502 computer. Not Assembly. Not Forth. Maybe BASIC, maybe not. I know that some of y'all were handed computers at an early age, and all you COULD do on them was program. I'm trying to follow in those footsteps a bit here.
I'm looking for a style/language that is very simple. Not at all good with speed, memory, size, or efficiency. Instead, something that is readable, somewhat usable, and can ask for keyboard input, spit out ASCII output, do some loops and if statements, and basic integer math. Also, if I were to make my own language, I'm thinking it would slightly resemble 6502 Assembly in how it functions. One stack, accumulator, X and Y, little things like that that would make learning the real Assembly language easier to grasp.
Because I haven't found what I'm looking for, I've been devising my own programming language which resembles something between BASIC and COBOL. And I do not mind making up my own language since this is very specific, but some pointers/guides would be nice. Or, if BASIC is good enough, I'm ok with trying that. What I found though, when looking at versions of BASIC, is that it *can* be complicated looking, using special symbols and stuff.
Remember, this is for a 4 year old, not for any advanced programmers like yourselves. [ And I can't STAND to use some dumbed down point-and-click IDE, gross! ]
Recommendations? Thoughts? Comments? I'm willing to hear them! Thank you all.
Chad
I have a 4 year old daughter who has been using my 6502 computer daily for her math (and reading/typing) lessons. We use a program I made called the "Scratchpad" which allows you to type and move around the screen, very simple.
She is progressing in her math very quickly, and it makes me wonder if she could at least start programming some very basic things on the 6502 computer. Not Assembly. Not Forth. Maybe BASIC, maybe not. I know that some of y'all were handed computers at an early age, and all you COULD do on them was program. I'm trying to follow in those footsteps a bit here.
I'm looking for a style/language that is very simple. Not at all good with speed, memory, size, or efficiency. Instead, something that is readable, somewhat usable, and can ask for keyboard input, spit out ASCII output, do some loops and if statements, and basic integer math. Also, if I were to make my own language, I'm thinking it would slightly resemble 6502 Assembly in how it functions. One stack, accumulator, X and Y, little things like that that would make learning the real Assembly language easier to grasp.
Because I haven't found what I'm looking for, I've been devising my own programming language which resembles something between BASIC and COBOL. And I do not mind making up my own language since this is very specific, but some pointers/guides would be nice. Or, if BASIC is good enough, I'm ok with trying that. What I found though, when looking at versions of BASIC, is that it *can* be complicated looking, using special symbols and stuff.
Remember, this is for a 4 year old, not for any advanced programmers like yourselves. [ And I can't STAND to use some dumbed down point-and-click IDE, gross! ]
Recommendations? Thoughts? Comments? I'm willing to hear them! Thank you all.
Chad
- CountChocula
- Posts: 101
- Joined: 07 Nov 2021
- Location: Toronto, Canada
Re: A VERY simple 6502 programming language
Have you considered Logo? It was built specifically for this reason (and, as I recall, there was a version for the Apple ][, so you might even be lucky enough to find some source code!).
- commodorejohn
- Posts: 299
- Joined: 21 Jan 2016
- Location: Placerville, CA
- Contact:
Re: A VERY simple 6502 programming language
I guess it kind of depends on the goal. LOGO is certainly a simple way to grasp basic concepts - programming is making a list of instructions for the machine to follow, numbers and lists/structures of numbers can represent human-level information in a way machines can understand - but it's not well-suited for doing much more than drawing simple pictures. Still, it might be a good jumping-off point.
Past that, finding a nice BASIC would be a good choice (something with a reasonably complete library of functions so that you don't have to go the CBM route of learning cryptic PEEKs and POKEs simply to draw a line on the screen; a full-fledged structured variant is probably unnecessary for beginners, but if you find one that supports it, so much the better.)
If I were designing a teaching language myself, I think I might start by looking to Smalltalk for syntax and general structure - but Smalltalk itself has never solved the problem of decoupling a program from the object library/operating environment in a really satisfactory way...
Past that, finding a nice BASIC would be a good choice (something with a reasonably complete library of functions so that you don't have to go the CBM route of learning cryptic PEEKs and POKEs simply to draw a line on the screen; a full-fledged structured variant is probably unnecessary for beginners, but if you find one that supports it, so much the better.)
If I were designing a teaching language myself, I think I might start by looking to Smalltalk for syntax and general structure - but Smalltalk itself has never solved the problem of decoupling a program from the object library/operating environment in a really satisfactory way...
-
teamtempest
- Posts: 443
- Joined: 08 Nov 2009
- Location: Minnesota
- Contact:
Re: A VERY simple 6502 programming language
What do you mean by "6502 computer"? Is it a name brand, such as Apple, Atari, BBC or Commodore? All (or at any rate) most of these had a BASIC interpreter in ROM. Additional languages were often available for purchase. The C64 had versions of Comal (a popular teaching language in Europe in the 80's, sort of a more structured BASIC) and Logo (probably more appropriate for younger children, and the language has the features you want).
That would be the Turtle Graphics, which I'd argue is not really part of the core language, but just a way to get children interested. As a language it's more about lists, functions and recursion. It can also be very slow at purely numerical tasks (at least the C64 version is).
Even if you go on to write your own, you might take a look around at some languages meant for teaching programming for inspiration. There have been many efforts in this area over the years.
Quote:
but it's not well-suited for doing much more than drawing simple pictures.
Even if you go on to write your own, you might take a look around at some languages meant for teaching programming for inspiration. There have been many efforts in this area over the years.
Re: A VERY simple 6502 programming language
Thank you all for the comments so far!
I didn't even know what that was until now! I see the cool graphics it can make, that's interesting. Any code examples I've seen have been about turtles, which is... interesting. I see lots of features but some are cryptic (to me) and some are something I would ask "Well, why do I need that?" The style of using words for, ya know, doing stuff is close to what I'm thinking though.
'Nice' is the key word I think.
I saw some examples of Smalltalk, and besides me being confused, it has various sorts of special characters to do particular tasks. Colons all over the place, carets for I don't know what, etc. I mean, perhaps? A good attempt.
My own SBC, thus my bend on programming my own language. I can't even see a good way to use someone else's existing BASIC!
Let me give you some examples of code I'm thinking about:
or
or
I don't know exactly, these are just basic commands I was thinking of. As little symbols as possible, but math symbols are acceptable ( + - * / = )
Here's another example of something I'd like to see: My daughter likes to make music using my SBC's 1-voice square wave audio output. I made a sheet music program that you can move notes around and then create your own song. Maybe here she could type:
To make it play little tunes. Also, she likes drawing things on my little 'paint' program, so perhaps with this she could do:
I don't know, that's maybe a bit much honestly.
Any other thoughts?
Thanks again everyone.
Chad
CountChocula wrote:
Have you considered Logo
commodorejohn wrote:
finding a nice BASIC would be a good choice
commodorejohn wrote:
I think I might start by looking to Smalltalk
teamtempest wrote:
What do you mean by "6502 computer"?
Let me give you some examples of code I'm thinking about:
Code: Select all
VAR X
VAR Y
SET Y = 0
FOR X FROM 0 TO 128
CALC Y = Y + 1
PRINT Y
PRINT $0D ; carriage return
LOOP
Code: Select all
VAR X
ARRAY X 'HELLO WORLD'
PRINT X
Code: Select all
VAR X
LABEL MAIN
INPUT X
IF X = 0 THEN MAIN
PRINT X
GOTO MAIN
Here's another example of something I'd like to see: My daughter likes to make music using my SBC's 1-voice square wave audio output. I made a sheet music program that you can move notes around and then create your own song. Maybe here she could type:
Code: Select all
SOUND 100
SOUND 120
SOUND 120
SOUND 80
SOUND 60
Code: Select all
LINE FROM 10,10 TO 20,20
CIRCLE AT 30,30 RADIUS 10
Any other thoughts?
Thanks again everyone.
Chad
Re: A VERY simple 6502 programming language
I think it's important to have words to do graphics and sounds - POKEs are a big barrier to learning, and they encourage memorising arcane facts, instead of building an understanding.
> all you could do was program
I'd extend that thought a little: it was very common to type in other people's programs from magazines. In doing that, you learn something by osmosis, something by needing to correct your typos, and something by making minor changes.
> Logo
An excellent idea. It's a whole lot more than turtle graphics. (There's a 4004 transistor level simulator written in logo.) It has named procedures, and apparently kids spontaneously learn to factor out repeated things. After typing so many constants, they naturally see the advantage of loops.
I've never studied the art of teaching, bar a very short course at school on child development, but I remain convinced it's a science and a skill all of its own. Teaching something is much more than just handing over one's own knowledge. It might be worth looking into this.
> all you could do was program
I'd extend that thought a little: it was very common to type in other people's programs from magazines. In doing that, you learn something by osmosis, something by needing to correct your typos, and something by making minor changes.
> Logo
An excellent idea. It's a whole lot more than turtle graphics. (There's a 4004 transistor level simulator written in logo.) It has named procedures, and apparently kids spontaneously learn to factor out repeated things. After typing so many constants, they naturally see the advantage of loops.
I've never studied the art of teaching, bar a very short course at school on child development, but I remain convinced it's a science and a skill all of its own. Teaching something is much more than just handing over one's own knowledge. It might be worth looking into this.
- floobydust
- Posts: 1394
- Joined: 05 Mar 2013
Re: A VERY simple 6502 programming language
From a simpler view, you could always start her out with BASIC. Dumbing it down is relative, you don't need to tell her everything it can do, just focus initially on a handful of commands/functions to get something working. As she progresses, you introduce her to more features/functions.
In some cases... I'd likely say try and find her an old Vic-20 to start with (assuming you have a monitor/TV to hook it up to). It can do some simple graphics and sounds, which is likely going to be more interesting for a 4 year old than a text screen with the occasional beep. It also let's her know that it's her machine... not yours.
In some cases... I'd likely say try and find her an old Vic-20 to start with (assuming you have a monitor/TV to hook it up to). It can do some simple graphics and sounds, which is likely going to be more interesting for a 4 year old than a text screen with the occasional beep. It also let's her know that it's her machine... not yours.
Regards, KM
https://github.com/floobydust
https://github.com/floobydust
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: A VERY simple 6502 programming language
I agree with flooby on this one.
I think it would be more beneficial for your daughter to work with a language environment that is already a de facto standard. Just introduce her to it little-by-little, and as she progresses and is able to make the computer do cool things, her interest will be stoked.
The trouble with concocting your own language is she will be learning something that exists nowhere else, which means (assuming she maintains interest as she gets older) she would have to unlearn what she learned working with a homebrew pseudo-language.
I think it would be more beneficial for your daughter to work with a language environment that is already a de facto standard. Just introduce her to it little-by-little, and as she progresses and is able to make the computer do cool things, her interest will be stoked.
The trouble with concocting your own language is she will be learning something that exists nowhere else, which means (assuming she maintains interest as she gets older) she would have to unlearn what she learned working with a homebrew pseudo-language.
x86? We ain't got no x86. We don't NEED no stinking x86!
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: A VERY simple 6502 programming language
floobydust wrote:
I'd likely say try and find her an old Vic-20 to start with...
One advantage a VIC-20 has in this sort of application is its large on-screen character size. I think that feature would be better suited to a young child getting the hang of playing around with a computer, as well as developing her reading skills. As she learns and gains confidence, then introduce her to a different machine with smaller character size, but more capability.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: A VERY simple 6502 programming language
BigEd wrote:
I think it's important to have words to do graphics and sounds
BigEd wrote:
you learn something by osmosis
BigEd wrote:
I remain convinced it's a science and a skill all of its own
floobydust wrote:
From a simpler view, you could always start her out with BASIC
floobydust wrote:
It also let's her know that it's her machine... not yours.
BDD wrote:
I think it would be more beneficial for your daughter to work with a language environment that is already a de facto standard.
BDD wrote:
large on-screen character size
Thanks everyone, any other thoughts are welcome.
Chad
- commodorejohn
- Posts: 299
- Joined: 21 Jan 2016
- Location: Placerville, CA
- Contact:
Re: A VERY simple 6502 programming language
As far as picking a BASIC, you're right that many home computers of the day use subtly or not-so-subtly incompatible dialects (even the ones that are tweaked MS BASIC variants...!) But there are a few BASICs out there that are designed to be more portable, with a little elbow grease; I know ehBasic is popular these days.
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: A VERY simple 6502 programming language
sburrow wrote:
BDD wrote:
I think it would be more beneficial for your daughter to work with a language environment that is already a de facto standard.
For better or worse, Microsoft's rendition of BASIC has a sort of universality in the microcomputer world. EhBasic, the late Lee Davison’s rendition for the 6502, is sufficiently similar to Microsoft’s for your purposes, should you desire to implement BASIC on your SBC. Also, floobydust edited the EhBasic source code so it could be run on a 65C02 system and take advantage of the C02’s enhanced instructions.
I'd stay away from what Apple did on their eight-bit machines, as it is a bit of an outlier in the BASIC world. Commodore BASIC is a good version because it is almost entirely MS BASIC. The weakness, of course, is the lack of verbs for using audio and graphics (excepting BASIC 7.0 in the C-128). Those could be added to EhBasic, assuming the target system has the required resources.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: A VERY simple 6502 programming language
I'm a big fan of public domain stuff, so that I can use/modify/add/subtract/sell without any constraints. I do not believe EhBasic is public domain, correct? Say I wanted to sell my SBC as a kit at some point, putting EhBasic on it would not work, correct? Y'all help me here please, because I'm in the dark about copyrights and stuff.
Chad
Chad
- floobydust
- Posts: 1394
- Joined: 05 Mar 2013
Re: A VERY simple 6502 programming language
Well, I think you're possibly getting a lot ahead of yourself on this one.... from trying to get a simple learning language to selling machines and worrying about copyright and licensing! You don't have to supply any code with the hardware, just have a link to download some software. Granted, there might someone related to Lee that could hold some copyright for EhBasic, but it too has much similarity to MS Basic.
For now, just focus on getting something for a 4-year old. Grant Searle has a single source code for MS Basic which should be pretty easy to get running on your system. As BDD pointed out, my version of EhBasic should be extremely simple to get running, as a single source, you only need to provide character in/out routines, a starting address in ROM for assembly and declare a half page or so for the input buffer.
Still... the Vic-20 is an easy win on doing this. Commodore also released a Programmer's Aid cartridge that extended Basic and also added an additional 3KB of RAM.
For now, just focus on getting something for a 4-year old. Grant Searle has a single source code for MS Basic which should be pretty easy to get running on your system. As BDD pointed out, my version of EhBasic should be extremely simple to get running, as a single source, you only need to provide character in/out routines, a starting address in ROM for assembly and declare a half page or so for the input buffer.
Still... the Vic-20 is an easy win on doing this. Commodore also released a Programmer's Aid cartridge that extended Basic and also added an additional 3KB of RAM.
Regards, KM
https://github.com/floobydust
https://github.com/floobydust
Re: A VERY simple 6502 programming language
floobydust wrote:
Well, I think you're possibly getting a lot ahead of yourself on this one....
So, no offense was intended in showing my typical behavior, I never meant to get ahead of myself. Thank you anyways, I'll be exploring ways to get Basic going somehow. I appreciate the input, this was exactly what I needed. A little extra push towards the right direction.
Chad