source: buchla-68k/orig/IOLIB/VCTRL.C@ 7bf3856

Last change on this file since 7bf3856 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 1.7 KB
Line 
1
2/*
3 =============================================================================
4 vctrl.c -- VSDD control functions
5 Version 7 -- 1988-08-15 -- D.N. Lynx Crowe
6 (c) Copyright 1987,1988 -- D.N. Lynx Crowe
7
8 unsigned int
9 vbank(b)
10 unsigned int b;
11
12 Set VSDD Data Segment bank to b.
13 Return old bank select value.
14
15
16 vfwait()
17
18 Wait for a FRAMESTOP update to transpire.
19 =============================================================================
20*/
21
22#include "stddefs.h"
23#include "hwdefs.h"
24#include "vsdd.h"
25
26/*
27
28*/
29
30/*
31 =============================================================================
32 vbank(b) -- change VSDD Data Segment bank to b. Return old bank.
33 Assumes a 128K byte window, sets S15..S11 to zero.
34 =============================================================================
35*/
36
37unsigned int
38vbank(b)
39unsigned int b;
40{
41 register unsigned int newb, oldb;
42
43 oldb = v_regs[5] >> 6; /* get old bank value */
44 oldb = (oldb & 2) | ((oldb >> 2) & 1);
45
46 if (oldb EQ b) /* done if same as b */
47 return(b);
48
49 newb = b << 6; /* calculate new bank value */
50 newb = (newb & 0x0080) | ((newb << 2) & 0x0100);
51
52 v_regs[5] = newb; /* set new bank value */
53
54 while (v_regs[11] GT 300) ; /* wait for FRAMESTOP */
55 while (v_regs[11] LT 175) ;
56 while (v_regs[11] GE 175) ;
57
58 return(oldb); /* return old bank value */
59}
60
61/*
62
63*/
64
65/*
66 =============================================================================
67 vfwait() -- Wait for a FRAMESTOP update to transpire.
68 =============================================================================
69*/
70
71vfwait()
72{
73 while (v_regs[11] GT 300) ; /* wait for FRAMESTOP */
74 while (v_regs[11] LT 175) ;
75 while (v_regs[11] GE 175) ;
76}
Note: See TracBrowser for help on using the repository browser.