OpenCores
URL https://opencores.org/ocsvn/vtach/vtach/trunk

Subversion Repositories vtach

[/] [vtach/] [trunk/] [asm/] [cardiac.inc] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wd5gnr
/**********************************************************************
2
axasm Copyright 2006, 2007, 2008, 2009
3
by Al Williams (alw@al-williams.com).
4
 
5
 
6
This file is part of axasm.
7
 
8
axasm is free software: you can redistribute it and/or modify it
9
under the terms of the GNU General Public Licenses as published
10
by the Free Software Foundation, either version 3 of the License, or
11
(at your option) any later version.
12
 
13
axasm is distributed in the hope that it will be useful, but
14
WITHOUT ANY WARRANTY: without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with axasm (see LICENSE.TXT).
20
If not, see http://www.gnu.org/licenses/.
21
 
22
If a non-GPL license is desired, contact the author.
23
 
24
This is the One-Der definition file
25
 
26
***********************************************************************/
27
#ifndef __SOLO_ASM_INC
28
#define __SOLO_ASM_INC
29
#include   // needed for XSYM
30
#include 
31
#include 
32
 
33
/* Define _SOLO_XSYM to get symbol xref dumped to stderr */
34
 
35
// Define this to override to a different memory size (in words, not bytes!)
36
#ifndef MAXMEM
37
#define MAXMEM 99
38
#endif
39
 
40
static void __setary(unsigned int a, unsigned int v)
41
  {
42
  if (a>=MAXMEM)
43
     {
44
     fprintf(stderr,"Memory overflow, program too large.\n");
45
     _solo_info.err=1;
46
     }
47
  else _solo_info.ary[a]=v;
48
  }
49
 
50
 
51
// note ORG is only for first address, use REORG to start over
52
#define ORG(n) unsigned int genasm(int _solo_pass) { \
53
   unsigned _solo_add=n;\
54
   _solo_info.psize=16; \
55
   _solo_info.begin=n; \
56
   _solo_info.end=n; \
57
   _solo_info.memsize=MAXMEM; \
58
   _solo_info.ary=malloc(_solo_info.memsize*_solo_info.psize); \
59
   _solo_info.err=(_solo_info.ary==NULL)
60
 
61
#define REORG(n) _solo_info.end=((_solo_add)-1)>_solo_info.end?((_solo_add)-1):_solo_info.end; _solo_add=n; _solo_info.begin=(n)<_solo_info.begin?(n):_solo_info.begin
62
// Assume end is at the highest address
63
#define END _solo_info.end=_solo_info.end<_solo_add-1?_solo_add-1:_solo_info.end; return _solo_info.end; }
64
// Note this requires a compiler like gcc that supports var
65
// declarations inthe middle of a block
66
#define DEFLABEL(l) static unsigned l
67
#ifdef _SOLO_XSYM
68
#define LABEL(l) l=_solo_add; if (_solo_pass==2) fprintf(stderr,"%-32s:\t%08X\n",#l,_solo_add)
69
#else
70
#define LABEL(l) l=_solo_add
71
#endif
72
 
73
 
74
#define bcd(n) ((((n)/100)<<8)+((((n)/10)%10)<<4)+((n)%10))
75
 
76
#define DATA(d) __setary(_solo_add++,(bcd(d)))
77
#define NEGDATA(d) __setary(_solo_add++,0x1000 + bcd(d))
78
 
79
#define INP(r) __setary(_solo_add++,bcd(r))
80
#define LOD(r) __setary(_solo_add++,bcd(100+(r)))
81
#define ADD(r) __setary(_solo_add++,bcd(200+(r)))
82
#define TAC(r) __setary(_solo_add++,bcd(300+(r)))
83
#define SFT(r,l) __setary(_solo_add++,bcd(400+((r)*10)+(l)))
84
#define OUT(r) __setary(_solo_add++,bcd(500+(r)))
85
#define STO(r) __setary(_solo_add++,bcd(600+(r)))
86
#define SUB(r) __setary(_solo_add++,bcd(700+(r)))
87
#define JMP(r) __setary(_solo_add++,bcd(800+(r)))
88
#define HLT __setary(_solo_add++,bcd(900))
89
 
90
 
91
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.