Files
PC-E220-Tools/doc/base64.md
2023-02-28 22:09:06 +01:00

33 lines
883 B
Markdown

# 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.
1. The function takes the pointer to an input buffer as a parameter on the stack?
Can also be in one of the automatic variables.
2. Another variable contains the address of the 2nd buffer.
3. We need to find a way to get the addresses of a DIM variable on the stack, in order to call it
from BASIC.
4. Implement a subroutine for encoding a string.
5. 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:
```Assembler
LD A,(HL)
SLA,2
PUSH A
```