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

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

Fixed eticnf.c.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 =============================================================================
3 eticnf.c -- instrument editor - configuration number field handlers
4 Version 16 -- 1988-08-23 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10#define CFG_OFF 10 /* display offset into configuration field */
11
12/*
13 =============================================================================
14 et_icnf() -- load the edit buffer
15 =============================================================================
16*/
17
18int16_t et_icnf(int16_t n)
19{
20 (void)n;
21
22 sprintf(ebuf, "%02d", vbufs[curvce].idhcfg);
23 ebflag = TRUE;
24
25 return(SUCCESS);
26}
27
28/*
29 =============================================================================
30 ef_icnf() -- parse (unload) the edit buffer
31 =============================================================================
32*/
33
34int16_t ef_icnf(int16_t n)
35{
36 register int16_t i, tmpval;
37
38 (void)n;
39
40 ebuf[2] = '\0'; /* terminate the string in ebuf */
41 ebflag = FALSE;
42
43 tmpval = 0;
44
45 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
46 tmpval = (tmpval * 10) + (ebuf[i] - '0');
47
48 if (tmpval GE NUMCFG) /* check against limit */
49 return(FAILURE);
50
51 vbufs[curvce].idhcfg = (int8_t)tmpval;
52 dosync(curvce);
53 showcfg(tmpval);
54 modinst();
55 return(SUCCESS);
56}
57
58/*
59 =============================================================================
60 rd_icnf() -- (re)display the field
61 =============================================================================
62*/
63
64int16_t rd_icnf(int16_t n)
65{
66 sprintf(dspbuf, "%02d", vbufs[curvce].idhcfg); /* convert */
67
68 if (v_regs[5] & 0x0180)
69 vbank(0);
70
71 vcputsv(instob, 64, idbox[n][4], idbox[n][5], /* display */
72 idbox[n][6], idbox[n][7] + CFG_OFF, dspbuf, 14);
73
74 return(SUCCESS);
75}
76
77/*
78 =============================================================================
79 nd_icnf() -- handle new data entry
80 =============================================================================
81*/
82
83int16_t nd_icnf(int16_t n, int16_t k)
84{
85 register int16_t ec;
86
87 ec = stccol - cfetp->flcol; /* setup edit buffer column */
88 ebuf[ec] = (int8_t)(k + '0'); /* enter new data in buffer */
89 ebuf[2] = '\0'; /* make sure string is terminated */
90
91 dspbuf[0] = (int8_t)(k + '0'); /* setup for display */
92 dspbuf[1] = '\0';
93
94 if (v_regs[5] & 0x0180)
95 vbank(0);
96
97 /* display the new data */
98
99 vcputsv(instob, 64, ID_ENTRY, idbox[n][5],
100 idbox[n][6], stccol, dspbuf, 14);
101
102 advicur(); /* advance cursor */
103
104 return(SUCCESS);
105}
106
107
Note: See TracBrowser for help on using the repository browser.