SEDORIC extended BASIC commands syntax samples/manual?

Everything related to BASIC version 1.x (Oric 1 and Atmos) or HYPERBASIC (Telestrat).
Don't hesitate to give your small program samples, technical insights, or questions...
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

Dbug wrote: Thu Oct 22, 2020 6:06 am Regarding memcpy, I've been thinking in adding a variant of memcpy with two "stride" and a second counter which could be used to copy rectangular areas by automatically skipping some data
That would of course be even more elegant ;-) Started to think to code that, but quickly found that a) your present routine does suit my needs b) I really need to up my assembly skills to be able to program it by myself without being so clumsy that the code would maybe work at some point but not very efficiently....

Now basically did in BASIC almost exactly what your C code would do just with a fixed width of 40 characters (which of course then does not need to skip memory positions):

Code: Select all

 10140 AD=#A006: WN=1: DIM WI(10,2)
 15020 :
 15030 REM SAVE SCREEN
 15040 :
 15050 WI(WN,0)=AD: WI(WN,1)=YC-1: WI(WN,2)=H+3
 15052 DOKE #A000,#BBA8+WI(WN,1)*40: DOKE #A002,WI(WN,0): DOKE #A004,WI(WN,2)*40
 15053 WN=WN+1:AD=AD+WI(WN,2)*40
 15054 CALL #6506
 15055 RETURN
 15060 :
 15070 REM LOAD SCREEN BACK
 15080 : 
 15090 WN=WN-1: AD=WI(WN,0)
 15091 DOKE #A000,WI(WN,0): DOKE #A002,#BBA8+40*WI(WN,1): DOKE #A004,WI(WN,2)*40
 15092 CALL #6506
 15093 RETURN
 
Memcopy routine is jumped to by calling #6506 (#6500 and #6503 already used by the mymplayer routine), slightly adapted it to take the source, dest and number of bytes to copy from the #A000, #A002 and #A004 memory positions instead of C stack.
AD is destination memory address counter (start position #A006), WN is windows number counter, WI(x,y) saves start address, start line and number of lines for each window. YC is window Y co-ordinate, H is window height.
Did not build in a check to not overflow available memory yet as for my present project I have ample space in the HIRES area for the window depth used (present code goes to a max windows number of 3).
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

Duh. Examining the SEDORIC manual more to learn about the sequential file commands, now see that SEDORIC actually adds a memcopy command to BASIC already:

MOVE AEstart , AEend , AEtarget address
Moves a block of memory.

Sigh. Completely missed that one going over the SEDORIC manual before. Much effort in building something in machine code that was actually already present in BASIC directly. Will use the BASIC version (unless it proves much slower).
Anyway, learned my first steps in 6502 assembly again.

This brings my code to this now, fully in BASIC. Also bringing this topic back in line with the topictitle, namely syntax of SEDORIC extended BASIC.

Code: Select all

 15030 REM SAVE SCREEN
 15040 :
 15050 WI(WN,0)=AD: WI(WN,1)=YC-1: WI(WN,2)=H+3
 15052 MOVE #BBA8+WI(WN,1)*40,#BBA8+(WI(WN,1)+WI(WN,2))*40,WI(WN,0)
 15053 AD=AD+WI(WN,2)*40:WN=WN+1
 15055 RETURN
 15060 :
 15070 REM LOAD SCREEN BACK
 15080 : 
 15090 WN=WN-1: AD=WI(WN,0)
 15091 MOVE WI(WN,0),WI(WN,0)+WI(WN,2)*40,#BBA8+40*WI(WN,1)
 15093 RETURN
 
EDIT: Was a bug in the code ;-) Increased WN before increasing AD with WI(WN,2)*40 ......
Last edited by xahmol on Tue Oct 27, 2020 10:12 am, edited 1 time in total.
User avatar
Symoon
Archivist
Posts: 2307
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by Symoon »

