memory pack question
| Author | Message | ||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6103 |
All, This is a generic question about MEMORY PACK and MEMORY UNPACK. These commands can be used to pack data into 64 bit integers (i.e. 8 bytes per integer). What I am trying to achieve is packing text (ASCII data) for use in PIO FIFO's. The FIFO's are 32 bit wide, and a DMA of integers will fill the PIO FIFO 32 bits at at time (2 FIFO locations per integer). But I need to fill the FIFO with text in a$. I already experimented with peek(varaddr a$) as sourceaddr% and an array%() as destination. But I never seem to get the right mapping of text into the integer to match the FIFO. What I need is MSByte LSbyte 0 0 0 a$:2 0 0 0 a$:1 I currently use a loop (slow) to transfer character for character into integers (1 char per integer), and then pack the integers in a new array (2 char per integer). But the loop is slow (when the string is long). So I wonder if there is a way to avoid the loop, and use either a single MEMORY PACK, or 2 MEMORY PACK's ... Any advise ? Volhout PicomiteVGA PETSCII ROBOTS |
||||