Peek and poke in POWER C on the C64

In my last article I wrote that the POWER C distribution for the C64 does not contain all functions the C128 distribution has. Today I found a solution to the missing peek ( ) and poke ( ) functions.

Martin Sigley wrote some C functions for POWER C between 2019 and 2021 which can be found on GitHub. I am talking specifically of the GGPower C.d81 container, that contains two poke.h header files.

In order not to violate his copyright I am not posting the (short) header files here. But following is an easy to understand example on how to use the peek ( ) and poke ( ) functions on the C64 in POWER C:

/* Poke & peek test */
include <stdio.h>
include <poke.h>
static char ts[1];
int main(void) {
  /* Set the window and border to white */
  /* Set the text color to brown */
  poke (char,53280,1);
  poke (char,53281,1);
  poke (char,646,9);
  printf ("The text color is %u", peek (char,646));
  return 0;
}

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert


Der Zeitraum für die reCAPTCHA-Überprüfung ist abgelaufen. Bitte laden Sie die Seite neu.