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

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

Added missing includes and declarations.

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