Misc_Functions

From ArchaicPixels: HuC and PCEAS Documentation

Jump to: navigation, search

Contents

Misc. Functions

clock_reset

void clock_reset(void);
[ 3.20+ ]

    Reset the internal clock's hour, minute, second, and 'tick'
    counters to zero.


clock_hh / clock_mm / clock_ss / clock_tt

char clock_hh(void);
char clock_mm(void);
char clock_ss(void);
char clock_tt(void);
    Return the number of hours, minutes, seconds, or 'ticks'
    (one VSYNC interval, or 1/6th of a second) since the last
    clock_reset().
    Note: the accuracy of this clock is off by about 2 seconds per hour,
          due to the fact that NTSC VSYNC frequency is 59.97Hz, rather
          than 60Hz


poke / pokew

void poke(int offset, char val);
void pokew(int offset, int val);
[ 3.04+ ]

    Write 'val' value at memory location 'offset'.
    poke() is char-sized access, whereas pokew() is word-sized.
    This function can be used to access the hardware
    I/O ports located at 0x0000 to 0x1FFF.


peek / peekw / farpeekb / farpeekw

char peek(int offset);
int peekw(int offset);
char farpeekb(farptr offset);
int farpeekw(farptr offset);
[ 3.04+ ]

    Read the content of memory location 'offset'.
    peek() is char-sized access, whereas peekw() is word-sized.


farmemget

void farmemget(void *dst, far void *base, int len);
[ 3.04+ ]

    Copy 'len' bytes of memory location 'base' into 'dest'.



rand

int rand(void);
[ improved 1.5+ ]

    Return a 16-bit random number.


srand / srand32

void srand(int seed);
[ 1.5+ ]

void srand32(int seed1, int seed2);
[ 3.20+ ]

    Change the random seed. You can use this function to improve randomness by
    giving a value based on when the player press start first for example.


random

char random(char max);
[ 1.5+ ]

    Return a random value between 0 and A-1.
Personal tools