// -----------------------------------------------------------
// defs.h - hardware pointers, constants
// included first by every translation unit
// -----------------------------------------------------------
#ifndef DEFS_H
#define DEFS_H

#include <c64/vic.h>
#include <stdbool.h>

// string literals compile straight to screen codes: 'a'..'z' -> 1..26,
// space / digits / punctuation (32..63) are identical in both sets
#pragma charmap(97, 1, 26)

#define SCREEN  ((char *)0x0400)     // screen RAM (40x25 chars)
#define COLRAM  ((char *)0xd800)     // color RAM
#define FADEBUF ((char *)0xc000)     // snapshot of color RAM for the fade-in
#define SPRBUF  ((char *)0x0340)     // sprite shape (cassette buffer): 64-aligned
                                     //   RAM the VIC can fetch from (the chargen
                                     //   ROM shadows $1000-$1fff in bank 0)

// ---- screen layout (slide 1) ----
#define BIGROW      2                // top row of the giant letters
#define BIGCOL      6                // left column (3*8 + 2*2 = 28 wide, centered)
#define TITLE_POS   (12*40 + 13)     // "TELETYPE GAMES" (14 chars, centered)
#define SCROLLROW   14               // scroller row

// ---- timing ----
#define SCROLL_STEP 2                // pixels per frame (8 px / 4 frames = 1 char)
#define RAS_SCRTOP  160              // just above the scroller row (row 14 = lines 162-169)
#define RAS_SCRBOT  171              // just below it (rows 13 and 15 are blank, so
                                     //   a line of jitter here is invisible)
#define RAS_BOTTOM  248              // lower border: safe time for screen updates
#define RAS_BARTOP  16               // first raster line of the bar area (slide 3):
                                     //   starts in the upper border
#define BAR_STEPS   57               // 57 steps * 4 lines = up to line 244

#define NUM_SLIDES  5
#define SLIDE_TIME  400              // 8 seconds per slide (PAL, 50 frames/s)
#define S5_TIME     450              // slide 5 is longer: the typewriter needs time
#define FADE_STEPS  5                // fade steps (longest fadetbl chain is 4)
#define FADE_SPEED  4                // frames between two fade steps

// ---- transition types (tin_tbl / tout_tbl in main.c) ----
#define TR_FADE     0                // fade through black (the original)
#define TR_DISSOLVE 1                // cells appear/vanish in random order
#define TR_WIPE     2                // column sweep, left to right

#endif
