13#error This is a C++ include file and cannot be used from plain C
91 if (
mticks > 0)
return (1);
92 else if (
mticks < 0)
return (0);
93 else if (
ticks >= 0)
return (1);
242 returnNr_ = 0; loopNr_ = 0; pos_ = 0;
243 error_ = 0; erms_[0] =
'\0';
255 return (prg_->code[pos_]);
259 sprintf(erms_,
"invalid program address");
274 while (!terminate_ && !error_ && !callBack_)
305 sprintf(erms_,
"error parsing loop (loop not closed)");
318 sprintf(erms_,
"invalid pattern address");
325 sprintf(erms_,
"error parsing loop (negative rep. factor)");
357 if ((cnt < -1) || (cnt == 0))
359 sprintf(erms_,
"error parsing loop (invalid loop counter %d)", cnt);
366 sprintf(erms_,
"error parsing loop (too many open loops)");
373 loop_[loopNr_].infinite = 1;
379 loop_[loopNr_].infinite = 0;
382 loop_[loopNr_].cnt = cnt;
383 loop_[loopNr_++].pos = pos_ + 1;
401 sprintf(erms_,
"error parsing loop (skip over loop end)");
406 if (loop_[n].infinite && !breakPoint_) infinite_ = 1;
407 if (loop_[n].cnt >= 0) loop_[n].cnt--;
408 if (loop_[n].cnt == 0)
415 if (loop_[n].infinite)
443 "error parsing loop (invalid subroutine address 0x%04x)",
452 "error parsing loop (too many nested subroutines)");
460 returnPos_[returnNr_++] = pos_ + 1;
474 sprintf(erms_,
"error parsing loop (loop not closed)");
489 Goto(returnPos_[--returnNr_]);
497 void Goto(
int newPos) {pos_ = newPos;}
void Return()
Return from subroutine.
Definition ngcdcsSEQ_PRG.hpp:469
ngcdcsSEQ_EMU()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:214
virtual ~ngcdcsSEQ_EMU()
Destructor.
Definition ngcdcsSEQ_PRG.hpp:230
void OpenLoop(int cnt)
One more open loop.
Definition ngcdcsSEQ_PRG.hpp:356
int id
Definition ngcdcsSEQ_PRG.hpp:207
int counter
Definition ngcdcsSEQ_PRG.hpp:209
void Next()
Goto next code position.
Definition ngcdcsSEQ_PRG.hpp:494
void CloseLoop()
Close loop.
Definition ngcdcsSEQ_PRG.hpp:396
void Goto(int newPos)
Goto code position.
Definition ngcdcsSEQ_PRG.hpp:497
int offset
Definition ngcdcsSEQ_PRG.hpp:211
int Instr()
Get actual instruction.
Definition ngcdcsSEQ_PRG.hpp:252
int Infinite()
Infinite sequence.
Definition ngcdcsSEQ_PRG.hpp:389
int address
Definition ngcdcsSEQ_PRG.hpp:208
void Jsr(int addr)
Jump to subroutine.
Definition ngcdcsSEQ_PRG.hpp:439
int Error()
Check if an error occured.
Definition ngcdcsSEQ_PRG.hpp:500
int infiniteLoopRuns
Definition ngcdcsSEQ_PRG.hpp:210
void BreakPoint()
Breakpoint reached.
Definition ngcdcsSEQ_PRG.hpp:393
void Init()
Initialize the emulation and the generic offset.
Definition ngcdcsSEQ_PRG.hpp:236
char * ErrMsg()
Return pointer to actual error message.
Definition ngcdcsSEQ_PRG.hpp:503
ngcdcs_seqp_t * Program()
Return loaded program.
Definition ngcdcsSEQ_PRG.hpp:233
int Step()
Step forward to next pattern execution.
Definition ngcdcsSEQ_PRG.hpp:266
ngcdcsSEQ_EMU(ngcdcs_seqp_t *prg)
Constructor with program.
Definition ngcdcsSEQ_PRG.hpp:222
Definition ngcdcsSEQ_PRG.hpp:145
ngcdcsSEQ_TOK(int instr)
Constructor with instruction to load.
Definition ngcdcsSEQ_PRG.hpp:155
int code
Definition ngcdcsSEQ_PRG.hpp:147
int cnt
Definition ngcdcsSEQ_PRG.hpp:149
void Instruction(int instr)
Load instruction.
Definition ngcdcsSEQ_PRG.hpp:159
ngcdcsSEQ_TOK()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:152
int addr
Definition ngcdcsSEQ_PRG.hpp:148
#define ngcbSEQ_MAX_SUBRT
Definition ngcbAddr.h:310
#define ngcbSEQ_RAM_CODE
Definition ngcbAddr.h:273
#define ngcbSEQ_CODE_EXIT
Definition ngcbAddr.h:305
#define ngcbSEQ_RAM_SIZE
Definition ngcbAddr.h:278
#define ngcbSEQ_PATRAM_SIZE
Definition ngcbAddr.h:283
#define ngcbSEQ_RAM_CNT
Definition ngcbAddr.h:272
#define ngcbSEQ_CODE_LOOP_INF
Definition ngcbAddr.h:302
#define ngcbSEQ_RAM_ADDR
Definition ngcbAddr.h:271
#define ngcbSEQ_CODE_RETURN
Definition ngcbAddr.h:304
#define ngcbSEQ_CODE_LOOP
Definition ngcbAddr.h:300
#define ngcbSEQ_CODE_EXEC
Definition ngcbAddr.h:299
#define ngcbSEQ_CODE_LOOP_END
Definition ngcbAddr.h:301
#define ngcbSEQ_MAX_OPEN_LOOPS
Definition ngcbAddr.h:315
#define ngcbSEQ_CODE_JSR
Definition ngcbAddr.h:303
Definition ngcdcsSEQ_PRG.hpp:132
int pos
Definition ngcdcsSEQ_PRG.hpp:133
int cnt
Definition ngcdcsSEQ_PRG.hpp:134
int infinite
Definition ngcdcsSEQ_PRG.hpp:135
ngcdcs_loop_t()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:138
Definition ngcdcsSEQ_PRG.hpp:118
int code[ngcbSEQ_RAM_SIZE]
Definition ngcdcsSEQ_PRG.hpp:120
int numSubRt
Definition ngcdcsSEQ_PRG.hpp:123
ngcdcs_seqp_t()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:126
int length
Definition ngcdcsSEQ_PRG.hpp:121
int stored
Definition ngcdcsSEQ_PRG.hpp:124
ngcdcs_subrt_t subRt[ngcbSEQ_MAX_SUBRT]
Definition ngcdcsSEQ_PRG.hpp:122
Definition ngcdcsSEQ_PRG.hpp:101
ngcdcs_subrt_t()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:109
double time
Definition ngcdcsSEQ_PRG.hpp:105
int addr
Definition ngcdcsSEQ_PRG.hpp:102
int index
Definition ngcdcsSEQ_PRG.hpp:103
int length
Definition ngcdcsSEQ_PRG.hpp:104
char name[256]
Definition ngcdcsSEQ_PRG.hpp:106
void Add(ngcdcs_ticks_t t)
Add ticks + megaticks.
Definition ngcdcsSEQ_PRG.hpp:60
ngcdcs_ticks_t()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:27
ngcdcs_ticks_t(int mt, int t)
Constructor specifying megaticks and ticks.
Definition ngcdcsSEQ_PRG.hpp:32
int EqZero()
Definition ngcdcsSEQ_PRG.hpp:82
int mticks
Definition ngcdcsSEQ_PRG.hpp:24
void Sub(int t)
Subtract tick.
Definition ngcdcsSEQ_PRG.hpp:47
void Sub(ngcdcs_ticks_t t)
Subtracct ticks + megaticks.
Definition ngcdcsSEQ_PRG.hpp:66
void Set(ngcdcs_ticks_t t)
Set ticks + megaticks.
Definition ngcdcsSEQ_PRG.hpp:38
void Add(int t)
Add tick.
Definition ngcdcsSEQ_PRG.hpp:41
void Reset()
Reset ticks.
Definition ngcdcsSEQ_PRG.hpp:35
int GtZero()
Definition ngcdcsSEQ_PRG.hpp:90
int ticks
Definition ngcdcsSEQ_PRG.hpp:23