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