Petit Computer


@All you guys who programmed in BASIC back in the day: It was possible to translate things between the differing dialects, right? What do you think the chances are for being able to adapt old type-in listings for this? :p

That really depends to be honest. If you're proficient in BASIC then you'll be able to read the source and (with the help of the manual for the source dialect) be able to translate between the two. Some gotchas may be that one uses line numbers, the other uses labels - for example, converting from BBC Basic, which uses line numbers, to AMOS which doesn't - some coders used computed GOTOs such as GO TO x*10 which would be a pain to convert. On the other hand, converting from BBC BASIC to Sinclair BASIC would likely be trivial so long as you bear in mind that the two machines had wildly different graphics systems.


In general, if your languages are based on the Dartmouth specification (which was the first BASIC, and the vast majority are based on it) then you should be ok until you get to the fine details like sound and graphics. If you're after converting from something like Visual BASIC to a less-modern syntax such as Sinclair BASIC (or PandaBAS!) then you'll likely need the guidance of someone more of an expert than you are currently. You'll learn a hell of a lot about programming in general as you go though, and it's satisfying to do.


If you're wanting to learn a simple language then I cannot recommend BASIC highly enough - it's very easy, gives immediate results without wading through compiler errors and is very good fun.


D.
 
[EDIT] I deleted my post; I didn't see ZXDunny's post before replying. It says pretty much everything I said.
 
Last edited by a moderator:
Thanks guys!


Unfortunately for me, after spending the last couple of hours messing with C64 BASIC in VICE, with the accompaniment of the original C64 manual, I'm now unsure how much use I could make of Petit Computer for programming from scratch, since I'm clearly cursed with being unable to learn further languages - not one thing has stuck. It's very annoying. :p


That aside, the source code for each of the included sample programs has been published on the official website for Petit Computer, if anyone wants to take a look.


EDIT: And an unofficial tool for editing the code, graphics, and so on, and for generating QR Codes from programs made with Petit Computer without having to upload them to the official website is available, too. The Windows version more-or-less works under WINE on Linux, albeit slightly weirdly. It will stop taking keyboard input if you copy the contents of the PRG Editor to an outside application and then switch back to it, but you can still paste stuff into it from outside, for example, and it generally seems to behave a bit strangely, but it does work, more or less.
 
Last edited by a moderator:
Unfortunately for me, after spending the last couple of hours messing with C64 BASIC in VICE, with the accompaniment of the original C64 manual, I'm now unsure how much use I could make of Petit Computer for programming from scratch, since I'm clearly cursed with being unable to learn further languages - not one thing has stuck. It's very annoying. :p

Don't start from scratch, and don't use C64 BASIC! That one is well known for being almost impossible to get anything done with - most coders on the 64 went pretty much straight for machine code. C64 BASIC was created by microsoft, so that should give you an idea of the quality you can expect!


Get yourself a decent BASIC that runs on the PC in linux, and start with that. You'll have lots of web resources at your fingertips in an environment you understand. There are hundreds of them out there that you can choose from, and some of them will even run on the Pandora (though I do not recommend coding on the Pandora for a start, do that much later).


The most important thing is not to start from scratch - get yourself someone else's code and run it, make sure it works. Then have a go at modifying it. Make it display text other than what it usually does. Change some maths-looking things and see what happens. When you get an error, look it up and then see if you can work out how to fix it - but only have a couple of tries before jumping into here and getting some help. The last thing you want is to become discouraged!


You can expect to be spending some months just getting the basics of program flow and maths-with-variables (algebra) down, but when you do a whole new world will open up to you. It's amazing fun, so don't give up just yet!


D.
 
What I've seen in schools recently is Python making it's way as a first programming language taught to kids. I suppose it's good in many ways, it's clean looking just like basic and it at least teaches kids how to indent consistently.


I learned on TRS-80 BASIC, Tandy had good books bundled with them to learn BASIC.. well with dumb cartoons of Tandy computers with legs and arms.. Later I moved to BASICA/GW-BASIC and then QBASIC.. I've always felt like more of a hardware guy, software didn't interest me and I loved electronics. I never thought I could actually program anything outside of small scripts. That was until I started teaching myself Web Programming. At first Perl, then later PHP in the early 2000's.. I was doing pretty good learning on my own, I then decided to go back to school for a software engineering degree and now I program for a living, I feel confident in programming in almost every language I touch.. It's just a matter of learning the nuances of the language.
 
