Wiki Home >> SIO-Command-$CD-Base64-Encode-Output

SIO-Command-$CD-Base64-Encode-Output


This is a command for Device $70 - The FujiNet Device itself (see SIO-Commands-for-Device-ID-$70).

Base64 Encode Output ($CD)

Description

This function retrieves the output buffer containing the base64 encoded data previously input. You can fetch as many bytes up to the length reported by Base64 Encode Length. Any attempt to get more bytes than are in the buffer will result in an error.

DBYT and DAUX must be set to the same value, so that the FujiNet knows the number of bytes to return.

Firmware version required: 1.1 (2023.08.22) +

Parameters

DCBValue
DDEVIC$70
DUNIT$01
DCOMND$CD
DSTATS$40
DBUFa buffer as big as set by DBYT and DAUX
DTIMLO$03
DBYTthe number of bytes to send back
DAUX1the number of bytes to send back (LO)
DAUX2the number of bytes to send back (HI)

Examples

CC65

unsigned char base64_encode_output(char *s, unsigned short len)                                                                      
{                                                                                                                                    
  OS.dcb.ddevic   = BASE64_DEVICE;                                                                                                   
  OS.dcb.dunit    = 1;                                                                                                               
  OS.dcb.dcomnd   = 0xCD;                                                                                                            
  OS.dcb.dstats   = 0x40;                                                                                                            
  OS.dcb.dbuf     = s;                                                                                                               
  OS.dcb.dtimlo   = BASE64_TIMEOUT;                                                                                                  
  OS.dcb.dbyt     = len;                                                                                                             
  OS.dcb.daux     = len;                                                                                                             
  siov();                                                                                                                            
                                                                                                                                     
  return OS.dcb.dstats; // Return SIO error or success.                                                                              
}                                                                                                                                    

Wiki content is mirrored from the FujiNet Github Wiki