# unit b_system

### System Tools

author: bocianu bocianu@gmail.com

Set of useful constants, registers and methods to simplify common system related tasks in Atari 8-bit programming.
This library is a part of 'blibs' - set of custom Mad-Pascal libraries.
https://gitlab.com/bocianu/blibs

## Constants:

name: | value: | description:
--- | --- | ---
PORTB_SELFTEST_OFF | %10000000 | portb bit value to turn Self-Test off
PORTB_BASIC_OFF | %00000010 | portb bit value to turn Basic off
PORTB_SYSTEM_ON | %00000001 | portb bit value to turn System on

## Interface:

name: | description:
--- | ---
SystemOff | #### procedure SystemOff(port_b: byte); assembler; overload; Turns off OS with custom PORTB($D301) value. ##### parameters: port_b - value of PORTB register
SystemOff | #### procedure SystemOff; overload; Turns off OS and BASIC. Gives maximum available RAM.
SystemReset | #### procedure SystemReset; overload; Turns on OS back and resets machine.
EnableVBLI | #### procedure EnableVBLI(vblptr: pointer); assembler; Enable and set custom handler for Vertical Blank Interrupt. ##### parameters: vblptr - pointer to interrupt handler routine
DisableVBLI | #### procedure DisableVBLI; assembler; Disables custom routine of Vertical Blank Interrupt.
EnableDLI | #### procedure EnableDLI(dliptr: pointer); assembler; Enable and set custom handler for Display List Interrupt. ##### parameters: dliptr - pointer to interrupt handler routine
DisableDLI | #### procedure DisableDLI; assembler; Disables Display List Interrupts.
WaitFrame | #### procedure WaitFrame; assembler; Waits till drawing of current frame ends.
WaitFrames | #### procedure WaitFrames(frames: byte); Waits for a specified number of frames. Each frame is 1/50 sec for PAL systems, or 1/60 sec for NTSC. ##### parameters: frames - number of frames to wait.
SetCharset | #### procedure SetCharset(msb: byte); Sets font charset located at specified page of memory. ##### parameters: msb - most significant byte of charset address (memory page number).