ESXDOS Boot Loader written in Basic

Show us what you're working on, (preferably with screenshots).
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

ESXDOS Boot Loader written in Basic

Post by Nige »

Image

A boot loader program I've written in Basic :) What do you think?

Image
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: ESXDOS Boot Loader written in Basic

Post by Luzie »

Image

[mention]Nige[/mention] It´s looking really good. I hope you publish it (Sourcecode) here!
Thompson
Drutt
Posts: 13
Joined: Thu Dec 17, 2020 11:16 pm

Re: ESXDOS Boot Loader written in Basic

Post by Thompson »

Why anyone would need this? Please elaborate
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

Thompson wrote: Wed Feb 23, 2022 9:26 pm Why anyone would need this? Please elaborate
Not everyone would want, or need it :) I just find it handy to switch on my spectrum and choose what I want to do from a menu.
Also I just like messing about with Basic :lol:
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

I'm also trying to Define Procedures in BetaBasic v4 to mimic some of the Spectrum NextBasic commands ;) A bit pointless maybe? But why not? :D Obviously I can't do the higher screen modes, extra colours, sound and speed ;)
But so far I do have a crude version of the SPRITE command working :shock:
The Procedures are called with N.nextcmd ie: for the above N.SPRITE a,b,c,d,e. The letters are the parameters for the sprite number, position, colour etc.
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

Image

This is the N.SPRITE procedure I've written. As I said very crude atm? :)
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

Here's the listing of my ESXDOS Boot Loader version 2

10 REM ESXDOS Boot Loader v2
20 REM Nigel's Workbench 2022
30 REM AUTOBOOT.BAS
40 GO TO hd0"/": CLS
50 GO SUB 330
60 GO SUB 280
70 PRINT AT 0,0; INVERSE 1; BRIGHT 1;"ESXDOS Boot Loader "
80 PRINT AT 6,5;"1.BetaBasic v4.0+D (128k)"
90 PRINT AT 8,5;"2.BetaBasic v3.1 (48k)"
100 PRINT AT 10,5;"3.128k Basic"
110 PRINT AT 12,5;"4.48k Basic"
120 PRINT AT 14,5;"5.RAM Check"
130 PRINT AT 16,5;"6.ROM Check"
140 PRINT AT 18,5;"7.Browse"
150 PAUSE 0
160 IF INKEY$="1" THEN CLS : GO TO hd0"BETABAS":.snapload BETAB4D.SNA
170 IF INKEY$="2" THEN CLS : GO TO hd0"BETABAS":.snapload BB48k.SNA
180 IF INKEY$="3" THEN CLS :.128
190 IF INKEY$="4" THEN CLS : PRINT USR 0
200 IF INKEY$="5" THEN CLS :.tapein /UTILS/TESTRAM.TAP: LOAD ""
210 IF INKEY$="6" THEN CLS :.tapein /UTILS/ROMCHECK.TAP: LOAD ""
220 IF INKEY$="7" THEN CLS :.browse: GO TO 60
230 STOP
240 SAVE *"/SYS/MyMenu.BAS" LINE 10
250 STOP
260 SAVE *"/SYS/AUTOBOOT.BAS" LINE 10
270 STOP
280 REM 128k Menu Bar
290 INK 0: PAPER 7: CLS : BRIGHT 0: FLASH 0: BORDER 7: CLS
300 PRINT #0; INVERSE 1; BRIGHT 1;"Nigel's Workbench "; PAPER 2;"\a"; INK 6;"\b"; PAPER 4;"\a"; INK 5;"\b"; PAPER 0;"\a"; INK 0;"\{vi} \{vn}"
310 RETURN
320 STOP
330 REM UDG's
340 DATA 1,3,7,15,31,63,127,255,254,252,248,240,224,192,128,0
350 RESTORE 340
360 FOR i=0 TO 14
370 READ x
380 POKE USR "a"+i,x
390 NEXT i
400 RETURN
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: ESXDOS Boot Loader written in Basic

