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

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

Unix line breaks.

  • 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 short advwcur(), newws(), wdswin();
18
19extern unsigned *waveob;
20
21extern short stccol, curwhrm;
22
23extern short wdbox[][8];
24
25extern char dspbuf[];
26
27/*
28
29*/
30
31/*
32 =============================================================================
33 et_whar() -- load the edit buffer
34 =============================================================================
35*/
36
37short
38et_whar(n)
39short 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
53ef_whar(n)
54short n;
55{
56 register short i, tmpval;
57
58 ebuf[2] = '\0'; /* terminate the string in ebuf */
59 ebflag = FALSE;
60
61 tmpval = 0;
62
63 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
64 tmpval = (tmpval * 10) + (ebuf[i] - '0');
65
66 if ((tmpval GT NUMHARM) OR (tmpval EQ 0))
67 return(FAILURE);
68
69 curwhrm = tmpval - 1;
70 newws();
71 wdswin(5);
72 return(SUCCESS);
73}
74
75/*
76
77*/
78
79/*
80 =============================================================================
81 rd_whar() -- (re)display the field
82 =============================================================================
83*/
84
85short
86rd_whar(nn)
87short nn;
88{
89 register short n;
90
91 n = nn & 0xFF;
92 sprintf(dspbuf, "%02d", curwhrm + 1);
93
94 vbank(0); /* display the value */
95 vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
96 wdbox[n][6], wdbox[n][7] + WHRM_OFF, dspbuf, 14);
97
98 return(SUCCESS);
99}
100
101/*
102 =============================================================================
103 nd_whar() -- handle new data entry
104 =============================================================================
105*/
106
107short
108nd_whar(nn, k)
109short nn;
110register short k;
111{
112 register short ec, n;
113
114 n = nn & 0xFF;
115 ec = stccol - cfetp->flcol; /* setup edit buffer column */
116 ebuf[ec] = k + '0';
117 ebuf[2] = '\0';
118
119 dspbuf[0] = k + '0';
120 dspbuf[1] = '\0';
121
122 vbank(0);
123 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
124 wdbox[n][6], stccol, dspbuf, 14);
125
126 advwcur();
127 return(SUCCESS);
128}
Note: See TracBrowser for help on using the repository browser.