BomberZ.bas and bas2tap ..

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

User avatar
ibisum
Wing Commander
Posts: 1643
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

BomberZ.bas and bas2tap ..

Post by ibisum »

Hi .. in the process of getting a bit more familiar with the OSDK 1.11, I spent some time going through the samples this morning and trying to build everything .. And I encountered the project at osdk_1_11/sample/basic/game/BomberZ.bas, which is a very different BASIC variant than I would expect .. and indeed is different from other samples, e.g. osdk_1_11/sample/basic/hires_demo.

And in fact, it appears that Bas2Tap.exe doesn't like these 'weird basic' projects .. is there any reason for their inclusion in the project, perhaps there is a different Bas2Tap expected for these projects?
christian
Pilot Officer
Posts: 96
Joined: Sun Nov 24, 2013 9:58 pm

Re: BomberZ.bas and bas2tap ..

Post by christian »

Hi,
It looks like it's written with virtualbasic: http://virtualbasic.org/
But the syntax is incorrect. Every GOTO &label should be GOTO @label, same with THEN &label and ON xx GOTO &label1,&label2...
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: BomberZ.bas and bas2tap ..

Post by Dbug »

It's an historical thing: One of the forum users wrote a converter that handle auto numbering and labels, unfortunately the converter was written in Delphi or something else that was not C or C++ and thus would have been a major pain to maintain in the OSDK.

Code: Select all

C:\Users\mike>%osdk%\bin\labels2num
Error : Not enough parameters !
"Labelized BASIC" to Oric BASIC converter for OSDK v1.1
Wilfrid AVRILLON - 2007

Syntax  : Labels2Num.exe <FromFile> <ToFile> <FirstLineNum> <Step> -v

<FromFile>.... : File to be processed - mandatory
<ToFile>....   : Target file, result of the process - mandatory
<FirstLineNum> : Index of the first Line
                 of the Basic Program.
                 default=1 - this  field is optional
<Step>........ : Step used for the numbering of the BASIC program.
                  default=1 - this  field is optional