Post by Luzie »

Nige wrote: Tue Mar 01, 2022 11:07 pm Here's the listing of my ESXDOS Boot Loader version 2
...
Thank you very much!
Nige wrote: Tue Mar 01, 2022 11:07 pm

Code: Select all

300 PRINT #0; INVERSE 1; BRIGHT 1;"Nigel's Workbench "; PAPER 2;"\a"; INK 6;"\b"; PAPER 4;"\a"; INK 5;"\b"; PAPER 0;"\a"; INK 0;"\{vi} \{vn}"
In Line 300 these characters "\a" e.g. should be entered in Graphics-Mode as e.g. UDG "A" I think :)
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

Luzie wrote: Wed Mar 02, 2022 7:58 pm
Nige wrote: Tue Mar 01, 2022 11:07 pm Here's the listing of my ESXDOS Boot Loader version 2
...
Thank you very much!
Nige wrote: Tue Mar 01, 2022 11:07 pm

Code: Select all

300 PRINT #0; INVERSE 1; BRIGHT 1;"Nigel's Workbench "; PAPER 2;"\a"; INK 6;"\b"; PAPER 4;"\a"; INK 5;"\b"; PAPER 0;"\a"; INK 0;"\{vi} \{vn}"
In Line 300 these characters "\a" e.g. should be entered in Graphics-Mode as e.g. UDG "A" I think :)
Yes you are right 👍. It was the programs I used to convert to text altered it. Still learning 😊
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: ESXDOS Boot Loader written in Basic

Post by Luzie »

Nige wrote: Wed Mar 02, 2022 8:06 pm
Luzie wrote: Wed Mar 02, 2022 7:58 pm
In Line 300 these characters "\a" e.g. should be entered in Graphics-Mode as e.g. UDG "A" I think :)
Yes you are right 👍. It was the programs I used to convert to text altered it. Still learning 😊
No problem. On first run it thought it was my fault by cutting and pasting it to "Remy's NextBASIC encoder and decoder" at: https://zx.remysharp.com/bas/ and saving it to a .TAP-File. On closer look I discovered the "UDGs expressions" e.g. "\a" :D
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

Luzie wrote: Wed Mar 02, 2022 8:14 pm
Nige wrote: Wed Mar 02, 2022 8:06 pm

Yes you are right 👍. It was the programs I used to convert to text altered it. Still learning 😊
No problem. On first run it thought it was my fault by cutting and pasting it to "Remy's NextBASIC encoder and decoder" at: https://zx.remysharp.com/bas/ and saving it to a .TAP-File. On closer look I discovered the "UDGs expressions" e.g. "\a" :D
So what is the best way to convert a basic program from a real Spectrum to a text file?
Or the best way to upload and display it on the forum? :)
User avatar
flatduckrecords
Manic Miner
Posts: 826
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by flatduckrecords »

Nige wrote: Thu Mar 03, 2022 7:46 am
Luzie wrote: Wed Mar 02, 2022 8:14 pm
No problem. On first run it thought it was my fault by cutting and pasting it to "Remy's NextBASIC encoder and decoder" at: https://zx.remysharp.com/bas/ and saving it to a .TAP-File. On closer look I discovered the "UDGs expressions" e.g. "\a" :D
So what is the best way to convert a basic program from a real Spectrum to a text file?
Or the best way to upload and display it on the forum? :)
Remy's tool that [mention]Luzie[/mention] mentioned also works with .BAS files which can be put directly on your esxDOS SD card and either loaded from the file browser, or LOADed and SAVEed from BASIC:

Code: Select all

LOAD * "FILENAME.BAS"

Code: Select all

SAVE * "FILENAME.BAS"
So for example that will allow you to SAVE a program from the Spectrum to SD card, then open it up on a modern computer and edit/copy/paste etc.
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

