source: buchla-68k/ram/etiwsn.c@ ea9a162

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

Fixed etiwsn.c.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 =============================================================================
3 etiwsn.c -- MIDAS instrument editor - waveshape number handlers
4 Version 6 -- 1988-04-19 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10/*
11 =============================================================================
12 et_iwsn() -- load the edit buffer
13 =============================================================================
14*/
15
16int16_t et_iwsn(int16_t nn)
17{
18 register int16_t m;
19
20 m = nn >> 8;
21
22 sprintf(ebuf, "%02d", m ? vbufs[curvce].idhwsb + 1
23 : vbufs[curvce].idhwsa + 1);
24 ebflag = TRUE;
25
26 return(SUCCESS);
27}
28
29/*
30 =============================================================================
31 ef_iwsn() -- parse (unload) the edit buffer
32 =============================================================================
33*/
34
35int16_t ef_iwsn(int16_t nn)
36{
37 int16_t i, tmpval, m;
38 volatile uint16_t *fpuws;
39
40 m = nn >> 8;
41 ebuf[2] = '\0'; /* terminate the string in ebuf */
42 ebflag = FALSE;
43
44 tmpval = 0;
45
46 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
47 tmpval = (tmpval * 10) + (ebuf[i] - '0');
48
49 if ((tmpval EQ 0) OR (tmpval GT NUMWAVS))
50 return(FAILURE);
51
52 if (m) {
53
54 /* slot B */
55 vbufs[curvce].idhwsb = (int8_t)(tmpval - 1);
56
57 memcpyw(vbufs[curvce].idhwvbf, &wslib[tmpval - 1],
58 NUMHARM + (2 * NUMWPNT));
59
60 fpuws = io_fpu + FPU_OWST + (curvce << 9) + 1;
61
62 memcpyw(fpuws, vbufs[curvce].idhwvbf, NUMWPNT);
63
64 *(fpuws - 1) = (uint16_t)vbufs[curvce].idhwvbf[0];
65 *(fpuws + NUMWPNT) = (uint16_t)vbufs[curvce].idhwvbf[NUMWPNT - 1];
66
67 } else {
68
69 /* slot A */
70
71 vbufs[curvce].idhwsa = (int8_t)(tmpval - 1);
72
73 memcpyw(vbufs[curvce].idhwvaf, &wslib[tmpval - 1],
74 NUMHARM + (2 * NUMWPNT));
75
76 fpuws = io_fpu + FPU_OWST + (curvce << 9) + 0x100 + 1;
77
78 memcpyw(fpuws, vbufs[curvce].idhwvaf, NUMWPNT);
79
80 *(fpuws - 1) = (uint8_t)vbufs[curvce].idhwvaf[0];
81 *(fpuws + NUMWPNT) = (uint8_t)vbufs[curvce].idhwvaf[NUMWPNT - 1];
82 }
83
84 dswin(21);
85 modinst();
86 return(SUCCESS);
87}
88
89/*
90 =============================================================================
91 rd_iwsn() -- (re)display the field
92 =============================================================================
93*/
94
95int16_t rd_iwsn(int16_t nn)
96{
97 register int16_t m, n;
98
99 m = (nn >> 8) & 0x00FF;
100 n = nn & 0x00FF;
101
102 sprintf(dspbuf, "%02d", m ? vbufs[curvce].idhwsb + 1
103 : vbufs[curvce].idhwsa + 1);
104
105 vbank(0);
106
107 vcputsv(instob, 64, (m ? WSBFC : WSAFC), idbox[n][5],
108 cfetp->frow, cfetp->flcol, dspbuf, 14);
109
110 return(SUCCESS);
111}
112
113/*
114 =============================================================================
115 nd_iwsn() -- handle new data entry
116 =============================================================================
117*/
118
119int16_t nd_iwsn(int16_t nn, int16_t k)
120{
121 register int16_t ec, n;
122
123 n = nn & 0x00FF;
124
125 ec = stccol - cfetp->flcol; /* setup edit buffer column */
126 ebuf[ec] = (int8_t)(k + '0'); /* enter new data in buffer */
127 ebuf[2] = '\0'; /* make sure string is terminated */
128
129 dspbuf[0] = (int8_t)(k + '0'); /* setup for display */
130 dspbuf[1] = '\0';
131
132 vbank(0); /* display the new data */
133 vcputsv(instob, 64, ID_ENTRY, idbox[n][5], stcrow, stccol, dspbuf, 14);
134
135 advicur(); /* advance cursor */
136
137 return(SUCCESS);
138}
139
140
Note: See TracBrowser for help on using the repository browser.