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

Last change on this file since fa38804 was fa38804, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Removed form-feed comments.

  • Property mode set to 100644
File size: 2.2 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 sprintf(ebuf, "%02d", prgchan);
21 ebflag = TRUE;
22
23 return(SUCCESS);
24}
25
26/*
27 =============================================================================
28 ef_aprg() -- parse (unload) the edit buffer
29 =============================================================================
30*/
31
32int16_t ef_aprg(int16_t n)
33{
34 register int16_t i, tmpval;
35
36 ebuf[2] = '\0'; /* terminate the string in ebuf */
37 ebflag = FALSE;
38 tmpval = 0;
39
40 for (i = 0; i < 2; i++) /* convert from ASCII to binary */
41 tmpval = (tmpval * 10) + (ebuf[i] - '0');
42
43#if DEBUGIT
44 if (debugsw)
45 printf("ef_aprg($%04.4X): ebuf=[%s], tmpval=%d\n",
46 n, ebuf, tmpval);
47#endif
48
49 if ((tmpval EQ 0) OR (tmpval GT 16))
50 return(FAILURE);
51
52 prgchan = tmpval;
53 return(SUCCESS);
54}
55
56/*
57 =============================================================================
58 rd_aprg() -- (re)display the field
59 =============================================================================
60*/
61
62int16_t rd_aprg(int16_t nn)
63{
64 register int16_t n;
65
66 n = nn & 0xFF;
67 sprintf(dspbuf, "%02.2d", prgchan);
68
69 vbank(0);
70 vcputsv(asgob, 64, adbox[n][4], adbox[n][5],
71 adbox[n][6], adbox[n][7] + 8, dspbuf, 14);
72
73 return(SUCCESS);
74}
75
76/*
77 =============================================================================
78 nd_aprg() -- handle new data entry
79 =============================================================================
80*/
81
82int16_t nd_aprg(int16_t nn, int16_t k)
83{
84 register int16_t ec, n;
85
86 n = nn & 0xFF;
87
88 ec = stccol - cfetp->flcol; /* setup edit buffer column */
89
90 ebuf[ec] = k + '0';
91 ebuf[2] = '\0';
92
93 dspbuf[0] = k + '0';
94 dspbuf[1] = '\0';
95
96 vbank(0);
97 vcputsv(asgob, 64, AK_ENTRY, adbox[n][5], stcrow, stccol, dspbuf, 14);
98
99 advacur();
100 return(SUCCESS);
101}
102
103
Note: See TracBrowser for help on using the repository browser.