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

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

Added missing includes and declarations.

  • 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
17#include "stdio.h"
18
19extern void advwcur(void);
20extern void newws(void);
21extern void wdswin(int16_t n);
22
23extern uint16_t *waveob;
24
25extern int16_t stccol, curwhrm;
26
27extern int16_t wdbox[][8];
28
29extern int8_t dspbuf[];
30
31/*
32
33*/
34
35/*
36 =============================================================================
37 et_whar() -- load the edit buffer
38 =============================================================================
39*/
40
41int16_t et_whar(int16_t n)
42{
43 sprintf(ebuf, "%02d", curwhrm + 1);
44 ebflag = TRUE;
45 return(SUCCESS);
46}
47
48/*
49 =============================================================================
50 ef_whar() -- parse (unload) the edit buffer
51 =============================================================================
52*/
53
54int16_t ef_whar(int16_t n)
55{
56 register int16_t 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
85int16_t rd_whar(int16_t nn)
86{
87 register int16_t n;
88
89 n = nn & 0xFF;
90 sprintf(dspbuf, "%02d", curwhrm + 1);
91
92 vbank(0); /* display the value */
93 vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
94 wdbox[n][6], wdbox[n][7] + WHRM_OFF, dspbuf, 14);
95
96 return(SUCCESS);
97}
98
99/*
100 =============================================================================
101 nd_whar() -- handle new data entry
102 =============================================================================
103*/
104
105int16_t nd_whar(int16_t nn, int16_t k)
106{
107 register int16_t ec, n;
108
109 n = nn & 0xFF;
110 ec = stccol - cfetp->flcol; /* setup edit buffer column */
111 ebuf[ec] = k + '0';
112 ebuf[2] = '\0';
113
114 dspbuf[0] = k + '0';
115 dspbuf[1] = '\0';
116
117 vbank(0);
118 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
119 wdbox[n][6], stccol, dspbuf, 14);
120
121 advwcur();
122 return(SUCCESS);
123}
Note: See TracBrowser for help on using the repository browser.