xahmol wrote: Fri Oct 16, 2020 8:28 am Thinking now I might 'cheat' a bit and align all pop-ups to the complete right of the screen. At least in that case I do not need to worry about the attributes being incorrect to the right of the pop-up, sparing me the space needed to set charset, ink and paper back. Otherwise it quickly becomes complex.
Oh, doing pop-ups was something I had in mind for years, without really starting working at it... And didn't even think of the attributes hell it could be! Would require scanning each line for ink/paper attributes, from right to left, and setting them back on the right of the pop-up... Ouch!
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

Symoon wrote: Sun Oct 25, 2020 7:15 am Would require scanning each line for ink/paper attributes, from right to left, and setting them back on the right of the pop-up... Ouch!
Correct. So therefore settle on cheating and aligning all pop-ups to the right at least for now.
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

Small update: game nearing completion for a first alpha. Almost was able to finish a first full game playing.
Only a thousand free bytes left, so that fits exactly ;-) Was afraid I had to ditch music to make it fit.

Only to find at the very end that there is somewhere a bug in the game logic as it forbids me to play the move needed to finish the game......
Puzzled as it did allow similar moves earlier in the game. So now really have to delve into my logic of 28 years ago to see where the code goes wrong. Starting with figuring out which variable was again doing what (did not have a habit of documenting that back then).
As it apparently only happens in very specific circumstances, not sure yet if the bug has been there also 28 years ago, or that converting the logic to Oric BASIC broke something.

Another to do is that Game save and Game load for some strange reason works most of the time, but completely hangs Oricutron with for me unpredictable reasons in some occasions. Plan to test also on the real hardware to see if it is an Oricutron issue or something I do wrong. Frustrating if exactly the same game save or load works 4 times out of 5 but completely hangs the system the fifth time.
Allready did disable my try at ERR SET and ERR GOTO routines to exclude that being the issue. But it just hangs. No error shown.
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by Dbug »

Is your game for Tape or Disk configurations?
Do you have "Data" that you READ/POKE on startup in your program?
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

Dbug wrote: Thu Oct 29, 2020 2:46 pm Is your game for Tape or Disk configurations?
Do you have "Data" that you READ/POKE on startup in your program?
Disk, using SEDORIC commands for sequential file access. Disk build via OSDK Tap2dsk tool (and old2mfm).
And yes, it does READ data at start of the program to variables (arrays).

Does that matter? And can it indeed cause it mostly working but sometimes not?

Read statements are at 10700-10800 for the main initialisation routine for pawn co-ordinates and dice print strings and 16460-14920 for reading data for the menu and pulldown menu system. Both are called at game start before any disc operation (and not at any further point).

My present SAVE and LOAD routines:
(Explanation of GOSUBs used: 16100 is create window, 15740 is validated input routine, 15090 restore screen from window, 16140 is now disabled by RAM and was the routine for handling errors using ERR SET / ERR GOTO)

