Change log:

V5.05.04RC3

Bug fixes from V5.05.03
Set maximum ADC sampling rate to 480KHz on 400MHz processors, 500KHz on 480MHz processors
Fixed bug in ADC command causing lockup when number of channes opened > number sampled
Fixed bug in ADC command setting sampling rate
Fixed bug in DAC command setting output rate
Fixed ! character in font 4 and \ character in font 7
Fixed a bug in the initial startup dialogue after battery loss. This was introduced when I added FR keyboard support.
Fixed commandline being incorrectly tokenised in run command
Fixed passing float literals and functions yielding floats to CSUBs
Fixed minor colour variations between sprites and drawing commands in Legacy mode
Imposed checks on MODE and OPTION LEGACY commands to only allow legacy in 8-bit colour mode
Allow comment lines in CMM1 sprite files
fixed bug when trying to edit a new file that has the same name as an existing directory
Removed the faulty ability to use the RUN command with a string variable to be passed to MM.CMDLINE$
fixed bug when playing mono WAV files
fix bug that caused OPTION EDIT FONT MEDIUM to be lost
Tidy up font 4 and font 7 to make degree symbol compatible - use back single quote
Fix bug when using full path with include files
FIX bug using USB insert key
Closes serial ports when entering the editor to avoid corruption
Fixes page to read from after Ctrl-C
Opens the editor on the last edited line after a skipped error rather than the error line
Fixed bug in GPS function when run from the command line
Fixed bug where graphics commands that were completely off-screen left a line
Fixed case matching bug in EVAL when user functions were called
Avoid issue with OPTION EXPLICIT being specified when using RUN with a text commandline

BREAKING CHANGES FROM V5.05.03:
NUNCHUK command replaced by WII NUNCHUK otherwise syntax the same
Removed PLAY SPEECH, it didn't work anyway so obviously no-one had used it
OPTION SD TIMING now defaults to the slower setting. New settings are OPTION SD TIMING NORMAL and OPTION SD TIMING FAST
This option is permanent and will survive re-flashing the firmware in most cases.
WS2812 renamed BITBANG WS2812 
FONT 4 replaced with 10x16 font
BITMAP command removed as per the manual
FFT replaced by MATH FFT otherwise syntax the same
TTS replaced by PLAY TTS otherwise syntax the same 

New Functionality from V5.05.03
Change to initialisation to better support dual mode PS2/USB keyboards
WII CLASSIC OPEN [channel] [,interrupt] [,bitmask]
WII CLASSIC CLOSE 
As for the nunchuk the default channel is 3 which is the board edge connector. The others channels are I2C1 and I2C2 on the 40-pin connector.
There is a single interrupt routine which is triggered when ever any of the buttons are pressed. 
The optional bitmask can only be specified if an interrupt routine is used. It specifies which of the buttons should generate an interrupt
The Classic is interrogated using the CLASSIC function. The parameters are:
CLASSIC(LX [,chan]) 'returns the position of the analog left joystick x axis
CLASSIC(LY [,chan]) 'returns the position of the analog left joystick y axis
CLASSIC(RX [,chan]) 'returns the position of the analog right joystick x axis
CLASSIC(RY [,chan]) 'returns the position of the analog right joystick y axis
CLASSIC(L [,chan]) 'returns the position of the analog left button
CLASSIC(R [,chan]) 'returns the position of the analog right button
CLASSIC(B [,chan]) 'returns a bitmap of the state of all the buttons
CLASSIC(T [,chan]) 'returns the ID code of the controller - should be hex &H4200101
The button bitmap is as follows:
BIT 0: Button R
BIT 1: Button start  
BIT 2: Button home
BIT 3: Button select
BIT 4: Button L
BIT 5: Button down cursor
BIT 6: Button right cursor
BIT 7: Button up cursor
BIT 8: Button left cursor
BIT 9: Button ZR
BIT 10: Button x
BIT 11: Button a
BIT 12: Button y
BIT 13: Button b
BIT 14: Button ZL

