# unit b_dl

### Display List manipulation library.

author: bocianu bocianu@gmail.com

Set of useful constants and methods, to customize display lists for the Atari 8-bit.
This library is a part of 'blibs' - set of custom Mad-Pascal libraries.
https://gitlab.com/bocianu/blibs

## Constants:

name: | value: | description:
--- | --- | ---
DL_BLANK1 | 0 | 1 blank line
DL_BLANK2 | %00010000 | 2 blank lines
DL_BLANK3 | %00100000 | 3 blank lines
DL_BLANK4 | %00110000 | 4 blank lines
DL_BLANK5 | %01000000 | 5 blank lines
DL_BLANK6 | %01010000 | 6 blank lines
DL_BLANK7 | %01100000 | 7 blank lines
DL_BLANK8 | %01110000 | 8 blank lines
DL_DLI | %10000000 | Order to run DLI
DL_LMS | %01000000 | Order to set new memory address
DL_VSCROLL | %00100000 | Turn on vertical scroll on this line
DL_HSCROLL | %00010000 | Turn on horizontal scroll on this line
DL_MODE_40x24T2 | 2 | Antic Modes
DL_MODE_40x24T5 | 4 |
DL_MODE_40x12T5 | 5 |
DL_MODE_20x24T5 | 6 |
DL_MODE_20x12T5 | 7 |
DL_MODE_40x24G4 | 8 |
DL_MODE_80x48G2 | 9 |
DL_MODE_80x48G4 | $A |
DL_MODE_160x96G2 | $B |
DL_MODE_160x192G2 | $C |
DL_MODE_160x96G4 | $D |
DL_MODE_160x192G4 | $E |
DL_MODE_320x192G2 | $F |
DL_JMP | %00000001 | Order to jump
DL_JVB | %01000001 | Jump to begining

## Global Variables:

name: | type: | description:
--- | --- | ---
DL_address | word | contains memory of Display List
DL_cursor | byte | contains position of modification cursor

## Interface:

name: | description:
--- | ---
DL_Init | #### procedure DL_Init(address:word); Initializes new empty Display List at desired address. Sets DL_cursor at 0. ##### parameters: address - Display List memory address
DL_Push | #### procedure DL_Push(value:byte);overload; Pushes single byte value into Display List at DL_cursor position. Moves cursor one byte forward. Use it to set with mode lines and blanks. ##### parameters: value - Display List element to push
DL_Push | #### procedure DL_Push(value, count:byte);overload; Pushes multple bytes with single value into Display List at DL_cursor position. Moves cursor to position of first byte after added values. Use it to set multiple mode lines and blanks. ##### parameters: value - value of byte to push count - number of bytes to push
DL_Push | #### procedure DL_Push(address: word);overload; Pushes address value into Display List at DL_cursor position. Moves cursor two bytes forward. ##### parameters: address - (word) address to push
DL_Push | #### procedure DL_Push(value: byte; address: word);overload; Pushes byte value and address value into Display List at DL_cursor position. Moves cursor three bytes forward. Use with DL_LMS and jump orders. ##### parameters: value - Display List order to push address - address to push
DL_Start | #### procedure DL_Start; Order ANTIC to use currently defined Display List.
DL_Attach | #### function DL_Attach:word; Attaches to current (system) Display List. Sets modification pointer at 0, so next DL_Push overwrites first byte of Display List. ##### returns: (word) - memory address of current Display List
DL_Seek | #### function DL_Seek(offset:byte):byte; Moves DL_cursor to desired position, and returns byte value stored at this offset. ##### parameters: offset - new DL_cursor position ##### returns: (byte) - byte at cursor
DL_SeekW | #### function DL_SeekW(offset:byte):word; Moves DL_cursor to desired position, and returns word value stored at this offset. ##### parameters: offset - new DL_cursor position ##### returns: (word) - word at cursor
DL_Find | #### function DL_Find(val: byte):byte; Tries to find desired value in Display List starting from DL_cursor. It checks only first 255 bytes of DL. Returns offset of first found element, or $ff (255) if not found. ##### parameters: val - value to find ##### returns: (byte) - offset of found element (or 255 if not found)
DL_Poke | #### procedure DL_Poke(offset: byte; val: byte); Moves DL_cursor to desired position, and puts a byte value at this offset. ##### parameters: offset - new DL_cursor position val - value to poke
DL_PokeW | #### procedure DL_PokeW(offset: byte; val: word); Moves DL_cursor to desired position, and puts a word value at this offset. ##### parameters: offset - new DL_cursor position val - value to poke