883 B
883 B
Implementing BASE64 in Z80 Assembler
About
Goal of this little project is to encode and decode a byte buffer in memory. The project defines the following requirements.
- The function takes the pointer to an input buffer as a parameter on the stack? Can also be in one of the automatic variables.
- Another variable contains the address of the 2nd buffer.
- We need to find a way to get the addresses of a DIM variable on the stack, in order to call it from BASIC.
- Implement a subroutine for encoding a string.
- Implement a subroutine for decding a string.
Problem No. 1: Splitting 3-8bit values into 4 6-bit-values.
Example:
We want to convert the string "ABC". In binary the values are as follows.
- 01000001
- 01000010
- 01000011
The first step is to reduce the first byte to 6 bytes:
LD A,(HL)
SLA,2
PUSH A