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

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

Removed form-feed comments.

  • Property mode set to 100644
File size: 2.2 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 "ram.h"
9
10/*
11 =============================================================================
12 et_whar() -- load the edit buffer
13 =============================================================================
14*/
15
16int16_t et_whar(int16_t n)
17{
18 sprintf(ebuf, "%02d", curwhrm + 1);
19 ebflag = TRUE;
20 return(SUCCESS);
21}
22
23/*
24 =============================================================================
25 ef_whar() -- parse (unload) the edit buffer
26 =============================================================================
27*/
28
29int16_t ef_whar(int16_t n)
30{
31 register int16_t i, tmpval;
32
33 ebuf[2] = '\0'; /* terminate the string in ebuf */
34 ebflag = FALSE;
35
36 tmpval = 0;
37
38 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
39 tmpval = (tmpval * 10) + (ebuf[i] - '0');
40
41 if ((tmpval GT NUMHARM) OR (tmpval EQ 0))
42 return(FAILURE);
43
44 curwhrm = tmpval - 1;
45 newws();
46 wdswin(5);
47 return(SUCCESS);
48}
49
50/*
51 =============================================================================
52 rd_whar() -- (re)display the field
53 =============================================================================
54*/
55
56int16_t rd_whar(int16_t nn)
57{
58 register int16_t n;
59
60 n = nn & 0xFF;
61 sprintf(dspbuf, "%02d", curwhrm + 1);
62
63 vbank(0); /* display the value */
64 vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
65 wdbox[n][6], wdbox[n][7] + WHRM_OFF, dspbuf, 14);
66
67 return(SUCCESS);
68}
69
70/*
71 =============================================================================
72 nd_whar() -- handle new data entry
73 =============================================================================
74*/
75
76int16_t nd_whar(int16_t nn, int16_t k)
77{
78 register int16_t ec, n;
79
80 n = nn & 0xFF;
81 ec = stccol - cfetp->flcol; /* setup edit buffer column */
82 ebuf[ec] = k + '0';
83 ebuf[2] = '\0';
84
85 dspbuf[0] = k + '0';
86 dspbuf[1] = '\0';
87
88 vbank(0);
89 vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
90 wdbox[n][6], stccol, dspbuf, 14);
91
92 advwcur();
93 return(SUCCESS);
94}
95
Note: See TracBrowser for help on using the repository browser.