Last edited by a moderator:
Don't start from scratch, and don't use C64 BASIC! That one is well known for being almost impossible to get anything done with - most coders on the 64 went pretty much straight for machine code. C64 BASIC was created by microsoft, so that should give you an idea of the quality you can expect!
Hahaha, right-o. I thought that that only applied to the disk-drive add-on, not C64 BASIC itself. Yep, that does surely explain a lot of its bizarreness and counterintuitive points (such as the bizarre abbreviations, including being able to use a question mark in place of PRINT). :lol:

Get yourself a decent BASIC that runs on the PC in linux, and start with that. You'll have lots of web resources at your fingertips in an environment you understand. There are hundreds of them out there that you can choose from, and some of them will even run on the Pandora (though I do not recommend coding on the Pandora for a start, do that much later).
Any suggestions, here? I couldn't find much in the Ubuntu repositories, and the ones I did try were pretty abysmal. BASIC-256, for example, claims to be a complete environment for teaching kids with - its error messages tell you nothing, and its help file is actually blank. And sdlBasic wouldn't let me run anything without saving it first, which I could see getting very cumbersome very quickly.

The most important thing is not to start from scratch - get yourself someone else's code and run it, make sure it works. Then have a go at modifying it. Make it display text other than what it usually does. Change some maths-looking things and see what happens. When you get an error, look it up and then see if you can work out how to fix it - but only have a couple of tries before jumping into here and getting some help. The last thing you want is to become discouraged!
Well, if it helps any, I was doing some of these things with the examples in the C64 manual, and successfully messed about with some of those, at least.


I readily picked up stuff like IF/THEN statements, nesting (just like forum code!), and suchlike, and I've understood how GOTO does its thing since I was a kid, so I suppose that's something. :p Maybe I did pick up more than I thought I did...


My plan had been to track down some type-in listings to mess with, last night, but that was hobbled by not having great tools to work with in the first instance. :p I'm sure I'll do better at grasping things if I can see more of it in action, as it were.


My immediate goal - at least as far as Petit Computer goes if it gets a European release (I assume it will - the timing seems to be right, since there are so many efforts to get kids coding again right now) - would be to cobble together a plain-text editor, that can save files to the SD Card. I imagine that this is well within its capabilities. :p After all, my 3DS is with me *all the time*, and I can type a lot faster with a stylus on a good resistive screen (almost my full touch-typing speed - I learned that with Animal Crossing: Wild World on the DS) than I can on even the Pandora's thumb-keyboard.


This would be my aim right now on my PC, as well, since it covers what I want to learn. Character-sheet generators (structured like a quiz, I suppose) for recording information for fiction that I'm working on, or pen-and-paper RPGs, would also be handy, as would something for keeping an inventory of my threads and fabrics for current sewing projects, and obviously these are something that I could derive from the text-editor, or vice-versa. :p


I guess I'd be best off tracking down something like this to learn from, no?

