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

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

Fixed etaprg.c.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 =============================================================================
3 etaprg.c -- MIDAS assignment editor - program change channel field
4 Version 3 -- 1987-12-21 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define DEBUGIT 0
9
10#include "ram.h"
11
12/*
13 =============================================================================
14 et_aprg() -- load the edit buffer
15 =============================================================================
16*/
17
18int16_t et_aprg(int16_t n)
19{
20 (void)n;
21
22 sprintf(ebuf, "%02d", prgchan);
23 ebflag = TRUE;
24
25 return(SUCCESS);
26}
27
28/*
29 =============================================================================
30 ef_aprg() -- parse (unload) the edit buffer
31 =============================================================================
32*/
33
34int16_t ef_aprg(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 tmpval = 0;
43
44 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
45 tmpval = (tmpval * 10) + (ebuf[i] - '0');
46
47#if DEBUGIT
48 if (debugsw)
49 printf("ef_aprg($%04.4X): ebuf=[%s], tmpval=%d\n",
50 n, ebuf, tmpval);
51#endif
52
53 if ((tmpval EQ 0) OR (tmpval GT 16))
54 return(FAILURE);
55
56 prgchan = tmpval;
57 return(SUCCESS);
58}
59
60/*
61 =============================================================================
62 rd_aprg() -- (re)display the field
63 =============================================================================
64*/
65
66int16_t rd_aprg(int16_t nn)
67{
68 register int16_t n;
69
70 n = nn & 0xFF;
71 sprintf(dspbuf, "%02.2d", prgchan);
72
73 vbank(0);
74 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
75 adbox[n][6], adbox[n][7] + 8, dspbuf, 14);
76
77 return(SUCCESS);
78}
79
80/*
81 =============================================================================
82 nd_aprg() -- handle new data entry
83 =============================================================================
84*/
85
86int16_t nd_aprg(int16_t nn, int16_t k)
87{
88 register int16_t ec, n;
89
90 n = nn & 0xFF;
91
92 ec = stccol - cfetp->flcol; /* setup edit buffer column */
93
94 ebuf[ec] = (int8_t)(k + '0');
95 ebuf[2] = '\0';
96
97 dspbuf[0] = (int8_t)(k + '0');
98 dspbuf[1] = '\0';
99
100 vbank(0);
101 vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
102
103 advacur();
104 return(SUCCESS);
105}
106
107
Note: See TracBrowser for help on using the repository browser.