flatduckrecords wrote: Thu Mar 03, 2022 1:55 pm
Nige wrote: Thu Mar 03, 2022 7:46 am

So what is the best way to convert a basic program from a real Spectrum to a text file?
Or the best way to upload and display it on the forum? :)
Remy's tool that @Luzie mentioned also works with .BAS files which can be put directly on your esxDOS SD card and either loaded from the file browser, or LOADed and SAVEed from BASIC:

Code: Select all

LOAD * "FILENAME.BAS"

Code: Select all

SAVE * "FILENAME.BAS"
So for example that will allow you to SAVE a program from the Spectrum to SD card, then open it up on a modern computer and edit/copy/paste etc.
10 REM 128k Menu Bar
20 RESTORE 60: GO SUB 90
30 CLS
40 INK 0: PAPER 7: CLS : BRIGHT 0: FLASH 0: BORDER 7: CLS
50 PRINT AT 21,0; INVERSE 1; BRIGHT 1;"Nigel's Workbench "; PAPER 2;"\A"; INK 6;"\B"; PAPER 4;"\A"; INK 5;"\B"; PAPER 0;"\A"; INK 0;" "
60 DATA 1,3,7,15,31,63,127,255,254,252,248,240,224,192,128,0
70 PAUSE 200: STOP
90 FOR i=0 TO 14
100 READ x
110 POKE USR "a"+i,x
120 NEXT i
130 RETURN
140 STOP
150 SAVE *"128kMBAR.BAS" LINE 10

:D
User avatar
flatduckrecords
Manic Miner
Posts: 826
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by flatduckrecords »

Nige wrote: Thu Mar 03, 2022 4:46 pm

Code: Select all

10 REM 128k Menu Bar
…
:D


:mrgreen: The "\A" escaped graphics characters worked perfectly. Groovy!
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

New version? :)

Image
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

BTW I've started a new topic in programming. "Programming with BetaBasic".
I'll copy the BB ones from this thread over there as well :)
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

Version 2.2
Menu is now like the 128k Spectrum's. Use cursor keys to choose an option, Enter to select.
Any ideas for improvements are welcome :)

Code: Select all