You can expect to be spending some months just getting the basics of program flow and maths-with-variables (algebra) down, but when you do a whole new world will open up to you. It's amazing fun, so don't give up just yet!
Variables, unfortunately, are a point where I got a bit stuck - I found them to be a little confusing (not massively - I can see how they work and all, but they seemed a bit arbitrary, and the manual I was reading didn't explain them well enough for my liking; For example, it kept using A$ as a variable, but never explained why it is this, or if I could use anything else to name them), and mathematics is something that I tend to struggle with a bit. Any suggestions, here?
 
Variables come in a variety of flavours and are whatever you want them to be.


A$= a string of text e.g A$="Hello World"


A%= an integer number (eg. 1 or 2 or 5900073)


A#= is a floating point number (eg 1.5 or 2.33)


If you type



Code:
LET A$="Hello World"

PRINT A$

The result would be Hello World is printed on the screen



If you typed -



Code:
LET a%=57

PRINT A%

then the value of A% (57) would be printed on the screen



You can name and use variables however you want - eg

NAME$="FRED"

MONEY_IN_BANK#="0.00"

HI_SCORE%=50000



You can combine different variables





Code:
LET a%=50

LET b%=25


c%=a%+b%


PRINT c%


Result would be c%= 75 (50+25)


BTW some BASICs needed you to declare the variable value with LET (hence why I put them in the code).


Many BASIC dialects allow you to use ? instead of PRINT.
 
Last edited by a moderator:
Thanks muchly, iprice. :D That clears up a lot of my confusion about variables. (I somehow got that "$" means "string", though I don't know when or where I picked that up.)


Why is "?" used as a stand-in for PRINT, though?
 
Last edited by a moderator:
I'm clearly cursed with being unable to learn further languages - not one thing has stuck. It's very annoying. :p

I'd say that the reason you're having trouble is you're trying to start with BASIC, which is primitive, clunky, unreadable garbage. There's a reason I'm not impressed with this addition to the 3DS. If you want to learn programming, you'd have a lot better luck starting with a better high-level language, like Python or even Visual Basic (which is still not very good, but a vast improvement over its BASIC ancestors).
 
Last edited by a moderator:
<inbefore language flamewar>


The key to learn any language is to keep trying, just like with a spoken language. Learn small peices at a time and wear them in before moving on. Your first dozen programs will be clunky and primitive, but you need to know the ins and outs of multiple pieces before you can start putting them together to form something usable.
 
I'm clearly cursed with being unable to learn further languages - not one thing has stuck. It's very annoying. :p

I'd say that the reason you're having trouble is you're trying to start with BASIC, which is primitive, clunky, unreadable garbage. There's a reason I'm not impressed with this addition to the 3DS. If you want to learn programming, you'd have a lot better luck starting with a better high-level language, like Python or even Visual Basic (which is still not very good, but a vast improvement over its BASIC ancestors).
I'd say the reason is because I actually have difficulty with picking up languages, as I said. I'm fairly sure that I actually know myself better than anyone else does.


BASIC actually makes a great deal more sense, and is a great deal more readable to me, than Python or the like. That's why I'm interested in messing with it. I do remember a bit of it from when I was six years old, so I have a minor bit of pre-existing familiarity.


I don't much care what's currently said about what languages I should or shouldn't learn, or by what impresses you, and to be honest, I'm not actually interested in learning programming (my mind is far too visual to make this a simple task, really): I'm interested in learning a bit of BASIC so that I can make some very simple tools that are of use to me, and I'm interested in *this* application because my 3DS is constantly with me, and already much more useful to what I do than my Pandora is. :p
 
Last edited by a moderator:
Get yourself a decent BASIC that runs on the PC in linux, and start with that. You'll have lots of web resources at your fingertips in an environment you understand. There are hundreds of them out there that you can choose from, and some of them will even run on the Pandora (though I do not recommend coding on the Pandora for a start, do that much later).
Any suggestions, here? I couldn't find much in the Ubuntu repositories, and the ones I did try were pretty abysmal. BASIC-256, for example, claims to be a complete environment for teaching kids with - its error messages tell you nothing, and its help file is actually blank. And sdlBasic wouldn't let me run anything without saving it first, which I could see getting very cumbersome very quickly.

Well, the days of an immediate language are pretty much over - most compilers and interpreters these days require a source file to work from, which means you need to save before you run. I don't want to blow my own trumpet here, but the only one I know of offhand (though there must be others, I'm sure) which will work similarly to the old BBC/C64/Spectrum BASICs is SpecBAS (PandaBAS on the Pandora) - you type in a command and it's executed immediately, so results are quick. You can get it from http://www.specbas.co.uk where a linux build is available, but it takes some getting used to in the way that it works, so pm me and we'll go through getting you started if that's the way you want to go. It also has a full manual available, so it's got one up on the competition right there!


Don't pay any attention to onpon, he has no idea what he's talking about. If BASIC was as bad as he says it is then nobody would be using it - and I know from experience that even my own interpreter is very popular amongst those of us that grew up with the 8bit computers. Python most certainly is not (in my opinion) a better language. More capable, yes, but almost impossible to learn as a first language as it doesn't have the similarity to plain english that standard dartmouth BASIC has.


D.
 
I've tried learning Python on and off for years but found it really confusing and inconsistent to learn. I've now knocked that on the head and decided to give C++ a try, which I seem to be remembering easier. After I get that down I'll be learning Visual basic as I've just found all the learning material for a course I signed up for over 15 years ago but never got into. Basic seems like a language that I would use more for fun, whilst C++ is something that I would find useful/necessary for working with open source software and hardware.


I've got the same problems with learning to program that Prometheus has. I'm a visual and hands on person that finds it really hard to learn from text books (the main reason why I never went to uni). I'm also rubbish at maths, which is a bit of a kick in the teeth when most programming tutorials seem to rely on it so heavily. It might take me years to learn programming but like slaeshjag says "The key to learn any language is to keep trying, just like with a spoken language. Learn small pieces at a time and wear them in before moving on." I would also recommend to people that they should learn from more than one source, e.g multiple books. That way if you don't understand what one is saying, the other one can point you in the right direction.


I like the idea of being able to program on the DS itself for the same reason that I think it's a good idea to program directly on the Pandora; instant gratification. It doesn't matter if the language your using is limited, as long as it works. Most people who fail at programming do so simply because they get bored when it takes ages to see any kind of results.
 
Well, the days of an immediate language are pretty much over - most compilers and interpreters these days require a source file to work from, which means you need to save before you run. I don't want to blow my own trumpet here, but the only one I know of offhand (though there must be others, I'm sure) which will work similarly to the old BBC/C64/Spectrum BASICs is SpecBAS (PandaBAS on the Pandora) - you type in a command and it's executed immediately, so results are quick. You can get it from http://www.specbas.co.uk where a linux build is available, but it takes some getting used to in the way that it works, so pm me and we'll go through getting you started if that's the way you want to go. It also has a full manual available, so it's got one up on the competition right there!
Thanks very muchly, Dunny. I just had a skim of the manual, and after a brief "Hello World!"-esque mess about, the application itself seems to be exactly what I've been after. :D Top marks for the documentation, by the way - it's very thorough!


