10-01-2021, 08:33 PM
Different implementations of BASIC have different naming schemes.
Rather than Microsoft's method of using 2 letters to define variables of any type, the MWB uses:
The history behind this is that the MWB evolved from an integer only Tiny BASIC and the simplistic [A-Z][0-7] naming made it simple and quick to find the variables in memory.
Apart from the RESET key, all of the keys are all assigned unique scancode. The microbee scans its keys into different ways. One method is the free run scanning where the VDU character address register which incremented is used to provide the keycode scan address and when the LPEN signal is triggered the 6545 holds the VDU Character address as the keyscan code. The other method is to use the R6545's R31 Update Register to check the state of a specified key. The MWB keyboard driver uses a combination of both these methods. The keys are wired up so that each key is assigned to a block of 16 VDU character addresses. From the scancodes and separately polled modifier keys, the keyboard driver converts them into ASCII codes for MWB to use.
Here is a a small demonstration code snippet that was written by Monte Chan that was very useful for writing games that needed to sense multiple keypresses quickly.
It loads a tiny machine code hook that allows keys to be scanned by their scancode.
The K variable is the keycode to be scanned. This value can be changed as required. The screen dump value of 2 is the 'B' key. The keycodes are listed on the microbee schematic diagram by reading the keyboard matrix from the top left hand corner down each column and then across from left to right with the SHIFT key being last at 63.
The driver returns a result of 0 if the key is pressed and -1 if not pressed. The machine code driver is loaded at 8192 but is totally relocatable.
Someone tried it on MWB 5.10 and it works. It should also work on MWB 5.22e
Go on, try it and have fun in the process.
Rather than Microsoft's method of using 2 letters to define variables of any type, the MWB uses:
- 26 single letter variables A-Z to hold 16 bit signed integer values.
- 26 * 8 two letter characters with the first letter being a letter A-Z followed by a digit between 0-7. Floating Point, string and array variables are specified using option B naming schemes.
The history behind this is that the MWB evolved from an integer only Tiny BASIC and the simplistic [A-Z][0-7] naming made it simple and quick to find the variables in memory.
Apart from the RESET key, all of the keys are all assigned unique scancode. The microbee scans its keys into different ways. One method is the free run scanning where the VDU character address register which incremented is used to provide the keycode scan address and when the LPEN signal is triggered the 6545 holds the VDU Character address as the keyscan code. The other method is to use the R6545's R31 Update Register to check the state of a specified key. The MWB keyboard driver uses a combination of both these methods. The keys are wired up so that each key is assigned to a block of 16 VDU character addresses. From the scancodes and separately polled modifier keys, the keyboard driver converts them into ASCII codes for MWB to use.
Here is a a small demonstration code snippet that was written by Monte Chan that was very useful for writing games that needed to sense multiple keypresses quickly.
It loads a tiny machine code hook that allows keys to be scanned by their scancode.
The K variable is the keycode to be scanned. This value can be changed as required. The screen dump value of 2 is the 'B' key. The keycodes are listed on the microbee schematic diagram by reading the keyboard matrix from the top left hand corner down each column and then across from left to right with the SHIFT key being last at 63.
The driver returns a result of 0 if the key is pressed and -1 if not pressed. The machine code driver is loaded at 8192 but is totally relocatable.
Someone tried it on MWB 5.10 and it works. It should also work on MWB 5.22e
Go on, try it and have fun in the process.