Use CTRL-B in the editor to write the contents of the cut/paste buffer to a file. You can then use this file to include in another program
Holding the shift key and using the right arrow or down arrow keys in the editor will initiate select mode. 
This only works with a USB keyboard and not a serial console as shift arrow is not interpreted on a serial console.
BLIT to and from the framebuffer is now supported for all graphics modes and with all orientation parameter support. 
To BLIT from the framebuffer to the current WRITE page use FRAMEBUFFER as the page parameter
BLIT READ/SPRITE READ now both support reading from the framebuffer
NEW FUNCTION BOUND
BOUND( array() [,dimension])
This returns the upper limit of the array for the dimension requested. 
The dimension defaults to one if not specified. Specifying a dimension value of 0 will return the current value of OPTION BASE. 
Unused dimensions will return a value of zero. Thanks to MikoKisai for the idea of a sensible syntax
New command FRAMEBUFFER
This command allows you to create, use and remove a variable size framebuffer which should make many applications which have a working area bigger than the screen easier to program
FRAMEBUFFER CREATE HorizontalSize%, VerticalSize%
This command creates a framebuffer with the width and height specified in pixels. HorizontalSize>=MM.HRES and <=1600: VerticalSize>=MM.VRES and <=1200
FFRAMEBUFFER WRITE
PAGE WRITE FRAMEBUFFER 
This command sets all drawing commands to write to the framebuffer and inherit the width and height defined.
FRAMEBUFFER BACKUP
This command creates a backup copy of the framebuffer. If a backup already exists it is overwritten. This allows the programmer to save the background before he/she starts writing non-static data to it. NB: It won't be possible to use this command if a very large framebuffer is specified in 12 or 16-bit colour depth. A sensible error will be given in this case.
FRAMEBUFFER RESTORE [x, y, w, h] 
This command restores all or part of the framebuffer from the backup. This allows the programmer to “clean” all or part of the framebuffer before adding non-static items
FRAMEBUFFER WINDOW x, y, pageno [,I or B]‘
This command copies an area MM.HRES by MM.VRES from the framebuffer with top left at x,y to the page specified, The optional parameter specifies if the copy is Immediate or during frame Blanking
FRAMEBUFFER CLOSE 
This command releases the memory resources used by the framebuffer and backup allowing a new framebuffer to be created with a different size
MM.INFO(FrameH)
This function returns the horizontal size of the framebuffer in pixels
MM.INFO(FrameV)
This function returns the vertical size of the framebuffer in pixels
Notes
Setting a different graphics mode which changes the colour depth will close and delete the framebuffer 
JPG files cannot be loaded to the framebuffer and will error if tried.
The framebuffer is deleted by Ctrl-C and by running a new program