Example : Labels2Num.exe myprogram.txt myprogram.bas 5 5
It's one of the features I'd like to add directly to Bas2Tap, but with a different syntax (because I don't really like the & and #) :)
User avatar
ibisum
Wing Commander
Posts: 1643
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: BomberZ.bas and bas2tap ..

Post by ibisum »

Are the Delphi sources around? I'd be willing to try to port it to something a bit more portable, or even try a FreePascal port that might even work .. or else, knowing the specs, add the feature to bas2tap?
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: BomberZ.bas and bas2tap ..

Post by Dbug »

Ideally the feature should be added to bas 2 tap, basically the idea is to allow two different things:
- Have the system automatically generate line numbers
- Be able to point to labels instead of numbers

For the sake of portability, I think both features should be able to work together, like you have a program that does that:

Code: Select all

10 CLS
20 PRINT"HELLO WORLD"
30 GOTO 20
a first step approach would allow you to rewrite it that way:

Code: Select all

10 CLS
loop
20 PRINT"HELLO WORLD"
30 GOTO loop
and then at some point you can get rid of the line numbers:

Code: Select all

 CLS
loop
 PRINT"HELLO WORLD"
 GOTO loop
but the final generate executable still have all the line numbers.

As far as specs, as said earlier, I don't like the & and #, don't see any reasons for them, could just be like in assembler, where things that start on the first column are labels, and the rest has to start with at least some white space from the left column.
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: BomberZ.bas and bas2tap ..

Post by Chema »

Or even simpler anything not being a reserved word is a label unless in an assignment expression (in which it would be a variable). You don't really need line numbers (you can generate them in the end and substitute labels with the corresponding line number.

I think any parser can handle that easily.

But in the worst case, a label can end with a colon...
User avatar
ibisum
Wing Commander
Posts: 1643
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: BomberZ.bas and bas2tap ..

Post by ibisum »

I think the point is, do we want all this or is it just a distraction? Because the other thing would be to just update the onboard samples so they actually do build, and move on from it...
christian
Pilot Officer
Posts: 96
Joined: Sun Nov 24, 2013 9:58 pm

Re: BomberZ.bas and bas2tap ..

Post by christian »

I have my own "virtualbasic like" written in shell.
In case you want try BomberZ, here is the tap file.
Attachments
BomberZ.tap
(3.01 KiB) Downloaded 386 times
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: BomberZ.bas and bas2tap ..

Post by Dbug »

As of now, having a normal game with normal line numbers that compiles and run normally is probably the best idea.
Now, should that be this game in particular, I don't know.
As I said, it was some experiment from Wascol, and I don't remember why it ended up in the final SDK, probably because I put it in samples to test and it stayed there and was packed with the rest.

Which means:
- Either we fix it
- Or we remove it
User avatar
ibisum
Wing Commander
Posts: 1643
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: BomberZ.bas and bas2tap ..

Post by ibisum »

christian: thanks for that, its actually a cute little type-in ..

I vote we fix all of these games and bring the samples up to working condition ..
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: BomberZ.bas and bas2tap ..

Post by Dbug »

ibisum wrote: Mon Apr 30, 2018 12:37 pm christian: thanks for that, its actually a cute little type-in ..

I vote we fix all of these games and bring the samples up to working condition ..
Is there any other non working sample?
User avatar
ibisum
Wing Commander
Posts: 1643
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: BomberZ.bas and bas2tap ..

Post by ibisum »

Only samples/basic/labels/label_test.bas .. should probably just be removed from the repo as being non-sequitur.

Everything else is buildable..
User avatar
ibisum
Wing Commander
Posts: 1643
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: BomberZ.bas and bas2tap ..

Post by ibisum »

Here is a version of BomberZ, fixed:

Code: Select all

10 REM ##########################################################
20 REM #Type in program adapted from the book                   #
30 REM #"ORIC ATMOS, vos programmes BASIC et langage machine    #
40 REM #Authors : Michel Bussac and Gil Espèche              #
50 REM #Editor : CEDIC NATHAN (1984)                            #
60 REM #Original Title : Mission Bonbardement                   #
70 REM ##########################################################
80 REM # Move with A,Z, < and >
90 REM # Fire with space bar
100 REM 'BomberZ
110 REM 'machine code
120 REM #the assembly routine can be used in any game
130 REM #for this copy the series of DATA given here and 
140 REM #the folowing code :
150 REM #    FOR R=0 TO #8D
160 REM #    READ A
170 REM #    POKE #400+R,A
180 REM #    NEXT 
190 REM #It can be used in two different ways :
200 REM # - With DOKE 0,#BBA9:DOKE 2,#BBA8:CALL#400, you should obtain 
210 REM #   a scrolling from right to left
220 REM # - With both the same DOKE, but calling the routine in #431, you should obtain 
230 REM #   a scrolling from right to left plus the plotting of two characters that you must
240 REM #   define at the beginning of the game in #4FD and #4FE. Moreover, used in this way, 
250 REM #   this code takes care of keybord handlingand moves the characters according 
260 REM #   to the keys pressed.
270 DATA #A2,#00,#A0,#00
280 DATA #B1,#00,#91,#02
290 DATA #C8,#C0,#26,#D0
300 DATA #F7,#A9,#20,#91
310 DATA #02,#18,#A5,#02
320 DATA #69,#28,#85,#02
330 DATA #48,#A5,#03,#69
340 DATA #00,#85,#03,#68
350 DATA #18,#69,#01,#85
360 DATA #00,#A5,#03,#69
370 DATA #00,#85,#01,#E8
380 DATA #E0,#1C,#D0,#D2
390 DATA #60,#A0,#01,#A9
400 DATA #20,#91,#04,#88
410 DATA #10,#FB,#20,#00
420 DATA #04,#AD,#08,#02
430 DATA #A2,#01,#C9,#94
440 DATA #F0,#0E,#C9,#8C
450 DATA #F0,#19,#A2,#28
460 DATA #C9,#AE,#F0,#13
470 DATA #C9,#AA,#D0,#1E
480 DATA #8A,#18,#65,#04
490 DATA #85,#04,#A5,#05
500 DATA #69,#00,#85,#05
510 DATA #4C,#72,#04,#86
520 DATA #06,#A5,#04,#38
530 DATA #E5,#06,#85,#04
540 DATA #A5,#05,#E9,#00
550 DATA #85,#05,#A0,#01
560 DATA #B1,#04,#C9,#20
570 DATA #D0,#0E,#88,#10
580 DATA #F7,#A0,#01,#B9
590 DATA #FD,#04,#91,#04
600 DATA #88,#10,#F8,#60
610 DATA #A9,#01,#8D,#FC
620 DATA #04,#60
630 
640 REM #Graphics for characters
650 'Graphics
660 DATA 0,48,56,60,31,31,31,7
670 DATA 0,0,0,0,48,60,63,32
680 DATA 30,45,45,45,30,18,33,63
690 DATA 1,1,2,4,8,16,32,32
700 DATA 63,0,0,0,0,0,0,0
710 DATA 32,32,16,8,4,2,1,1
720 DATA 0,0,0,0,0,0,0,63
730 DATA 0,30,33,63,18,12,0,0
740 DATA 45,24,61,35,51,62,37,35
750 DATA 0,0,16,56,24,4,2,1
760 
770 REM #Clear Screen, disable keyboard sound
780 CLS:POKE#26A,10
790 PLAY 0,7,0,0
800 
810 REM #Load Machine Code
820 FOR R=0 TO #8D
830 READ A
840 POKE #400+R,A
850 NEXT 
860 
870 REM #Load Graphics
880 FOR R=0 TO 79
890 READ A
900 POKE#B508+R,A
910 NEXT
920 
930 REM #Introduction
940 REM introduction
950 CLS:PAPER 0:INK2
960 PRINT 
970 PRINT CHR$(138);CHR$(134);SPC(15)"Bomber Z"
980 PRINT CHR$(138);CHR$(133);SPC(15)"Bomber Z"
990 PRINT
1000 PRINT "Controls :"
1010 PRINT "Up    - A"
1020 PRINT "Down  - Z"
1030 PRINT "Left  - <"
1040 PRINT "Right - >"
1050 PRINT "Fire  - [Space]
1060 PRINT
1070 PRINT CHR$(135);"   ";CHR$(35);" Radar       --> 5 Pts"
1080 PRINT
1090 PRINT CHR$(135);"   ";CHR$(40);" Flying mine --> 1 Pts"
1100 PRINT
1110 PRINT
1120 PRINT "Press any key to Start":GET A$:GET A$
1130 CLS
1140 REM #Prepare the screen, load two caracters for the assembly routine in #4FD,and init score
1150 PAPER 0:INK7:DOKE #4FD,#2221:AC=#25:SC=0
1160 
1170 REM #delete 'CAPS'
1180 FOR R=0 TO 3:POKE#BBA4+R,32:NEXT
1190 
1200 REM #Show up the battle field, and start the engines sound effects
1210 FOR R=0TO38
1220 POKE#BBD0+R,39:POKE#BE28+R,37:SOUND4,R,5
1230 NEXT
1240 
1250 REM #Prepare the tables for the machine code routine
1260 DOKE 4,#BD18:M=#BE4E:HM=15:POKE#4FC,0
1270 
1280 REM #Start of the main loop:vectors initialization for horizontal scrolling
1290 REM loop
1300 DOKE0,#BBA9:DOKE2,#BBA8:POKE#BBF6,39
1310 
1320 REM #Shoot test
1330 IF T=1 THEN POKE MT,32:GOTO 1390
1340 
1350 REM #Test for fire key
1360 IF PEEK(#208)=#84 THEN 1840
1370 
1380 REM #scoll the screen and move the plane
1390 REM Do_Scrolling
1400 CALL#431
1410 
1420 REM #collision test
1430 IF PEEK(#4FC)=1 THEN 2050
1440 
1450 REM #Shoot second test
1460 IF T=1 THEN 1860
1470 
1480 REM #Random evolution of the game
1490 REM update_field
1500 AZ=INT(RND(1)*5)
1510 ON AZ GOTO 1580,1640,1700,1770
1520 
1530 REM flat_mountain
1540 IF AC=#26 OR AC=#23THEN M=M+40:HM=HM+1
1550 POKEM,37:AC=#25
1560 GOTO 1290
1570 
1580 REM ascending_mountain
1590 IF HM-1<4 THEN 1530
1600 IF AC=#24 OR AC=#25 THEN M=M-40:HM=HM-1
1610 POKEM,36:AC=#24
1620 GOTO 1290
1630 
1640 REM descending_mountain
1650 IF HM+1>20 THEN 1530
1660 IF AC=#26 OR AC=#23 THEN M=M+40:HM=HM+1
1670 POKEM,38:AC=#26
1680 GOTO 1290
1690 
1700 REM radar
1710 IF AC=#26 THEN 1730
1720 GOTO 1530
1730 REM new_radar
1740 POKEM,35:AC=#23
1750 GOTO 1290
1760 
1770 REM mine
1780 IF INT(RND(1)*2)=0 THEN 1530
1790 HB=INT(RND(1)*HM)
1800 POKE#BC1E+40*HB,40
1810 GOTO 1530
1820 
1830 REM #Shoot handlers
1840 REM Create_Fire_Shot
1850 T=1:MT=DEEK(4):GOTO 1290
1860 REM Move_Fire_Shot
1870 MT=MT+40
1880 IFDEEK(MT-1)<>#2020THEN1910
1890 POKEMT,42:GOTO 1490
1900 
1910 REM Boom
1920 IF PEEK(MT)=35THEN 1950
1930 IF PEEK(MT)=40THEN 1970
1940 GOTO1990
1950 REM boom_radar
1960 SC=SC+5:POKEMT,41:GOTO1990
1970 REM boom_mine
1980 SC=SC+1:POKEMT,32:GOTO1990
1990 REM boom_common
2000 T=0:SHOOT
2010 PAPER7:PAPER0
2020 PLAY0,7,0,0:SOUND4,6,5
2030 GOTO 1490
2040 
2050 REM game_lost
2060 FOR R=0 TO 10
2070 PAPER7:PAPER0
2080 SOUND4,3*R,15
2090 NEXT
2100 EXPLODE
2110 WAIT50
2120 CLS:INK3:PRINT"Your Score:";SC;" Points."
2130 PRINT:PRINT:PRINT:PRINT
2140 PRINT:PRINTSPC(10)"You loose ..."
2150 PRINT:PRINT:PRINT
2160 PRINT"Play again ?":GET A$:GET A$
2170 IF A$="Y" THEN 940

User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: BomberZ.bas and bas2tap ..

Post by Dbug »

Ok, tomorrow I'll remove this dead stuff, no need to keep broken things :)
Thanks guys.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: BomberZ.bas and bas2tap ..

Post by Dbug »

I actually made a version of Bas2Tap that natively handles the labels and do the auto-numbering.
By default the tool behave as before and expects a 100% standard Oric formated BASIC line, but I added some directives that allows to bypass that.

The reason I did that is that I'm not 100% confident that my changes are still 100% compatible with other Oric BASIC programs so I did not want to break it, and things like a +1 issue on the generated line numbers.

Here is what that looks like:
BeforeAfter.png
Basically what you can do is:
- Define symbols (with #define) which can later be reused in the program instead of magical numerical values. Due to the BASIC code structure which allows for no whitespace at all, I had to restrict symbols to not allow them to contain BASIC instructions names in them. (I may be able to lift the constraint in some ways, but ultimately IF A=HYPOTHENUSE THEN will still be a problem and be parsed as IF A=HYPO THEN USE THEN), but since this is case sensitive, you can still use defines in lowercase and keep the BASIC keywords in uppercase. To be discussed.

- Mix and match labels, auto-generated numbers and sections of code with numbers, as long as the combination results in increasing numbers we are good to go. The reason is that this allows people to progressively convert an existing BASIC program to use the new system.

- Labels can be followed by one or two values separated by a ":" separator. "+n" is used to define the increment, and "n" the new starting line.

- A magic symbol, "§" which is expanded to contain the current line number, can creatively be used to store the location of a function to call in a variable.

- A magic symbol, "~" which can be used to directly insert all these annoying CHR$ characters. PRINT "~CYELLOW~LBLINKING" (when followed by a upper case character, directly inserts the ESCAPE code followed by the value), but also to insert things like carriage return/line breaks in as string: I$=I$+"black dust~m~j")

I admit it's a bit cryptic, but probably not worse than the average Oric BASIC program full of CHR$(27);"C"

And finally the #optimize command that enables the stripping of all useless whitespace, removal of comments, and ultimately anything that could be removed without impacting the program behavior.

Hope that makes sense, hopefully that should be in the next version of the OSDK, to be released Soon(tm)
Post Reply