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