Wee Basic

From GameBrew
Revision as of 09:13, 27 June 2012 by HydeWing (talk | contribs)
Wee Basic
File:Weebasicds08.jpg
General
Author(s)Marovada
TypeOther
Version0.81
LicenceMixed
Links
[Media:Weebasicds811.zip Download]
Website
Advertisements

<htmlet>adsense</htmlet>


Wee Basic is a BASIC interpreter for The Nintendo DS.It can used for programming and create NDS homebrew. The Basic interpreter now also comes equipped with a simple command to break infinite loops, and all keys are now supported for key operator.

Wee Basic 0.4 was submitted to the NEO Spring Coding Compo 2008 and ranked 9th. Version 0.6 was an entry to the NEO Spring Coding Compo 2009 under APP section.

Features

  • new dashboard with save, run, and load icons
  • backgrounds
  • sprites
  • sounds
  • microphone
  • key presses (keyboard and most hardware keys)
  • stylus touches (touch recognition and coordinates)
  • motion
  • primitive graphics
  • basic printing and coordinate printing
  • both screens can be used
  • core basic commands
  • usable editor with save/load, using text files

Installation

  1. Download and extract file
  2. DLDI patch it
  3. Put Wee and all of the gif files and demo.txt into the root directory of your card
  4. Press A to start

Usage

File names must be valid gif files and you must specify the full file name.Gif files must be kept in the root directory of your card.Don't try to move or delete sprites that you haven't created.

Each screen has its own numbered sprites, so you can specify the number 1 for a sprite on the top and bottom screens but don't specify the same number for sprites on the same screen.

Keywords document for Wee Basic can be found here.

Changelog

Version 0.81

  • revamped load screen now lists files in the root directory for you to select (no more typing in file names)
  • more colours added to lines and plots
black 1
blue 2
green 3
cyan 4
red 5
magenta 6
brown 7
white 8
gray 9
light blue 10
light green 11
light cyan 12
light red 13
light magenta 14
yellow 15
bright white 16
(colour 0 deletes)
  • new sprite functions to flip vertically and horizontally:
hflip <sprite no>,<screen>
vflip <sprite no>,<screen>
  • for/next now has a step parameter (the step parameter is added in square brackets):

for <variable>=<numexpression> to <numexpression> [<numexpression>] eg for i = 10 to 1 [-2], for j= 10 to 100 [10]

  • you can now use ‘;’ with print to keep on the same line (see sample program)
  • new math functions added: sqr, pi, asin, acos, atan, sinh, tanh, cosh and abs

eg let x=pi, let s=sqr(5)+pi-tanh(10)+abs(-10)

  • fixed: label errors
  • fixed: crash when file is loaded that exceeds editor capacity

Version 0.8

  • new dashboard with save, run and load icons (touch to enable)
  • cursor is off the screen for save and load
  • key combination to break: you can now hold ‘A’ and ‘Start’ at the same time to break a running program (eg if you get stuck

in an infinite loop)

  • all keys are now supported for key() operator, including L and R keys and Start and Select keys Summary of values returned by key():
X: 200
Y: 201
A: 202
B: 203
Left: 204
Right: 205
Up: 206
Down: 207
L: 208
R: 209
Start: 210
Select: 211
  • input statement bugs fixed

Version 0.7

  • editor bugs inserting text and backspacing fixed: many thanks to Peter Reissner (aka s54boc) for fixing these
  • new splash screen
  • cursor starts in correct position on launching wee basic
  • comments can now be made in program. Just start with ‘rem’ and everything is ignored until a ‘*’. For example:
rem this will be ignored *
print 1 “This will not be ignored”
  • cursor is now off-screen while a BASIC program is running

Version 0.6

Fixed:

I modified some of txtwriter’s basic editing code for the Wee Basic editor.

  • bug in boolexpressions (for if/while) using strings

Added/changed:

  • added motion commands (untested)

motion (keyword initializes motion – throws an error if no motion card detected) motx, moty (motion coordinates) example:

motion
let x=motx
let y=moty
print 1 “Motionx: “+x
print 1 “Motiony: “+y
end
  • playmp3 now has optional settings

Syntax is playmp3 <filename> <volume>,<pan>,<bitrate> (each is an integer or number variable) You can still use playmp3 without options if you want to keep it simple Version 0.5

Added:

  • SOUND (can play mp3s); and
  • you can record and play from the DS MICROPHONE

Version 0.4 Fixed:

  • bugs with nested ifs

Added:

  • neo splash screen
  • sprites on both screens (must be gif files)
  • backgrounds on both screens (must be gif files)
  • can uses start or A to start a program running
  • new commands:
loadspr number,screen,x,y,,width,height,file name (creates a sprite specified by the file name on the screen specified at the specified coordinates)
movspr number, screen, x,y (moves an existing sprite specified by the number to new coordinates x and Y on the screen)
delspr number, screen (deletes the specified sprite)
backgr screen, file name (creates a background on the specified screen with the gif file specified by the file name)

Version 0.3

Fixed:

  • editor: return key swallowing a character
  • editor: hopefully fixed remaining save bugs

Added/changed:

  • basic programs now have access to both DS screens and stylus input
  • hide or show keyboard with commands ‘keyhide’ and ‘keyshow’
  • you must hide the keyboard before printing to, or using graphics on, the bottom screen
  • cls, print, plot and line can now be used on both DS screens. You must specify a screen number. Syntax is now (s= screen number 0 or 1):
print s [at x,y] <string or variable>
plot s x,y,colour
line s x1,y1,x2,y2,colour
cls s
(s = screen number 0 or 1)
  • stylus coordinates can be obtained using stx() and sty()
eg, let sx=stx() let sxy=sty()
  • check whether bottom screen has been touched with stt()
eg, let touched=stt()
stt() returns 1 for touched and 0 for not touched
  • new example showing the above features

Alpha 2

Fixed:

  • no longer crashes when loading a file that doesn’t exist

Added/changed:

  • variable names are no longer restricted to 1 character. Wee Basic now supports variable names of up to 8 characters, starting with a letter

but can otherwise use a combination of letters and numbers. eg test, a1, string12, a1b1, hello$

  • one dimensional string and numerical arrays are now supported. To use them you first have to declare them with the “dim” statement.
eg. dim a1(10) dim hello$(5)
  • there is a maximum of 100 numerical and 100 string variables
  • each string array is limited to 30 members
  • each numerical array is limited to 100 members
  • you can print at a particular position on the screen using the “print at x,y”, where each of x and y is a numerical expression

Advertising: