#include "dll.h" #include DLLEntry DLL[NUMSLOTS]; // display list list byte DL[NUMSLOTS][SLOTSIZE]; // display list slots byte DL_len[NUMSLOTS]; // current bytes in each slot #ifdef DLSAVE byte DL_save[NUMSLOTS]; // save lengths of each slot #endif byte slot0 = 0; // current page offset // set display list list address registers void dll_set_addr(const void* dpp) { MARIA.DPPH = (word)dpp>>8; MARIA.DPPL = (byte)dpp; } // clear the current page void dll_clear() { byte i; for (i=slot0; idata_lo = (byte)addr; dl->data_hi = (byte)(addr>>8) + (y & 15); dl->xpos = x; dl->width_pal = wpal; if (y & 15) { DL4Entry* dl2 = (DL4Entry*) dll_alloc(slot+1, 4); *dl2 = *dl; dl2->data_hi -= SLOTHEIGHT; } } // add a string to currently selected page // strings are aligned to top of slot void dll_add_string(register const char* str, byte x, byte y, byte wpal) { byte slot = (y / SLOTHEIGHT) | slot0; register DL5Entry* dl = (DL5Entry*) dll_alloc(slot, 5); dl->data_lo = (byte)str; dl->data_hi = (word)str>>8; dl->flags = DL5_INDIRECT; dl->width_pal = wpal; dl->xpos = x; } // set up display lists void dll_setup() { byte i; byte* dlptr = &DL[0][0]; register DLLEntry *dll = &DLL[0]; for (i=0; ioffset_flags = DLL_FLAGS | (SLOTHEIGHT-1); dll->dl_hi = (word)dlptr>>8; dll->dl_lo = (byte)dlptr; dlptr += sizeof(DL[0]); dll++; } dll_clear(); #ifdef DOUBLEBUFFER dll_swap(); dll_clear(); dll_swap(); #else dll_set_addr(DLL); #endif #ifdef DLSAVE memset(DL_save, 0, sizeof(DL_save)); #endif }