Over the last month I've been working on MS Basic.
MS BASIC 4.7c - RC2014Initially, I started with MS Basic support as my APU stretch goal, but working on it turned out to be a worthy goal for RC2014 generally.
Over the past weeks I've learned a lot about the workings of the MS Basic code, and I hope to have improved on it in some ways.
Z80 Op Code OptimisationFurther, since the RC2014 is Z80 based, I've tried to optimise the MS Basic code to use Z80 instructions where relevant, and to in-line code to improve the handling of the floating point and string pointer registers.
Do you have any plans/desire to give updated maths routines (with and without APU support) to BASCOM?
There is an interesting BASIC program called HP45 (e.g. HP45-208.LBR) by Loring C. Chien which should benefit from incorporation of faster and more accurate maths routines.The source code for HP45 is available to rebuild under BASCOM.
Phillip Stevens wrote:Over the last month I've been working on MS Basic.MS BASIC 4.7c - RC2014Initially, I started with MS Basic support as my APU stretch goal, but working on it turned out to be a worthy goal for RC2014 generally.Over the past weeks I've learned a lot about the workings of the MS Basic code, and I hope to have improved on it in some ways.I thought it might be good to note the changes to the original MS Basic 4.7 code, which generate about 8% improvement in the benchmarks (Mandelbrot, Selection Sort, Pi).Z80 Op Code OptimisationFurther, since the RC2014 is Z80 based, I've tried to optimise the MS Basic code to use Z80 instructions where relevant, and to in-line code to improve the handling of the floating point and string pointer registers.
Do you have any plans/desire to give updated maths routines (with and without APU support) to BASCOM?I guess you're talking about the Microsoft Basic compiler, BASCOM? I think the short answer is no. There's some reasons for that no, and none of them are related to "desire". I would have a desire to do it, but practically it will be too hard.Source code. I don't think anyone has the source code for BASCOM 5.3. If anyone does, then let us know. Would be great to dig through it and it would open the possibility to integrate APU code into it.
Performance. BASCOM compiles Basic, and the resulting code is about 3x faster than MBASIC interpreted Basic code. It might be possible to modify the BASCOM libraries (if Source Code were available), and try to do a better job using Z80 instructions or using the APU. The APU would make BASCOM compiled Basic much faster, I would guess.
Benchmarking - Mandelbrot colour.bas
Phillip Stevens wrote:Over the last month I've been working on MS Basic.MS BASIC 4.7c - RC2014Initially, I started with MS Basic support as my APU stretch goal, but working on it turned out to be a worthy goal for RC2014 generally.Over the past weeks I've learned a lot about the workings of the MS Basic code, and I hope to have improved on it in some ways.I thought it might be good to note the changes to the original MS Basic 4.7 code, which generate about 8% improvement in the benchmarks (Mandelbrot, Selection Sort, Pi).
Phillip Stevens wrote:Over the last month I've been working on MS Basic.MS BASIC 4.7c - RC2014Initially, I started with MS Basic support as my APU stretch goal, but working on it turned out to be a worthy goal for RC2014 generally.Over the past weeks I've learned a lot about the workings of the MS Basic code, and I hope to have improved on it in some ways.
Supported RC2014 Hardware
The linked files are for a Mini, Micro, or Classic RC2014 with 8kB ROM, 32kB RAM, and the MC68B50 ACIA.It is possible to support other hardware, but that hardware is better covered by more advanced systems (aka CP/M or RomWBW) than booting to MS Basic.The NASCOM BASIC 4.7 Repository where everything is located.Let me know with an issue if you find any problems, or here to just chat.
Linking BASCOM generated REL with my APU.REL *does* improve the speed of BASCOM generated executables. You need to use /O in the compilation -- otherwise the math in BRUN is used.
Performance. BASCOM compiles Basic, and the resulting code is about 3x faster than MBASIC interpreted Basic code. It might be possible to modify the BASCOM libraries (if Source Code were available), and try to do a better job using Z80 instructions or using the APU. The APU would make BASCOM compiled Basic much faster, I would guess.
But you can in theory drive two APUs at once or do part software...

