source: buchla-68k/vlib/vhinit.c@ 4b63bf3

Last change on this file since 4b63bf3 was bf89cfb, checked in by Thomas Lopatic <thomas@…>, 7 years ago

No more warnings in vlib.

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[f40a309]1/*
2 =============================================================================
3 vhinit.c -- initialize VSDD hardware
4 Version 17 -- 1988-03-20 -- D.N. Lynx Crowe
5 (c) Copyright 1987, 1988 -- D.N. Lynx Crowe
6
7 VHinit()
8
9 Setup VSDD registers, clear access table, clear object table,
10 load character generator, set color lookup table defaults.
11 Defines major video system variables, since the linker isn't
12 smart enough to let me put them in a separate file.
13 =============================================================================
14*/
15
16#define FASTCHIP 1 /* non-zero if it's the fast VSDD chip */
17
[b28a12e]18#include "ram.h"
[e225e77]19
[bf89cfb]20#define VREG(h, v) (h * 1024u + v)
[f40a309]21
22struct octent v_obtab[16]; /* object control table */
23
24struct octent *v_curob; /* current v_obtab pointer */
25
[7258c6a]26int16_t v_nobj; /* current object number */
27int16_t v_obpri; /* current object priority */
[f40a309]28
29/* initialized variables */
30
[bf89cfb]31uint16_t vr_data[] = {
[f40a309]32
33 0x825B, /* R0 -- Mode word 0 */
34 0xC474, /* R1 -- Mode word 1 */
35 0x0006, /* R2 -- Register window base, Control flags */
36 0x0100, /* R3 -- Data window base, X limit (0x200000) */
37 0x0000, /* R4 -- Data length mask (128K) */
38 0x0000, /* R5 -- Data segment base (0x000000) */
39 0x0001, /* R6 -- Priority access count (1) */
40 0x0040, /* R7 -- Object Descriptor Table base (0x200080) */
41 0x0080, /* R8 -- Access Table base (0x200100) */
42 0x0010, /* R9 -- Color Lookup Table base (0x200020) */
43 0x00FF, /* R10 -- Character Generator bases (0x21E000) */
44 0x0000, /* R11 -- Access Table address counter */
45
46#if FASTCHIP
47 VREG( 3, 8), /* R12 -- HC0 (HSYNC width) VC0 (VSYNC width) */
48 VREG( 5, 10), /* R13 -- HC1 (AHZ start) VC1 (AVZ start) */
49 VREG(37, 360), /* R14 -- HC2 (AHZ stop) VC2 (AVZ stop) */
50 VREG(40, 362) /* R15 -- HC3 (HOR sweep) VC3 (VRT sweep) */
51#else
52 VREG( 3, 8), /* R12 -- HC0 (HSYNC width) VC0 (VSYNC width) */
53 VREG( 6, 10), /* R13 -- HC1 (AHZ start) VC1 (AVZ start) */
54 VREG(38, 360), /* R14 -- HC2 (AHZ stop) VC2 (AVZ stop) */
55 VREG(43, 361) /* R15 -- HC3 (HOR sweep) VC3 (VRT sweep) */
56#endif
57};
58
59/*
60 =============================================================================
61 VHinit() -- initialize the VSDD
62 =============================================================================
63*/
64
[0580615]65void VHinit(void)
[f40a309]66{
67
68 /* select VSDD RAM bank 0 so we can access the control tables */
69
70 vbank(0);
71
72 /* set the video register values */
73
74 memcpyw(v_regs, vr_data, 16);
75
76 /* clear the access table to turn off all objects */
77
78 memsetw(v_actab, 0xFFFF, 350);
79
80 /* clear the object table */
81
82 memsetw(v_odtab, 0, 64);
83
84 /* move the character generator table to VSDD RAM */
85
86 memsetw(v_cgtab, 0, 4096);
87 memcpyw(v_cgtab, cgtable, 256 * cg_rows);
88}
[6262b5c]89
Note: See TracBrowser for help on using the repository browser.