Posted By
MMS on 2017-08-20 14:15:39
| How to identify platform in BASIC (Plus/4, C64, C128, maybe VIC20)
Just a short question: related to the IEC2IEE I decided to put together a summary. It would be easy to create a small powerpoint slideshow converted to PDF.
On the other hand, I have the idea to create a BASIC program may run on the main C= platforms (Plus/4, C64, C128, maybe VIC20) without modification, to explain the main information on IEC2IEEE interface with the help of PETSCII GFX (taht is also common). (it could be easier to create separate PRGs, but then there where is the challenge?)
I know then I cannot use special new V3.5 and V7.0 commands like COLOR, SCNCLR, CHAR, SOUND, etc. But can use the color codes in PRINT"" or if I identify the machines properly, I may use the proper POKE commands to set the background and border colors (though it could be masochoistic way to set the colors on Plus/4 with a POKE command). Any idea which memory part I may check with a PEEK command? Multiplatform programmers, welcome your ideas...
|
|
Posted By
gerliczer on 2017-08-20 12:45:21
| Re: How to identify platform in BASIC (Plus/4, C64, C128, maybe VIC20)
You may want to check unconnected address spaces or platform specific registers that are mapped to different addresses and their values are not "constant" like raster counters.
|
|
Posted By
Hypex on 2017-08-20 13:27:23
| Re: How to identify platform in BASIC (Plus/4, C64, C128, maybe VIC20)
I remember this BASIC listing once that detected what machine it was on and set variables to where it could poke colours in. It detected VIC20, C16, +4 and C64 IIRC.
I thought it was Head for home but after a look it's not. It may have been some other MasterMind game. Memories a bit rusty, 30 years ago, that sort of thing.
But it seems obvious that you could check the ROM kernel or BASIC kernel. Are these set at $8000 and $C000? Or, check common Commodore vectors. Either reset vectors or other ROM jump points.
Checking $00/$01 might work. Don't know about VIC20 but C16 and C64 would have different things in DDR and PORT register.
Apart from that I thought someone would have documented it. And it just occurred. CBM File Browser. I was browsing the code. Looked kinda long.
|
|
Posted By
MMS on 2017-08-20 14:58:25
| Re: How to identify platform in BASIC (Plus/4, C64, C128, maybe VIC20)
Hi! Thank you for the hints! I also think first about the Kernal, but I remember, that in Plus/4 from BASIC you always read the RAM,and NOT the ROM (even with PEEKs). I suppose the C128 is the same.
On the other hand, this hint gave me the idea: it is not the case when you check a C64, above $E000 I can see from BASIC some (kernal) ROMs with fixed value, I can check the values on the net. (I am not sure about VIC-20, but it has rather low resolutions and other limitations, so I may skip that platform.)
-So if I write anything with POKE above $A000, and it is not the same, when I PEEK it, it should be C64. -Next step: if I PEEK (215) on C128: PEEK(215) - 0 = 40 column mode / 128 = 80 column mode, so probably not allow to change it. On Plus/4 it is unused as per SVS map, or by Speech modul (so unused). Probably I can write and re-read it. So if I write 64 to address 215, after then the PEEK(215) will show 64 if it is Plus/4, and 0 or 128, if C128.
Thanks!
|
|
Posted By
MIRKOSOFT on 2017-08-21 09:29:47
| Re: How to identify platform in BASIC (Plus/4, C64, C128, maybe VIC20)
Maybe this helps http://www.mirkosoft.sk/machine.txt It can recognize these machines: C64 C64DTV SX-64 C128 C128 mode 64 C65 mode 64 C16/116 C232 C264 C364 C+4 VIC20 no expansion VIC20 3kB expansion VIC20 8kB and up expansion ------- CBM-II PET2001 PET3032 PET4032/8032/8096/8296/SuperPET
Miro
|
|
Posted By
MMS on 2017-08-22 17:37:07
| Re: How to identify platform in BASIC (Plus/4, C64, C128, maybe VIC20)
@MIRKOSOFT Wow, this is huge! and much more complete than I have ever tought! Many thanks!
|
|
Posted By
Hypex on 2017-08-23 11:54:30
| Re: How to identify platform in BASIC (Plus/4, C64, C128, maybe VIC20)
I'm also thinking sticking to zero page could simplify things. That way you don't have to worry about ROM banks, expanded memory and that sort of thing. Just find a common value for all platforms to find the major model and dig deeper to find minor model variant.
|
|
|