ASCII in Small Basic
Microsoft Small Basic is a simplified programming language designed for beginners learning to code. It provides built-in functions for working with ASCII character codes, making it straightforward to convert between characters and their numeric representations.
The Text object in Small Basic includes two key methods for ASCII operations. Text.GetCharacter(code) takes a decimal ASCII value and returns the corresponding character. Text.GetCharacterCode(character) does the reverse, accepting a single character and returning its ASCII decimal value.
These functions work with the full range of ASCII values from 0 to 127 for standard ASCII, and 0 to 255 for extended ASCII. They are commonly used in Small Basic programs for text manipulation, simple encryption exercises like Caesar ciphers, and generating character patterns.
Small Basic's TextWindow object makes it easy to display ASCII characters and experiment with different codes. The examples below show how to use these functions in practice.
Code Examples
TextWindow.WriteLine(Text.GetCharacter(65))TextWindow.WriteLine(Text.GetCharacter(48))TextWindow.WriteLine(Text.GetCharacterCode("A"))TextWindow.WriteLine(Text.GetCharacterCode("z"))Common ASCII Ranges in Small Basic
| Range | Characters | Small Basic Example |
|---|---|---|
| 48-57 | Digits 0-9 | Text.GetCharacter(48) = "0" |
| 65-90 | Uppercase A-Z | Text.GetCharacter(65) = "A" |
| 97-122 | Lowercase a-z | Text.GetCharacter(97) = "a" |
| 32 | Space | Text.GetCharacter(32) = " " |
Quick Reference
View the complete ASCII table for all 256 character codes, or explore individual character pages for detailed information about each ASCII value.