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

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

Use standard integer types.

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