source: buchla-68k/ram/etwhar.c@ 0580615

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

Point of no return.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 =============================================================================
3 etwhar.c -- waveshape editor - harmonic number field handlers
4 Version 5 -- 1987-12-11 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "fields.h"
10#include "vsdd.h"
11#include "vsddsw.h"
12#include "graphdef.h"
13
14#include "midas.h"
15#include "wsdsp.h"
16
17extern void advwcur(void);
18extern void newws(void);
19extern void wdswin(short n);
20
21extern unsigned *waveob;
22
23extern short stccol, curwhrm;
24
25extern short wdbox[][8];
26
27extern char dspbuf[];
28
29/*
30
31*/
32
33/*
34 =============================================================================
35 et_whar() -- load the edit buffer
36 =============================================================================
37*/
38
39short et_whar(short n)
40{
41 sprintf(ebuf, "%02d", curwhrm + 1);
42 ebflag = TRUE;
43 return(SUCCESS);
44}
45
46/*
47 =============================================================================
48 ef_whar() -- parse (unload) the edit buffer
49 =============================================================================
50*/
51
52short ef_whar(short n)
53{
54 register short i, tmpval;
55
56 ebuf[2] = '\0'; /* terminate the string in ebuf */
57 ebflag = FALSE;
58
59 tmpval = 0;
60
61 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
62 tmpval = (tmpval * 10) + (ebuf[i] - '0');
63
64 if ((tmpval GT NUMHARM) OR (tmpval EQ 0))
65 return(FAILURE);
66
67 curwhrm = tmpval - 1;
68 newws();
69 wdswin(5);
70 return(SUCCESS);
71}
72
73/*
74
75*/
76
77/*
78 =============================================================================
79 rd_whar() -- (re)display the field
80 =============================================================================
81*/
82
83short rd_whar(short nn)
84{
85 register short n;
86
87 n = nn & 0xFF;
88 sprintf(dspbuf, "%02d", curwhrm + 1);
89
90 vbank(0); /* display the value */
91 vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
92 wdbox[n][6], wdbox[n][7] + WHRM_OFF, dspbuf, 14);
93
94 return(SUCCESS);
95}
96
97/*
98 =============================================================================
99 nd_whar() -- handle new data entry
100 =============================================================================
101*/
102
103short nd_whar(short nn, short k)
104{
105 register short ec, n;
106
107 n = nn & 0xFF;
108 ec = stccol - cfetp->flcol; /* setup edit buffer column */
109 ebuf[ec] = k + '0';
110 ebuf[2] = '\0';
111
112 dspbuf[0] = k + '0';
113 dspbuf[1] = '\0';
114
115 vbank(0);
116 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
117 wdbox[n][6], stccol, dspbuf, 14);
118
119 advwcur();
120 return(SUCCESS);
121}
Note: See TracBrowser for help on using the repository browser.