12#error This is a C++ include file and cannot be used from plain C
90 if (
mticks > 0)
return (1);
91 else if (
mticks < 0)
return (0);
92 else if (
ticks >= 0)
return (1);
241 returnNr_ = 0; loopNr_ = 0; pos_ = 0;
242 error_ = 0; erms_[0] =
'\0';
254 return (prg_->code[pos_]);
258 sprintf(erms_,
"invalid program address");
273 while (!terminate_ && !error_ && !callBack_)
304 sprintf(erms_,
"error parsing loop (loop not closed)");
317 sprintf(erms_,
"invalid pattern address");
324 sprintf(erms_,
"error parsing loop (negative rep. factor)");
356 if ((cnt < -1) || (cnt == 0))
358 sprintf(erms_,
"error parsing loop (invalid loop counter %d)", cnt);
365 sprintf(erms_,
"error parsing loop (too many open loops)");
372 loop_[loopNr_].infinite = 1;
378 loop_[loopNr_].infinite = 0;
381 loop_[loopNr_].cnt = cnt;
382 loop_[loopNr_++].pos = pos_ + 1;
400 sprintf(erms_,
"error parsing loop (skip over loop end)");
405 if (loop_[n].infinite && !breakPoint_) infinite_ = 1;
406 if (loop_[n].cnt >= 0) loop_[n].cnt--;
407 if (loop_[n].cnt == 0)
414 if (loop_[n].infinite)
442 "error parsing loop (invalid subroutine address 0x%04x)",
451 "error parsing loop (too many nested subroutines)");
459 returnPos_[returnNr_++] = pos_ + 1;
473 sprintf(erms_,
"error parsing loop (loop not closed)");
488 Goto(returnPos_[--returnNr_]);
496 void Goto(
int newPos) {pos_ = newPos;}
void Return()
Return from subroutine.
Definition ngcdcsSEQ_PRG.hpp:468
ngcdcsSEQ_EMU()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:213
virtual ~ngcdcsSEQ_EMU()
Destructor.
Definition ngcdcsSEQ_PRG.hpp:229
void OpenLoop(int cnt)
One more open loop.
Definition ngcdcsSEQ_PRG.hpp:355
int id
Definition ngcdcsSEQ_PRG.hpp:206
int counter
Definition ngcdcsSEQ_PRG.hpp:208
void Next()
Goto next code position.
Definition ngcdcsSEQ_PRG.hpp:493
void CloseLoop()
Close loop.
Definition ngcdcsSEQ_PRG.hpp:395
void Goto(int newPos)
Goto code position.
Definition ngcdcsSEQ_PRG.hpp:496
int offset
Definition ngcdcsSEQ_PRG.hpp:210
int Instr()
Get actual instruction.
Definition ngcdcsSEQ_PRG.hpp:251
int Infinite()
Infinite sequence.
Definition ngcdcsSEQ_PRG.hpp:388
int address
Definition ngcdcsSEQ_PRG.hpp:207
void Jsr(int addr)
Jump to subroutine.
Definition ngcdcsSEQ_PRG.hpp:438
int Error()
Check if an error occured.
Definition ngcdcsSEQ_PRG.hpp:499
int infiniteLoopRuns
Definition ngcdcsSEQ_PRG.hpp:209
void BreakPoint()
Breakpoint reached.
Definition ngcdcsSEQ_PRG.hpp:392
void Init()
Initialize the emulation and the generic offset.
Definition ngcdcsSEQ_PRG.hpp:235
char * ErrMsg()
Return pointer to actual error message.
Definition ngcdcsSEQ_PRG.hpp:502
ngcdcs_seqp_t * Program()
Return loaded program.
Definition ngcdcsSEQ_PRG.hpp:232
int Step()
Step forward to next pattern execution.
Definition ngcdcsSEQ_PRG.hpp:265
ngcdcsSEQ_EMU(ngcdcs_seqp_t *prg)
Constructor with program.
Definition ngcdcsSEQ_PRG.hpp:221
Definition ngcdcsSEQ_PRG.hpp:144
ngcdcsSEQ_TOK(int instr)
Constructor with instruction to load.
Definition ngcdcsSEQ_PRG.hpp:154
int code
Definition ngcdcsSEQ_PRG.hpp:146
int cnt
Definition ngcdcsSEQ_PRG.hpp:148
void Instruction(int instr)
Load instruction.
Definition ngcdcsSEQ_PRG.hpp:158
ngcdcsSEQ_TOK()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:151
int addr
Definition ngcdcsSEQ_PRG.hpp:147
#define ngcbSEQ_MAX_SUBRT
Definition ngcbAddr.h:309
#define ngcbSEQ_RAM_CODE
Definition ngcbAddr.h:272
#define ngcbSEQ_CODE_EXIT
Definition ngcbAddr.h:304
#define ngcbSEQ_RAM_SIZE
Definition ngcbAddr.h:277
#define ngcbSEQ_PATRAM_SIZE
Definition ngcbAddr.h:282
#define ngcbSEQ_RAM_CNT
Definition ngcbAddr.h:271
#define ngcbSEQ_CODE_LOOP_INF
Definition ngcbAddr.h:301
#define ngcbSEQ_RAM_ADDR
Definition ngcbAddr.h:270
#define ngcbSEQ_CODE_RETURN
Definition ngcbAddr.h:303
#define ngcbSEQ_CODE_LOOP
Definition ngcbAddr.h:299
#define ngcbSEQ_CODE_EXEC
Definition ngcbAddr.h:298
#define ngcbSEQ_CODE_LOOP_END
Definition ngcbAddr.h:300
#define ngcbSEQ_MAX_OPEN_LOOPS
Definition ngcbAddr.h:314
#define ngcbSEQ_CODE_JSR
Definition ngcbAddr.h:302
Definition ngcdcsSEQ_PRG.hpp:131
int pos
Definition ngcdcsSEQ_PRG.hpp:132
int cnt
Definition ngcdcsSEQ_PRG.hpp:133
int infinite
Definition ngcdcsSEQ_PRG.hpp:134
ngcdcs_loop_t()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:137
Definition ngcdcsSEQ_PRG.hpp:117
int code[ngcbSEQ_RAM_SIZE]
Definition ngcdcsSEQ_PRG.hpp:119
int numSubRt
Definition ngcdcsSEQ_PRG.hpp:122
ngcdcs_seqp_t()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:125
int length
Definition ngcdcsSEQ_PRG.hpp:120
int stored
Definition ngcdcsSEQ_PRG.hpp:123
ngcdcs_subrt_t subRt[ngcbSEQ_MAX_SUBRT]
Definition ngcdcsSEQ_PRG.hpp:121
Definition ngcdcsSEQ_PRG.hpp:100
ngcdcs_subrt_t()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:108
double time
Definition ngcdcsSEQ_PRG.hpp:104
int addr
Definition ngcdcsSEQ_PRG.hpp:101
int index
Definition ngcdcsSEQ_PRG.hpp:102
int length
Definition ngcdcsSEQ_PRG.hpp:103
char name[256]
Definition ngcdcsSEQ_PRG.hpp:105
void Add(ngcdcs_ticks_t t)
Add ticks + megaticks.
Definition ngcdcsSEQ_PRG.hpp:59
ngcdcs_ticks_t()
Constructor.
Definition ngcdcsSEQ_PRG.hpp:26
ngcdcs_ticks_t(int mt, int t)
Constructor specifying megaticks and ticks.
Definition ngcdcsSEQ_PRG.hpp:31
int EqZero()
Definition ngcdcsSEQ_PRG.hpp:81
int mticks
Definition ngcdcsSEQ_PRG.hpp:23
void Sub(int t)
Subtract tick.
Definition ngcdcsSEQ_PRG.hpp:46
void Sub(ngcdcs_ticks_t t)
Subtracct ticks + megaticks.
Definition ngcdcsSEQ_PRG.hpp:65
void Set(ngcdcs_ticks_t t)
Set ticks + megaticks.
Definition ngcdcsSEQ_PRG.hpp:37
void Add(int t)
Add tick.
Definition ngcdcsSEQ_PRG.hpp:40
void Reset()
Reset ticks.
Definition ngcdcsSEQ_PRG.hpp:34
int GtZero()
Definition ngcdcsSEQ_PRG.hpp:89
int ticks
Definition ngcdcsSEQ_PRG.hpp:22