06-20-2010, 12:22 AM
First case
I moved the main loop of my program into a sub, but I forgot to call the sub... so the program had nothing to do after DIMing and LETing some variables. The program returned to Sinclair BASIC with the error "C Nonsense in BASIC" instead of "0 OK".
Then I wrote a test program: just one sub, not called. The program returned to Sinclar BASIC with "0 OK". Strange. So there's something wrong with my program.
If I call the sub, or take its content out of the sub, everything works fine.
Second Case
But then I moved the main loop (out of any sub) to the end of the program... and the same error happened. I suspected two files I'm including, with character sets in assembler format, had something to do.
Here you are schematic versions of both cases:
This one works fine:
But this one simply returns with "Nonsense in basic":
Both included files have the same structure:
So?
Both cases are not the same, but I suspected the included files are the reason of the strange error in the first case, when there was nothing to exectute; and the fact than the main loop is not found in the second case, and the error is returned.
I kept the main loop at the end of the program and removed the #includes. The program worked fine! Case 2 confirmed.
Then I moved the main loop into a sub but didn't called the sub... The program returned with a "0 OK" message as expected! Case 1 confirmed.
Will it happen with explicit (not #included) ASM sections? Let's see. I added some assembler lines right before the main loop sub, but the message was still "0 OK". It seems the strange behaviour is caused by #including the ASM sections.
Am I doing something wrong? Is there any limitation about the location of ASM sections or its including?
I moved the main loop of my program into a sub, but I forgot to call the sub... so the program had nothing to do after DIMing and LETing some variables. The program returned to Sinclair BASIC with the error "C Nonsense in BASIC" instead of "0 OK".
Then I wrote a test program: just one sub, not called. The program returned to Sinclar BASIC with "0 OK". Strange. So there's something wrong with my program.
If I call the sub, or take its content out of the sub, everything works fine.
Second Case
But then I moved the main loop (out of any sub) to the end of the program... and the same error happened. I suspected two files I'm including, with character sets in assembler format, had something to do.
Here you are schematic versions of both cases:
This one works fine:
Code:
' ....most of the program here......
do
' MAIN LOOP
loop
#include "charset1.bas"
#include "charset2.bas"
def sub charset()
' bla bla
end sub
' END OF FILE
But this one simply returns with "Nonsense in basic":
Code:
' ....most of the program here......
#include "charset1.bas"
#include "charset2.bas"
def sub charset()
' bla bla
end sub
do
' MAIN LOOP
loop
' END OF FILE
Both included files have the same structure:
Code:
label:
asm
defb 1,8,86,68,78,78,78,6
; hundreds of DEFB
defb 1,8,86,68,78,78,78,6
end asm
So?
Both cases are not the same, but I suspected the included files are the reason of the strange error in the first case, when there was nothing to exectute; and the fact than the main loop is not found in the second case, and the error is returned.
I kept the main loop at the end of the program and removed the #includes. The program worked fine! Case 2 confirmed.
Then I moved the main loop into a sub but didn't called the sub... The program returned with a "0 OK" message as expected! Case 1 confirmed.
Will it happen with explicit (not #included) ASM sections? Let's see. I added some assembler lines right before the main loop sub, but the message was still "0 OK". It seems the strange behaviour is caused by #including the ASM sections.
Am I doing something wrong? Is there any limitation about the location of ASM sections or its including?
Marcos Cruz
http://programandala.net
http://programandala.net