Code: Select all

 12900 'SAVE GAME
 12910 :
 12920 XC=8:YC=8:B=30:H=7:GOSUB16100
 12940 PRINT@10,10;CHR$(130);"Save game.";CHR$(129)
 12960 PRINT@10,12;CHR$(131);"Enter filename:";CHR$(129)
 12970 XC=10:YC=14:ML=8:TT$=AL$:GOSUB15740:GOSUB15090:IFAN$=""THENRETURN
 12980 AN$=AN$+".SAV"
 12990 'ERR SET: ERRGOTO 13320
 13000 SEARCH AN$
 13020 IFEF=0THENGOTO13120
 13030 : XC=8:YC=8:B=30:H=8:GOSUB16100
 13050 : PRINT@10,10;CHR$(131);"Filename exists.";CHR$(129)
 13060 : PRINT@10,11;CHR$(131);"Replace?";CHR$(129)
 13070 : XC=15:YC=13:MN=5:GOSUB15130
 13080 : GOSUB15090
 13090 : IFM=2THENRETURN
 13100 : DESTROY AN$
 13120 OPEN S,AN$,1
 13130 : PUT 1,BS
 13140 : FORN=0TO3
 13150 :   PUT 1,NP(N)
 13160 : NEXTN
 13170 : FORN=0TO3
 13180 :   FORM=0TO3
 13190 :     PUT 1,SP(N,M)
 13200 :   NEXTM
 13210 : NEXTN
 13220 : FORN=0TO3
 13230 :   FORM=0TO3
 13240 :     PUT 1,SC(N,M,0)
 13250 :     PUT 1,SC(N,M,1)
 13260 :   NEXTM
 13270 : NEXTN
 13280 : FORN=0TO3
 13290 :   PUT 1,SP$(N)
 13300 : NEXTN
 13310 CLOSE 1
 13311 'ERR OFF: RETURN
 13312 'ERROR HANDLING
 13320 'GOSUB16410: ERR OFF
 13330 RETURN
 13340 :
 13350 'LOAD GAME
 13360 :
 13370 XC=8:YC=8:B=30:H=8
 13371 GOSUB16100
 13390 PRINT@10,10;CHR$(131);"Load game.";CHR$(129)
 13391 'TBD. ROUTINE TO SHOW DIR
 13530 PRINT@10,12;CHR$(131);"Filename (without .SAV):";CHR$(129)
 13540 XC=10:YC=14:ML=8:TT$=AL$:GOSUB15740:GOSUB15090:IFAN$=""THENRETURN
 13550 AN$=AN$+".SAV"
 13551 'ERR SET: ERRGOTO 13800
 13552 SEARCH AN$
 13553 IFEF<>0THENGOTO13560
 13554 : XC=8:YC=8:B=30:H=6:GOSUB16100
 13555 : PRINT@10,10;CHR$(131);"File not found.";CHR$(129)
 13556 : PRINT@10,11;CHR$(131);"Press key.";CHR$(129):GOSUB16320
 13557 : GOSUB15090:RETURN
 13560 OPEN S,AN$,1
 13600 : TAKE 1,BS
 13610 : FORN=0TO3
 13620 :   TAKE 1,NP(N)
 13630 : NEXTN
 13640 : FORN=0TO3
 13650 :   FORM=0TO3
 13660 :     TAKE 1,SP(N,M)
 13670 :   NEXTM
 13680 : NEXTN
 13690 : FORN=0TO3
 13700 :   FORM=0TO3
 13710 :     TAKE 1,SC(N,M,0)
 13720 :     TAKE 1,SC(N,M,1)
 13730 :   NEXTM
 13740 : NEXTN
 13750 : FORN=0TO3
 13760 :   TAKE 1,SP$(N)
 13770 : NEXTN
 13780 CLOSE 1
 13790 EI=2
 13794 'ERR OFF
 13795 'RETURN
 13799 'ERROR HANDLING
 13800 'GOSUB16410: ERR OFF
 13810 RETURN
 
Last edited by xahmol on Thu Oct 29, 2020 7:01 pm, edited 1 time in total.
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by Dbug »

Just that you were mentioning starting to get short in memory, if you are making a game that uses the disk, you can simply load data from disk instead of converting on startup, so if you have some assembler routines, or some redefined characters, sprites, etc... just store that on disk and load it where you want, that would also have the benefit of making the game faster :)
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

Dbug wrote: Thu Oct 29, 2020 6:56 pm Just that you were mentioning starting to get short in memory, if you are making a game that uses the disk, you can simply load data from disk instead of converting on startup, so if you have some assembler routines, or some redefined characters, sprites, etc... just store that on disk and load it where you want, that would also have the benefit of making the game faster :)
Ah. Already did that for assembly code, charsets and main screen design. In the BASIC listing itself only variables are loaded, no graphics or assembly code.
Game loader and splash screen is already a separate BASIC file, assembly code and first music track already loaded there as well.

But the music and windowing routine limit space for BASIC. HIMEM is at #6000

Actually, disk space was also getting a limit ;-) Kicked down the music from six tracks to be selected to three to actually be able to have space for at least two or three save games.
See
Schermafbeelding 2020-10-29 190846.png
Schermafbeelding 2020-10-29 190846.png (10.33 KiB) Viewed 5340 times
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by Dbug »

xahmol wrote: Thu Oct 29, 2020 7:03 pm Actually, disk space was also getting a limit ;-) Kicked down the music from six tracks to be selected to three to actually be able to have space for at least two or three save games.
What I see is that it's a simple face floppy, with 17 sectors per tracks and only 21 tracks, while a 3" floppy can handle up to 42 tracks (so double as that), double sided disks double that again, and 3.5" disks support 82 tracks (so almost double again).

