Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 00:27 27 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MM BASIC vs ATARI BASIC and Page 6...

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 11:56pm 12 Jan 2013
Copy link to clipboard 
Print this post

Back in the days of the Atari, you used to be able to call a machine-code program from within the BASIC program. Commonly, this was referred to(by Atari programmers), as PAGE 6.

Page 6 was an area of system memory reserved for use for user programs running in machine code. The practical upshot of which, was that you could call for a machine code routine from within the BASIC program, allowing you to program special features etc, that were not available from withing the BASIC language.

Commonly, this area of memory was used for things like special function drivers, and graphics processes which would be far to slow running inside the BASIC.

Now, I know that MM does not have this ability, but is it perhaps something that might make it into a future release of MM BASIC do you think?

The ability to code fancy graphics or even just playing around with fonts etc in native machine code would introduce some amazing abilities for those that WANTED to code a routine in native PIC32(which I think is C?).

Thoughts?
Opinions?

Smoke makes things work. When the smoke gets out, it stops!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 01:24am 13 Jan 2013
Copy link to clipboard 
Print this post

It would be fabulous.
You would need to load it from sd card or another source as using data statements and poke would require too much memory.
In the most easy case it would maybe possible to use a MM basic string as a placeholder for some machinecode. It is restricted to 255 bytes but that might be enough and if it isn't then using more string variables as machinecode holders could be possible.
You then just execute a "string".
Of course the datatype string would confuse everything but inventing a new datatype isn't a real problem. Just another keyword.
Expand the LOAD command to accept a variable name.
You could then do this:
LOAD "fastcode.bin", code#
result = EXECUTE code#(1,2)

LOAD would then be responsible to load a bin file into memory pointed to by the code# variable.
EXECUTE would then push parameters 1 and 2 on the stack and then call the code# routine, returning a value which should be of a fixed type to make implementing not overly difficult.
I think the EXECUTE keyword can even be optional because the code#(1,2) can already be a defined function just like the other functions in MMBasic.



Edited by TZAdvantage 2013-01-14
Microblocks. Build with logic.
 
Nick

Guru

Joined: 09/06/2011
Location: Australia
Posts: 512
Posted: 10:16am 13 Jan 2013
Copy link to clipboard 
Print this post

Another usefull idea for this is to provide MMBASIC the ability to poll hardware at a higher rate than what MMBASIC can.

Nick

 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3802
Posted: 10:25pm 13 Jan 2013
Copy link to clipboard 
Print this post

There's a thread on this from ages ago (a year?) but it needs someone to write the internal code for MMBasic.

John
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 12:32am 14 Jan 2013
Copy link to clipboard 
Print this post

This is something that comes up often, so much so that I cover it in my FAQ

The problem is that you would need to write the loadable machine code module in MIPS assembler to make it work. The MIPS machine code is intended to be generated by an optimising compiler and it is very difficult for a human to master.

So I guess that the short answer is; show me someone who can program in MIPS assembler and I will have a crack at implementing Page 6, loadable machine code, or whatever you want to call it.

Geoff
Geoff Graham - http://geoffg.net
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 01:09am 14 Jan 2013
Copy link to clipboard 
Print this post

  Geoff said  The problem is that you would need to write the loadable machine code module in MIPS assembler to make it work. The MIPS machine code is intended to be generated by an optimising compiler and it is very difficult for a human to master.


Tell me about it. Probably like you and other oldies on the forum, we have all done our fair share of assembly language in a variety of MPUs. I downloaded the instruction set for a MIPS unit, thinking "this'll be much the same" - I think I will leave that area alone. The grey matter is having enough trouble these days trying to cope with C++, C#,8 bit pic machine code and now MMBasic

Mind you, if I was really pressed and had the time ...who knows?
David M.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3802
Posted: 03:23am 14 Jan 2013
Copy link to clipboard 
Print this post

To do it, I think C would be the way. Much easier to write.

Various runtime functions would have to be banned and a few (or maybe none) provided as standard (I suppose those already used by MMBasic). Or provide some APIs callable via gcc's asm construct.

Not pretty, but doable. Whether it's worth the effort? Pass. I'm guessing Geoff has a "would like to have" list that's enormous!!

Executing a string var is not likely good enough as 255 bytes is so few for a 32-bit MIPS architecture.

John
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 02:07pm 14 Jan 2013
Copy link to clipboard 
Print this post

Okey dokey, thanks guys.

I was not expecting it to be any kind of easy add to MM BASIC, or if it would EVER happen let alone anytime soon, but it was a curiosity of mine, if it could be done at all some time in the future.

Much like my other thread about showing the available space on the SD card, if it involves so much work to make it happen, it probably is not worth the effort.
Smoke makes things work. When the smoke gets out, it stops!
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 03:28pm 14 Jan 2013
Copy link to clipboard 
Print this post

  grogster said  Much like my other thread about showing the available space on the SD card, if it involves so much work to make it happen, it probably is not worth the effort.


Don't be disheartened, if nobody came up with ideas, nothig would ever happen. You never know, with technology advances at the rate we see them, your ideas might be quite feasible in the not too distant future. Afterall, when did the first MPU get developed? and look how far we have come in the 35 or so years since.

In 1978 when I built my first 1K RAM (8x 2102) I could not conceive puting giga bytes into a chip. The word "giga" didn't apply to very much at all then....but I ramble on.
David M.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 03:36pm 14 Jan 2013
Copy link to clipboard 
Print this post

Heh, heh.

I STILL have a hard time comprehending just how they manage to make 64GB micro-SD cards...
Smoke makes things work. When the smoke gets out, it stops!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 07:49pm 14 Jan 2013
Copy link to clipboard 
Print this post

What about the terrabyte usb stick from Kingston? :)

Microblocks. Build with logic.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 08:34pm 14 Jan 2013
Copy link to clipboard 
Print this post

Was not aware of that one - Holy Excrement!



EDIT: Are you sure? I cannot find anything bigger then 256GB on the Kingston website...Edited by Grogster 2013-01-16
Smoke makes things work. When the smoke gets out, it stops!
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1313
Posted: 09:05pm 14 Jan 2013
Copy link to clipboard 
Print this post

http://www.techradar.com/news/portable-devices/other-devices /kingston-debuts-1-terabyte-usb-3-0-flash-drive-with-matchin g-price-tag-1124153

Not cheap.

Don...
https://www.dontronics.com
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 09:32pm 14 Jan 2013
Copy link to clipboard 
Print this post

$3,400 - yikes!

That would buy a lot of standard HDD's or even SSD's
Smoke makes things work. When the smoke gets out, it stops!
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 10:09pm 14 Jan 2013
Copy link to clipboard 
Print this post

  grogster said  Holy Excrement


Whatever ARE you eating???
David M.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9307
Posted: 11:03pm 14 Jan 2013
Copy link to clipboard 
Print this post

Well, I was going to write Holy S**t, but figured that would be censored and as a newbie around here, would not make me any friends among the moderators.
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024