[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etwoff.c -- waveshape editor - offset value field handlers
|
---|
| 4 | Version 16 -- 1987-12-22 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[6262b5c] | 8 | #include "all.h"
|
---|
[e225e77] | 9 |
|
---|
[0580615] | 10 | extern void advwcur(void);
|
---|
[7258c6a] | 11 | extern void wdswin(int16_t n);
|
---|
[0580615] | 12 | extern void pntsup(void);
|
---|
[f40a309] | 13 |
|
---|
[e225e77] | 14 | extern void wdintp(void);
|
---|
| 15 |
|
---|
[7258c6a] | 16 | extern uint16_t *waveob;
|
---|
[f40a309] | 17 |
|
---|
[7258c6a] | 18 | extern int16_t stcrow, stccol, lstwoff, curwoff, curvce, curwslt, curwdth;
|
---|
[f40a309] | 19 |
|
---|
[7258c6a] | 20 | extern int16_t wsnmod[12][2];
|
---|
[f40a309] | 21 |
|
---|
[7258c6a] | 22 | extern int16_t wdbox[][8];
|
---|
[f40a309] | 23 |
|
---|
[7258c6a] | 24 | extern int8_t dspbuf[];
|
---|
[f40a309] | 25 |
|
---|
| 26 | /* |
---|
| 27 |
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /*
|
---|
| 31 | =============================================================================
|
---|
| 32 | et_woff() -- load the edit buffer
|
---|
| 33 | =============================================================================
|
---|
| 34 | */
|
---|
[7258c6a] | 35 |
|
---|
[f40a309] | 36 | int16_t et_woff(int16_t n)
|
---|
[7258c6a] | 37 | {
|
---|
| 38 | register int16_t hoff;
|
---|
[f40a309] | 39 | register int8_t hosgn;
|
---|
| 40 |
|
---|
| 41 | lstwoff = curwoff;
|
---|
| 42 |
|
---|
| 43 | if (curwoff LT 0) {
|
---|
| 44 |
|
---|
| 45 | hosgn = '-';
|
---|
| 46 | hoff = -curwoff;
|
---|
| 47 |
|
---|
| 48 | } else {
|
---|
| 49 |
|
---|
| 50 | hosgn = '+';
|
---|
| 51 | hoff = curwoff;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | sprintf(ebuf, "%c%04d", hosgn, hoff);
|
---|
| 55 | ebflag = TRUE;
|
---|
| 56 |
|
---|
| 57 | return(SUCCESS);
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | /* |
---|
| 61 |
|
---|
| 62 | */
|
---|
| 63 |
|
---|
| 64 | /*
|
---|
| 65 | =============================================================================
|
---|
| 66 | ef_woff() -- parse (unload) the edit buffer
|
---|
| 67 | =============================================================================
|
---|
[7258c6a] | 68 | */
|
---|
[f40a309] | 69 |
|
---|
[7258c6a] | 70 | int16_t ef_woff(int16_t n)
|
---|
| 71 | {
|
---|
[f40a309] | 72 | register int16_t *ov;
|
---|
| 73 | register int16_t i, tmpval;
|
---|
| 74 |
|
---|
| 75 | ebuf[5] = '\0'; /* terminate the string in ebuf */
|
---|
| 76 | ebflag = FALSE;
|
---|
| 77 |
|
---|
| 78 | tmpval = 0;
|
---|
| 79 |
|
---|
| 80 | for (i = 1; i < 5; i++) /* convert from ASCII to binary */
|
---|
| 81 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
| 82 |
|
---|
| 83 | if (tmpval GT 1023)
|
---|
| 84 | return(FAILURE);
|
---|
| 85 |
|
---|
| 86 | if (ebuf[0] EQ '-')
|
---|
| 87 | curwoff = -tmpval;
|
---|
| 88 | else
|
---|
| 89 | curwoff = tmpval;
|
---|
| 90 |
|
---|
| 91 | if (curwdth EQ NUMWIDS)
|
---|
| 92 | wdintp();
|
---|
| 93 | else
|
---|
| 94 | pntsup();
|
---|
| 95 |
|
---|
| 96 | wdswin(0);
|
---|
| 97 | wdswin(2);
|
---|
| 98 | wdswin(4);
|
---|
| 99 | return(SUCCESS);
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | /* |
---|
| 103 |
|
---|
| 104 | */
|
---|
| 105 |
|
---|
| 106 | /*
|
---|
| 107 | =============================================================================
|
---|
| 108 | rd_woff() -- (re)display the field
|
---|
[7258c6a] | 109 | =============================================================================
|
---|
[f40a309] | 110 | */
|
---|
[7258c6a] | 111 |
|
---|
| 112 | int16_t rd_woff(int16_t nn)
|
---|
[f40a309] | 113 | {
|
---|
| 114 | register int16_t hoff, n;
|
---|
| 115 | register int8_t hosgn;
|
---|
| 116 |
|
---|
| 117 | n = nn & 0xFF;
|
---|
| 118 | lstwoff = curwoff;
|
---|
| 119 |
|
---|
| 120 | if (curwoff LT 0) {
|
---|
| 121 |
|
---|
| 122 | hosgn = '-';
|
---|
| 123 | hoff = -curwoff;
|
---|
| 124 |
|
---|
| 125 | } else {
|
---|
| 126 |
|
---|
| 127 | hosgn = '+';
|
---|
| 128 | hoff = curwoff;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | sprintf(dspbuf, "%c%04d", hosgn, hoff);
|
---|
| 132 |
|
---|
| 133 | /* display the value */
|
---|
| 134 |
|
---|
| 135 | if (v_regs[5] & 0x0180)
|
---|
| 136 | vbank(0);
|
---|
| 137 |
|
---|
| 138 | vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
|
---|
| 139 | wdbox[n][6], wdbox[n][7] + WOFF_OFF, dspbuf, 14);
|
---|
| 140 |
|
---|
| 141 | return(SUCCESS);
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | /* |
---|
| 145 |
|
---|
| 146 | */
|
---|
| 147 |
|
---|
| 148 | /*
|
---|
| 149 | =============================================================================
|
---|
[7258c6a] | 150 | nd_woff() -- handle new data entry
|
---|
[f40a309] | 151 | =============================================================================
|
---|
[7258c6a] | 152 | */
|
---|
[f40a309] | 153 |
|
---|
| 154 | int16_t nd_woff(int16_t nn, int16_t k)
|
---|
| 155 | {
|
---|
| 156 | register int16_t ec, n;
|
---|
| 157 |
|
---|
| 158 | n = nn & 0xFF;
|
---|
| 159 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 160 |
|
---|
| 161 | if (ec EQ 0) {
|
---|
| 162 |
|
---|
| 163 | if (k EQ 8) {
|
---|
| 164 |
|
---|
| 165 | ebuf[0] = '-';
|
---|
| 166 | ebuf[5] = '\0';
|
---|
| 167 |
|
---|
| 168 | dspbuf[0] = '-';
|
---|
| 169 | dspbuf[1] = '\0';
|
---|
| 170 |
|
---|
| 171 | } else if (k EQ 9) {
|
---|
| 172 |
|
---|
| 173 | ebuf[0] = '+';
|
---|
| 174 | ebuf[5] = '\0';
|
---|
| 175 |
|
---|
| 176 | dspbuf[0] = '+';
|
---|
| 177 | dspbuf[1] = '\0';
|
---|
| 178 |
|
---|
| 179 | } else {
|
---|
| 180 |
|
---|
| 181 | return(FAILURE);
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | } else {
|
---|
| 185 |
|
---|
| 186 | ebuf[ec] = k + '0';
|
---|
| 187 | ebuf[5] = '\0';
|
---|
| 188 |
|
---|
| 189 | dspbuf[0] = k + '0';
|
---|
| 190 | dspbuf[1] = '\0';
|
---|
| 191 | }
|
---|
| 192 | /* |
---|
| 193 |
|
---|
| 194 | */
|
---|
| 195 | if (v_regs[5] & 0x0180)
|
---|
| 196 | vbank(0);
|
---|
| 197 |
|
---|
| 198 | vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
|
---|
[6262b5c] | 199 | stcrow, stccol, dspbuf, 14);
|
---|
| 200 |
|
---|
| 201 | advwcur();
|
---|
| 202 | return(SUCCESS);
|
---|
| 203 | }
|
---|
| 204 |
|
---|