Wiki

Clone wiki

Super-Mon / Short_library_functions

SHORT: LIBRARY FUNCTION REFERENCE

NOTE: LOCATIONS ARE GIVEN ASSUMING
  SHORT'S DEFAULT LOCATION OF $1C00.1FFF

POINTER-RELATED FUNCTIONS
=========================

PTR(LABEL) - $1E3C - RETURN LABEL AS
  A POINTER ADDRESS, SUITABLE FOR USE
  IN *PB FUNCTIONS BELOW OR AS STRINGS

GETPB(PTR) - $1E44 - GET ONE BYTE FROM
  THE GIVEN POINTER ADDRESS

SETPB(PTR,VAL) - $1E4C - WRITE THE LOWER
  BYTE OF VAL TO THE GIVEN PTR ADDRESS

MEMSET(DSTPTR,LENGTH,VALUE) - $1FB5 -
  SET A RANGE OF MEMORY TO A VALUE

MEMCPY(DSTPTR,LENGTH,SRCPTR) - $1DFF -
  COPY A RANGE OF MEMORY. NOTE: IF OVER-
  LAPPING, WORKS ONLY IF DST < SRC.

LOOPING FUNCTIONS
=================

LOOP() - $1F5F - PUSH CURRENT PROGRAM
  COUNTER ON THE STACK.

WHILE(COND) - $1F6E - IF CONDITION IS
  NON-ZERO, JUMP TO PROGRAM COUNTER
  FROM THE STACK. OTHERWISE POP IT.

INCREMENT / DECREMENT
=====================

INCW(VAR) - $1E60 - INCREASE VARIABLE
  BY ONE, RETURN ITS FINAL VALUE

DECW(VAR) - $1E6B - DECREASE VARIABLE.

STEP(VAR,NUMBER,LIMIT) - $1F80 -
  INCREASE VAR BY NUMBER, THEN RETURN 1
  IF THE RESULT IS LESS THAN LIMIT.

INPUT / OUTPUT
==============

PRSTR(STR) - $1EC6 - PRINT A HIGH-ASCII
  STRING, STOP AT TERMINATING ZERO.

PRHEX(NUM) - $1E8C - PRINT HEX NUMBER

PRDEC(NUM) - $1E92 - PRINT DECIMAL NUM

PRINTF(FORMAT,VAR) - $1ECB - PRINT A
  FORMATTED STRING. WITHIN IT SHOULD BE
  ONE OF THE FOLLOWING % CODES TO
  SPECIFY HOW TO PRINT VAR:

  %D - DECIMAL NUMBER
  %X - HEX NUMBER (4 CHARS)
  %S - STRING

READKEY() - $1FE3 - READ A KEY FROM THE
  KEYBOARD, RETURN IT'S NUMERIC HIGH
  ASCII CODE (128-255)

USE IN FUNCTIONS
================

LOCAL(VAR,INITVAL) - $1F23 - PUSH VAR'S
  CURRENT VALUE ON THE STACK, SET IT
  TO INITVAL, AND ARRANGE SO THAT THE
  ORIGINAL VALUE WILL BE RESTORED WHEN
  THE CURRENT FUNCTION RETURNS.

RETURN(VALUE) - $1F0D - PLACE VALUE IN
  A-REG (HIGH) AND X-REG (LOW BYTE),
  THEN RETURN TO CALLING FUNCTON.

LIMITS
======

MIN(VAL1,VAL2) - $1FAE - RETURN THE
  LOWER NUMBER, VAL1 OR VAL2.

MAX(VAL1,VAL2) - $1F98 - RETURN THE
  HIGHER NUMBER, VAL1 OR VAL2.

LOGICAL
=======

IFT(COND,LABEL) - $1E78 - IF COND IS >
  NONZERO, JUMP TO LABEL. OTHERWISE DO
  NOTHING.

IFNOT(COND,LABEL) - $1E84 - IF COND IS 0
  THEN JUMP TO LABEL; ELSE DO NOTHING.

NOT(COND) - $1E54 - RETURN 1 IF COND IS
  0, ELSE RETURN 0.

This page is from Super-mon's built-in help system.

Updated