More additional items added to ARMCFunctions.h
Additional items added to ARMCFunctions.h
Added additional parameter to SPRITE READ SPRITE READ [#]n, x , y, w, h [,page_number]
This specifies which page to read from. If ommited it defaults to the write page
FR keyboard support
Improved error reporting of IF statements
Full implementation of CSUBs 
New optional parameter for PLAY MODFILE fname$ [,samplerate]
The sample rate is the number of samples per second that the modfile engine generates. The default is 44100.
Processor overhead is reduced by decreasing this. Valid values are 8000, 16000, 22050, 44100, 48000
Note: wav files played using PLAY EFFECT during mod file playback must have the same sample rate as the modfile output. 
Trying to play a wav file with a diffent sample rate will generate an error.
Wav files played with PLAY EFFECT can now be mono or stereo.

New command EXECUTE command$. 
This executes the Basic command "command$". This is expermimental and may not make the final release and comes with a serious health warning. 
You will probably find many ways of locking up the system using this requiring a power cycle.
Things that are tested and work OK include RUN, GOSUB, Subroutine calls, other simple statements (like Print and simple assignments)
Statements separated by : are not allowed and will error
The GOTO statement will not work properly
The command sets a "screw up timer" before executing the requested command and if control does not return to the command, like in a goto statement, the timer will expire.
In this case you will get the message "Command timeout". 
RUN is a special case and will cancel the timer

EDIT OPTION FONT expanded, new values are now SMALL, NORMAL, MEDIUM, LARGE
BITBANG BITSTREAM pinno, n_transitions, array[%]()
IMAGE ROTATE_FAST and IMAGE_RESIZE_FAST both have a new optional parameter - dontcopyblack
IMAGE RESIZE x, y, width, height, new_x, new_y, new_width, new_height [,page_number] [,dontcopyblack]
IMAGE ROTATE x, y, width, height, new_x, new_y, angle! [,page_number] [,dontcopyblack]
This defaults to 0, i.e. black pixels are treated like any other. If it is set to 1 then any black pixels in the created image will not be written. 

New subcommands for the PAGE command
PAGE AND_PIXELS sourcepage1, sourcepage2, destinationpage
PAGE OR_PIXELS sourcepage1, sourcepage2, destinationpage
PAGE XOR_PIXELS sourcepage1, sourcepage2, destinationpage
These combine the pixels on sourcepage1 and sourcepage2 by ANDing, ORing, or XORing them. destinationpage can be the same as either of the sourcepages if required. 

New permanent OPTION: OPTION EDIT FONT LARGE or OPTION EDIT FONT NORMAL
When LARGE is selected this changes the font used in the editor and file manager to FONT 2. 
This reduces the editor to 30 lines of 66 characters but makes it much more readable on small screenas or with "older" eyes.
The serial terminal is resized to fit. The screen returns to the normal font when exiting the editor or filemanager

KEYDOWN(7) will give any modifier keys that are pressed. These keys do not add to the count in keydown(0)
The return value is a bitmask as follows:
lalt ? 1
lctrl ? 2
lgui ? 4
lshift ? 8
ralt ? 16
rctrl ? 32
rgui ? 64
rshift ? 128

KEYDOWN(8) will give the current status of the lock keys. These keys do not add to the count in keydown(0)
The return value is a bitmask as follows:
caps_lock ? 1
num_lock ? 2
scroll_lock ? 4

OPTION PATH renamed to "OPTION SEARCH PATH"
e.g. OPTION SEARCH PATH "/zmim/"
MM.INFO$(SEARCH PATH) will return the string
OPTION LIST modified to match 

OPTION COLOURCODE REVERSE
This will be the same as OPTION COLORCODE OFF except that the text will be in reverse video black on white. This will apply to the filemanager and editor 

Tidy up of OPTION LIST
Change auto repeat scaling in editor to improve performance
BREAKING CHANGES
FFT replaced by MATH FFT otherwise syntax the same
TTS replaced by PLAY TTS otherwise syntax the same
Implemented support for $GN messages as well as $GP in the GPS background processor



Existing files without an extension can now be edited.
The editor will still default to appending ".BAS" if the file does not exist. If you need a new file without an extension create it with an extension of ".tmp" and then rename it.

The keyboard auto-repeat rate is automatically scaled when in the editor if the screen is scrolled.
This will stop multiple keypresses stacking up when the screen can't keep up.

Better picture review in the filemanager
Pressing return on any picture file in the filemanager will switch to 800x600x16bit mode (mode 1,16) and display the picture as before. 
However, now pressing any key when the picture is displayed will return to the filemanager with everything left as before the picture was displayed.

New IMAGE subcommands
IMAGE ROTATE_FAST
IMAGE RESIZE_FAST
these commands have exactly the same syntax as the originals but use a nearest neighbour algorithm rather than bi-linear interpolation. 
As a result they are much faster (6x for rotate and 20x for resize) but, of course, the resulting image quality will not be as good

OPTION F11 and F12 restricted to 23 characters

BITMAP command removed as per the manual

OPTION SEARCH PATH pathname$
This defines a path which will be searched when you use the existing RUN command or the new shortform RUN command if the file does not exist in the current directory

RUN filename$ command will search path
When you type RUN with a filename it will first look for the file in the current working directory and then any path specified by OPTION PATH. 
As before the filename must be a quoted string literal. Any text after a comma following the filename will be passed to the program in MM.CMDLINE$

Shortform run command at the command prompt
An asterix before a filename will be interpreted as the RUN command. The filename is not quoted and any text after a space following the filename will be passed to the program as MM.CMDLINE$.
The command will check for the existence of the file in the current directory and run it from there if found. If the file is not found the command will also search in any path defined by the OPTION PATH command.
The shortform run command is not available in a program

V5.05.03
Fixes use of function keys with line input
Fixes filled circle with colour black
Fixed bug in MM.INFO(CURRENT) and MM.INFO(PATH)
Change to the "modified program" test to try and ensure all relevant modifications force a re-load
Implemented read after write check for the OPTION settings
Changed the test for pin 40 reset to require three positive (tied to GND) readings at 300mSec intervals
Fixed memory leak in file open command
Implemented support for reverse video on the serial console when using PRINT @(x,y,2) or PRINT @(x,y,5)

New OPTION

OPTION KEYBOARD REPEAT firstchar, nextchars

firstchar is the time in milliseconds before a new character repeats. Default is 600mSec, valid range 100 to 2000 mSec
nextchars is the time in milliseconds before subsequent character repeats. Default is 150mSec, valid range 25 to 2000 mSec

NB: Of course this only applies to the USB keyboard, serial consoles have their own algorithms.
NB: Installing this version will reset all options to default so things like USBKEYBOARD and RTC CALIBRATE will need re-doing

Added number of characters in paste buffer to status line
Added German keyboard support - use OPTION USBKEYBOARD DE
Fixed bug in function CWD$
Fixed bug in relative pathnames in LS / LIST FILES
Re-engineered relative pathnames for all file-opening commands to imptove exFAT compatibility
Made a change that could ameliorate a bug in cut and paste functionality
Reset colour mapping when entering editor or filemanager
Fixed bug when text was printed that caused the display to scroll from within a subroutine
Fixed bug that stopped drawing commands accepting functions as parameters
Changed the memory handling for cut/paste functionality in the editor
Fixes bugs in editor
  Incorrect cursor placement after cutting text that required the page to scroll
  END END does not go to end of the last line if the last line doesn't have a CR
  CUT does not remove last line of the file if the last line doesn't have a CR
Fixed bug in ON ERROR SKIP
Improved MM.ERRMSG$ to give the full text of the error with substitutions of data made and file name (if and include file) and linenumber
Fixed a bug in transparent text when writing to a page other than page 0
Improved performance of transparent text output 
Added various functions to the list for colour coding in the editor
Corrected the OPTION list text for OPTION SD TIMING CONSERVATIVE
Fixed bug in cursor when typing manually into AUTOSAVE
Flushed caches before doing compare of existing program with edited version
Close all open files after an error


V5.05.02
Changes from RC44
Included a protection to try and avoid editor incorrectly reporting "Nothing to edit" and fixed the underlying cause
Re-engineered INPUT$ from files to better fix a bug that was reported earlier
Removed a spurious esc character sent by the editor
Fixed editor bug where if ESCAPE is only pressed once or twice, then any other keys are pressed, the warning message still remains at the bottom of the terminal screen
LS, LIST FILES and DIR$ now all understand a path name as part of the pattern string
e.g.
? dir$(“subdir/*.bas”)   ‘get the first .bas file in the subdirectory subdir of the current working directory
? dir$(“/subdir/*.bas”) ‘get the first .bas file in the directory A:/subdir
Ls “subdir/*”   ’ list all the files in subdirectory subdir of the current working directory
LS “/subdir/*” ‘ list all the files in the directory a:/subdir

For both LS and DIR$ the code works as follows
You type  “/subdir”   the firmware looks for a file or directory subdir in the root directory
You type  “/subdir/”   the firmware interprets  “/subdir/*” 
You type  “/subdir/something”   the firmware looks for a file or directory with the name “something” in subdir
You type  “/subdir/something/” the firmware interprets  “/subdir/something/*” 

RC44
Blocks the use of function keys and shifted function keys that do not have defined uses in the editor.

RC43
Fixes a bug in MM.INFO(FILESIZE,fname$) when a path is specified in the filename
Fixes a bug in MM.INFO(MODIFIED,fname$) when a path is specified in the filename

RC42
fixes a bug where MM.INFO$(KEYBOARD) was giving an incorrect value
fixes a "feature" where when editing files other than BAS or INC with OPTION COLOURCODE ON selections and find results were not highlighted
fixes a "feature" where when editing any files with OPTION COLOURCODE OFF selections and find results were not highlighted

RC41
Fixes a bug where Ctrl-K in the editor would jump to the start of file if directly preceeded by the HOME key
Introduces a minor limitation on selection of text in the editor  such that you can't select backwards from the 
point at which you pressed F4. You can go forwards and then reduce the selection by going back but you can never 
go back past the point you started the selection.
This will affect LEFT, HOME and UP commands while in selection mode. 
Key presses that attempt to select back beyond the start point will be ignored  

RC40
Fixes bug in ON ERROR command
Fixes lack of response to Ctrl-C when using a USB keyboard and calling PIN functions which involve ADC conversion in a tight loop

RC39
Fixes bug in loading CMM1 sprite files in 12 and 16-bit colour modes

RC38
Corrects the implementation of TRACE commands

RC37
Fixes bug introduced in RC36 that stopped the enter key working in the filemanager and editor when using a USB keyboard
Make OPTION LEGACY ON only available in a program and returns to normal when the program exits

RC36
"Save As" in editor renamed "Backup"
LS implemented as synonym for LIST FILES
bug in pressing END twice in editor fixed
keyboard buffer truncated when page scrolls in editor
OPTION MODES command removed. Increased video stability in recent releases makes this now redundant.

RC35
Fixed an issue introduced in RC32 where USB keyboard enumeration was less reliable than in previous versions
Fixed bug in array state after running editor and also in other conditions
Improved Circle drawing algorithm
Fixed various bugs in graphics commands when scalar colours are used with arrayed coordinates
Modified POLYGON command so x and y coordinate arrays can each be float or integer as required 

RC32
Fixes bug in ERROR command
Fixes bug where input$ reads 1 character past the end of a file
Fixes bug in select & delete/copy/cut multiple lines when start line is blank
Fixes bug in code underlying BLIT and SPRITE SCROLLR that could cause a processor hang
Change to SAVE IMAGE: new optional parameters
Change to POLYGON command + huge performance increase

RC28
Fixes a floating point issue when very large integers are stored as FLOATS
Fixes a lockup that could be caused by framing errors on the serial console port
Fixes an editor bug when after an error the file would open with the cursor one line above the incorrect one under certain circumstances
Fixes an editor bug where CUTTING or DELETING multiple lines and where the selection caused the screen to scroll would leave the screen incorrectly updated.
Enables use of Terminal emulators on LINUX
Removes the need to configure Teraterm to send CRLF when receiving CR on Windows

RC18
Original general release