From 6499e94fccf637f8ebe56b1c567f9ed3d42e4ea6 Mon Sep 17 00:00:00 2001 From: Jali Date: Tue, 28 Feb 2023 22:09:06 +0100 Subject: [PATCH] Add documentation --- doc/base64.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 doc/base64.md diff --git a/doc/base64.md b/doc/base64.md new file mode 100644 index 0000000..9305165 --- /dev/null +++ b/doc/base64.md @@ -0,0 +1,32 @@ +# 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 +```