title: "vbmDrawSmallBCD" description: TRSE built-in method (from IDE help)
vbmDrawSmallBCD
Systems: VIC20
Parameters: a, a, b, b, b
vbmDrawSmallBCD( [address-bcd], [address-chars], [byte-x], [byte-y], [byte-lineheight]);
- [address-bcd] - address of a BCD array (number)
- [address-chars] - address of the characterset to use for the font
- [byte-x] - X column (0-39) to display the message
- [byte-y] - Y line (0-183) to display the message
- [byte-bcdlength] - length of the BCD number in bytes
Description
Writes a Binary Coded Decimal (BCD) number to the bitmap using a small 4x5 or 4x8 bitmap font.
Small bitmap fonts require two copies of the digits in each character, each 4 pixels wide. See the VBM examples in the Vic 20 tutorials for an example.
This command will blank out a 4x5 or 4x8 space to draw each digit. If pixel row 6 is empty in the font bitmap it will clear and draw only a 4x5 small number, otherwise it will draw a 4x8 small number.
To be used with the BCD commands to set, add, subtract and compare BCD numbers. Useful for scores and allows numbers of any size, much larger than integer numbers!
Example
font: incbin("font4x8.bin", $4000); // first 64 PETSCII Screen Codes
@define nums $4180 // this is the address where the 0 character data starts in the above font
...
// create a BCD number
score : array[] of byte = ($56, $34, $12); // low bytes first - number is 123456
...
// draws the number 123456 to the screen at column 2, row 10 (pixels)
// with a length of 3 bytes (size of BCD number in memory)
vbmDrawBCD( score, ^@nums, 2, 10, 3 );
See also
- bcdCompare
- bcdIsEqual
- bcdSub
- bcdAdd