Code:NextBasic Snippets: Difference between revisions

From SpecNext Wiki
Jump to: navigation, search
m Xalior moved page NextBasic Snippets to Code:NextBasic Snippets: Moving a Dave's code related page into the code: subwiki
Szerman (talk | contribs)
No edit summary
Line 33: Line 33:
poke 23692,255: print at 20,0;"Scroll my screen"
poke 23692,255: print at 20,0;"Scroll my screen"
for s=1 to 20: print at 21,31;" ": next s
for s=1 to 20: print at 21,31;" ": next s
</syntaxhighlight>
Select a file type to use by browsing the SD
<syntaxhighlight>
.browse -t pt3 m$
If m$<>"" then .$ playpt3 m$
</syntaxhighlight>
</syntaxhighlight>

Revision as of 13:44, 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

Check if a file exists in a location without generating an error

Layer 2,0: print at 0,0; : cat file$: exist$=screen$(0,0)
Layer 0: If exist$<>"N" then print "File found"

Press space to continue with flashy border when waiting for a key

Print "Press Space to continue": randomize usr 1300

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$