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

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

Added include files for global functions and variables.

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