Picomite/PicoMiteVGA V5.07.05 release candidates


Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8572
Posted: 04:39pm 30 Nov 2022      

PicoMite V5.07.05RC10

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Updated CSUB header file and additional functions exposed (header file in zip)
Implements new commands MEMORY PACK and MEMORY UNPACK
These allow the normal 64 bit integers in memory to be packed into 32, 16, 8, 4 or 1 bits and then unpacked

' test of memory pack and unpack
Option default integer
Dim in(127)
Dim out(63)
Dim back(127)
Dim nibbles,bits
iadd=Peek(varaddr in())
oadd=Peek(varaddr out())
' test packing into words : 32-bit
For i=0 To 127:in(i)=i:Next
Memory pack iadd, oadd, 128,32
Print Peek(word oadd+64)
Memory unpack oadd,Peek(varaddr back()),128,32
For i=0 To 127: If back(i)<> i Then Error ("Oops"):Next
'
' test packing into shorts : 16-bit
Memory pack iadd, oadd, 128,16
Print Peek(short oadd+32)
Memory unpack oadd,Peek(varaddr back()),128,16
For i=0 To 127: If back(i)<> i Then Error ("Oops"):Next
'
' test packing into bytes : 8-bit
Memory pack iadd, oadd, 128,8
Print Peek(byte oadd+16)
Memory unpack oadd,Peek(varaddr back()),128,8
For i=0 To 127: If back(i)<> i Then Error ("Oops"):Next
'
' test packing into nibbles : 4-bit
Memory pack Peek(varaddr in()),Peek(varaddr nibbles),16,4
Print Hex$(nibbles)
Memory unpack Peek(varaddr nibbles),Peek(varaddr back()),16,4
For i=0 To 15: If back(i)<> i Then Error ("Oops"):Next
'
' test packing into bits : 1-bit
For i=0 To 63:in(i)=i And 1:Next i
Memory pack Peek(varaddr in()),Peek(varaddr bits),64,1
Print Bin$(bits)
Memory unpack Peek(varaddr bits),Peek(varaddr back()),64,1
For i=0 To 63: If back(i)<> i And 1 Then Error ("Oops"):Next