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

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

Use standard integer types.

  • 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(int16_t n);
20
21extern uint16_t *waveob;
22
23extern int16_t stccol, curwhrm;
24
25extern int16_t wdbox[][8];
26
27extern int8_t dspbuf[];
28
29/*
30
31*/
32
33/*
34 =============================================================================
35 et_whar() -- load the edit buffer
36 =============================================================================
37*/
38
39int16_t et_whar(int16_t 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
52int16_t ef_whar(int16_t n)
53{
54 register int16_t 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
83int16_t rd_whar(int16_t nn)
84{
85 register int16_t 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
103int16_t nd_whar(int16_t nn, int16_t k)
104{
105 register int16_t 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.