I'm using the Windows build under WINE, as an aside - I couldn't really figure out what I needed to do with the Linux one... :p

Don't pay any attention to onpon, he has no idea what he's talking about. If BASIC was as bad as he says it is then nobody would be using it - and I know from experience that even my own interpreter is very popular amongst those of us that grew up with the 8bit computers. Python most certainly is not (in my opinion) a better language. More capable, yes, but almost impossible to learn as a first language as it doesn't have the similarity to plain english that standard dartmouth BASIC has.
That's been my experience also - Python came across as awfully esoteric, to me. It's certainly not going to be winning any Plain English Awards, anyway. :lol:


Moreover, if BASIC was so damn bad for getting started with, not only would people not be using it, there also very likely wouldn't be the British games industry as it is now, would there? :p


Thanks again - now to see how I go with this... Once I find some code to feed into it and mess with... :p
 
Last edited by a moderator:
Heya ZXDunny, so I download SpecBAS, and noticed that I can't use my '/" key in it. So basically, I can't even type in the following:


10 PRINT "Hello World"


It appears to respond to all my keys beside that one key.


I'm running this under Ubuntu 12.04, US keyboard layout. Any ideas why this may be?


Thanks. :)
 
Last edited by a moderator:
Heya ZXDunny, so I download SpecBAS, and noticed that I can't use my '/" key in it. So basically, I can't even type in the following:


10 PRINT "Hello World"


It appears to respond to all my keys beside that one key.


I'm running this under Ubuntu 12.04, US keyboard layout. Any ideas why this may be?


Thanks. :)

I've not got around to this yet - keyboards are on the list though, and will be added to the next update. SpecBAS currently only supports a british layout right now. For what it's worth, the "/" key should be the 3rd key to the right of the "M" key, which might work.


Edit: Did you mean the Quote key? Try shift-2 :)


D.
 
Last edited by a moderator:
Edit: Did you mean the Quote key? Try shift-2 :)
I spotted that one, too. :lol: I use the UK Macintosh layout, since it was what I learned to type so quickly on, and Xubuntu allows for that no matter what hardware you're using, so my 2 is typically @, not ". :p


The UK Macintosh layout is basically a British layout, but with 2" swapped with @'. SpecBAS produces unusual slanted quotes if I use my regular " key (which is where @' is).
 
Ah yes, I meant the single and double quotes. And thank you, shift-2 worked. :D Thank you.
 
I've added keyboard localisation for the next release - SpecBAS will make a "keyboards" directory in your ~/specbas/ directory, and includes a keyboard configuration program which saves keyboard definition files there. Using the KEYBOARD command in the startup-sequence you can set your desired keymap permanently.


Should be out very soon - just polishing up some new graphics features.


D.
 
Back
Top