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

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

Fixed etiwsn.c.

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[f40a309]1/*
2 =============================================================================
3 etiwsn.c -- MIDAS instrument editor - waveshape number handlers
4 Version 6 -- 1988-04-19 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
[b28a12e]8#include "ram.h"
[f40a309]9
10/*
11 =============================================================================
12 et_iwsn() -- load the edit buffer
13 =============================================================================
14*/
15
[7258c6a]16int16_t et_iwsn(int16_t nn)
[f40a309]17{
[7258c6a]18 register int16_t m;
[f40a309]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
[7258c6a]35int16_t ef_iwsn(int16_t nn)
[f40a309]36{
[8c8b4e5]37 int16_t i, tmpval, m;
38 volatile uint16_t *fpuws;
[f40a309]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 */
[ffce2bc]55 vbufs[curvce].idhwsb = (int8_t)(tmpval - 1);
[f40a309]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
[ffce2bc]64 *(fpuws - 1) = (uint16_t)vbufs[curvce].idhwvbf[0];
65 *(fpuws + NUMWPNT) = (uint16_t)vbufs[curvce].idhwvbf[NUMWPNT - 1];
[f40a309]66
67 } else {
68
69 /* slot A */
70
[ffce2bc]71 vbufs[curvce].idhwsa = (int8_t)(tmpval - 1);
[f40a309]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
[ffce2bc]80 *(fpuws - 1) = (uint8_t)vbufs[curvce].idhwvaf[0];
81 *(fpuws + NUMWPNT) = (uint8_t)vbufs[curvce].idhwvaf[NUMWPNT - 1];
[f40a309]82 }
83
84 dswin(21);
85 modinst();
86 return(SUCCESS);
87}
88
89/*
90 =============================================================================
91 rd_iwsn() -- (re)display the field
92 =============================================================================
93*/
94
[7258c6a]95int16_t rd_iwsn(int16_t nn)
[f40a309]96{
[7258c6a]97 register int16_t m, n;
[f40a309]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
[7258c6a]119int16_t nd_iwsn(int16_t nn, int16_t k)
[f40a309]120{
[7ecfb7b]121 register int16_t ec, n;
[f40a309]122
123 n = nn & 0x00FF;
124
125 ec = stccol - cfetp->flcol; /* setup edit buffer column */
[ffce2bc]126 ebuf[ec] = (int8_t)(k + '0'); /* enter new data in buffer */
[f40a309]127 ebuf[2] = '\0'; /* make sure string is terminated */
128
[ffce2bc]129 dspbuf[0] = (int8_t)(k + '0'); /* setup for display */
[f40a309]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
[6262b5c]140
Note: See TracBrowser for help on using the repository browser.