10 REM ESXDOS Boot Loader
20 LET v$="2.2"
30 REM Nigel's Workbench 2022
40 REM AUTOBOOT.BAS
50 GO TO hd0"/": CLS
60 GO SUB 8170: REM udgs
70 REM b$ 24 inverse spaces
80 LET b$="                        "
90 REM o(n)=num of menu options
100 LET n=8: DIM o(n)
110 REM x,y pos menu options
120 LET x=6: LET y=4
130 REM make array
140 FOR i=1 TO n: LET o(i)=i: NEXT i
150 REM s=select menu option
160 LET s=1
170 GO SUB 8250: REM Menu
180 REM loop
190 GO SUB 8290: REM Menu Options
200 PRINT INVERSE 0; OVER 1; BRIGHT 1; INK 5; PAPER 0; AT o(s)+x,y;b$
210 LET i$= INKEY$ : IF i$="" THEN GO TO 210
220 IF i$= CHR$ 13 THEN GO SUB s*1000
230 IF i$= CHR$ 10 THEN LET s=s+1: IF s >= n THEN LET s=n
240 IF i$= CHR$ 11 THEN LET s=s-1: IF s <= 0 THEN LET s=1
250 GO TO 180
260 STOP
900 REM Option selected
999 REM Option 1
1000 CLS : GO TO hd0"BETABAS":.snapload BETAB4D.SNA
1010 RETURN
1999 REM Option 2
2000 CLS : GO TO hd0"BETABAS":.snapload BB48k.SNA
2010 RETURN
2999 REM Option 3
3000 CLS :.128
3010 RETURN
3999 REM Option 4
4000 CLS : PRINT USR 0
4010 RETURN
4999 REM Option 5
5000 CLS :.tapein /UTILS/TESTRAM.TAP: LOAD ""
5010 RETURN
5999 REM Option 6
6000 CLS :.tapein /UTILS/ROMCHECK.TAP: LOAD ""
6010 RETURN
6999 REM Option 7
7000 CLS :.browse: GO TO 10
7010 RETURN
7999 REM Option 8
8000 CLS : STOP
8010 RETURN
8170 REM UDG's
8180 RESTORE 8230
8190 FOR i=0  TO  14
8200 READ x
8210 POKE USR "a"+i,x
8220 NEXT i
8230 DATA 1,3,7,15,31,63,127,255,254,252,248,240,224,192,128,0
8240 RETURN
8250 REM Menu \A & \B are UDG's
8260 INK 0: PAPER 7: BRIGHT 0: FLASH 0: BORDER 7: CLS
8270 PRINT #0; INVERSE 1; BRIGHT 1;"Nigel's Workbench         "; PAPER 2;"\A"; INK 6;"\B"; PAPER 4;"\A"; INK 5;"\B"; PAPER 0;"\A"; INK 0;" "
8280 PRINT AT 0,0; INVERSE 1; BRIGHT 1;"ESXDOS Boot Loader v";v$;"         "
8281 PRINT AT 6,y; INVERSE 1; BRIGHT 1;"Options           "; PAPER 2;"\A"; INK 6;"\B"; PAPER 4;"\A"; INK 5;"\B"; PAPER 0;"\A"; INK 0;" "
8282 PLOT 31,127: DRAW 0,-72
8283 PLOT 224,127: DRAW 0,-72
8284 PLOT 223,55: DRAW -191,0
8285 RETURN
8288 REM Menu Options: REM pad options text with spaces to make each 24 characters long
8290 PRINT AT o(1)+x,y; BRIGHT 1; PAPER 7; INK 0;"BetaBasic v4.0+D (128k"
8300 PRINT AT o(2)+x,y; BRIGHT 1; PAPER 7; INK 0;"BetaBasic v3.1 (48k)"
8310 PRINT AT o(3)+x,y; BRIGHT 1; PAPER 7; INK 0;"128k Basic"
8320 PRINT AT o(4)+x,y; BRIGHT 1; PAPER 7; INK 0;"48k Basic"
8330 PRINT AT o(5)+x,y; BRIGHT 1; PAPER 7; INK 0;"RAM Check"
8340 PRINT AT o(6)+x,y; BRIGHT 1; PAPER 7; INK 0;"ROM Check"
8350 PRINT AT o(7)+x,y; BRIGHT 1; PAPER 7; INK 0;"Browse"
8360 PRINT AT o(8)+x,y; BRIGHT 1; PAPER 7; INK 0;"EXIT"
8365 RETURN
8420 STOP
8430 SAVE *"/SYS/MyMenu.BAS" LINE 10
8440 STOP
8450 SAVE *"/SYS/AUTOBOOT.BAS" LINE 10
8460 STOP
Image

Edited by PJ to include code tags.
User avatar
flatduckrecords
Manic Miner
Posts: 826
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by flatduckrecords »

Nice work @Nige.

I think I would maybe keep the hotkeys as well, so you can either use cursors+enter, or press a number for the most common options?

I've been using a version of your code for the last few days actually. I have it set up with a couple of options for recieving machine code (either WiFi or RS232, depending hardware and adapters). Having it on the boot menu makes it easy to recieve some new code from my development machine, test it out; rinse and repeat. Cuts down a lot of faff and lets me test on a real Spectrum.

Image