You are far from using all the disk space :)
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

Ah. Probably I have to change something in the tap2dsk commands with additional switches then? Or use something else to build the DSK?

Borrowed the OSDK building scripts to build the DSK.
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by iss »

IMO, the freeze of Oricutron is related to the issue which we already discussed here i.e. how to proceed when DSK image needs to be extended.
The root of the problem is in tap2dsk - it allocates so much space to fit the selected taps - historically this makes sense to have smaller files...

Possible workaround can be to add a command line switch to tap2dsk which forces the number of allocated tracks to a supplied value or to standard one (40,41,42,80,81,82).

Else this bug should be fixed in Oricutron too but I can't make promises when this will happen :?

@xahmol : Can you try to add some more files when building the DSK image (for instance some TAPs with pictures) then on first boot simply delete them form DOS (using a commnad like: DELETE "SAMPLE.BIN").
So you will have more free space and proper DSK file from Oricutron's point of view.
Test your SAVE routines and ... give feedback ;).
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

iss wrote: Thu Oct 29, 2020 8:16 pm Possible workaround can be to add a command line switch to tap2dsk which forces the number of allocated tracks to a supplied value or to standard one (40,41,42,80,81,82).
Any documentation on syntax to use for that? Maybe looking not good enough, but do not see those switches documented here:
https://osdk.org/index.php?page=documen ... ge=tap2dsk
iss wrote: Thu Oct 29, 2020 8:16 pmCan you try to add some more files when building the DSK image (for instance some TAPs with pictures) then on first boot simply delete them form DOS (using a commnad like: DELETE "SAMPLE.BIN").
Did this. Did not help much.
And also notice now that Oricutron actually does not hang completely as music via the mymplayer irq routine still plays. Did not notice before because yyesterday at testing I had my volume at zero (not to get crazy from the music at testing). But program is completely unresponsive for the rest at some but not all saves and loads, also CTRL+C does not work.

Tried some other things as well:
- stopping music does not help (wanted to see if the music routines might interfere with disk I/O)
- tried on my real Oric Atmos with a Cumana Reborn, same behaviour, it works sometimes and sometimes it freezes.
- copied all files to a Sedoric 4 empty disk and started the program from there, same behaviour

So apparently it is not Oricutron related and also occurs with a Sedoric 4 disk not created by tap2dsk. So probably something my routines do wrong? But than do really not understand why it actually does work in some occasions and not on others on the same save data, same filename.
Or is too many disk I/O operations within a given time window an issue?

Puzzled.
Did notice indeed that with the empty Sedoric 4 disc I have ample of diskspace with that. No way to build directly from OSDK to Sedoric 4 full capacity disks?
User avatar
iss
Wing Commander
Posts: 1641
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by iss »

One easy thing to try:
In your BASIC source precede all DOS commands with '!' (i.e. !OPEN S,AN$,1 : !PUT 1,BS etc.).
After boot exit Sedoric DOS with command "QUIT" (or !QUIT) and start your program. Hope this will help!
User avatar
xahmol
Flight Lieutenant
Posts: 437
Joined: Sun Jun 28, 2020 7:32 pm
Location: Utrecht, The Netherlands
Contact:

Re: SEDORIC extended BASIC commands syntax samples/manual?

Post by xahmol »

iss wrote: Fri Oct 30, 2020 12:43 am One easy thing to try:
In your BASIC source precede all DOS commands with '!' (i.e. !OPEN S,AN$,1 : !PUT 1,BS etc.).
After boot exit Sedoric DOS with command "QUIT" (or !QUIT) and start your program. Hope this will help!
Will try tonight. Just one first question: presently my program heavily leans on some Sedoric extended BASIC commands. Primarily MOVE for the Windowing commands and INSTR for the input and key response routines. If I QUIT Sedoric DOS, will I then also loose those commands? In that case the cure is worse than the disease.....

Also hard to test then as then maybe the save routine itself works but all routines going there break unless I rewrite everything to not use SEDORIC extended BASIC commands.
Post Reply