Philip -- so ~20 instructions vs ~100 instructions. So, you get ~100,000 multiplies/s at 8Mhz CPUclock. Actually, given the multiply code for the APU, and the APU clocked at ~2 to 3Mhz... I am guessingthat it was "neck on neck". At a 4Mhz CPU, the APU should win. At 8Mhz, guessing a tie. At over, the CPUwould win.
Just curious, is there a reason for putting the bus connector on the back of the modules instead of the component side?Is it just a personal preference, or something about the APU module?
Supported RC2014 HardwareThe linked ROMs are for a Mini, Micro, or Classic RC2014 with 8kB ROM, 32kB RAM, and the MC68B50 ACIA Serial Module.It is possible to support other RC2014 hardware, but that hardware is better supported by more advanced software systems (aka CP/M or RomWBW) rather than booting to MS Basic.The NASCOM BASIC 4.7 Repository where everything (Z80, 8085, optional APU) is located.
Let me know with an issue if you find any problems, or here to just chat.
I've updated the HLOAD statement to check for the top of used RAM before continuing with the loading process. If there is a BASIC program in the way of the intended location for the assembly program, then the HLOAD will fail with ?OM Error (Out of Memory). I think that's a useful extra check, which might save some frustration.
Supported RC2014 HardwareThe linked ROMs are for a Mini, Micro, or Classic RC2014 with 8kB ROM, 32kB RAM, and the MC68B50 ACIA Serial Module.It is possible to support other RC2014 hardware, but that hardware is better supported by more advanced software systems (aka CP/M or RomWBW) rather than booting to MS Basic.The NASCOM BASIC 4.7 Repository where everything (Z80, 8085, optional APU) is located.Let me know with an issue if you find any problems, or here to just chat.
I've updated the HLOAD statement to check for the top of used RAM before continuing with the loading process. If there is a BASIC program in the way of the intended location for the assembly program, then the HLOAD will fail with ?OM Error (Out of Memory). I think that's a useful extra check, which might save some frustration.Following up on more stuff for RC2014 Classic 32k RAM machines, over the last while I've added quite a few things to my MS Basic 4.7c builds, and just yesterday finished adding in some some interesting new statements to the standard BASIC repertoire.
- The Z80 builds now have a serial and memory sanity check to make the first launch a little bit easier. But all builds (Z80 and 8085, with and without APU) will now send a BEL on startup, so you can hear your RC2014 is alive if your terminal emulator supports BEL.
- The WIDTH statement now supports setting the "comma" column width, so that PRINT comma (or tab) spacing can be done without POKE-ing memory locations. This corrects a flaw dating back to the 1970s.
- Removed some in-line code used for performance optimisation, and the Searle binary number support. Binary numbers can be represented as Hexadecimal, so they're duplicated functions, and I needed to make space to support...
- Added new MEEK and MOKE statements. These statements can be used to tabulate and print the contents of memory in Hexadecimal, and to view and edit memory, respectively. Using MOKE it is possible to easily enter a small assembly language program by hand, and then view the entered code in memory using MEEK. The names were selected to echo the PEEK and DEEK functions and POKE and DOKE statements, but are multi-byte themed.
- Streamlined the entry of Hexadecimal numbers using the & keyword. As Microsoft Basic uses signed 16 bit integers for address entry, it can be cumbersome to calculate these by hand. Now simply entering, for example, &nnnn will provide the correct signed integer address to the system, or &nn to provide a hexadecimal parameter. So for example entering an address becomes DOKE &8204,&9000 to write the address 0x9000 to location 0x8204, which is the USRLOC address needed to launch assembly programs with the USR(n) function in these ROMs. The memory can be inspected with MEEK &8200,1 which tabulates and prints 16 bytes from 0x8200.
New Statement Syntax
- MEEK I,J will print J blocks of 16 bytes of memory, commencing from I address.
- MOKE I will commencing editing of memory starting from I address. New byte values are entered in undecorated Hexadecimal, so 0xAB is simply entered as AB. To quit to the command line use CTRL C.
- WIDTH I,J where I is the terminal width (automatic insertion of CRLF), and J is the comma column screen width. Setting the width to 0xFF (the default) will disable auto CRLF.
The paint on these additions is still super fresh, so there could be some quirks. But, now a lot of my in-line optimisation code has been removed, the result is actually much closer to the original NASCOM MS Basic listings.Hope this is useful. Let me know of any problems or feedback, please.
--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/a34b2892-a895-47df-8654-7f70643b29b7n%40googlegroups.com.
I've been running some tests on this BASIC ROM for a few days now, and really happy with the way it's turned out. The MEEK and MOKE commands work well, and feel quite intuitive (Once you get in the habit of putting "&" in front of hex addresses anyway).Probably my favourite bit, though, is the BELL command on startup (or ctrl-g) which works great with the new RP2040 VGA Terminal :-)
There are a few ROMs I've already programmed with the older BASIC, but once those run low, I will be using this one going forward.
On Tuesday, 25 April 2023, Spencer wrote:I've been running some tests on this BASIC ROM for a few days now, and really happy with the way it's turned out. The MEEK and MOKE commands work well, and feel quite intuitive (Once you get in the habit of putting "&" in front of hex addresses anyway).Probably my favourite bit, though, is the BELL command on startup (or ctrl-g) which works great with the new RP2040 VGA Terminal :-)
There are a few ROMs I've already programmed with the older BASIC, but once those run low, I will be using this one going forward.
Thanks for your confidence in this work.To make it easy to back track specifically to this ROM and build directly, I've made a HexLoadr release v1.0 in the RC2014 Repository.I've also added a ROM suitable for a Plus with 64kB of RAM Module, and for those with a RC2014 provided a ROM for the APU Module, to the release too.Promise not to touch the code again for at least a few months. :-)
--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/CAFC0-0VwGi4pagjqb1L-6cTY9TVoxjeHGr1t-XpX-8o0GtDgvQ%40mail.gmail.com.
Hi Phillip,That timing is very fortuitous. I have just been writing up the documentation for the RC2014 Mini II, and just been linking back to your current documentation on GitHub here less than an hour ago!The Mini II had a silent launch last night, and until I have finished the documentation on the RC2014 website and written the assembly instructions I will not be making a big announcement. Although hopefully early next week it'll be in a state worthy of flooding social media with. So, of course, if there is any additional documentation you can add on the Wiki around the enhancements of your ROM then that would be appreciated.Sadly there has hardly been any progress with RC2014 Towers this summer. Partly this has been weather related, but also I thoroughly underestimated just how much time making up all the RC2014 Pride kits would take. Still, if I can get electrics up there before the end of summer then maybe there'll be some progress over winter. We'll see.Have to admit that I'm more than a little jealous that you can just Go Bush for a few months. I assume this is with your trailer setup that you've been working on? Internet access kind of defeats the purpose though, surely? Well, have a great time anyway.CheersSpencer
Hi Spencer,
--
You received this message because you are subscribed to the Google Groups "RC2014-Z80" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/CAFC0-0XxOdXSfUdvO3Q1q1BGczZ%2BxgNWgZ99JNHz8SSZdbGg4A%40mail.gmail.com.
Hi Phillip,Yes, the Mini II CP/M Upgrade Kit does include the CF updates that Tadeusz suggested, and it seems to be tolerant of all the same CF cards. Obviously without an SIO/2 is is not totally compatible with the RC2014 Pro but that's the only real difference. The ROM on the Mini II can be paged from the CP/M Upgrade, so with this setup there's no need to provide a second ROM just for CP/M.
On the subject of ROMs, due to the Mini II having 128k, I am dividing this in to 8k and 16k banks, and for the likes of your BASIC which fits in to 8k, I was thinking about putting some other software (like Zen) in the 8k above it with a little loader routine.
So, for example, G 2400 would run a loader routine at 0x2400 that copies Zen up to 0x9000, and then G 9000 would run Zen. There's obviously quite a bit of space for several programs in that 8k. Whilst I never describe myself as a programmer, writing the loader for that (similar to the one I wrote for CP/M on the Pro) is within my capabilities :-)I think it has only just dawned on me who Neal Crook is. I know a guy called Neal that I've met at a load of retro events that always has Nascom stuff with him, and always takes an interest in my RC2014 stuff. I hadn't appreciated that he is the Zen Guy!Just on a side note, I will be including CamelForth on the Mini II. In particular a port by Justin Skists which, amongst other things, includes your hex loader routine. He thought that had a non-commercial licence against it, however, as that's on the RC2014 GitHub page, I figured that would be fine. But just wanted to mention it to you in case I'm missing anything.
You received this message because you are subscribed to a topic in the Google Groups "RC2014-Z80" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rc2014-z80/Y-rwRO3xXQ8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/CAO93Ptd3M2y1TygPz_ojrCEy3N2UKN10%3DwJryCUQ5K8T-Zubvg%40mail.gmail.com.
On Sat, 19 Aug 2023, Spencer wrote:Yes, the Mini II CP/M Upgrade Kit does include the CF updates that Tadeusz suggested, and it seems to be tolerant of all the same CF cards. Obviously without an SIO/2 is is not totally compatible with the RC2014 Pro but that's the only real difference. The ROM on the Mini II can be paged from the CP/M Upgrade, so with this setup there's no need to provide a second ROM just for CP/M.Excellent. It will be another variant for me, as I have ACIA+PPIDE and 8085+ACIA+CF. But not ACIA+CF. But it’s a 30min fix to build that variant and then it has an actual useful target.