source: buchla-68k/ram/etinst.c

Last change on this file was b9ddc9a, checked in by Thomas Lopatic <thomas@…>, 6 years ago

Fixed etinst.c.

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[f40a309]1/*
2 =============================================================================
3 etinst.c -- instrument field handlers
4 Version 23 -- 1988-07-11 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
[b28a12e]8#include "ram.h"
[f40a309]9
10/*
11 =============================================================================
12 et_inst() -- load edit buffer
13 =============================================================================
14*/
15
[7258c6a]16int16_t et_inst(int16_t n)
[f40a309]17{
18 sprintf(ebuf, "%02.2d", ins2grp[n] & 0x00FF);
19 ebflag = TRUE;
20
21 return(SUCCESS);
22}
23
24/*
25 =============================================================================
26 ef_inst() -- parse edit buffer
27 =============================================================================
28*/
29
[7258c6a]30int16_t ef_inst(int16_t n)
[f40a309]31{
[7258c6a]32 register int16_t ival;
[f40a309]33 register struct s_entry *ep;
34
35 ebuf[2] = '\0';
36 ival = ((ebuf[0] - '0') * 10) + (ebuf[1] - '0');
37 ebflag = FALSE;
38
39 if (ival GE NINST)
40 return(FAILURE);
41
[b9ddc9a]42 ins2grp[n] = ival | (ins2grp[n] & (int16_t)0xFF00);
[f40a309]43 setv2gi(n);
44 setinst();
45
46 if (recsw AND grpstat[n] AND (2 EQ grpmode[n])) {
47
48 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_INST, n, -1))) {
49
[b9ddc9a]50 ep->e_data2 = (int8_t)ival;
[f40a309]51
52 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
53
54 ep->e_type = EV_INST;
[b9ddc9a]55 ep->e_data1 = (int8_t)n;
56 ep->e_data2 = (int8_t)ival;
[f40a309]57 ep->e_time = t_cur;
58 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
59 eh_ins(ep, EH_INST);
60 ctrsw = TRUE;
61 se_disp(ep, D_FWD, gdstbc, 1);
62 scupd();
63 }
64 }
65
66 return(SUCCESS);
67}
68
69/*
70 =============================================================================
71 rd_inst() -- (re)display the field
72 =============================================================================
73*/
74
[7258c6a]75int16_t rd_inst(int16_t n)
[f40a309]76{
[7258c6a]77 int8_t buf[4];
[f40a309]78
79 sprintf(buf, "%02.2d", ins2grp[n] & 0x00FF);
80
81 if (v_regs[5] & 0x0180)
82 vbank(0);
83
84 vputs(obj8, 2, 7+(n*5), buf, SDW11ATR);
85
86 return(SUCCESS);
87}
88
89/*
90 =============================================================================
91 ds_inst() -- display all instrument to group assignments
92 =============================================================================
93*/
94
[0580615]95void ds_inst(void)
[f40a309]96{
[7258c6a]97 register int16_t i;
[f40a309]98
99 for (i = 0; i < 12; i++)
100 rd_inst(i);
101}
102
103/*
104 =============================================================================
105 nd_inst() -- data entry function
106 =============================================================================
107*/
108
[7258c6a]109int16_t nd_inst(int16_t n, int16_t k)
[f40a309]110{
[7258c6a]111 register int16_t ec;
[f40a309]112
[7ecfb7b]113 (void)n;
114
[f40a309]115 ec = stccol - cfetp->flcol;
[b9ddc9a]116 ebuf[ec] = (int8_t)(k + '0');
[f40a309]117
118 if (v_regs[5] & 0x0180)
119 vbank(0);
120
121 vputc(obj8, 2, stccol, k + '0', SDW11DEA);
122 advscur();
123
124 return(SUCCESS);
125}
[6262b5c]126
Note: See TracBrowser for help on using the repository browser.