[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | etvel.c -- velocity field handlers
|
---|
| 4 | Version 2 -- 1988-06-13 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #include "stddefs.h"
|
---|
| 9 | #include "fields.h"
|
---|
| 10 | #include "hwdefs.h"
|
---|
| 11 | #include "graphdef.h"
|
---|
| 12 | #include "vsdd.h"
|
---|
| 13 | #include "vsddsw.h"
|
---|
| 14 | #include "score.h"
|
---|
| 15 | #include "scfns.h"
|
---|
| 16 |
|
---|
| 17 | #include "midas.h"
|
---|
| 18 | #include "scdsp.h"
|
---|
| 19 | #include "instdsp.h"
|
---|
| 20 |
|
---|
[7258c6a] | 21 | extern uint16_t *obj8;
|
---|
[f40a309] | 22 |
|
---|
[7258c6a] | 23 | extern int16_t recsw;
|
---|
| 24 | extern int16_t stccol;
|
---|
[f40a309] | 25 |
|
---|
[7258c6a] | 26 | extern int16_t grpmode[];
|
---|
| 27 | extern int16_t grpstat[];
|
---|
| 28 | extern int16_t lastvel[];
|
---|
[f40a309] | 29 |
|
---|
| 30 | /* |
---|
| 31 |
|
---|
| 32 | */
|
---|
| 33 |
|
---|
| 34 | /*
|
---|
| 35 | =============================================================================
|
---|
| 36 | et_vel() -- load edit buffer
|
---|
| 37 | =============================================================================
|
---|
| 38 | */
|
---|
[7258c6a] | 39 |
|
---|
[f40a309] | 40 | int16_t et_vel(int16_t n)
|
---|
| 41 | {
|
---|
| 42 | sprintf(ebuf, "%03d", lastvel[n] / 252);
|
---|
| 43 |
|
---|
| 44 | ebflag = TRUE;
|
---|
| 45 | return(SUCCESS);
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | /* |
---|
| 49 |
|
---|
| 50 | */
|
---|
| 51 |
|
---|
| 52 | /*
|
---|
| 53 | =============================================================================
|
---|
| 54 | ef_vel() -- parse edit buffer
|
---|
| 55 | =============================================================================
|
---|
[7258c6a] | 56 | */
|
---|
[f40a309] | 57 |
|
---|
[7258c6a] | 58 | int16_t ef_vel(int16_t n)
|
---|
[f40a309] | 59 | {
|
---|
| 60 | register int16_t ival, i;
|
---|
| 61 | register struct s_entry *ep;
|
---|
| 62 |
|
---|
| 63 | ival = 0;
|
---|
| 64 |
|
---|
| 65 | for (i = 0; i < 3; i++)
|
---|
| 66 | ival = (ival * 10) + (ebuf[i] - '0');
|
---|
| 67 |
|
---|
| 68 | ebflag = FALSE;
|
---|
| 69 |
|
---|
| 70 | if (ival > 127)
|
---|
| 71 | return(FAILURE);
|
---|
| 72 |
|
---|
| 73 | ival = SM_SCALE(ival);
|
---|
| 74 |
|
---|
| 75 | if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
|
---|
| 76 |
|
---|
| 77 | lastvel[n] = ival;
|
---|
| 78 | ep = ep_adj(p_cur, 1, t_cur);
|
---|
| 79 |
|
---|
| 80 | while (t_cur EQ ep->e_time) {
|
---|
| 81 |
|
---|
| 82 | if ((EV_NBEG EQ (0x007F & ep->e_type)) AND
|
---|
| 83 | (ep->e_data2 EQ n)) {
|
---|
| 84 |
|
---|
| 85 | ((struct n_entry *)ep)->e_vel = ival;
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | ep = ep->e_fwd;
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | return(SUCCESS);
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | /* |
---|
| 96 |
|
---|
| 97 | */
|
---|
| 98 |
|
---|
| 99 | /*
|
---|
| 100 | =============================================================================
|
---|
| 101 | rd_vel() -- (re)display the field
|
---|
[7258c6a] | 102 | =============================================================================
|
---|
[f40a309] | 103 | */
|
---|
[7258c6a] | 104 |
|
---|
[f40a309] | 105 | int16_t rd_vel(int16_t n)
|
---|
| 106 | {
|
---|
| 107 | int8_t buf[6];
|
---|
| 108 |
|
---|
| 109 | sprintf(buf, "%03d", lastvel[n] / 252);
|
---|
| 110 |
|
---|
| 111 | if (v_regs[5] & 0x0180)
|
---|
| 112 | vbank(0);
|
---|
| 113 |
|
---|
| 114 | vputs(obj8, 5, 6 + (n * 5), buf, SDW11ATR);
|
---|
| 115 |
|
---|
| 116 | return(SUCCESS);
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | /* |
---|
| 120 |
|
---|
| 121 | */
|
---|
| 122 |
|
---|
| 123 | /*
|
---|
| 124 | =============================================================================
|
---|
[7258c6a] | 125 | nd_vel() -- data entry function
|
---|
[f40a309] | 126 | =============================================================================
|
---|
[7258c6a] | 127 | */
|
---|
[f40a309] | 128 |
|
---|
| 129 | int16_t nd_vel(int16_t n, int16_t k)
|
---|
| 130 | {
|
---|
| 131 | register int16_t ec;
|
---|
| 132 |
|
---|
| 133 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
| 134 | ebuf[ec] = k + '0';
|
---|
| 135 |
|
---|
| 136 | if (v_regs[5] & 0x0180)
|
---|
| 137 | vbank(0);
|
---|
| 138 |
|
---|
| 139 | vputc(obj8, 5, stccol, k + '0', SDW11DEA);
|
---|
| 140 | advscur();
|
---|
| 141 |
|
---|
| 142 | return(SUCCESS);
|
---|
| 143 | }
|
---|