Basic function
Basic function
hello,
I am a little new . I would ask you, if you are using the BASIC of the Atmos, which commands you are missing and would like to have.
bye.
Edited by Dbug: If you have some needs in your BASIC programs, he can help you with some 6502 assembly routines to spice up your programs. Just indicate what you would like to have, and he will help if he can.
I am a little new . I would ask you, if you are using the BASIC of the Atmos, which commands you are missing and would like to have.
bye.
Edited by Dbug: If you have some needs in your BASIC programs, he can help you with some 6502 assembly routines to spice up your programs. Just indicate what you would like to have, and he will help if he can.
RECALL A$,FILENAME$
Well, I know that the following example is impossible on Atmos BASIC:
10 DIM A$
20 INPUT "Enter desired filename", FN$
30 STORE A$, FN$
Instead, the user (myself) have to do it as follows:
10 DIM A$
20 rem
30 STORE A$,"FILENAME.TAP"
This also implies for RECALL (RECALL A$,"FILENAME.TAP")
Or, to put it in short:
The user must define the filename to STORE to / RECALL from
within the BASIC program (it cannot be defined while the program is already running!) This have something to do with some kind of bug in Oric BASIC rom/routine.
I wonder could it be "fixed"?
Brana
10 DIM A$
20 INPUT "Enter desired filename", FN$
30 STORE A$, FN$
Instead, the user (myself) have to do it as follows:
10 DIM A$
20 rem
30 STORE A$,"FILENAME.TAP"
This also implies for RECALL (RECALL A$,"FILENAME.TAP")
Or, to put it in short:
The user must define the filename to STORE to / RECALL from
within the BASIC program (it cannot be defined while the program is already running!) This have something to do with some kind of bug in Oric BASIC rom/routine.
I wonder could it be "fixed"?
Brana
Edit:
EDIT/in addition:
On the date of: Thu Dec 20, 2007
DBUG answered: (quote)
For the filename problem, you can do the STORE instruction yourself by POKing/DOKing the right parameters in page 2, and calling the right ROM instructions with CALL.
(EndQuote)
... hehe, but I (still) do not know how!
Brana
On the date of: Thu Dec 20, 2007
DBUG answered: (quote)
For the filename problem, you can do the STORE instruction yourself by POKing/DOKing the right parameters in page 2, and calling the right ROM instructions with CALL.
(EndQuote)
... hehe, but I (still) do not know how!
Brana
Re
In addition to Mr. Dbug
If I use INPUT (string variable) then the file will save thousand errors! (file will become corrupted!) but, of course, it works fine if i use "literal string".
I can send you a small TAP (BASIC) demo file for this "bug" that I have made, if would like?
If I use INPUT (string variable) then the file will save thousand errors! (file will become corrupted!) but, of course, it works fine if i use "literal string".
I can send you a small TAP (BASIC) demo file for this "bug" that I have made, if would like?
Does Oric Basic allow a line like this:
30 STORE A$,"FILENAME.TAP"::::::::
Note all the trailing colons. If that works, you might traverse the FN$ string as follows:
FOR I=1 TO LEN(FN$):POKE address+I,ASC(MID$(FN$,I,1)):NEXT
where address happens to be the location of the literal string FILENAME.TAP.
Possibly you need to extend the FOR statement to add an ending " and new colons to fill up to maximum file name length.
It might be a bit cumbersome, but while waiting for alternative ROM routines it could work, and also be an interesting example of self modifyfing Basic programs.
30 STORE A$,"FILENAME.TAP"::::::::
Note all the trailing colons. If that works, you might traverse the FN$ string as follows:
FOR I=1 TO LEN(FN$):POKE address+I,ASC(MID$(FN$,I,1)):NEXT
where address happens to be the location of the literal string FILENAME.TAP.
Possibly you need to extend the FOR statement to add an ending " and new colons to fill up to maximum file name length.
It might be a bit cumbersome, but while waiting for alternative ROM routines it could work, and also be an interesting example of self modifyfing Basic programs.
Anders Carlsson
Re:
have You tested it?
I think it will not work as I think that - if the BASIC program is changed, then instantly after that change - all string variables will be "reset" to "zero"
However, I will test it as soon as I get home tonight
I think it will not work as I think that - if the BASIC program is changed, then instantly after that change - all string variables will be "reset" to "zero"
However, I will test it as soon as I get home tonight
Possibly you can add a REM statement using custom labels. A chunk of absolutely untested code which likely is full of bugs:
50 INPUT"LABEL",LB$
60 INPUT"FILENAME",FN$
70 GOSUB 200
80 END
100 REM STOREA$
101 STORE A$,"FILENAME.TAP"::::::::
102 RETURN
110 REM STOREX
111 STORE X,"XFILE.TAP":::::::::::
112 RETURN
200 REM SOB = START OF BASIC
201 REM EOB = END OF BASIC
203 REM LB$ = LABEL NAME
204 REM FN$ = FILE NAME
205 J=1
206 FOR I=SOB TO EOB
207 J=J+1
208 IF PEEK(I)<>ASC(MID$(LB$,J,1)) THEN J=1
209 IF J<LEN(LB$)+1 THEN NEXT I
210 REM "I" SHOULD POINT TO "STORE"
211 REM MOVE "I" FORWARD TO GET TO
212 REM THE FILE NAME STRING
211 I=I+7:REM WILD GUESS !!!
212 FOR J=1 TO LEN(FN$)
213 POKE I+J,ASC(MID$(FN$,J,1))
214 NEXT J
215 REM PAD LINE UP TO THE MAX
216 REM LENGTH OF A FILENAME
215 I=I+J:POKE I,CHR$(34):I=I+1
215 FOR J=I TO 16:REM WILD GUESS !!
216 POKE I+J,ASC(":"):NEXT J
217 RETURN
A lot of this could of course be done in machine code, but then again perhaps a patch to the STORE command would be a better way to go than all this possibly self modifying code.
Please note that I'm not familiar with Oric Basic so I don't know all its traits and features, e.g. if you have a WHILE/WEND statement, ELSE and so on.
50 INPUT"LABEL",LB$
60 INPUT"FILENAME",FN$
70 GOSUB 200
80 END
100 REM STOREA$
101 STORE A$,"FILENAME.TAP"::::::::
102 RETURN
110 REM STOREX
111 STORE X,"XFILE.TAP":::::::::::
112 RETURN
200 REM SOB = START OF BASIC
201 REM EOB = END OF BASIC
203 REM LB$ = LABEL NAME
204 REM FN$ = FILE NAME
205 J=1
206 FOR I=SOB TO EOB
207 J=J+1
208 IF PEEK(I)<>ASC(MID$(LB$,J,1)) THEN J=1
209 IF J<LEN(LB$)+1 THEN NEXT I
210 REM "I" SHOULD POINT TO "STORE"
211 REM MOVE "I" FORWARD TO GET TO
212 REM THE FILE NAME STRING
211 I=I+7:REM WILD GUESS !!!
212 FOR J=1 TO LEN(FN$)
213 POKE I+J,ASC(MID$(FN$,J,1))
214 NEXT J
215 REM PAD LINE UP TO THE MAX
216 REM LENGTH OF A FILENAME
215 I=I+J:POKE I,CHR$(34):I=I+1
215 FOR J=I TO 16:REM WILD GUESS !!
216 POKE I+J,ASC(":"):NEXT J
217 RETURN
A lot of this could of course be done in machine code, but then again perhaps a patch to the STORE command would be a better way to go than all this possibly self modifying code.
Please note that I'm not familiar with Oric Basic so I don't know all its traits and features, e.g. if you have a WHILE/WEND statement, ELSE and so on.
Anders Carlsson