Misc Functions

From Archaic Pixels
Jump to: navigation, search

Misc. Functions


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
   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); [ 3.20+ ]
void pokew(int offset, int val);
   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); [ 3.20+ ]
int peekw(int offset);
char farpeekb(farptr offset);
int farpeekw(farptr offset);
   Read the content of memory location 'offset'.
   peek() is char-sized access, whereas peekw() is word-sized.


void farmemget(void *dst, far void *base, int len); [ 3.20+ ]
   Copy 'len' bytes of memory location 'base' into 'dest'.


int rand(void); [ 3.20+ ]
   Return a 16-bit random number.

srand / srand32

void srand(int seed); [ 3.20+ ]
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.


char random(char max); [ 3.20+ ]
   Return a random value between 0 and max-1.