mos-hardware 0.4.0

Hardware register tables and support functions for 8-bit retro computers like the Commodore 64, MEGA65 and others.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <memory.h>
#include "hal.h"

void usleep(uint32_t micros)
{
  // Sleep for desired number of micro-seconds.
  // Each VIC-II raster line is ~64 microseconds
  // this is not totally accurate, but is a reasonable approach
  while (micros > 64) {
    uint8_t b = PEEK(0xD012);
    while (PEEK(0xD012) == b)
      continue;
    micros -= 64;
  }
  return;
}