// Tests pointer to pointer in a more complex setup

void main() {

    byte* screen = $400;

    byte* text;
    for(byte i: 0..20) {
        nexttext(&text);
        while(*text) {
            *screen++ = *text++;
        }
    }

}

byte[] text1 = "camelot ";
byte[] text2 = "rex ";

byte textid = 0;

// Choose the next text to show - by updating the text pointer pointed to by the passed pointer to a pointer
void nexttext(byte** textp) {
    if((textid++&1)==0) {
        *textp = text1;
    } else {
        *textp = text2;
    }
}