I also reused the stripes at the top for fun (FLASH 1 makes it look like they're scrolling. Sort of!)
User avatar
PeterJ
Site Admin
Posts: 6947
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ESXDOS Boot Loader written in Basic

Post by PeterJ »

Where did you by your DivTIESUS from @flatduckrecords? I found it on Antonio's store, but it's out of stock.
User avatar
flatduckrecords
Manic Miner
Posts: 826
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by flatduckrecords »

PeterJ wrote: Tue Mar 22, 2022 12:27 pm Where did you by your DivTIESUS from @flatduckrecords? I found it on Antonio's store, but it's out of stock.
I just got lucky! I saw a tweet from @chernandezba about an hour before they went on sale (I managed to claim #0005). I was meaning to write a brief review for the Hardware section here. But in short, it's really good. I think Miguel mentioned he is/was working on another batch, hopefully more will be available soon.
User avatar
PeterJ
Site Admin
Posts: 6947
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ESXDOS Boot Loader written in Basic

Post by PeterJ »

Thanks @flatduckrecords. I have sent him a DM.
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

flatduckrecords wrote.
Nice work @Nige.

I think I would maybe keep the hotkeys as well, so you can either use cursors+enter, or press a number for the most common options?
Thank you for the praise 😊
TBH I just make sure the first option is the one I use the most 🙂
But I could add the numbered options as well, I don't think it'd be to difficult 🤔
User avatar
flatduckrecords
Manic Miner
Posts: 826
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by flatduckrecords »

Nige wrote: Wed Mar 23, 2022 1:43 pm TBH I just make sure the first option is the one I use the most 🙂
But I could add the numbered options as well, I don't think it'd be to difficult 🤔
Yes, I realised I usually just press '1' which could just as well be 'enter' right enough!

I was loading a game last night and thought that joystick support might be nice to have. If your DivMMC supports Kempston joystick you can do:

Code: Select all

 ...
 220 IF i$ = CHR$ 13 THEN GO SUB s*1000
 221 IF 16 = IN 31 THEN GO SUB s*1000: REM press fire
 
 230 IF i$ = CHR$ 10 THEN LET s=s+1
 231 IF 4 = IN 31 THEN LET s=s+1: REM press down
 232 IF s >= n THEN LET s=n
 
 240 IF i$ = CHR$ 11 THEN LET s=s-1
 241 IF 8 = IN 31 THEN LET s=s-1: REM press up
 242 IF s <= 0 THEN LET s=1
 ...
(Sinclair joysticks are different - they correspond to the number keys and can be read with INKEY$).
User avatar
Nige
Dizzy
Posts: 53
Joined: Tue Feb 15, 2022 7:01 pm
Location: UK
Contact:

Re: ESXDOS Boot Loader written in Basic

Post by Nige »

flatduckrecords wrote: Wed Mar 23, 2022 2:48 pm
Nige wrote: Wed Mar 23, 2022 1:43 pm TBH I just make sure the first option is the one I use the most 🙂

Yes, I realised I usually just press '1' which could just as well be 'enter' right enough!

I was loading a game last night and thought that joystick support might be nice to have. If your DivMMC supports Kempston joystick you can do:

Code: Select all

 ...
 220 IF i$ = CHR$ 13 THEN GO SUB s*1000
 221 IF 16 = IN 31 THEN GO SUB s*1000: REM press fire
 
 230 IF i$ = CHR$ 10 THEN LET s=s+1
 231 IF 4 = IN 31 THEN LET s=s+1: REM press down
 232 IF s >= n THEN LET s=n
 
 240 IF i$ = CHR$ 11 THEN LET s=s-1
 241 IF 8 = IN 31 THEN LET s=s-1: REM press up
 242 IF s <= 0 THEN LET s=1
 ...
(Sinclair joysticks are different - they correspond to the number keys and can be read with INKEY$).
I like the idea of the code being altered to suit whatever the user needs🙂

My divmmc is the lite version from ByteDelight so no joystick interface. I do have a RAM Turbo interface that works with it though, and supports Kempston, Sinclair and a few other as well.
User avatar
PeterJ
Site Admin
Posts: 6947
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ESXDOS Boot Loader written in Basic

Post by PeterJ »

@Nige,

How are you loading Beta BASIC 4 via the divMMC? It doesn't work for me.
Post Reply