Difference between revisions of "Code:NextBasic Snippets"

From SpecNext official Wiki
Jump to: navigation, search
("Check for file not present" deleted as code does not work without screen corruption/reliably)
(Deleted "space to continue with flashy border" as code does not work without making painful speaker noises sideeffect)
Line 16: Line 16:
 
fsize=a
 
fsize=a
 
CLOSE #4
 
CLOSE #4
</syntaxhighlight>
 
 
Press space to continue with flashy border when waiting for a key
 
<syntaxhighlight>
 
Print "Press Space to continue": randomize usr 1300
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 20:40, 11 December 2023

NextBasic Snippets

To read a file of any type or size to any bank this will load myfile.bin to bank 22 (8kbs):

.extract myfile.bin -mb 22

To get the filesize of a file in to var fsize:

OPEN #4, "myfile"
DIM #4 TO a
fsize=a
CLOSE #4

Scroll screen up without prompt

poke 23692,255: print at 20,0;"Scroll my screen"
for s=1 to 20: print at 21,31;" ": next s

Select a file type to use by browsing the SD

.browse -t pt3 m$
If m$<>"" then .$ playpt3 m$

Change the font width to X pixels when printing

10 LAYER 1,1 : CLS
20 PRINT CHR$ 30+CHR$ 5  : REM 5 pixels wide
30 PRINT "HELLO"

Get the current CORE version

10 DEFPROC CoreVersion()
20 %i=% REG 1: LET m=%i>>4: LET ml=%i&@00001111
30 i=% REG 14: LET i= IN 9531: PRINT INK 2;"Current core :";m;".";ml;".";i
40 ENDPROC

Get Next version running

.nextver v
print "Current Next OS:";v
if v<2.07 then print "Think about upgrading your distro"