dect
/
asl
Archived
13
0
Fork 0

Import ASL

Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
Patrick McHardy 2011-03-03 18:44:02 +01:00
commit 1f3e92989e
651 changed files with 204302 additions and 0 deletions

330
BENCHES Normal file
View File

@ -0,0 +1,330 @@
This is a file I use to collect the assembly time of a selected subset of
the AS test suite. It might give you a rough estimate of the performance
you may expect from your machine. The times are the wallclock times AS
prints itself, measured three times, averaged and rounded to 1/100's of
seconds. As system overhead goes into these times, memory size and disk
speed play a role, so do not quarrel if the results you get vary by a few
percent... Furthermore, I sometimes manage to make AS itself a bit faster,
what furtherly distorts the results... the fresher the measuring is (see
last column), the more accurate a value probably is. When measuring, assure
that your machine is otherwise unloaded and all the files are on a local
filesystem (if possible)! Speed of screen output is also an issue, so it
may not be a bright idea to do the tests on a Sparc console in single user
mode...
Optimization is the highest available, with some CPU-specific optimi-
zations (e.g. -m486) ...
Alpha AXP-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
Digital Pers. Workstation 433au 21164a 433 [8K+8K/96K]/??? 128 Digital Unix 4.0 DEC-C 3.11 | 0.25s 0.14s 1.52s 245.48 0.567 [ 4. 8.1997]
Digital AlphaStation 500/266 21164 267 [8K+8K/96K]/2M 128 Digital Unix 4.0 DEC-C 3.11 | 0.43s 0.25s 2.76s 138.59 0.521 [ 1.11.1997]
Digital PC164 board 21164 500 [8K+8K/96K]/1M 128 Linux 2.1.42 gcc 2.7.2 | 0.62s 0.35s 3.51s 101.08 0.202
Digital DECpc AXP/150 21064 150 [8K+8K]/512K 32 Linux 2.1.125 gcc 2.7.2.3 | 1.98s 1.04s 11.59s 32.05 0.214 [ 7. 2.1999 comp 96min]
Digital DECpc AXP/150 21064 150 [8K+8K]/512K 32 Linux 2.1.74 egcs 1.0.1 | 2.05s 0.99s 12.44s 31.51 0.210 [20.06.1998]
Digital DECpc AXP/150 21064 150 [8K+8K]/512K 32 Linux 1.99.12 DEC-C 3.11 | 2.02s 1.04s 12.09s 31.40 0.209
Digital DEC 3000 Model 400 21064 133 [8K+8K]/512K 64 Digital Unix 4.0 DEC-C 3.11 | 2.18s 1.09s 12.79s 29.58 0.222
Digital DEC 3000 Model 300X 21064 175 [8K+8K]/256K 64 Digital Unix 4.0 DEC-C 3.11 | 2.44s 1.30s 14.80s 25.59 0.093
Digital DEC 3000 Model 300 21064 150 [8K+8K]/256K 64 Digital Unix 4.0 DEC-C 3.11 | 2.84s 1.42s 15.24s 23.38 0.156
Digital DEC 3000 Model 300LX 21064 125 [8K+8K]/256K 48 Digital Unix 4.0 DEC-C 3.11 | 3.34s 1.59s 18.19s 20.11 0.161
Digital Noname board 21066 166 [8K+8K]/256K 64 Linux 2.0.34 egcs 1.0.2 | 4.09s 1.87s 21.97s 16.74 0.100 [18. 4.1999 comp 150min]
Sparc-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
Sun Ultra 1/170 UltraSparc-1 167 [16K+16K]/512K 128 Solaris 2.5.1 gcc 2.7.2 | 1.08s 0.56s 5.89s 60.40 0.362
Sun Ultra 1/140 UltraSparc-1 143 [16K+16K]/512K 64 Solaris 2.5 Sun-C 3.0.1 | 1.13s 0.59s 5.55s 59.74 0.418
Sun SPARCstation 20/712 2xSuperSparc-2 75 [20K+16K]/1M 256 Solaris 2.5.1 Sun-C 3.0.1 | 1.87s 0.93s 9.78s 35.88 0.478
Sun SPARCstation 20/612 2xSuperSparc-2 60 [20K+16K]/1M 64 Solaris 2.4 Sun-C 3.0.1 | 2.24s 1.12s 11.58s 30.01 0.500
Sun SPARCstation 20/612 2xSuperSparc-2 50 [20K+16K]/1M 64 Solaris 2.5 Sun-C 3.0.1 | 2.90s 1.41s 14.53s 23.66 0.473
Sun SPARCstation 4 MicroSparc-2 85 [16K+8K] ??? Solaris 2.4 Sun-C 3.0.1 | 3.37s 1.56s 17.23s 20.56 0.242
Sun SPARCstation 10/20 SuperSparc-1 33 [20K+16K] 64 Solaris 2.5 Sun-C 3.0.1 | 4.54s 2.23s 22.54s 15.11 0.458
Sun SPARCstation Classic MicroSparc 50 [4K+2K] 24 Solaris 2.5.1 Sun-C 3.0.1 | 6.92s 3.22s 37.45s 9.81 0.196
Sun SPARCstation 1+ LSI L64801 25 64K 16 Solaris 2.4 Sun-C 3.0.1 | 9.16s 4.51s 48.96s 7.30 0.292
Sun 4/670MP ??? 40(?) 64K(?) ??? SunOS 4.1.3 gcc 2.6.3 | 8.29s 4.87s 51.48s 7.24 0.181
Mips-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
SGI Origin 2000 R10000 200 [32K+32K]/4M 512(?) Irix 6.4 SGI-C | 0.64s 0.37s 3.74s 96.16 0.481 [ 4. 8.1997]
SGI Indigo 2 R4400 200 [16K+16K]/2M 64 Irix 5.3 SGI-C (2) | 1.78s 0.88s 9.70s 37.25 0.186
SGI Onyx R4400 150 [16K+16K]/4M 256 Irix 5.3 SGI-C (2) | 2.08s 1.07s 11.80s 31.03 0.207
Digital DECStation 5000/240 R3400 40 64K+64K ??? Ultrix 4.3 gcc 2.7.2 | 3.90s 2.45s 24.45s 15.03 0.376
Digital DECStation 5000/200 R3000+R3010 25 64K+64K 48 NetBSD 1.3.3 gcc 2.7.2.2 | 8.10s 3.85s 47.64s 8.09 0.324 [17. 1.1999]
Digital DECStation 3100 R2000+R2010 16.7 64K+64K 16 NetBSD 1.3.3 gcc 2.7.2.2 | 12.78s 6.09s 74.79s 5.14 0.308 [17. 1.1999]
RS/6000 / PowerPC-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
IBM R50 8xPPC604e 200 [32K+32K]/2M 4096 AIX 4.2.1 IBM XLC | 0.85s 0.53s 4.60s 72.67 0.363 [29. 8.1997]
IBM 43P-140 PPC604e 166 [32K+32K]/1M ??? AIX 4.1.3 IBM XLC | 0.94s 0.60s 5.66s 62.89 0.379 [20. 8.1997]
IBM G40 2xPPC604 112 [16K+16K]/512K ??? AIX 4.2.1 IBM XLC | 1.76s 0.97s 9.86s 36.01 0.322 [ 5. 8.1997]
IBM RS/6000 Model 390 POWER 2 66.7 [32K+64K]/1M 128 AIX 4.1.3 IBM XLC | 2.21s 1.14s 11.52s 30.03 0.450
IBM RS/6000 Model 250 MPC601 66 [32K] ??? AIX 4.1 IBM XLC | 4.27s 2.08s 21.60s 16.00 0.242
IBM RS/6000 Model 320H POWER 1 ? ? 64 AIX 3.2 IBM XLC | 7.00s 3.41s 42.48s 9.20 [29. 7.1999 comp 93min]
IBM RS/6000 Model 220 RSC3308 33.3 [8K] 16 AIX 4.1 IBM XLC | 11.32s 5.60s 66.56s 5.71 0.172
PA-Risc-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
HP HP9000/715 PA7100 50 64K+64K 32 HP-UX 9.0 HP-C | 5.63s 2.88s 29.97s 11.72 0.234
VAX-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
Digital VAXstation 3100 M38 CVAX 16.6666 [???]/64K 16 Ultrix 4.5 gcc 2.7.2 | 22.74s 11.71s 147.15s 2.72 0.163 [ 9. 2.1999 comp 352min]
Digital MicroVAX 3100 (1) (2) CVAX 11.1111 [???] 16 NetBSD 1.3I egcs 1.1 | 39.59s 20.09s 260.70s 1.56 0.141 [14. 2.1999]
Digital VAXstation 2000 MVAX [0.9VUP] none 6 Ultrix 4.1 gcc 2.7.2 | 79.66s 40.43s 512.77s 0.78 ????? [12. 7.1998]
68xxx-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
Sun 3/260 MC68020+MC68881 25+20 [0.25K]/64K 16 NetBSD 1.2 gcc 2.7.2 | 28.98s 13.98s 155.79s 2.32 0.093
PCS Cadmus 9600/5 MC68020+MC68881 25+20 [0.25K]/64K 8 Munix V.3.3-1 cc | 26.12s 14.36s 202.96s 2.20 0.088 [20.06.1998]
Sun 3/60 MC68020+MC68881 20 [0.25K] 24 SunOS 4.1.1u1 egcs 1.1b | 28.31s 14.64s 203.45s 2.19 0.106 [17. 1.1999]
Sun 3/60 (tuned) MC68030+MC68882 24 [0.25K] 16 NetBSD 1.2 gcc 2.7.2 | 38.29s 19.48s 220.14s 1.68 0.070
Sun 3/160 MC68020+MC68881 16.67 [0.25K] 16 NetBSD 1.2 gcc 2.7.2 | 49.58s 24.79s 282.11s 1.31 0.079
PCS Cadmus 9600/4 MC68020+MC68881 16.67 [0.25K]/16K 8 Munix V.3.3-1 cc | 53.49s 29.97s 317.50s 1.16 0.069
Sun 3/50 MC68020+MC68881 15.8 [0.25K] 4 NetBSD 1.2 gcc 2.7.2 | 71.01s 47.11s 422.60s 0.83 0.052
Pentium-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
<Noname> 2*Pentium2 450 Linux gcc | 0.28s 0.14s 1.62s 231.31 0.514
<Noname> Asus T2P4 AMD K6 233 [32K+32K]/512K 64 Linux 2.1.74 gcc 2.7.2 | 0.44s 0.25s 2.69s 138.57 0.595 [20.06.1998]
<Noname> Asus T2P4 AMD K6 200 [32K+32K]/512K 128 Linux 2.0.32 gcc 2.7.2 | 0.47s 0.24s 2.77s 136.00 0.680 [20.06.1998]
<Noname> Natoma Chipset PPro 233 [16K+16K]/256K 64 Linux 2.1.42 pent-gcc | 0.82s 0.45s 4.53s 77.76 0.334
<Noname> Asus T2P4 AMD K6 200 [32K+32K]/512K 128 Linux 2.0.32 emx 0.9 | 0.87s 0.72s 3.65s 73.30 0.367 [20.06.1998]
<Noname> SIS551x Chipset Intel Pentium 100 [8K+8K]/256K 16 Linux 2.0.35 gcc 2.7.2.3 | 1.49s 0.73s 8.89s 43.31 0.433 [25. 7.1999 comp 36min]
<Noname> Asus PCI/I-P5MP3 Intel Pentium 66.6666 [8K+8K]/256K 32 Linux 2.0.27 gcc 2.7.2 | 1.82s 0.93s 11.78s 34.11 0.512 [17. 1.1999]
<Noname> SIS551x Chipset Intel Pentium 75 [8K+8K]/256K 16 Linux 2.0.35 gcc 2.7.2.3 | 2.02s 0.97s 11.63s 32.51 0.433 [25. 7.1999 comp 47min]
<Noname> Asus PCI/I-P5MP3 Intel Pentium 60 [8K+8K]/256K 32 Linux 2.0.27 gcc 2.7.2 | 2.03s 1.05s 12.18s 31.17 0.520 [17. 1.1999]
<Noname> FIC PA-2002 Intel Pentium 75 [8K+8K] 6 Linux 2.0.27 gcc 2.7.2 | 4.74s 2.15s 23.77s 14.82 0.198 [30. 1.1999]
486-based systems
Note for the 486's: To avoid confusion, I named the 486 CPU's according
to the factor they physically use in multiplying the external clock.
E.g., an Am486DX4/100 which physically triples the clock is named
Am486DX3, and an Am5x86 which physically quadruples the clock is named
Am486DX4!
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
<Noname> Eteq 491/493-Chipset Am486DX4 133 [16K(WT)]/256K 20 Linux 2.2.6 gcc 2.7.2.3 | 2.23s 1.09s 12.28s 29.76 0.223 [19. 9.1999 comp 56min]
<Noname> Eteq 491/493-Chipset i486DX3 100 [16K(WT)]/256K 20 Linux 2.2.6 gcc 2.7.2.3 | 2.51s 1.14s 13.35s 27.47 0.275 [19. 9.1999 comp 58min]
<Noname> SISATQ-Chipset Am486DX4 112 [16K]/256K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 2.67s 1.33s 12.73s 25.92 0.231 [15.10.1999 comp 62min]
<Noname> SISATQ-Chipset i486DX3 96 [16K]/256K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 2.60s 1.50s 14.04s 24.35 0.254 [14.10.1999 comp 65min]
IBM PS/2 Model 85 i486DX2 66.666 [8K]/256K 16 Linux 2.2.10 gcc 2.7.2.3 | 3.22s 1.68s 18.76s 19.79 0.297 [16.10.1999 comp 70min]
<Noname> UMC 481A/482A-Chipset Am486DX4 144 [16K(WT)]/128K(WB) 7.875 Linux 2.2.6 gcc 2.7.2.3 | 3.25s 1.92s 16.62s 19.69 0.137 [16. 9.1999 comp 85min]
<Noname> Eteq 491/493-Chipset i486DX2 66.7 [8K]/256K 20 Linux 2.2.6 gcc 2.7.2.3 | 3.31s 1.70s 19.43s 19.29 0.289 [18. 9.1999 comp 82min]
<Noname> UMC 481A/482A-Chipset i486DX3 108 [16K(WT)]/128K(WB) 7.875 Linux 2.2.6 gcc 2.7.2.3 | 3.51s 1.88s 17.17s 19.10 0.177 [12. 9.1999 comp 85min]
IBM PS/2 Model 77s i486DX2 66.666 [8K]/128K 32 Linux 2.2.10 gcc 2.7.2.3 | 3.57s 1.64s 20.24s 18.83 0.283 [19. 9.1999 comp 72min]
<Noname> Eteq 491/493-Chipset Cx486DX2 66.7 [8K]/256K 20 Linux 2.2.6 gcc 2.7.2.3 | 3.60s 1.80s 21.65s 17.77 0.266 [18. 9.1999 comp 87min]
<Noname> SISATQ-Chipset i486DX2 64 [8K]/256K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 3.74s 1.83s 20.79s 17.68 0.276 [14.10.1999 comp 84min]
<Noname> Eteq 491/493-Chipset Am486DX4 133 [16K(WT)] 20 Linux 2.2.6 gcc 2.7.2.3 | 4.19s 1.81s 19.98s 17.35 0.130 [19. 9.1999 comp 95min]
<Noname> Eteq 491/493-Chipset i486DX3 100 [16K(WT)] 20 Linux 2.2.6 gcc 2.7.2.3 | 4.25s 1.87s 20.64s 16.90 0.169 [19. 9.1999 comp 97min]
<Noname> VIA 486/482-Chipset i486DX2 66.7 [8K]/256K 15.625 Linux 2.2.10 gcc 2.7.2.3 | 4.10s 1.91s 22.94s 16.37 0.246 [ 6.11.1999 comp 97min]
<Noname> VIA 486/482-Chipset Cx486DX2 66.7 [8K]/256K 15.625 Linux 2.2.10 gcc 2.7.2.3 | 4.20s 1.97s 24.01s 15.82 0.237 [ 5.11.1999 comp 100min]
<Noname> UM8498-Chipset Am486DX4 133 [16K(WT)]/256K 12 Linux 2.0.27 gcc 2.7.2 | 4.19s 2.17s 23.00s 15.54 0.116
<Noname> VIA 481/495-Chipset i486DX2 66.7 [8K]/256K(WB) 7.625 Linux 2.2.10 gcc 2.7.2.3 | 3.07s 2.09s 26.85s 15.41 0.231 [ 3.10.1999 comp 116min]
<Noname> SISATQ-Chipset Cx486DX2 64 [8K]/256K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 4.35s 2.11s 24.50s 15.18 0.237 [13.10.1999 comp 94min]
<Noname> VIA 481/495-Chipset Cx486DX2 66.7 [8K]/256K(WB) 7.625 Linux 2.2.10 gcc 2.7.2.3 | 4.17s 2.49s 23.31s 14.82 0.222 [ 3.10.1999 comp 98min]
<Noname> UMC 481A/482A-Chipset i486DX2 72 [8K]/128K(WB) 7.875 Linux 2.2.6 gcc 2.7.2.3 | 4.77s 2.20s 25.32s 14.35 0.199 [17. 9.1999 comp 109min]
<Noname> UMC 481A/482A-Chipset Cx486DX2 72 [8K]/128K(WB) 7.875 Linux 2.2.6 gcc 2.7.2.3 | 4.79s 2.31s 27.63s 13.71 0.190 [11. 9.1999 comp 114min]
IBM PS/2 Model 76i i486DX2 66.666 [8K] 16 Linux 2.2.10 gcc 2.7.2.3 | 5.31s 2.35s 28.64s 13.03 0.195 [ 9.10.1999 comp 118min]
<Noname> Eteq 491/492-Chipset Am486DX4 133 [16K(WT)]/256K 20 OS/2 Warp 3 emx 0.99 | 5.10s 2.92s 24.96s 12.88 0.097
<Noname> Asus SP3G Am486DX3 100 [8K]/256K 32 Linux 2.0.7 gcc 2.7.2 | 5.16s 2.45s 29.16s 12.88 0.129
<Noname> Eteq 491/493-Chipset i486SX 33.3 [8K]/256K(WB) 7.875 Linux 2.2.6 gcc 2.7.2.3 | 5.35s 2.49s 32.14s 12.28 0.368 [18. 9.1999 comp 111min]
<Noname> Asus SP3G-PVI Am486DX3 100 [8K]/256K 32 Linux 2.0.21 gcc 2.7.2 | 5.77s 2.77s 32.32s 11.50 0.115
<Noname> SISATQ-Chipset i486SX 32 [8K]/256K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 5.41s 2.89s 33.26s 11.47 0.359 [12.10.1999 comp 115min]
<Noname> SISATQ-Chipset Am486DX4 112 [16K] 7.875 Linux 2.2.10 gcc 2.7.2.3 | 6.25s 2.92s 29.71s 11.33 0.101 [15.10.1999 comp 151min]
<Noname> SISATQ-Chipset i486DX3 96 [16K] 7.875 Linux 2.2.10 gcc 2.7.2.3 | 6.35s 2.98s 30.38s 11.11 0.116 [14.10.1999 comp 152min]
<Noname> VIA 486/482-Chipset i486SX 33.3 [8K]/256K 15.625 Linux 2.2.10 gcc 2.7.2.3 | 5.93s 2.79s 35.15s 11.07 0.332 [ 4.11.1999 comp 122min]
<Noname> UMC 481A/482A-Chipset i486DX3 108 [16K(WT)] 7.875 Linux 2.2.6 gcc 2.7.2.3 | 6.48s 2.99s 31.14s 10.93 0.101 [12. 9.1999 comp 151min]
<Noname> UMC 481A/482A-Chipset Am486DX4 144 [16K(WT)] 7.875 Linux 2.2.6 gcc 2.7.2.3 | 6.31s 3.15s 30.83s 10.88 0.076 [16. 9.1999 comp 151min]
<Noname> Eteq 491/493-Chipset Cx486DX2 66.7 [8K] 20 Linux 2.2.6 gcc 2.7.2.3 | 6.42s 2.86s 35.35s 10.67 0.160 [18. 9.1999 comp 146min]
<Noname> Eteq 491/493-Chipset i486DX2 66.7 [8K] 20 Linux 2.2.6 gcc 2.7.2.3 | 6.53s 2.97s 34.98s 10.51 0.158 [18. 7.1999 comp 149min]
<Noname> UMC 481A/482A-Chipset i486SX 36 [8K]/128K(WB) 7.875 Linux 2.2.6 gcc 2.7.2.3 | 6.94s 2.99s 36.46s 10.15 0.282 [11. 9.1999 comp 132min]
<Noname> VIA 486/482-Chipset Cx486DX2 66.7 [8K] 15.625 Linux 2.2.10 gcc 2.7.2.3 | 7.23s 3.18s 38.93s 9.59 0.144 [ 4.11.1999 comp 166min]
<Noname> VIA 481/495-Chipset i486SX 33.3 [8K]/256K(WB) 7.625 Linux 2.2.10 gcc 2.7.2.3 | 7.45s 3.36s 39.12s 9.29 0.279 [ 2.10.1999 comp 122min]
IBM PS/2 Model 76 i486SX 33 [8K] 7.875 Linux 2.0.35 gcc 2.7.2.3 | 7.52s 3.66s 44.65s 8.62 0.261 [24. 7.1999 comp 151min]
<Noname> VIA 486/482-Chipset i486DX2 66.7 [8K] 15.625 Linux 2.2.10 gcc 2.7.2.3 | 7.58s 3.28s 39.82s 9.27 0.139 [ 6.11.1999 comp 169min]
<Noname> Eteq 491/493-Chipset i486SX 33.3 [8K] 20 Linux 2.2.6 gcc 2.7.2.3 | 8.58s 3.92s 48.60s 7.85 0.235 [19. 7.1999 comp 169min]
<Noname> VIA 481/495-Chipset Cx486DX2 66.7 [8K] 7.625 Linux 2.2.10 gcc 2.7.2.3 | 8.76s 3.87s 51.85s 7.67 0.115 [ 3.10.1999 comp 209min]
<Noname> Eteq 491/492-Chipset i486DX2 66.7 [8K]/64K 5 Linux 2.0.27 gcc 2.7.2 | 8.61s 4.52s 46.33s 7.58 0.114
<Noname> VIA 481/495-Chipset i486DX2 66.7 [8K] 7.625 Linux 2.2.10 gcc 2.7.2.3 | 9.23s 4.10s 47.81s 7.58 0.114 [ 3.10.1999 comp 219min]
<Noname> Eteq 491/492-Chipset Cx486DX2 66.7 [8K]/64K 5 Linux 2.0.27 gcc 2.7.2 | 9.03s 4.46s 46.73s 7.47 0.112
<Noname> UMC 481A/482A-Chipset Cx486DX2 72 [8K] 7.875 Linux 2.2.6 gcc 2.7.2.3 | 9.14s 4.28s 48.42s 7.46 0.104 [11. 9.1999 comp 214min]
<Noname> No Chipset Am486DX4 100 [16K(WT)] 16 Linux 1.99.12 gcc 2.7.2 | 9.18s 4.36s 48.27s 7.41 0.074
<Noname> UMC 481A/482A-Chipset i486DX2 72 [8K] 7.875 Linux 2.2.6 gcc 2.7.2.3 | 9.60s 4.36s 49.99s 7.22 0.100 [17. 9.1999 comp 220min]
<Noname> SISATQ-Chipset Cx486DX2 64 [8K] 7.875 Linux 2.2.10 gcc 2.7.2.3 | 9.73s 4.40s 50.44s 7.15 0.112 [12.10.1999 comp 225min]
<Noname> SISATQ-Chipset i486DX2 64 [8K]/64K(no dirty) 4 Linux 2.0.27 gcc 2.7.2 | 9.46s 4.46s 49.44s 7.13 0.111
<Noname> SISATQ-Chipset Cx486DX2 64 [8K]/64K(no dirty) 4 Linux 2.0.27 gcc 2.7.2 | 9.27s 4.64s 51.35s 7.08 0.111
<Noname> VIA 486/482-Chipset i486SX 33.3 [8K] 15.625 Linux 2.0.27 gcc 2.7.2 | 9.79s 4.23s 54.60s 7.05 0.212 [ 3.11.1999 comp 189min]
IBM PS/2 Model 70-R21 i486DX 25 [8K] 8 Linux 2.0.35 gcc 2.7.2.3 | 9.26s 4.70s 53.86s 6.95 0.278 [ 2. 3.1999 comp 206min]
<Noname> SIS BTQ Chipset i486SX 33.333 [8K] 4 Linux 2.0.27 gcc 2.7.2 | 9.25s 5.76s 50.80s 6.65 0.199 [ 7.12.1997]
<Noname> UMC 481A/482A-Chipset i486SX 36 [8K]/256K(WB) 5 Linux 2.0.27 gcc 2.7.2 | 9.83s 5.15s 57.31s 6.47 0.179
<Noname> UMC 481/482-Chipset i486SX 36 [8K] 7.875 Linux 2.2.6 gcc 2.7.2.3 | 11.49s 5.09s 62.54s 6.00 0.167 [11. 9.1999 comp 233min]
<Noname> No Chipset i486DX2 50 [8K] 16 Linux 2.0.27 gcc 2.7.2 | 11.53s 5.41s 66.61s 5.75 0.115
<Noname> VIA 486/482-Chipset i486DX2 66.7 [8K]/64K 4 Linux 2.0.27 gcc 2.7.2 | 11.72s 6.00s 62.43s 5.63 0.085
<Noname> VIA 481/495-Chipset i486SX 33.3 [8K] 7.625 Linux 2.2.10 gcc 2.7.2.3 | 12.35s 5.42s 66.84s 5.61 0.168 [ 2.10.1999 comp 244min]
<Noname> Eteq 491/492-Chipset i486SX 33.3 [8K]/64K 5 Linux 2.0.27 gcc 2.7.2 | 11.79s 5.93s 65.39s 5.55 0.167
<Noname> SISATQ-Chipset i486DX2 64 [8K] 7.875 Linux 2.2.10 gcc 2.7.2.3 | 10.30s 4.85s 52.87s 6.68 0.104 [13.10.1999 comp 237min]
<Noname> VIA 486/482-Chipset Cx486DX2 66.7 [8K]/64K 4 Linux 2.0.27 gcc 2.7.2 | 11.90s 6.26s 67.01s 5.39 0.081
<Noname> SISATQ-Chipset i486SX 32 [8K]/64K(no dirty) 4 Linux 2.0.27 gcc 2.7.2 | 12.03s 6.32s 67.79s 5.34 0.167
<Noname> SISATQ-Chipset i486SX 32 [8K] 7.875 Linux 2.2.10 gcc 2.7.2.3 | 12.94s 5.70s 70.58s 5.33 0.166 [11.10.1999 comp 260min]
<Noname> UMC 481/482-Chipset i486DX 33 [8K]/256K 16 Linux 2.0.18 gcc 2.7.2 | 16.19s 7.59s 91.05s 4.13 0.125
<Noname> VIA 486/482-Chipset i486SX 33.3 [8K]/64K 4 Linux 2.0.27 gcc 2.7.2 | 15.86s 7.83s 97.15s 4.03 0.121
386DX-based systems
Note for the 386's: Though Cyrix claimed that the Cx486DLC is a 486,
I will show it in this list because it fits into 386DX sockets. Similar
is valid for the IBM chips.
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
IBM PS/2 Model 57SLC3 IBM486DLC3 75 [16K] 11.875 Linux 2.0.35 gcc 2.7.2.3 | 8.24s 3.63s 44.14s 8.42 0.112 [ 4. 9.1999 comp 161min]
<Noname> OPTi 391/392-Chipset Am386DX+Cx83D87DX 40 64K 7,875 Linux 2.2.6 gcc 2.7.2.3 | 8.34s 4.28s 52.53s 7.50 0.187 [ 3. 9.9999 comp 193min]
<Noname> Opti 495-Chipset Am386DX+Cx83D87 40 128K(no dirty) 7.625 Linux 2.2.10 gcc 2.7.2.3 | 8.17s 4.44s 54.11s 7.39 0.185 [30. 9.1999 comp 199min]
<Noname> VIA 481/495-Chipset Am386DX 40 128K(WB) 7.625 Linux 2.2.10 gcc 2.7.2.3 | 8.85s 4.58s 57.33s 6.98 0.174 [ 4.10.1999 comp 196min]
<Noname> Bioteq 3491-Chipset Am386DX 40 128K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 8.83s 4.71s 56.70s 6.94 0.174 [28.10.1999 comp 190min]
<Noname> UMC 482/391-Chipset i386DX+Cx83D87 33.3 128K(no dirty) 5 Linux 2.0.27 gcc 2.7.2 | 9.56s 4.91s 62.83s 6.45 0.194 [ 2.11.1999 comp 232min]
<Noname> Opti 495-Chipset Am386DX+Cx83D87 33.3 128K(no dirty) 7.625 Linux 2.2.10 gcc 2.7.2.3 | 10.13s 5.22s 66.24s 6.09 0.183 [28. 9.1999 comp 242min]
<Noname> Eteq 491/493-Chipset i386DX 40 64K 4 Linux 2.0.27 gcc 2.7.2 | 10.08s 5.98s 63.64s 5.90 0.148 [ 1.11.1997]
<Noname> Bioteq 3491-Chipset Am386DX 33 128K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 10.59s 5.47s 69.72s 5.81 0.176 [28.10.1999 comp 227min]
<Noname> UMC 482/391-Chipset Cx486DLC+Cx83D87 33.3 [1K]/128K(no dirty) 5 Linux 2.0.27 gcc 2.7.2 | 12.37s 6.75s 71.72s 5.08 0.153
IBM PS/2 Model 80-A21 i386DX+i387DX 25 64K 7.875 Linux 2.0.35 gcc 2.7.2.3 | 11.99s 6.62s 81.10s 4.98 0.199 [19. 5.1999, comp 258min]
IBM PS/2 Model 70-A16 i386DX 25 64K 7.875 Linux 2.0.30 gcc 2.7.2 | 12.10s 6.62s 81.14s 4.96 0.198 [ 7. 2.1999, comp 232min]
<Noname> SIS 85C3x0-Chipset i386DX 25 64K 4 Linux 2.0.27 gcc 2.7.2 | 13.02s 6.41s 84.31s 4.83 0.193 [ 1.11.1997]
IBM PS/2 Model P70-386 Cx486DLC+Cx83D87 20 [1K] 7.875 Linux 2.2.10 gcc 2.7.2.3 | 13.11s 6.92s 84.75s 4.69 0.234 [20. 7.1999, comp 329min]
<Noname> TI TACT823x-Chipset i386DX 33 32K(WB) 4 Linux 2.0.27 gcc 2.7.2 | 13.50s 7.22s 81.02s 4.63 0.140 [14.11.1997]
<Noname> Bioteq 3491-Chipset Am386DX 25 128K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 14.48s 6.96s 91.47s 4.41 0.177 [28.10.1999 comp 301min]
<Noname> Opti 495-Chipset Am386DX+Cx83D87 25 128K(no dirty) 7.625 Linux 2.2.10 gcc 2.7.2.3 | 13.77s 7.32s 91.80s 4.41 0.176 [28. 9.1999 comp 323min]
<Noname> UMC 482/391-Chipset Cx486DLC+Cx83D87 33.3 [1K] 5 Linux 2.0.27 gcc 2.7.2 | 15.38s 8.05s 89.57s 4.14 0.124
<Noname> VIA 481/495-Chipset i386DX 40 none 7.625 Linux 2.2.10 gcc 2.7.2.3 | 15.27s 8.09s 103.11s 3.97 0.099 [ 4.10.1999 comp 365min]
<Noname> AMI MK II i386DX+Cx83D87 33 64K 4 Linux 2.0.27 gcc 2.7.2 | 17.19s 9.26s 96.46s 3.71 0.112
<Noname> C&T PEAK/DM-Chipset i386DX+Cx83D87 33.3 64K 4 Linux 2.0.27 gcc 2.7.2 | 17.35s 9.09s 97.07s 3.71 0.111
<Noname> Opti 495-Chipset Am386DX+Cx83D87 20 128K(no dirty) 7.625 Linux 2.2.10 gcc 2.7.2.3 | 16.94s 8.85s 117.47s 3.56 0.178 [26. 9.1999 comp 399min]
IBM PS/2 Model 70-121 i386DX+i387DX 20 none 5.875 Linux 2.0.7 gcc 2.7.2 | 17.26s 9.57s 108.70s 3.53 0.176 [23.11.1997 comp 362min]
<Noname> Bioteq 3491-Chipset Am386DX 20 128K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 17.92s 8.85s 115.57s 3.51 0.176 [26.10.1999 comp 388min]
<Noname> C&T PEAK/DM-Chipset i386DX 33.3 none 7.875 Linux 2.2.10 gcc 2.7.2.3 | 17.64s 9.00s 118.49s 3.48 0.105 [ 7.11.1999 comp 401min]
IBM PS/2 Model P70-386 i386DX+i387DX 20 none 7.875 Linux 2.0.35 gcc 2.7.2.3 | 18.22s 10.22s 123.62s 3.25 0.163 [18. 4.1999 comp 425min]
<Noname> UMC 482/391-Chipset i386DX+IIT3C87 16.7 128K(no dirty) 7.875 Linux 2.2.10 gcc 2.7.2.3 | 19.07s 10.07s 127.44s 3.19 0.191 [ 1.11.1999 comp 463min]
<Noname> Opti 495-Chipset Am386DX+Cx83D87 40 none 7.625 Linux 2.2.10 gcc 2.7.2.3 | 19.88s 10.40s 133.73s 3.06 0.076 [29. 9.1999 comp 494min]
<Noname> SIS 85C3x0-Chipset i386DX+Cx83D87 25 64K 4 Linux 2.0.27 gcc 2.7.2 | 22.62s 11.47s 120.07s 2.93 0.117
IBM PS/2 Model 80-311 i386DX+i387DX 20 none 9.875 Linus 2.0.35 gcc 2.7.2.3 | 21.69s 10.99s 141.28s 2.87 0.143
<Noname> Bioteq 3491-Chipset Am386DX 40 none 7.875 Linux 2.2.10 gcc 2.7.2.3 | 21.44s 10.96s 142.41s 2.87 0.072 [29.10.1999 comp 502min]
<Noname> C&T PEAK/DM-Chipset i386DX+Cx83D87 25 64K 4 Linux 2.0.27 gcc 2.7.2 | 23.56s 12.47s 131.00s 2.73 0.109
<Noname> Opti 495-Chipset Am386DX+Cx83D87 33.3 none 7.625 Linux 2.2.10 gcc 2.7.2.3 | 23.70s 13.44s 160.44s 2.50 0.074 [28. 9.1999 comp 591min]
<Noname> UMC 482/391-Chipset i386DX+IIT3C87 33.3 none 5 Linux 2.0.27 gcc 2.7.2 | 24.34s 12.82s 166.97s 2.48 0.074 [ 2.11.1999 comp 598min]
<Noname> Bioteq 3491-Chipset Am386DX 33 none 7.875 Linux 2.2.10 gcc 2.7.2.3 | 26.02s 14.55s 174.90s 2.29 0.069 [28.10.1999 comp 609min]
<Noname> C&T 8230-Chipset i386DX+i387DX 25 none 8 Linux 2.0.27 gcc 2.7.2 | 27.57s 14.97s 162.15s 2.27 0.091
<Noname> C&T PEAK/DM-Chipset i386DX+Cx83D87 20 64K 4 Linux 2.0.27 gcc 2.7.2 | 29.10s 15.34s 165.43s 2.19 0.110
<Noname> OPTi 381/382-Chipset i386DX+Cx83D87 25 none 4 Linux 2.0.27 gcc 2.7.2 | 30.57s 15.83s 168.03s 2.13 0.085
<Noname> SIS 85C3x0-Chipset i386DX+Cx83D87 25 none 4 Linux 2.0.27 gcc 2.7.2 | 32.94s 16.95s 180.37s 1.98 0.079
<Noname> Opti 495-Chipset Am386DX+Cx83D87 25 none 7.625 Linux 2.2.10 gcc 2.7.2.3 | 32.64s 16.63s 220.51s 1.88 0.075 [27. 9.1999 comp 794min]
<Noname> C&T PEAK/DM-Chipset i386DX+Cx83D87 16 64K 4 Linux 2.0.27 gcc 2.7.2 | 37.12s 19.37s 206.50s 1.74 0.109
<Noname> Bioteq 3491-Chipset Am386DX 25 none 7.875 Linux 2.2.10 gcc 2.7.2.3 | 35.59s 18.00s 236.35s 1.74 0.070 [27.10.1999 comp 824min]
<Noname> C&T 8230-Chipset i386DX+Cx83D87 20 none 4 Linux 2.0.27 gcc 2.7.2 | 40.56s 22.26s 220.02s 1.63 0.082
<Noname> C&T PEAK/DM-Chipset i386DX+Cx83D87 25 none 4 Linux 2.0.27 gcc 2.7.2 | 42.91s 22.23s 244.48s 1.50 0.060
<Noname> Opti 495-Chipset Am386DX+Cx83D87 20 none 7.625 Linux 2.2.10 gcc 2.7.2.3 | 40.97s 21.04s 276.59s 1.49 0.074 [26. 9.1999 comp 1020min]
<Noname> Bioteq 3491-Chipset Am386DX 20 none 7.875 Linux 2.2.10 gcc 2.7.2.3 | 45.58s 22.78s 304.22s 1.36 0.068 [24.10.1999 comp 1052min]
<Noname> C&T 8230-Chipset i386DX+Cx83D87 16 none 4 Linux 2.0.27 gcc 2.7.2 | 48.10s 25.91s 274.92s 1.32 0.082
<Noname> C&T PEAK/DM-Chipset i386DX+Cx83D87 20 none 4 Linux 2.0.27 gcc 2.7.2 | 53.93s 28.07s 310.04s 1.19 0.059
<Noname> UMC 482/391-Chipset i386DX+IIT3C87 16.7 none 7.875 Linux 2.2.10 gcc 2.7.2.3 | 52.42s 26.57s 345.95s 1.18 0.071 [ 1.11.1999 comp 1229min]
Tandon TM8000 i386DX 16 none 4 Linux 2.0.27 gcc 2.7.2 | 60.64s 32.08s 350.00s 1.05 0.066
<Noname> C&T PEAK/DM-Chipset i386DX+Cx83D87 16 none 4 Linux 2.0.27 gcc 2.7.2 | 69.79s 36.19s 399.86s 0.92 0.057
<Noname> TI TACT823x-Chipset i386DX 33 none 4 Linux 2.0.27 gcc 2.7.2 | 68.13s 34.92s 444.39s 0.91 0.028 [14.11.1997]
Tandon TM8000 i386DX 8 none 4 Linux 2.0.27 gcc 2.7.2 | 87.33s 45.53s 504.37s 0.73 0.091
386SX-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
IBM PS/2 Model 56SLC2 IBM 486SLC2 50 [16K] 11.875 Linux 2.0.35 gcc 2.7.2.3 | 7.44s 3.73s 43.22s 8.69 0.173 [ 8. 4.1999 comp 161min]
IBM PS/2 Model 56SLC IBM 386SLC 20 [8K] 7.875 Linux 2.0.35 gcc 2.7.2.3 | 17.56s 8.89s 106.39s 3.63 0.181 [ 9. 5.1999 comp 363min]
<Noname> Cyclone RC2016-Chipset Am386SX 33.3 none 7.625 Linux 2.2.6 gcc 2.7.2.3 | 19.05s 9.70s 128.13s 3.23 0.097 [15. 9.1999 comp 449min]
<Noname> Headland HT18-Chipset i386SX 25 none 7.625 Linux 2.2.10 gcc 2.7.2.3 | 21.84s 12.00s 146.17s 2.74 0.110 [ 9.10.1999 comp 507min]
<Noname> Intel 8234x-Chipset i386SX 20 none 4 Linux 2.0.27 gcc 2.7.2 | 24.11s 12.84s 153.16s 2.55 0.128 [31.12.1997]
IBM PS/2 Model 56SX i386SX 20 none 7.875 Linux 2.2.10 gcc 2.7.2.3 | 24.76s 12.27s 164.25s 2.52 0.126 [ 3.10.1999 comp 565min]
IBM PS/2 Model 57SX i386SX 20 none 7.875 Linux 2.0.35 gcc 2.7.2.3 | 26.61s 13.55s 178.55s 2.31 0.116 [ 8. 4.1999 comp 564min]
<Noname> VLSI-82C33x-Chipset i386SX 20 none 7.625 Linux 2.2.6 gcc 2.7.2.3 | 27.41s 13.93s 183.47s 2.25 0.112 [30. 9.1999 comp 641min]
<Noname> Cyclone RC2016-Chipset Am386SX 40 none 4 Linux 2.0.27 gcc 2.7.2 | 28.41s 14.92s 162.07s 2.25 0.056
<Noname> C&T 8221-Chipset i386SX 16 none 7.625 Linux 2.2.10 gcc 2.7.2.3 | 30.60s 15.37s 204.90s 2.02 0.126 [ 6.11.1999 comp 705min]
<Noname> PCChips Chip 2 Am386SX 33.3 none 4 Linux 2.0.27 gcc 2.7.2 | 33.03s 16.98s 176.92s 1.99 0.060
<Noname> UMC 336-Chipset i386SX 16 none 7.875 Linux 2.2.10 gcc 2.7.2.3 | 30.23s 15.31s 202.86s 2.04 0.127 [10.10.1999 comp 692min]
<Noname> Cyclone RC2016-Chipset Am386SX 20 none 7.625 Linux 2.2.6 gcc 2.7.2.3 | 32.42s 16.55s 218.44s 1.89 0.095 [14. 9.1999 comp 758min]
<Noname> Cyclone RC2016-Chipset Am386SX 16.7 none 7.625 Linux 2.2.6 gcc 2.7.2.3 | 35.68s 17.79s 237.24s 1.74 0.104 [14. 9.1999 comp 817min]
<Noname> Intel 82335-Chipset i386SX 16 none 4 Linux 2.0.27 gcc 2.7.2 | 63.16s 31.86s 350.67s 1.04 0.065
<Noname> PCChips Chip 2 Am386SX 8 none 4 Linux 2.0.27 gcc 2.7.2 | 140.13s 71.44s 778.46s 0.47 0.058
286-based systems
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
<Noname> Suntac 241/203-Cipset Am286+i287 16 none 0.875 MS-DOS 5.0 BC++ 3.1 | 62.00s 36.73s 321.28s 1.03 0.064 [24. 8.1997]
<Noname> C&T 8221-Chipset i286 16 none 1 MS-DOS 5.0 BC++ 3.1 | 67.80s 39.09s 357.13s 0.94 0.059 [24. 8.1997]
<Noname> VLSI VL82C10x-Chipset i286 12 none 1 MS-DOS 5.0 BC++ 3.1 | 75.06s 42.86s 407.07s 0.84 0.070 [24. 8.1997]
<Noname> Headland HT101/102/113 Am286 16 none 1.125 MS-DOS 5.0 BC++ 3.1 | 85.33s 51.42s 416.75s 0.76 0.047 [24. 8.1997]
Toshiba T1600 i286+Am80C287 12+8 none 0.9375 MS-DOS 5.0 BC++ 3.1 | 86.02s 50.26s 471.03s 0.73 0.061 [24. 8.1997]
<Noname> C&T 8220-Chipset i286 12 none 1 MS-DOS 5.0 BC++ 3.1 | 93.47s 53.05s 510.81s 0.68 0.056 [24. 8.1997]
<Noname> G2 GC101/102-Chipset i286 12.5 none 1 MS-DOS 5.0 BC++ 3.1 | 92.56s 52.46s 505.70s 0.68 0.055 [24. 8.1997]
IBM PS/2 Model 50Z i286+i287 10 none 1 MS-DOS 5.0 BC++ 3.1 | 102.50s 59.11s 557.61s 0.62 0.062 [24. 8.1997]
<Noname> Suntac ST62-Chipset i286 10 none 1 MS-DOS 5.0 BC++ 3.1 | 119.15s 66.87s 651.05s 0.53 0.053 [17. 8.1997]
<Noname> Suntac ST62-Chipset i286 8 none 1 MS-DOS 5.0 BC++ 3.1 | 153.73s 87.69s 826.73s 0.41 0.052 [17. 8.1997]
8088/8086-based systems (yes I know I'm a pervert...)
Vendor Machine CPU Clock(MHz) Cache [on]offchip Memory(MB) OS Compiler | BUF32 FL900 MIC51 Index rel.
-----------------------------------------------------------------------------------------------------------------------------+-------------------------------------------
<Noname> no chipset V20+i8087 10 none 0.625+0.5 MS-DOS 3.3 BC++ 3.1 | 225.26s 133.13s 1176.93s 0.28 0.028 [24. 8.1997]
<Noname> CBM PC10-I V20+i8087 4.77 none 0.6875 MS-DOS 3.3 BC++ 3.1 | 472.15s 276.51s 2500.47s 0.13 0.028 [24. 8.1997]
Notes:
(1) non-local filesystem(diskless machine)
(2) Program did not work with -O3, -O2 chosen
(3) a.out-based
(4) node program, very slow I/O!
(5) half of memory is slow 16bit/7.16MHz
(6) slower (100ns) memory
(7) best performance achieved with optimization level 1 ?!
The index numbers at the end of the lines can be calculated with the following
HP28 program:
<< 359.52 SWAP / ROT 65.12 SWAP / ROT 33.52 SWAP / + + 3 / >>
whereby the last value is the second last divided by the clock frequency.
Non-UPN-wheenies may also use the freshly built AS to assemble the 'marks'
assembler program in this distribution.
You have to find out the rest for yourself ;-)
I calculated this weighed ratio to get a unique number to sort the list;
there is so far no special name for this measure. Call them ASstones,
ASmarks, SPECas or whatever you like ;-)

99
INSTALL Normal file
View File

@ -0,0 +1,99 @@
This file is intended to be a short guide for getting AS compiled on
a Unix-like operating system. If you are interested in a more in-depth
discussion of the source code of AS, take a look in the appropriate chapter
of the AS user's manual (german resp. english version located in the doc_DE/
resp. doc_EN/ subdirectory). I highly recommend reading this chapter before
you make extensions or modifications to the source code.
The installation process consists of the following steps:
(1) see if there are additional README files for your platform
(2) create a Makefile.def
(3) compile
(4) execute the test suite
(5) build the documentation
(6) install into the system directories
Step (1):
On some (especially non-Unix) platforms, some additional preliminaries
are needed:
--> If you do not have a C compiler conforming to the ANSI standard,
take a look into 'README.KR'.
--> For MS-DOS and OS/2 platforms, additionally read README.DOS resp.
README.OS2
Step (2):
Settings that may vary from platform to platform are located in a file
called 'Makefile.def'. Your task is either to select an approriate file
from the 'Makefile.def-samples' directory, or to create an own one. I know
this is a bit tedious process, and one day I will probably replace this
scheme with an autoconf-style configuration, but for now we will have to
live with it. A good starting point for a gcc-based, 'normal' Unix system
is the file 'Makefile.def.tmpl'. The settings to make include:
- CC, LD, CFLAGS, LDFLAGS: The compiler and linker you want to use (nice
if you have more than just 'cc' on your machine), plus flags that should
be passed to them. like optimization settings and libraries needed for
linking.
- BINDIR, INCDIR, MANDIR, LIBDIR, DOCDIR: directiories where AS should be
placed after compilation.
- CHARSET: character encoding for non ASCII national special characters.
If your system is absolutely 8-bit-unclean, the ASCII7 setting is a good
idea. Most modern Unix systems default to ISO8859-1, and the IBM437
resp. IBM850 settings are only needed for DOS and OS/2 platforms.
Step (3):
Compilation should be a simple matter of saying 'make' and waiting...
depending on your machine, compliation time can be between a few minutes
(a modern Pentium-based PC or a fast Alpha) and a day (VAXstation 2000).
A few compilers (like newer egcs releases or Borland-C) are known to
generate a lot of warnings about ambigious statements or unused parameters.
I will try to eliminate them when time permits, but I have no high priority
for doing this since they are harmless.
If you are compiling AS for a new platform, you will probably run into
an error message saying that you have to edit 'sysdefs.h'. This file
collects information about the anomalies and specialities of certain
systems. The include file detects a system by querying macros the compiler
predefines and makes the appropriate definitions. The file is sorted by
1. processor architecture
2. manufacturer
3. operating system
Find out the preprocessor symbols your compiler defines, make a new section
in 'sysdefs.h' and send it to me so I can include it in the next release of
AS!
Step (4):
Type 'make test' and the freshly compiled AS will be run on a couple of
test programs. For each program, the output is compared to a reference
binary included in the distribution. The binary output has to match
*exactly*, i.e. ther must not be any difference. Any failed test reported
by the script has to be investigated, even if it happens for a target
platform you never intend to use!
Step (5):
The documentation of AS is distributed in LaTeX format. I chose this format
because TeX is available on about any platform suitable for AS I can think
of. Other formats are created by typing 'make docs': simple ASCII, HTML,
and Postscript. You need a TeX distribution including dvips for the latter,
while converters to ASCII and HTML are included.
Step (6):
Type 'make install'. Depending on the target directories you chose in Step
(1), you may have to acquire root privileges to install AS.
Have fun!
Alfred Arnold, alfred@ccac.rwth-aachen.de

157
Makefile Normal file
View File

@ -0,0 +1,157 @@
include Makefile.def
CURRDIR=./
TAPE=/dev/ntape
DATE=`date +"%d%m%Y"`
include makedefs.src
include objdefs.unix
include makedefs.files
ALLFLAGS = $(CFLAGS) -D$(CHARSET) -DSTDINCLUDES=\"$(INCDIR)\" -DLIBDIR=\"$(LIBDIR)\"
#---------------------------------------------------------------------------
# primary targets
all: $(ALLTARGETS)
docs: $(TEX2DOCTARGET) $(TEX2HTMLTARGET)
cd doc_DE; $(MAKE) TEX2DOC=../$(TEX2DOCTARGET) TEX2HTML=../$(TEX2HTMLTARGET) RM="rm -f"
cd doc_EN; $(MAKE) TEX2DOC=../$(TEX2DOCTARGET) TEX2HTML=../$(TEX2HTMLTARGET) RM="rm -f"
$(ASLTARGET): $(AS_OBJECTS) $(ASM_OBJECTS) $(ST_OBJECTS) $(CODE_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(ASLTARGET) $(ASM_OBJECTS) $(AS_OBJECTS) $(ST_OBJECTS) $(CODE_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(PLISTTARGET): $(PLIST_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(PLISTTARGET) $(PLIST_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(PBINDTARGET): $(PBIND_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(PBINDTARGET) $(PBIND_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(P2HEXTARGET): $(P2HEX_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(P2HEXTARGET) $(P2HEX_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(P2BINTARGET): $(P2BIN_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(P2BINTARGET) $(P2BIN_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(RESCOMPTARGET): $(RESCOMP_OBJECTS)
$(LD) -o $(RESCOMPTARGET) $(RESCOMP_OBJECTS) $(LDFLAGS)
$(TEX2DOCTARGET): $(TEX2DOC_OBJECTS)
$(LD) -o $(TEX2DOCTARGET) $(TEX2DOC_OBJECTS) $(LDFLAGS) -lm
$(TEX2HTMLTARGET): $(TEX2HTML_OBJECTS)
$(LD) -o $(TEX2HTMLTARGET) $(TEX2HTML_OBJECTS) $(LDFLAGS) -lm
$(UNUMLAUTTARGET): $(UNUMLAUT_OBJECTS)
$(LD) -o $(UNUMLAUTTARGET) $(UNUMLAUT_OBJECTS) $(LDFLAGS)
#---------------------------------------------------------------------------
# special rules for objects dependant on string resource files
include makedefs.str
#---------------------------------------------------------------------------
# supplementary targets
test: $(ALLTARGETS)
cd tests; ./testall
install: $(ALLTARGETS)
./install.sh $(BINDIR) $(INCDIR) $(MANDIR) $(LIBDIR) $(DOCDIR)
clean:
rm -f $(ALLTARGETS) $(RESCOMPTARGET) $(TEX2DOCTARGET) $(TEX2HTMLTARGET) *.$(OBJEXTENSION) *.p *.rsc tests/testlog
cd doc_DE; $(MAKE) RM="rm -f" clean
cd doc_EN; $(MAKE) RM="rm -f" clean
#---------------------------------------------------------------------------
# create distributions
distrib: unjunk
mkdir ../asl-$(VERSION)
tar cf - $(DISTARCHFILES) | (cd ../asl-$(VERSION); tar xvf -)
cd ..; tar cvf asl-$(VERSION).tar asl-$(VERSION)
mv ../asl-$(VERSION).tar ./
rm -rf ../asl-$(VERSION)
gzip -9 -f asl-$(VERSION).tar
bindist:
mkdir asl-$(VERSION)
chmod 755 asl-$(VERSION)
./install.sh asl-$(VERSION)/bin asl-$(VERSION)/include asl-$(VERSION)/man asl-$(VERSION)/lib asl-$(VERSION)/doc
tar cvf asl-$(VERSION)-bin.tar asl-$(VERSION)
rm -rf asl-$(VERSION)
gzip -9 -f asl-$(VERSION)-bin.tar
#---------------------------------------------------------------------------
# for my own use only...
tape: unjunk
tar cvf $(TAPE) $(ARCHFILES)
disk: unjunk archive
mcopy -nvm asport.tar.gz a:ASPORT.TGZ
disks: unjunk archives
echo Insert disk 1...
read tmp
mcopy -nvm asport1.tar.gz a:ASPORT1.TGZ
echo Insert disk 2...
read tmp
mcopy -nvm asport2.tar.gz a:ASPORT2.TGZ
archive: unjunk asport.tar.gz
barchive: unjunk asport.tar.bz2
archives: unjunk asport1.tar.gz asport2.tar.gz
asport.tar.gz: $(ARCHFILES)
tar cvf asport.tar $(ARCHFILES)
gzip -9 -f asport.tar
asport.tar.bz2: $(ARCHFILES)
tar cvf asport.tar $(ARCHFILES)
bzip2 asport.tar
asport1.tar.gz: $(ARCH1FILES)
tar cvf asport1.tar $(ARCH1FILES)
gzip -9 -f asport1.tar
asport2.tar.gz: $(ARCH2FILES)
tar cvf asport2.tar $(ARCH2FILES)
gzip -9 -f asport2.tar
snap: unjunk
-mount /mo
-mkdir -p /mo/public/asport/snap_$(DATE)
cp -av $(ARCHFILES) /mo/public/asport/snap_$(DATE)
umount /mo
unjunk:
rm -f tmp.* n.c include/stddef56.inc asmpars.cas.c include/fileform* config.h test.h loc.c gennop.c \
nops.asm bind.* asmutils.* asmmessages.* filenums.* includelist.* tests/warnlog_* \
insttree.* flt1750.* t_65.* test87c8.* testst9.* testst7.* testtms7.* test3203.* \
ioerrors.new.c codeallg.* ASM*.c *_msg*.h p2BIN.* \
decodecmd.* ioerrors.* stringutil.* *split.c marks.c \
`find . -name "testlog" -print` \
`find . -name "*~" -print` \
`find . -name "core" -print` \
`find . -name "*.core" -print` \
`find . -name "*.lst" -print` \
`find . -name "lst" -print` \
`find . -name "*.noi" -print`
cd doc_DE; $(MAKE) clean RM="rm -f"
cd doc_EN; $(MAKE) clean RM="rm -f"
depend:
$(CC) $(ALLFLAGS) -MM *.c >depfile
#---------------------------------------------------------------------------
.SUFFIXES: .c
.c.$(OBJEXTENSION):
$(CC) $(ALLFLAGS) -c $*.c

View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = cc
LD = cc
CFLAGS = -O -D__MUNIX__ -I/usr/include/bsd -Dsigned= -Dvoid=int -Dconst=
LDFLAGS = -lbsd
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

View File

@ -0,0 +1,32 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = bcc
LD = bcc
CFLAGS =-ml -Y -Oe -k- -Z -d
OVR1FLAG=-Y
OVR2FLAG=-Yo
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = c:\as\bin
INCDIR = c:\as\include
MANDIR = c:\as\man
LIBDIR = c:\as\lib
DOCDIR = c:\as\doc
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
CHARSET = CHARSET_IBM437
# CHARSET = CHARSET_IBM850
# -------------------------------------------------------------------------
# DOS special...
EXEXTENSION=.exe

View File

@ -0,0 +1,30 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = bcc
LD = bcc -WX
CFLAGS =-WX -ml -Oe -k- -Z -d -dc
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = c:\as\bin
INCDIR = c:\as\include
MANDIR = c:\as\man
LIBDIR = c:\as\lib
DOCDIR = c:\as\doc
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
CHARSET = CHARSET_IBM437
# CHARSET = CHARSET_IBM850
# -------------------------------------------------------------------------
# DOS special...
EXEXTENSION=.exe

View File

@ -0,0 +1,27 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = cc
LD = cc -non_shared -om
CFLAGS = -std1 -O4 -Olimit 3000 -tune ev5 -fast
# ^^^^^^^^^
# |||||||||
# adapt this to your target cpu (ev4 or ev5)
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,27 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = cc
LD = cc -non_shared -om
CFLAGS = -std1 -O5 -Olimit 3000 -tune ev5 -fast
# ^^^^^^^^^
# |||||||||
# adapt this to your target cpu (ev4 or ev5)
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -O3 -fomit-frame-pointer -Wall
LDFLAGS =
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,28 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = c89
LD = c89
CFLAGS = +O2 +DA715 +ESlit +e -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_XOPEN_SOURCE_EXTENDED
LDFLAGS =
# ^^^^^^
# ||||||
# adapt to your target machine!
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,26 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = c89
LD = c89
CFLAGS = +O3 +DA715 +ESlit +e \
-D_INCLUDE_AES_SOURCE -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_HPUX_SOURCE
LDFLAGS =
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,30 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = bcc
LD = bcc -WX
CFLAGS =-WX -ml -Oe -k- -Z -d -dc
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = c:\as\bin
INCDIR = c:\as\include
MANDIR = c:\as\man
LIBDIR = c:\as\lib
DOCDIR = c:\as\doc
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
CHARSET = CHARSET_IBM437
# CHARSET = CHARSET_IBM850
# -------------------------------------------------------------------------
# DOS special...
EXEXTENSION=.exe

View File

@ -0,0 +1,27 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -O3 -m486 -fomit-frame-pointer -Wall
LDFLAGS =
# ^^^^^
# |||||
# adapt this to your target cpu (386/486 or higher)
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,32 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = bcc
LD = bcc
CFLAGS =-ml -Y -Oe -k- -Z -d
OVR1FLAG=-Y
OVR2FLAG=-Yo
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = c:\as\bin
INCDIR = c:\as\include
MANDIR = c:\as\man
LIBDIR = c:\as\lib
DOCDIR = c:\as\doc
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
CHARSET = CHARSET_IBM437
# CHARSET = CHARSET_IBM850
# -------------------------------------------------------------------------
# DOS special...
EXEXTENSION=.exe

View File

@ -0,0 +1,33 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -O3 -m486 -fomit-frame-pointer -g -Wall
LDFLAGS =
# ^^^^^
# |||||
# adapt this to your target cpu (386/486 or higher)
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_IBM850
# -------------------------------------------------------------------------
# OS/2 special...
EXEXTENSION = .exe

View File

@ -0,0 +1,31 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = vicc
LD = vlink
OBJOPT = "/Fo"
CFLAGS =
OUTOPT = "/O:"
LDFLAGS = /PM:VIO
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = .
INCDIR = m:/as/include
MANDIR = .
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_IBM850
# -------------------------------------------------------------------------
# OS/2 special...
EXEXTENSION = .exe

View File

@ -0,0 +1,28 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -O0 -g -Wall -Wno-parentheses -Wno-sign-compare
LDFLAGS =
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
EXEXTENSION=.exe
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_IBM850
# CHARSET = CHARSET_ISO8859_1

View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = cc
LD = cc
CFLAGS = -O -D__MUNIX__ -I/usr/include/bsd -Dsigned= -Dvoid=int -Dconst=
LDFLAGS = -lbsd
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

View File

@ -0,0 +1,28 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -O3 -fomit-frame-pointer -m68030 -Wall
LDFLAGS =
# ^^^^^^^
# |||||||
# adapt to your cpu type!
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,28 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
# You might want to adapt the -m-option to your cpu type
# Strange: on a 5000/200, things get slower with higher optimization
# levels...that doesn't happen on a 3100...
CFLAGS = -O1 -mcpu=r3000 -fomit-frame-pointer -Wall
LDFLAGS =
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = c89
LD = c89
CFLAGS = -O2 -Olimit 2500
LDFLAGS = -lcV
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = cc
LD = cc
CFLAGS = -O2 -Olimit 5000
LDFLAGS =
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = cc
LD = cc
CFLAGS = -O3 -OPT:Olimit=5000 -mips4 -xgot
LDFLAGS =
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

View File

@ -0,0 +1,28 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = xlc
LD = xlc
CFLAGS = -O3 -qarch=pwr2 -qtune=pwr2
LDFLAGS =
# ^^^^^^^^^^^^^^^^^^^^^^^
# |||||||||||||||||||||||
# adapt to your processor architecture (pwr/pwr2/ppc)
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

View File

@ -0,0 +1,24 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = cc
LD = cc
CFLAGS = -xO4 -xcg92
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -O3 -Wall -D__USE_FIXED_PROTOTYPES__
LDFLAGS =
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437

View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -O3 -fomit-frame-pointer -Wall
LDFLAGS = -lcV
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

25
Makefile.def.tmpl Normal file
View File

@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -O3 -fomit-frame-pointer -Wall
LDFLAGS =
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/local/bin
INCDIR = /usr/local/include/asl
MANDIR = /usr/local/man
LIBDIR = /usr/local/lib/asl
DOCDIR = /usr/local/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
CHARSET = CHARSET_ISO8859_1

120
Makefile.dos Executable file
View File

@ -0,0 +1,120 @@
!include Makefile.def
CURRDIR=.\\
!include makedefs.src
!include objdefs.dos
!include makedefs.files
ALLFLAGS = $(CFLAGS) -D$(CHARSET) -DSTDINCLUDES="$(INCDIR)" -DLIBDIR="$(LIBDIR)"
#---------------------------------------------------------------------------
# primary targets
all: $(ALLTARGETS)
docs: $(TEX2DOCTARGET) $(TEX2HTMLTARGET)
cd doc_DE
$(MAKE) TEX2DOC=..\$(TEX2DOCTARGET) TEX2HTML=..\$(TEX2HTMLTARGET) RM=del
cd ..\doc_EN
$(MAKE) TEX2DOC=..\$(TEX2DOCTARGET) TEX2HTML=..\$(TEX2HTMLTARGET) RM=del
cd ..
$(ASLTARGET): $(AS_OBJECTS) $(ASM_OBJECTS) $(ST_OBJECTS) $(CODE_OBJECTS) $(NLS_OBJECTS)
$(LD) @&&!
-ml $(OVR1FLAG) -e$(ASLTARGET)
$(AS_OBJECTS) $(ASM_OBJECTS)
$(ST_OBJECTS) $(NLS_OBJECTS)
$(OVR2FLAG) $(CODE_OBJECTS)
!
$(PLISTTARGET): $(PLIST_OBJECTS) $(NLS_OBJECTS)
$(LD) @&&!
-ml -e$(PLISTTARGET)
$(PLIST_OBJECTS) n*.$(OBJEXTENSION)
!
$(PBINDTARGET): $(PBIND_OBJECTS) $(NLS_OBJECTS)
$(LD) @&&!
-ml -e$(PBINDTARGET)
$(PBIND_OBJECTS) n*.$(OBJEXTENSION)
!
$(P2HEXTARGET): $(P2HEX_OBJECTS) $(NLS_OBJECTS)
$(LD) @&&!
-ml -e$(P2HEXTARGET)
$(P2HEX_OBJECTS)
$(NLS_OBJECTS)
!
$(P2BINTARGET): $(P2BIN_OBJECTS) $(NLS_OBJECTS)
$(LD) @&&!
-ml -e$(P2BINTARGET)
$(P2BIN_OBJECTS) n*.$(OBJEXTENSION)
!
$(RESCOMPTARGET): $(RESCOMP_OBJECTS)
$(LD) -ml -e$(RESCOMPTARGET) $(RESCOMP_OBJECTS) $(LDFLAGS)
$(TEX2DOCTARGET): $(TEX2DOC_OBJECTS)
$(LD) -ml -e$(TEX2DOCTARGET) $(TEX2DOC_OBJECTS) $(LDFLAGS)
$(TEX2HTMLTARGET): $(TEX2HTML_OBJECTS)
$(LD) -ml -e$(TEX2HTMLTARGET) $(TEX2HTML_OBJECTS) $(LDFLAGS)
$(UNUMLAUTTARGET): $(UNUMLAUT_OBJECTS)
$(LD) -ml -e$(UNUMLAUTTARGET) $(UNUMLAUT_OBJECTS) $(LDFLAGS)
#---------------------------------------------------------------------------
# special rules for objects dependant on string resource files
!include makedefs.str
#---------------------------------------------------------------------------
# supplementary targets
test: $(ALLTARGETS)
cd tests
copy t_secdri\wd1003at.inc t_secdri\lowlevel.inc
testall
cd ..
install: $(ALLTARGETS) $(UNUMLAUTTARGET)
install $(BINDIR) $(INCDIR) $(MANDIR) $(LIBDIR) $(DOCDIR)
clean:
del $(ALLTARGETS)
del $(TEX2DOCTARGET)
del $(TEX2HTMLTARGET)
del $(RESCOMPTARGET)
del *.$(OBJEXTENSION)
del *.p
del testlog
del *.rsc
cd doc_DE
$(MAKE) RM=del clean
cd ..\doc_EN
$(MAKE) RM=del clean
cd ..
#---------------------------------------------------------------------------
# create distributions
bindist: $(UNUMLAUTTARGET)
mkdir as
install as\bin as\include as\man as\lib as\doc
cd as
zip -9 -r ..\as$(VERSION) *.*
cd ..
deltree as
#---------------------------------------------------------------------------
# for my own use only...
#---------------------------------------------------------------------------
.SUFFIXES: .c
.c.$(OBJEXTENSION):
$(CC) $(ALLFLAGS) -c $*.c

100
Makefile.os2 Normal file
View File

@ -0,0 +1,100 @@
include Makefile.def
CURRDIR=.\\
include makedefs.src
include objdefs.unix
include makedefs.files
ALLFLAGS = $(CFLAGS) -D$(CHARSET) -DSTDINCLUDES=\"$(INCDIR)\" -DLIBDIR=\"$(LIBDIR)\"
#---------------------------------------------------------------------------
# primary targets
all: $(ALLTARGETS)
docs: $(TEX2DOCTARGET) $(TEX2HTMLTARGET)
cd doc_DE & $(MAKE) TEX2DOC=..\$(TEX2DOCTARGET) TEX2HTML=..\$(TEX2HTMLTARGET) RM=del
cd doc_EN & $(MAKE) TEX2DOC=..\$(TEX2DOCTARGET) TEX2HTML=..\$(TEX2HTMLTARGET) RM=del
$(ASLTARGET): $(AS_OBJECTS) $(ASM_OBJECTS) $(ST_OBJECTS) $(CODE_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(ASLTARGET) $(ASM_OBJECTS) $(AS_OBJECTS) $(ST_OBJECTS) $(CODE_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(PLISTTARGET): $(PLIST_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(PLISTTARGET) $(PLIST_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(PBINDTARGET): $(PBIND_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(PBINDTARGET) $(PBIND_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(P2HEXTARGET): $(P2HEX_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(P2HEXTARGET) $(P2HEX_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(P2BINTARGET): $(P2BIN_OBJECTS) $(NLS_OBJECTS)
$(LD) -o $(P2BINTARGET) $(P2BIN_OBJECTS) $(NLS_OBJECTS) -lm $(LDFLAGS)
$(RESCOMPTARGET): $(RESCOMP_OBJECTS)
$(LD) -o $(RESCOMPTARGET) $(RESCOMP_OBJECTS) $(LDFLAGS)
$(TEX2DOCTARGET): $(TEX2DOC_OBJECTS)
$(LD) -o $(TEX2DOCTARGET) $(TEX2DOC_OBJECTS) $(LDFLAGS) -lm
$(TEX2HTMLTARGET): $(TEX2HTML_OBJECTS)
$(LD) -o $(TEX2HTMLTARGET) $(TEX2HTML_OBJECTS) $(LDFLAGS) -lm
$(UNUMLAUTTARGET): $(UNUMLAUT_OBJECTS)
$(LD) -o $(UNUMLAUTTARGET) $(UNUMLAUT_OBJECTS) $(LDFLAGS)
#---------------------------------------------------------------------------
# special rules for objects dependant on string resource files
include makedefs.str
#---------------------------------------------------------------------------
# supplementary targets
test: $(ALLTARGETS)
cd tests & copy t_secdrive\wd1003at.inc t_secdrive\lowlevel.inc & .\testall
install: $(ALLTARGETS)
.\install $(BINDIR) $(INCDIR) $(MANDIR) $(LIBDIR) $(DOCDIR)
clean:
-del $(ALLTARGETS)
-del $(TEX2DOCTARGET)
-del $(TEX2HTMLTARGET)
-del $(RESCOMPTARGET)
-del *.$(OBJEXTENSION)
-del *.p
-del testlog
-del *.rsc
cd doc_DE & $(MAKE) RM=del clean
cd doc_EN & $(MAKE) RM=del clean
#---------------------------------------------------------------------------
# create distributions
bindist: $(UNUMLAUTTARGET)
mkdir as & cmd /cinstall as\bin as\include as\man as\lib as\doc
cd as & zip -9 -r ..\as2$(VERSION) *
-del as\bin\* /n
-del as\include\* /n
-del as\man\* /n
-del as\lib /n
-del as\doc\* /n
-rmdir as\bin
-rmdir as\include
-rmdir as\man
-rmdir as\lib
-rmdir as\doc
-rmdir as
#---------------------------------------------------------------------------
# for my own use only...
#---------------------------------------------------------------------------
.SUFFIXES: .c
.c.$(OBJEXTENSION):
$(CC) $(ALLFLAGS) -c $*.c

98
README Normal file
View File

@ -0,0 +1,98 @@
Hello, AS-Users,
OK, here it is, the C-Version of AS that is theoretically compilable
on any system that has an ANSI-C-compiler! After a couple of
optimizations, the performance degradations due to the way C handles
strings have been compensated, so the C version should effectively run
a bit faster than the original Pascal version.
LICENSING
Those who have already used the original DOS/Pascal version of AS
will know that AS is completely free: you may use and modify AS for
whatever purpose you like (regardless whether it is commercial or
not), given that you do not remove my copyright from the sources and
that programs that build upon the AS sources are given out under the
same license terms. Of course, if you add something significant,
you may also add your own name to the copyright list!
To make things a bit more interesting (for me), I have added a detail
to the license terms of the C version: it is wineware! If you want
and have time, you may send me a bottle of your favourite wine...
PLATFORMS
The C version of AS was designed primarily to work with a Unix-like system
with an ANSI-C compilant compiler. Specifically, I have tested this version
of AS on the following machines:
- Digital Unix 3.2/4.0 with DEC-C
- Digital Ultrix for Mips 4.3/4.5 with gcc 2.7.2
- Digital Ultrix for VAX 4.1/4.5 with gcc 2.7.2
- Linux/Alpha with gcc 2.7.2
- Linux/Intel with gcc 2.7.2
- HP9000/7xx HP-UX 9.0/10.0 with HP-C
- MS-DOS with Borland-C 3.1 resp. 4.5
- OS/2 with emx 0.9
- Munix V.3 with cc
- NetBSD/Sun3 with gcc 2.7.2
- NetBSD/pmax with gcc 2.7.2
- SGI Irix 5.3/6.2 with SGI-C
- SunOS 4.1.3/Sparc with gcc 2.6.3 or cc
- Solaris 2.5/Sparc with Sun-C 3.0.1
- IBM RS/6000 AIX 4.1 with IBM XLC
DIFFERENCES / THINGS TO DO
The portable C version of AS has the following, known differences to
the original BP version:
- Floating point values are internally only stored as IEEE double
precision values, not in the 80-bit format Intel NPUs use.
Therefore, floating point ranges and accuracy are not as good as in
the BP version. Currently, there seems to be no portable,
standardized 128-bit-format for FP numbers. Every vendor (IBM,
SUN, CRAY, SGI...) uses his own format, so supporting them all
looks like a lot of work...
+ On most systems, integer arithmetic is done with 64-bit-numbers.
This should hurt only programs that explicitly exploit overflow
and sign effects on 32-bit-versions of AS.
- String variables must not contain NUL characters. This is due to
the fact that C uses the NUL character as an end-of-string marker,
and is probably the hardest thing to resolve :-(
~ most UNIX systems name their own assembler already 'as', so I had
to modify the name to 'asl'. The additional letter is to the honor
of a person that did quite a lot to spread the UNIX philosophy ;-)
I also had to rename 'bind' to 'pbind', but I guess that this won't
matter too much as it is a rarely used tool.
- the C version was designed to have exactly the same command line
interface as the original BP version; however, UNIX shells
interprete some special characters like the dollar sign for hex
values in their own way, so you might have to work with escape (\)
and quote characters.
+ the USEXMS resp. USEEMS and ASXSWAP environment variables do not
exist for Unix platforms (thankfully).
- the AS2MSG filter does not exist (wouldn't make sense because there
is no Borland Pascal for Unix.)
+ This version now contains dynamic switching of program messages, i.e.
you do not have to compile AS any more for a specific language. Instead,
AS will test the LC_MESSAGES, LC_ALL, or LANG environment variables
on Unix resp. the COUNTRY settings on OS/2 and MSDOS to dynamically
load the correct set of messages at runtime.
INSTALLATION
See the file 'INSTALL'
FEEDBACK
In case of problems or questions, send them to alfred@ccac.rwth-aachen.de .

26
README.DOS Normal file
View File

@ -0,0 +1,26 @@
All right, I couldn't resist to port the C version back to DOS. It was
tricky, and I had to fight again all the limitations and bullshit MS-DOS
brings. For porting, I used Borland C in version 3.1 . Older versions
might work also, but you will probably have to take out a lot of code
generator modules if your version of Turbo/Borland-C does not offer
overlays. Porting to compilers from other manufacturers is probably not
impossible, but surely more effort than buying a used copy of BC3.1...
Don't bother with the dozens of warnings issued by the compiler concerning
unused parameters: Things have to be like that since functions are called
via pointers and some functions need the parameters and some not. There
must be a switch somewhere to silence the compiler..
Copy 'Makefile.dos' to 'Makefile' and move the 'makedef.dos' (I hate this
8+3 limit!) to 'Makefile.def'. Compiling and test run should then work
as usual. Assure that you have at least 600 Kbytes of free DOS memory
or otherwise the larger tests might fail! For the DOS platform, the
CKMALLOC symbol is defined to automatically check for out-of-memory
conditions. The 'wrapped' functions are malloc(), realloc(), and strdup().
There must be a function missing, since AS still occasionally crashes when
he runs out of memory....
Compiling for DOS protected mode is also possible. Use the 'makedef.dpmi'
as 'Makefile.def'. I tested this with Borland-C 4.5 and the Powerpack for
BC 4.X .

55
README.KR Normal file
View File

@ -0,0 +1,55 @@
All right, you want to compile AS with a K&R compiler, and I hope you
have really thought about it before attemptimg this. Think a second
and third time before you really go this way! The procedure is
tedious and error-prone. I really regard K&R C as being obsolete, and
that is why I did not provide an 'automatic' way to compile AS with a
K&R compiler. You will probably face more problems than mentioned
here, since K&R systems are mostly old systems that also lack library
functions of newer systems. The K&R support is mostly here because I
have an old PCS/Cadmus system (the first german company in the 80s
that built Unix systems, 68k-equipped and with a very bare System V.3
port) whose compiler is even too stupid to compile GNU-C, so the
description will orient along the things I had to do for the Cadmus.
This scheme however has also already worked for SunOS/Sparc with the
old 'cc' compiler from Sun....
1. remove the '#error' directives from 'sysdefs.h' - K&R
preprocessors do not know them.
2. construct an appropriate 'Makefile.def' for your system. Since
most older systems do not define OS-specific symbols, you might
have to define them yourself and correlate them to what you query
in 'sysdefs.h' for your system. For a K&R compiler, '-Dsigned=
-Dconst=' is a good start to remove ANSI extensions. For the
Cadmus, I also had to to add '-Dvoid=int' because the compiler's
void datatype was broken.
3. There is a tool called 'a2k' to convert ANSI sources (headers &
c-files) to K&R style. This mainly involves removing the
prototypes. Don't think this is a general ANSI-->K&R converter,
since it heavily depends on my way of formatting C sources and
some additional differences are handled in the sources themselves
via __STDC__ queries! To build a2k, a simple 'make a2k' should
suffice.
4. Convert all header files to K&R, like in the following:
for i in *.h; do
cp $i $i.ansi
a2k $i.ansi $i
done
5. Change the Makefile so that a2k is called as a preprocessor to the
compiler. The simplest way is to modify the implicit rule:
.c.o:
a2k $*.c tmp.c
$(CC) $(ALLFLAGS) -c tmp.c
mv tmp.o $*.o
rm -f tmp.c
6. Type 'make' and pray...
One more thing: older Unix systems do not know symbolic links, so a manual
'cp tests/t_secdrive/wd1003at.inc cp tests/t_secdrive/lowlevel.inc' might be
necessary...

197
README.LANGS Normal file
View File

@ -0,0 +1,197 @@
The current version of AS supports the concept loadable language modules,
i.e. the language AS speaks to you is not set during compile time. Instead,
AS tries to detect the language environment at startup and then to load
the appropriate set of messages dynamically. The process of detection
differs depending on the platform: On MS-DOS and OS/2 systems, AS queries
the COUNTRY setting made from CONFIG.SYS. On Unix systems, AS looks for
the environment variables
LC_MESSAGES
LC_ALL
LANG
and takes the first two letters from the variable that is found first.
These two letters are interpreted as a code for the country you live
in.
Currently, AS knows the languages 'german' (code 049 resp. DE) and
english (code 001 resp. EN). Any other setting leads to the default
english language. Sorry, but I do not know more languages good enough
to do other translations. You may now ask if you could add more
languages to AS, and this is just what I hoped for when I wrote these
lines ;-)
Messages are stored in text files with the extension '.res'. Since
parsing text files at every startup of the assembler would be quite
inefficient, the '.res' files are transformed into a binary, indexed
format that can be read with a few block read statements. The
translation is done during the build process with a special tool
called 'rescomp' (you might have seen the execution of rescomp while
you built the C version of AS). rescomp parses the input file(s),
assigns a number to each message, packs the messages to a single array
of chars with an index table, and creates an additional header file
that contains the numbers assigned to each message. A run-time
library then allows to look up the messages via their numbers.
A message source file consists of a couple of control statements.
Empty lines are ignored; lines that start with a semicolon are
treated as comments (i.e. they are also ignored). The first
control statement a message file contains is the 'Langs' statement,
which indicates the languages the messages in this file will support.
This is a *GLOBAL* setting, i.e. you cannot omit languages for single
messages! The Command has the following form:
Langs <Code>(<Country-Code(s),...>) ....
'Code' is the two-letter abbreviation for a language, e.g. 'DE' for
german. Please use only UPPERcase! The code is followed by a
comma-separated list of DOS-style country codes for DOS and OS/2
environments. As you see, several country codes may point to a
single language this way. For example, if you want to assign the
english language to both americans and british people, write
Langs EN(001,061) <further languages>
In case AS finds a language environment that was not explicitly
handled in the message file, the first language given to the 'Langs'
command is used. You may override this via the 'Default' statement.
e.g.
Default DE
Once the language is specified, the 'Message' command is the
only one left to be explained. This command starts the definition of
a message. The message file compiler reads the next 'n' lines, with
'n' being the number of languages defined by the 'Langs' command. A
sample message definition would look like
Message TestMessage
"Dies ist ein Test"
"This is a test"
given that you specified german and english language with the 'Langs'
command.
In case the messages become longer than a single line (messages may
contain newline characters, more about this later), the use of a
backslash (\) as a line continuation parameter is allowed:
Message TestMessage2
"Dies ist eine" \
"zweizeilige Nachricht"
"This is a" \
"two-line message"
Since we deal with non-english languages, we also have to deal with
characters that are not part of the standard ASCII character set - a
point where UNIX systems are traditionally weak. Since we cannot
assume that all terminals have the capability to enter all
language-specific character directly, there must be an 'escape
mechanism' to write them as a sequence of standard ASCII characters.
The message file compiler uses a subset of the sequences used in SGML
and HTML:
&auml; &euml; &iuml; &ouml; &uuml;
--> lowercase umlauted characters
&Auml; &Euml; &Iuml; &Ouml; &Uuml;
--> uppercase umlauted characters
&szlig;
--> german sharp s
&sup2;
--> exponential 2
&micro;
--> micron character
&agrave; &egrave; &igrave; &ograve; &ugrave;
--> lowercase accent grave characters
&Agrave; &Egrave; &Igrave; &Ograve; &Ugrave;
--> uppercase accent grave characters
&aacute; &eacute; &iacute; &oacute; &uacute;
--> lowercase accent acute characters
&Aacute; &Eacute; &Iacute; &Oacute; &Uacute;
--> uppercase accent acute characters
&acirc; &ecirc; &icirc; &ocirc; &ucirc;
--> lowercase accent circonflex characters
&Acirc; &Ecirc; &Icirc; &Ocirc; &Ucirc;
--> uppercase accent circonflex characters
&ccedil; &Ccedil;
--> lowercase / uppercase cedilla
&ntilde; &Ntilde;
--> lowercase / uppercase tilded n
&aring; &Aring;
--> lowercase / uppercase ringed a
&aelig; &Aelig;
--> lowercase / uppercase ae diphtong
&iquest; &iexcl;
--> inverted question / exclamation mark
\n
--> newline character
Upon translation of a message file, the message file compiler will
replace these sequences with the correct character encodings for the
target platform. In the extreme case of a bare 7-bit-ASCII system,
this may imply the translation to a sequence of ASCII characters that
'emulate' the non-ASCII character. *NEVER* use the special characters
directly in the message source files, as this would destroy their
portability!!!
The number of supported language-specific characters used to be
strongly biased to the german language. The reason for this is
simple: german is the only non-english language AS currently
supports...sorry, but English and German is the amount of languages
im am sufficiently fluent in to make a translation...help of others to
extend the range is mostly welcome, and this is the primary reason
why I explained the whole stuff ;-)
So, if you feel brave enough to add a language (don't forget that
there's also an almost-300-page user's manual that waits for
translation ;-), the following steps have to be taken:
1. Find out which non-ASCII characters you additionally need.
I can then extend the message file compiler appropriately.
2. Add your language to the 'Langs' statement in 'header.res'.
This file is included into all other message files, so you
only have to do this once :-)
3. go through all other '.res' files and add the line to all
messages........
4. recompile AS
5. You're done!
That's about everything to be said about the technical side.
Let's go to the political side. I'm prepared to get confronted
with two opinions after you read this:
"Gee, that's far too much effort for such a tool. And anyway, who
needs anything else than english on a Unix system? Unix is some-
thing that was born to be english, and you better accept that!"
"Hey, why did you reinvent the wheel? There's catgets(), there's
GNU-gettext, and..."
Well, i'll try to stay polite ;-)
First, the fact that Unix is so biased towards the english language is
in no way god-given, it's just the way it evolved. Unix was developed
in the USA, and the typical Unix users were up to now people who had
no problems with english - university students, developers etc. But
the times have changed: Linux and *BSD have made Unix cheap, and we are
facing more and more Unix users from other circles - people who
previously only knew MS-LOSS and MS-Windog, and who were told by their
nearest freak that Unix is a great thing. Such users typically will not
accept a system that only speaks english, given that every 500-Dollar-
Windows PC speaks to them in their native language, so why not this
Unix system that claims to be sooo great ?!
Furthermore, do not forget that AS is not a Unix-only tool: It runs
on MS-DOS and OS/2 too, and a some people try to make it go on Macs
(though this seems to be a much harder piece of work...). On these
systems, localization is the standard!
The portability to non-Unix platforms is the reason why I did not choose
an existing package to manage message catalogs. catgets() seems to be
Unix-specific (and it even is not available on all Unix systems!), and
about gettext...well, I just did not look into it...it might have worked,
but most of the GNU tools ported to DOS I have seen so far needed 32-bit-
extenders, which I wanted to avoid. So I quickly hacked up my own
library, but I promise that I will at least reuse it for my own projects!
chardefs.h

26
README.OS2 Normal file
View File

@ -0,0 +1,26 @@
Additional hints for OS/2 users:
- if you only have FAT file systems, forget compiling AS rightaway - we
need the long filenames and therefore a HPFS file system!
- You need the following Unix tools, ported to OS/2 :
- 'gzip' and 'tar' to unpack the archive, but you obviously already
have managed that ;-)
- Eberhard Matthes' port of the GNU-C compiler for OS/2. I haven't
made personally any attempts with other OS/2 compilers so far, but
it might be worth a try.... AS includes already patches for IBM's
Visual Age C 3.0 made by Steffen Schuemann <s.schuemann@pobox.com>
relative to the original r6 distribution. I couldn't test them
myself since I do not have the IBM compiler :-(
- a make utility to process the Makefile. A port of GNU's make should
be perfect.
- Copy 'Makefile.os2' (for emx) resp. 'Makefile.vac' (for IBM Visual Age C)
to 'Makefile' .
- If you make a binary distribution, don't forget to include the emx
runtime libaries...

6
TODO Normal file
View File

@ -0,0 +1,6 @@
- Benchmarks Dual-P2 einarbeiten
- README-Verweise in Anleitung
- Anleitung: Lieferumfang : Binaer-Basis, Zusatzfiles, Source wird
bisheriger Unix-Teil
- Anleitung: Quellenkapitel neuschreiben
- Anleitung: FAQ wenn viele Passes

193
a2k.c Normal file
View File

@ -0,0 +1,193 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/*** valid sym. character */
int readline(file,dest)
FILE *file;
char *dest;
{
char *run=dest;
int zeichen='a';
while ((!feof(file))&&(zeichen!=EOF)&&(zeichen!='\n'))
{
zeichen=fgetc(file);
if ((zeichen!=EOF)&&(zeichen!='\n')) *(run++)=zeichen;
}
*run='\0';
return 0;
}
int isblankline(line)
char *line;
{
for (; *line!='\0'; line++) if (!isspace(*line)) return 0;
return 1;
}
int linestartswidth(line,needle)
char *line;
char *needle;
{
while (isspace(*line)) line++;
return (strncmp(line,needle,strlen(needle))==0);
}
#define BUFFERSIZE 10
int main(argc, argv)
int argc;
char **argv;
{
FILE *inpfile,*outfile;
char lines[BUFFERSIZE][500],*p;
char orig[1000],dest[1000],params[1000],single[1000],save;
int BufferFill,start,z,flag;
if (argc!=3)
{
fprintf(stderr,"usage: %s <input file> <output file>\n",argv[0]);
exit(1);
}
if (strcmp(argv[1],"-")==0) inpfile=stdin;
else inpfile=fopen(argv[1],"r");
if (inpfile==NULL)
{
perror(argv[1]); return 2;
}
if (strcmp(argv[2],"-")==0) outfile=stdout;
else outfile=fopen(argv[2],"w");
if (outfile==NULL)
{
perror(argv[2]); return 2;
}
BufferFill=0;
while (!feof(inpfile))
{
if (BUFFERSIZE==BufferFill)
{
fprintf(outfile,"%s\n",lines[0]);
for (z=0; z<BufferFill; z++) strcpy(lines[z],lines[z+1]);
BufferFill--;
}
readline(inpfile,lines[BufferFill++]);
/* condition for a function header:
1. body begins with '{' or 'BEGIN' in first column
2. header searched backward until blank, comment, or preprocessor
line detected */
if ((strcmp(lines[BufferFill-1],"BEGIN")==0)||(strcmp(lines[BufferFill-1],"{")==0))
{
for (start=BufferFill-1; start>=0; start--)
if (isblankline(lines[start])) break;
else if (*lines[start]=='#') break;
else if (strncmp(lines[start],"/*",2)==0) break;
else if (strcmp(lines[start]+strlen(lines[start])-2,"*/")==0) break;
start++;
/* found: assemble source lines into a single line */
for (z=start,*orig='\0'; z<=BufferFill-2; z++)
{
p=lines[z]; while (isspace(*p)) p++; strcat(orig,p);
if (z!=BufferFill-2) strcat(orig," ");
}
/* cut function name+prefixes: parameter list starts at first '(' */
p=strchr(orig,'('); *p='\0';
sprintf(dest,"\t%s",orig); strcat(dest,"("); strcpy(orig,p+1);
/* cut trailing ')' */
for (p=orig+strlen(orig)-1; *p!=')'; p--); *p='\0';
/* loop through parameters: discard 'void' entries */
*params=0; flag=0;
while (*orig!='\0')
{
p=strchr(orig,',');
if (p==NULL)
{
strcpy(single,orig); *orig='\0';
}
else
{
*p='\0'; strcpy(single,orig); strcpy(orig,p+1);
}
for (p=single; isspace(*p); p++); strcpy(single,p);
for (p=single+strlen(single)-1; isspace(*p); p--); p[1]='\0';
if (strncmp(single,"const ",6)==0) strcpy(single,single+6);
if (strcmp(single,"void")!=0)
{
strcat(params,single); strcat(params,";\n");
for (p=single+strlen(single)-1; (isalnum(*p))||(*p=='_'); p--);
if (flag) strcat(dest,","); strcat(dest,p+1); flag=1;
}
}
/* close function head */
strcat(dest,")");
/* flush contents berore header from buffer */
for (z=0; z<start; fprintf(outfile,"%s\n",lines[z++]));
/* print K&R header; don't forget opening of function body! */
fprintf(outfile,"%s\n%sBEGIN\n",dest,params);
/* flush buffer */
BufferFill=0;
}
/* Detect 'extern' definitions in header files */
else if (linestartswidth(lines[BufferFill-1],"extern "))
{
/* find opening parenthesis. if none, it's a variable definition */
p=strchr(lines[BufferFill-1],'(');
if (p!=NULL)
{
/* if next character is a '*', we have an external definition of
a function pointer and have to find the next '(' */
if (p[1]=='*') p=strchr(p+1,'(');
/* copy out first part, extend by ');' and write the 'prototype'.
flush line buffer before. */
save=p[1];
p[1]='\0'; strcpy(dest,lines[BufferFill-1]); strcat(dest,");");
p[1]=save;
for (z=0; z<BufferFill-1; fprintf(outfile,"%s\n",lines[z++]));
fprintf(outfile,"%s\n",dest);
/* discard lines until end of prototype */
strcpy(dest,lines[BufferFill-1]); BufferFill=0;
while (strcmp(dest+strlen(dest)-2,");")!=0)
{
readline(inpfile,dest);
}
}
}
}
for (z=0; z<BufferFill; fprintf(outfile,"%s\n",lines[z++]));
fclose(inpfile); fclose(outfile);
return 0;
}

14
addcr.c Normal file
View File

@ -0,0 +1,14 @@
#include <stdio.h>
int main(int argc, char **argv)
{
int ch;
while (!feof(stdin))
{
ch=fgetc(stdin);
if (ch==10) fputc(13,stdout);
if (ch!=EOF) fputc(ch,stdout);
}
return 0;
}

2985
as.c Normal file

File diff suppressed because it is too large Load Diff

11
as.h Normal file
View File

@ -0,0 +1,11 @@
/* as.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Hauptmodul */
/* */
/* Historie: 4. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern char *GetErrorPos(void);

983
as.res Normal file
View File

@ -0,0 +1,983 @@
;* as.res
;*****************************************************************************
;* AS-Portierung *
;* *
;* String-Definitionen fuer AS *
;* *
;* Historie: 4. 5.1996 Grundsteinlegung *
;* 19. 1.1997 Kommandozeilenoption U *
;* 21. 1.1997 Warnung nicht bitadressierbare Speicherstelle *
;* 22. 1.1997 Fehler;Warnungen fuer Stacks *
;* 1. 2.1997 Warnung wegen NUL-Zeichen *
;* 29. 3.1997 Kommandozeilenoption g *
;* 30. 5.1997 Warnung wg. inkorrektem Listing *
;* 12. 7.1997 Kommandozeilenoption Y *
;* 5. 8.1997 Meldungen fuer Strukturen *
;* 7. 9.1997 Warnung Bereichsueberschreitung *
;* 24. 9.1997 Kopfzeile Registerdefinitionsliste *
;* 19.10.1997 Warnung neg. DUP-Anzahl *
;* 26. 6.1998 Fehlermeldung Codepage nicht gefunden *
;* 27. 6.1998 Meldungen für Codepage-Liste *
;* 18. 4.1999 Kommandozeilenoptionen cpu, shareout *
;* 2. 5.1999 'order' --> 'instruction' *
;* 13. 7.1999 Fehlermeldungen fuer extern-Symbole *
;* *
;*****************************************************************************
Include header.res
;-----------------------------------------------------------------------------
; Fehlermeldungen
Message ErrName
": Fehler "
": error "
Message WarnName
": Warnung "
": warning "
Message InLineName
" in Zeile "
" in line "
Message ErrMsgUselessDisp
"Displacement=0, &uuml;berfl&uuml;ssig"
"useless displacement 0"
Message ErrMsgShortAddrPossible
"Kurzadressierung m&ouml;glich"
"short addressing possible"
Message ErrMsgShortJumpPossible
"kurzer Sprung m&ouml;glich"
"short jump possible"
Message ErrMsgNoShareFile
"kein Sharefile angelegt, SHARED ignoriert"
"no sharefile created, SHARED ignored"
Message ErrMsgBigDecFloat
"FPU liest Wert evtl. nicht korrekt ein (>=1E1000)"
"FPU possibly cannot read this value (> 1E1000)"
Message ErrMsgPrivOrder
"privilegierte Anweisung"
"privileged instruction"
Message ErrMsgDistNull
"Distanz 0 nicht bei Kurzsprung erlaubt (NOP erzeugt)"
"distance of 0 not allowed for short jump (NOP created instead)"
Message ErrMsgWrongSegment
"Symbol aus falschem Segment"
"symbol out of wrong segment"
Message ErrMsgInAccSegment
"Segment nicht adressierbar"
"segment not accessible"
Message ErrMsgPhaseErr
"&Auml;nderung des Symbolwertes erzwingt zus&auml;tzlichen Pass"
"change of symbol values forces additional pass"
Message ErrMsgOverlap
"&uuml;berlappende Speicherbelegung"
"overlapping memory usage"
Message ErrMsgNoCaseHit
"keine CASE-Bedingung zugetroffen"
"none of the CASE conditions was true"
Message ErrMsgInAccPage
"Seite m&ouml;glicherweise nicht adressierbar"
"page might not be addressable"
Message ErrMsgRMustBeEven
"Registernummer mu&szlig; gerade sein"
"register number must be even"
Message ErrMsgObsolete
"veralteter Befehl"
"obsolete instruction, usage discouraged"
Message ErrMsgUnpredictable
"nicht vorhersagbare Ausf&uuml;hrung dieser Anweisung"
"unpredictable execution of this instruction"
Message ErrMsgAlphaNoSense
"Lokaloperator au&szlig;erhalb einer Sektion &uuml;berfl&uuml;ssig"
"localization operator senseless out of a section"
Message ErrMsgSenseless
"sinnlose Operation"
"senseless instruction"
Message ErrMsgRepassUnknown
"unbekannter Symbolwert erzwingt zus&auml;tzlichen Pass"
"unknown symbol value forces additional pass"
Message ErrMsgAddrNotAligned
"Adresse nicht ausgerichtet"
"address is not properly aligned"
Message ErrMsgIOAddrNotAllowed
"I/O-Adresse darf nicht verwendet werden"
"I/O-address must not be used here"
Message ErrMsgPipeline
"m&ouml;gliche Pipelining-Effekte"
"possible pipelining effects"
Message ErrMsgDoubleAdrRegUse
"mehrfache Adre&szlig;registerbenutzung in einer Anweisung"
"multiple use of address register in one instruction"
Message ErrMsgNotBitAddressable
"Speicherstelle nicht bitadressierbar"
"memory location is not bit addressable"
Message ErrMsgStackNotEmpty
"Stack ist nicht leer"
"stack is not empty"
Message ErrMsgNULCharacter
"NUL-Zeichen in String, Ergebnis undefiniert"
"NUL character in string, result is undefined"
Message ErrMsgPageCrossing
"Befehl &uuml;berschreitet Seitengrenze"
"instruction crosses page boundary"
Message ErrMsgWOverRange
"Bereichs&uuml;berschreitung"
"range overflow"
Message ErrMsgNegDUP
"negatives Argument f&uuml;r DUP"
"negative argument for DUP"
;*****
Message ErrMsgDoubleDef
"Symbol doppelt definiert"
"symbol double defined"
Message ErrMsgSymbolUndef
"Symbol nicht definiert"
"symbol undefined"
Message ErrMsgInvSymName
"ung&uuml;ltiger Symbolname"
"invalid symbol name"
Message ErrMsgInvFormat
"ung&uuml;ltiges Format"
"invalid format"
Message ErrMsgUseLessAttr
"&uuml;berfl&uuml;ssiges Attribut"
"useless attribute"
Message ErrMsgUndefAttr
"undefiniertes Attribut"
"undefined attribute"
Message ErrMsgTooLongAttr
"Attribut darf nur 1 Zeichen lang sein"
"attribute may only be one character long"
Message ErrMsgWrongArgCnt
"unpassende Operandenzahl"
"wrong number of operands"
Message ErrMsgWrongOptCnt
"unpassende Optionszahl"
"wrong number of options"
Message ErrMsgOnlyImmAddr
"nur immediate-Adressierung erlaubt"
"addressing mode must be immediate"
Message ErrMsgInvOpsize
"unpassende Operandengr&ouml;&szlig;e"
"invalid operand size"
Message ErrMsgConfOpSizes
"widersprechende Operandengr&ouml;&szlig;en"
"conflicting operand sizes"
Message ErrMsgUndefOpSizes
"undefinierte Operandengr&ouml;&szlig;e"
"undefined operand size"
Message ErrMsgInvOpType
"unpassender Operandentyp"
"invalid operand type"
Message ErrMsgTooMuchArgs
"zuviele Argumente"
"too many arguments"
Message ErrMsgUnknownOpcode
"unbekannter Befehl"
"unknown opcode"
Message ErrMsgBrackErr
"Klammerfehler"
"number of opening/closing parentheses does not match"
Message ErrMsgDivByZero
"Division durch 0"
"division by 0"
Message ErrMsgUnderRange
"Bereichsunterschreitung"
"range underflow"
Message ErrMsgOverRange
"Bereichs&uuml;berschreitung"
"range overflow"
Message ErrMsgNotAligned
"Adresse nicht ausgerichtet"
"address is not properly aligned"
Message ErrMsgDistTooBig
"Distanz zu gro&szlig;"
"distance too big"
Message ErrMsgInAccReg
"Register nicht zugreifbar"
"register not accessible"
Message ErrMsgNoShortAddr
"Kurzadressierung nicht m&ouml;glich"
"short addressing not allowed"
Message ErrMsgInvAddrMode
"unerlaubter Adressierungsmodus"
"addressing mode not allowed here"
Message ErrMsgMustBeEven
"Nummer mu&szlig; ausgerichtet sein"
"number must be aligned"
Message ErrMsgInvParAddrMode
"Adressierungsmodus im Parallelbetrieb nicht erlaubt"
"addressing mode not allowed in parallel operation"
Message ErrMsgUndefCond
"undefinierte Bedingung"
"undefined condition"
Message ErrMsgJmpDistTooBig
"Sprungdistanz zu gro&szlig;"
"jump distance too big"
Message ErrMsgDistIsOdd
"Sprungdistanz ist ungerade"
"jump distance is odd"
Message ErrMsgInvShiftArg
"ung&uuml;ltiges Schiebeargument"
"invalid argument for shifting"
Message ErrMsgRange18
"nur Bereich 1..8 erlaubt"
"operand must be in range 1..8"
Message ErrMsgShiftCntTooBig
"Schiebezahl zu gro&szlig;"
"shift amplitude too big"
Message ErrMsgInvRegList
"ung&uuml;ltige Registerliste"
"invalid register list"
Message ErrMsgInvCmpMode
"ung&uuml;ltiger Modus mit CMP"
"invalid addressing mode for CMP"
Message ErrMsgInvCPUType
"ung&uuml;ltiger Prozessortyp"
"invalid CPU type"
Message ErrMsgInvCtrlReg
"ung&uuml;ltiges Kontrollregister"
"invalid control register"
Message ErrMsgInvReg
"ung&uuml;ltiges Register"
"invalid register"
Message ErrMsgNoSaveFrame
"RESTORE ohne SAVE"
"RESTORE without SAVE"
Message ErrMsgNoRestoreFrame
"fehlendes RESTORE"
"missing RESTORE"
Message ErrMsgUnknownMacArg
"unbekannte Makro-Steueranweisung"
"unknown macro control instruction"
Message ErrMsgMissEndif
"fehlendes ENDIF/ENDCASE"
"missing ENDIF/ENDCASE"
Message ErrMsgInvIfConst
"ung&uuml;ltiges IF-Konstrukt"
"invalid IF-structure"
Message ErrMsgDoubleSection
"doppelter Sektionsname"
"section name double defined"
Message ErrMsgInvSection
"unbekannte Sektion"
"unknown section"
Message ErrMsgMissingEndSect
"fehlendes ENDSECTION"
"missing ENDSECTION"
Message ErrMsgWrongEndSect
"falsches ENDSECTION"
"wrong ENDSECTION"
Message ErrMsgNotInSection
"ENDSECTION ohne SECTION"
"ENDSECTION without SECTION"
Message ErrMsgUndefdForward
"nicht aufgel&ouml;ste Vorw&auml;rtsdeklaration"
"unresolved forward declaration"
Message ErrMsgContForward
"widersprechende FORWARD <-> PUBLIC-Deklaration"
"conflicting FORWARD <-> PUBLIC-declaration"
Message ErrMsgInvFuncArgCnt
"falsche Argumentzahl f&uuml;r Funktion"
"wrong numbers of function arguments"
Message ErrMsgMissingLTORG
"unaufgel&ouml;ste Literale (LTORG fehlt)"
"unresolved literals (missing LTORG)"
Message ErrMsgNotOnThisCPU1
"Befehl auf dem "
"instruction not allowed on "
Message ErrMsgNotOnThisCPU2
" nicht vorhanden"
""
Message ErrMsgNotOnThisCPU3
"Adressierungsart auf dem "
"addressing mode not allowed on "
Message ErrMsgInvBitPos
"ung&uuml;ltige Bitstelle"
"invalid bit position"
Message ErrMsgOnlyOnOff
"nur ON/OFF erlaubt"
"only ON/OFF allowed"
Message ErrMsgStackEmpty
"Stack ist leer oder nicht definiert"
"stack is empty or undefined"
Message ErrMsgNotOneBit
"Nicht genau ein Bit gesetzt"
"not exactly one bit set"
Message ErrMsgMissingStruct
"ENDSTRUCT ohne STRUCT"
"ENDSTRUCT without STRUCT"
Message ErrMsgOpenStruct
"offene Strukturdefinition"
"open structure definition"
Message ErrMsgWrongStruct
"falsches ENDSTRUCT"
"wrong ENDSTRUCT"
Message ErrMsgPhaseDisallowed
"Phasendefinition nicht in Strukturen erlaubt"
"phase definition not allowed in structure definition"
Message ErrMsgInvStructDir
"Ung&uuml;ltige STRUCT-Direktive"
"invalid STRUCT directive"
Message ErrMsgShortRead
"vorzeitiges Dateiende"
"unexpected end of file"
Message ErrMsgUnknownCodepage
"unbekannte Zeichentabelle"
"unknown codepage"
Message ErrMsgRomOffs063
"ROM-Offset geht nur von 0..63"
"ROM-offset must be in range 0..63"
Message ErrMsgInvFCode
"ung&uuml;ltiger Funktionscode"
"invalid function code"
Message ErrMsgInvFMask
"ung&uuml;ltige Funktionscodemaske"
"invalid function code mask"
Message ErrMsgInvMMUReg
"ung&uuml;ltiges MMU-Register"
"invalid MMU register"
Message ErrMsgLevel07
"Level nur von 0..7"
"level must be in range 0..7"
Message ErrMsgInvBitMask
"ung&uuml;ltige Bitmaske"
"invalid bit mask"
Message ErrMsgInvRegPair
"ung&uuml;ltiges Registerpaar"
"invalid register pair"
Message ErrMsgOpenMacro
"offene Makrodefinition"
"open macro definition"
Message ErrMsgDoubleMacro
"doppelte Makrodefinition"
"macro double defined"
Message ErrMsgTooManyMacParams
"mehr als 10 Makroparameter"
"more than 10 macro parameters"
Message ErrMsgEXITMOutsideMacro
"EXITM au&szlig;erhalb eines Makrorumpfes"
"EXITM not called from within macro"
Message ErrMsgFirstPassCalc
"Ausdruck mu&szlig; im ersten Pass berechenbar sein"
"expression must be evaluatable in first pass"
Message ErrMsgTooManyNestedIfs
"zu viele verschachtelte IFs"
"too many nested IFs"
Message ErrMsgMissingIf
"ELSEIF/ENDIF ohne IF"
"ELSEIF/ENDIF without IF"
Message ErrMsgRekMacro
"verschachtelter/rekursiver Makroaufruf"
"nested/recursive makro call"
Message ErrMsgUnknownFunc
"unbekannte Funktion"
"unknown function"
Message ErrMsgInvFuncArg
"Funktionsargument au&szlig;erhalb Definitionsbereich"
"function argument out of definition range"
Message ErrMsgFloatOverflow
"Gleitkomma&uuml;berlauf"
"floating point overflow"
Message ErrMsgInvArgPair
"ung&uuml;ltiges Wertepaar"
"invalid value pair"
Message ErrMsgNotOnThisAddress
"Befehl darf nicht auf dieser Adresse liegen"
"instruction must not start on this address"
Message ErrMsgNotFromThisAddress
"ung&uuml;ltiges Sprungziel"
"invalid jump target"
Message ErrMsgTargOnDiffPage
"Sprungziel nicht auf gleicher Seite"
"jump target not on same page"
Message ErrMsgCodeOverflow
"Code&uuml;berlauf"
"code overflow"
Message ErrMsgMixDBDS
"Konstanten und Platzhalter nicht mischbar"
"constants and placeholders cannot be mixed"
Message ErrMsgNotInStruct
"Codeerzeugung in Strukturdefinition nicht zul&auml;ssig"
"code must not be generated in structure definition"
Message ErrMsgParNotPossible
"paralleles Konstrukt nicht m&ouml;glich"
"parallel construct not possible here"
Message ErrMsgAdrOverflow
"Adre&szlig;&uuml;berlauf"
"address overflow"
Message ErrMsgInvSegment
"ung&uuml;ltiges Segment"
"invalid segment"
Message ErrMsgUnknownSegment
"unbekanntes Segment"
"unknown segment"
Message ErrMsgUnknownSegReg
"unbekanntes Segmentregister"
"unknown segment register"
Message ErrMsgInvString
"ung&uuml;ltiger String"
"invalid string"
Message ErrMsgInvRegName
"ung&uuml;ltiger Registername"
"invalid register name"
Message ErrMsgInvArg
"ung&uuml;ltiges Argument"
"invalid argument"
Message ErrMsgNoIndir
"keine Indirektion erlaubt"
"indirect mode not allowed"
Message ErrMsgNotInThisSegment
"nicht im aktuellen Segment erlaubt"
"not allowed in current segment"
Message ErrMsgNotInMaxmode
"nicht im Maximum-Modus zul&auml;ssig"
"not allowed in maximum mode"
Message ErrMsgOnlyInMaxmode
"nicht im Minimum-Modus zul&auml;ssig"
"not allowed in minimum mode"
Message ErrMsgOpeningFile
"Fehler beim &Ouml;ffnen der Datei"
"error in opening file"
Message ErrMsgListWrError
"Listingschreibfehler"
"error in writing listing"
Message ErrMsgFileReadError
"Dateilesefehler"
"file read error"
Message ErrMsgFileWriteError
"Dateischreibfehler"
"file write error"
Message ErrMsgIntError
"interne(r) Fehler/Warnung"
"internal error/warning"
Message ErrMsgHeapOvfl
"Speicher&uuml;berlauf"
"heap overflow"
Message ErrMsgStackOvfl
"Stapel&uuml;berlauf"
"stack overflow"
Message ErrMsgIsFatal
"Fataler Fehler, Assembler abgebrochen"
"fatal error, assembly terminated"
Message ErrMsgOvlyError
"Overlayfehler - Programmabbruch"
"overlay error - program terminated"
Message PrevDefMsg
"vorherige Definition in"
"previous definition in"
Message ErrMsgInvSwapSize
"ung&uuml;ltige Gr&ouml;&szlig;enangabe f&uuml;r Swapfile - Programmabbruch"
"swap file size not correctly specified - program terminated"
Message ErrMsgSwapTooBig
"zuwenig Platz f&uuml;r Swapfile - Programmabbruch"
"insufficient space for swap file - program terminated"
Message ErrMsgNoRelocs
"relokatible Symbole nicht erlaubt"
"relocatable symbols not allowed"
Message ErrMsgUnresRelocs
"unverarbeitete externe Referenzen"
"unresolved external references"
;----------------------------------------------------------------------------
; Strings in Listingkopfzeile
Message HeadingFileNameLab
" - Quelle "
" - source file "
Message HeadingPageLab
" - Seite "
" - page "
;----------------------------------------------------------------------------
; Strings in Listing
Message ListSymListHead1
" Symboltabelle (*=unbenutzt):"
" symbol table (* = unused):"
Message ListSymListHead2
" ----------------------------"
" ------------------------"
Message ListSymSumMsg
" Symbol"
" symbol"
Message ListSymSumsMsg
" Symbole"
" symbols"
Message ListUSymSumMsg
" unbenutztes Symbol"
" unused symbol"
Message ListUSymSumsMsg
" unbenutzte Symbole"
" unused symbols"
Message ListRegDefListHead1
" Registerdefinitionen (*=unbenutzt):"
" register definitions (*=unused):"
Message ListRegDefListHead2
" -----------------------------------"
" --------------------------------"
Message ListRegDefSumMsg
" Definition"
" definition"
Message ListRegDefSumsMsg
" Definitionen"
" definitions"
Message ListRegDefUSumMsg
" unbenutzte Definition"
" unused definition"
Message ListRegDefUSumsMsg
" unbenutzte Definitionen"
" unused definitions"
Message ListCodepageListHead1
" Zeichentabellen:"
" codepages:"
Message ListCodepageListHead2
" ----------------"
" ----------"
Message ListCodepageChange
" ver&auml;ndertes Zeichen"
" changed character"
Message ListCodepagePChange
" ver&auml;nderte Zeichen"
" changed characters"
Message ListCodepageSumMsg
" Zeichentabelle"
" code page"
Message ListCodepageSumsMsg
" Zeichentabellen"
" code pages"
Message ListMacListHead1
" definierte Makros:"
" defined macros:"
Message ListMacListHead2
" ------------------"
" ---------------"
Message ListMacSumMsg
" Makro"
" macro"
Message ListMacSumsMsg
" Makros"
" macros"
Message ListFuncListHead1
" definierte Funktionen:"
" defined functions:"
Message ListFuncListHead2
" ----------------------"
" ------------------"
Message ListDefListHead1
" DEFINEs:"
" DEFINEs:"
Message ListDefListHead2
" --------"
" --------"
Message ListSegListHead1
"in "
"space used in "
Message ListSegListHead2
" belegte Bereiche:"
" :"
Message ListCrossListHead1
" Querverweisliste:"
" cross reference list:"
Message ListCrossListHead2
" -----------------"
" ---------------------"
Message ListSectionListHead1
" Sektionen:"
" sections:"
Message ListSectionListHead2
" ----------"
" ---------"
Message ListIncludeListHead1
" Include-Verschachtelung:"
" nested include files:"
Message ListIncludeListHead2
" ------------------------"
" ---------------------"
Message ListCrossSymName
"Symbol "
"symbol "
Message ListCrossFileName
"Datei "
"file "
Message ListPlurName
"n"
"s"
Message ListHourName
" Stunde"
" hour"
Message ListMinuName
" Minute"
" minute"
Message ListSecoName
" Sekunde"
" second"
;---------------------------------------------------------------------------
; Durchsagen...
Message InfoMessAssembling
"Assembliere "
"assembling "
Message InfoMessPass
"PASS "
"PASS "
Message InfoMessPass1
"PASS 1 "
"PASS 1 "
Message InfoMessPass2
"PASS 2 "
"PASS 2 "
Message InfoMessAssTime
" Assemblierzeit"
" assembly time"
Message InfoMessAssLine
" Zeile Quelltext"
" line source file"
Message InfoMessAssLines
" Zeilen Quelltext"
" lines source file"
Message InfoMessPassCnt
" Durchlauf"
" pass"
Message InfoMessPPassCnt
" Durchl&auml;ufe"
" passes"
Message InfoMessNoPass
" zus&auml;tzliche erforderliche Durchl&auml;ufe wegen Fehlern nicht\n durchgef&uuml;hrt, Listing m&ouml;glicherweise inkorrekt"
" additional necessary passes not started due to\n errors, listing possibly incorrect"
Message InfoMessMacAssLine
" Zeile inkl. Makroexpansionen"
" line incl. macro expansions"
Message InfoMessMacAssLines
" Zeilen inkl. Makroexpansionen"
" lines incl. macro expansions"
Message InfoMessWarnCnt
" Warnung"
" warning"
Message InfoMessWarnPCnt
"en"
"s"
Message InfoMessErrCnt
" Fehler"
" error"
Message InfoMessErrPCnt
""
"s"
Message InfoMessRemainMem
" KByte verf&uuml;gbarer Restspeicher"
" Kbytes available memory"
Message InfoMessRemainStack
" Byte verf&uuml;gbarer Stack"
" bytes available stack"
Message InfoMessNFilesFound
": keine Datei(en) zu assemblieren!"
": no file(s) to assemble!"
Message InfoMessMacroAss
"Makroassembler "
"macro assembler "
Message InfoMessVar
"Version"
"version"
Message InfoMessHead1
"Aufruf : "
"calling convention : "
Message InfoMessHead2
" [Optionen] [Datei] [Optionen] ..."
" [options] [file] [options] ..."
Message KeyWaitMsg
"--- weiter mit <ENTER> ---"
"--- <ENTER> to go on ---"
Message ErrMsgInvParam
"ung&uuml;ltige Option: "
"invalid option: "
Message ErrMsgInvEnvParam
"ung&uuml;ltige Environment-Option: "
"invalid environment option: "
Message InvMsgSource
"Quelldatei?"
"source file?"
Message InfoMessHelp
"--------\n" \
"\n" \
"Optionen :\n" \
"----------\n" \
"\n" \
"-p : Sharefile im Pascal-Format -c : Sharefile im C-Format\n" \
"-a : Sharefile im AS-Format\n" \
"-o <Name> : Namen der Code-Datei neu setzen\n" \
"-shareout <Name> : Namen des Sharefiles neu setzen\n" \
"-q, -quiet : Stille &Uuml;bersetzung\n" \
"-cpu <Name> : Zielprozessor setzen\n" \
"-alias <neu>=<alt> : Prozessor-Alias definieren\n" \
"-l : Listing auf Konsole -L : Listing auf Datei\n" \
"-i <Pfad>[:Pfad]... : Pfadliste f&uuml;r Includedateien\n" \
"-D <Symbol>[,Symbol]... : Symbole vordefinieren\n" \
"-E [Name] : Zieldatei f&uuml;r Fehlerliste,\n" \
" !0..!4 f&uuml;r Standardhandles\n" \
" Default <Quelldatei>.LOG\n" \
"-r : Meldungen erzeugen, falls zus&auml;tzlicher Pass erforderlich\n" \
"-Y : Sprungfehlerunterdr&uuml;ckung (siehe Anleitung)\n" \
"-w : Warnungen unterdr&uuml;cken +G : Code-Erzeugung unterdr&uuml;cken\n" \
"-s : Sektionsliste erzeugen -t : Listing-Teile ein/ausblenden\n" \
"-u : Belegungsliste erzeugen -C : Querverweisliste erzeugen\n" \
"-I : Include-Verschachtelungsliste ausgeben\n" \
"-g : Debug-Informationen schreiben\n" \
"-A : kompaktere Symbolablage\n" \
"-U : Case-sensitiv arbeiten\n" \
"-x : erweiterte Fehlermeldungen -n : Fehlermeldungen mit Nummer\n" \
"-P : Makroprozessorausgabe erzeugen -M : Makrodefinitionen extrahieren\n" \
"-h : Hexadezimalzahlen mit Kleinbuchstaben\n" \
"\n" \
"Quelldateiangabe darf Jokerzeichen enthalten\n" \
"\n" \
"implementierte Prozessoren :\n"
"--------------------\n" \
"\n" \
"options :\n" \
"---------\n" \
"\n" \
"-p : share file formatted for Pascal -c : share file formatted for C\n" \
"-a : share file formatted for AS\n" \
"-o <name> : change name of code file\n" \
"-shareout <nname> : change name of share file\n" \
"-q, -quiet : silent compilation\n" \
"-cpu <name> : set target processor\n" \
"-alias <new>=<old> : define processor alias\n" \
"-l : listing to console -L : listing to file\n" \
"-i <path>[;path]... : list of paths for include files\n" \
"-D <symbol>[,symbol]... : predefine symbols\n" \
"-E <name> : target file for error list,\n" \
" !0..!4 for standard handles\n" \
" default is <srcname>.LOG\n" \
"-r : generate messages if repassing necessary\n" \
"-Y : branch error suppression (see manual)\n" \
"-w : suppress warnings +G : suppress code generation\n" \
"-s : generate section list -t : enable/disable parts of listing\n" \
"-u : generate usage list -C : generate cross reference list\n" \
"-I : generate include nesting list\n" \
"-g : write debug info\n" \
"-A : compact symbol table\n" \
"-U : case-sensitive operation\n" \
"-x : extended error messages -n : add error #s to error messages\n" \
"-P : write macro processor output -M : extract macro definitions\n" \
"-h : use lower case in hexadecimal output\n" \
"\n" \
"source file specification may contain wildcards\n" \
"\n" \
"implemented processors :\n"

1295
as1750.c Normal file

File diff suppressed because it is too large Load Diff

18
as1750.h Normal file
View File

@ -0,0 +1,18 @@
/* as1750.h -- exports of as1750.c */
extern void init_as1750 ();
extern unsigned short as1750 (char *operation,
int n_operands, char *operand[]);
#ifdef AS1750
extern void add_word (ushort word);
extern void add_reloc (symbol_t sym);
extern char *get_num (char *s, int *outnum);
extern char *get_sym_num (char *s, int *outnum);
extern status parse_addr (char *s);
extern status error (char *layout, ...);
#else /* ASL */
#define OKAY 0
#define ERROR 0xFFFD
#define NO_OPCODE 0xFFFE
#endif

377
asl.1 Normal file
View File

@ -0,0 +1,377 @@
.TH asl 1
.SH NAME
.B asl \- cross assembler for microprocessors and -controllers
.SH SYNTAX
.B asl
[ option(s) ] file(s) [ option(s) ] file(s) ...
.SH DESCRIPTION
AS is a cross assembler that can be used to write assembler programs
for a variety of different microprocessors and -controllers.
.B asl
is the UNIX/C implementation of AS. A complete description of AS is
far beyond the scope of this manual page, which is only intended as
a quick reference for AS's command line interface. For a more detailed
introduction into the usage of AS, see the user's manual.
.SH COMMAND-LINE PARAMETERS
Every argument that starts with a slash (/), plus (+) or minus (-) sign
is regarded as a command-line parameter. Some command-line parameters
take an argument as additional parameter. Every argument that is not
recognized as a command-line parameter is regarded as an assembler source
file to be assembled. A source file name that does not have an extension
is automatically extended with the default extension '.asm'.
Options are turned on with a parameter starting with
a slash (/) or minus sign (-), whereas a parameter with a leading plus sign
(+) turns an option off. In the following list, all options will be shown in
the form that is needed to change the default behaviour, which might be a
plus or minus sign, depening on wether the option is on or off by default.
.B asl
accepts the following command-line parameters:
.TP
.B -A
Change the data structure that is internally used to store the symbol table.
By default, AS uses binary trees to store macro and symbol definitions. Turning
this option on will change this to AVL-balanced trees. Depending on the ratio
of symbol entries and lookups, this might speed up assembly. Using AVL-balanced
trees helps also reducing the stack usage, which is however irrelevant for the C
version of AS.
.TP
.B -a
Instruct AS to write out the shared symbol definitions in a format suitable
for including into an AS assembler program. The file's name is constructed by
replacing the source file's extension with '.inc'. See the user manual for more
information about symbol sharing.
.TP
.B -cpu <name>
Set the target processor to <name>. Use this option if the source file does
not contain a CPU statement.
.TP
.B -alias <new name=old name>
Define a CPU alias. An alias is a name that can be used as an argument to the
CPU pseudo-instruction just like an intrinsic CPU type. Its usage will set
the same target as the old name, however the predefined symbols MOMCPU and
MOMCPUNAME will be set to the new name. This option is primarily useful for
adding a new member to a processor family that has the same core, but is
different in its internal peripherals, thus allowing to distinguish between
them.
.TP
.B -C
Add a cross reference table to the assembler listing. A cross reference
table lists all symbols that have been referenced at least once during assembly,
including the source line number(s) and count of every reference. This option
only makes sense when the generation of an assembly listing has been turned on
via the
.B -L
or
.B -l
parameters.
.TP
.B -c
Instruct AS to write out the shared symbol definitions in a format suitable
for including into a C program. The file's name is constructed by replacing
the source file's extension with '.h'. See the user manual for more information
about symbol sharing.
.TP
.B -D <name[=value]>[,...]
Pre-define symbols. Predefined symbols are entered into the global symbol
table prior to assembly of the source file(s). If no value is given for a
symbol, it is assigned the integer value 1. Value expressions may contain
arithmetic expressions as described in the user manual, but they may not
reference any other predefined or internal symbols.
.TP
.B -E [file]
Force AS to send warning and error messages to
.B file
rather than to the standard error output. The file names !0 to !4 are used
to refer to the standard input, output, error, auxilliary, and printer channels
predefined by the operating system (on some systems, some of these handles
might not exist). If the [file] specification is omitted, a name is constructed
by replacing the source file's extension with '.log'.
.TP
.B +G
Supress code generation, reducing the functionality of AS to macro
preprocessing.
.TP
.B -g [MAP/Atmel]
Instruct AS to write an additional file containing debug information. This
information covers the symbol table and the relation between source line
numbers and machine addresses. The argument specifies whether debug info
shall be written in AS's own MAP format or the object format for Atmel's AVR
tools. If no argument is given, MAP will be chosen. The file's name is
constructed by replacing the source file's extension with '.map' or '.obj'
respectively.
.TP
.B -h
Force AS to print all hexadecimal constants with lowercase letters, rather
than with uppercase letters A..F which is the default.
.TP
.B -i <path[:path...]>
Add new entries to the list of paths that are searched for include files.
New entries are prepended to the current include path list, so if multiple
paths are given with one command-line parameter, they will be entered into
the path list in reverse order.
.TP
.B -I
Add an include file list to the assembly listing. An include file list contains
all files that have been included while assembling the source files, including
multiple and nested inclusion. Nesting of inclusion is identified by different
indention. This option only makes sense when the generation of an assembly
listing has been turned on via the
.B -L
or
.B -l
parameters.
.TP
.B -L
Turn on generation of an assembly listing and send it to a file whose name is
constructed by replacing the source file's extension with '.lst'.
.TP
.B -l
Turn on generation of an assembly listing and send it to the console.
.TP
.B -M
Turn on generation of a macro definition file. A macro definition file is
a file that contains all macro definitions that have been detected during
assembly, in a format suitable for an inclusion into another file. The macro
definition file's name is constructed by replacing the source file's
extension with '.mac'.
.TP
.B -n
Force AS to extend all error and warning messages with their internal error
resp. warning number.
.TP
.B -o <name>
Tell AS to write the code output to a file <name>. By default, the code
output file's name is constructed by replacing the source file's extension
with '.p'. If multiple files are assembled with one command, this parameter
may also be given multiply. If there are less output specifications than
source file names, AS will switch back to the default naming convention after
all output specifications have been used up.
.TP
.B -shareout <name>
Tell AS to write shared symbol definitions to a file <name>, instead of
constructing the name from the source file's name. See the user manual for
more information about symbol sharing.
.TP
.B -P
Turn on generation of a macro output file. A macro output file contains the
intermediate source code that remains after macro expansion and conditional assembly.
The macro output file's name is constructed by replacing the source file's
extension with '.i'.
.TP
.B -p
Instruct AS to write out the shared symbol definitions in a format suitable
for including into a Pascal or Modula-2 program. The file's name is
constructed by replacing the source file's extension with '.inc'. See the
user manual for more information about symbol sharing.
.TP
.B -q or -quiet
Turn on silent assembly mode. In silent compilation mode, AS will not
do any console output except for warning and error messages.
.TP
.B -r [pass number]
Tell AS to output warnings when a situation appears in a source file that
forces another pass of assembly. Such situations either take place when a symbol
is undefined in the first pass or a symbol's value has changed compared to the
previous pass. This option is useful to track down sources of excessive
multi-passing, but be aware that it might yield a fairly large number of
warnings, especially in the first pass. Optionally, a pass number may be added
to this option to inhibit output until a certain pass is reached.
.TP
.B -s
Add a section list to the assembly listing. A section list contains
all sections that have been defined in the source files, marking their
nesting level by different levels of indentation. This option only
makes sense when the generation of an assembly listing has been turned
on via the
.B -L
or
.B -l
parameters.
.TP
.B -t <mask>
Turn on or off parts of the assembly listing that have no individual
command line parameter. AS internally keeps an integer value whose bits
represent certain components of the listing. A positive command line
parameter (-t or /t) sets the bits set in <mask>, whereas a negated
parameter (+t) resets the bits set in <mask>. The individual bits have
the following meaning: bit 0 = source lines and generated machine code,
bit 1 = symbol table, bit 2 = macro table, bit 3 = function table, bit 4 =
line numbering.
.TP
.B -u
Tell AS to do additional bookkeeping about which address ranges have been
used by the assembled program. This option enables the detection of overlapping
memory usage. If an assembly listing has been turned on via the
.B -L
or
.B -l
parameters, it will also contain a list of all used memory areas.
.TP
.B -U
Force AS to operate in case-sensitive mode. By default, names of symbols,
macros, user-defined functions and sections are treated in a case-insensitive
manner.
.TP
.B -w
Suppress output of warnings.
.TP
.B -x
Turn on extended error reporting. With extended error reporting, several
error and warning messages will also print the item that created the message,
e.g. the name of an unknown instruction. When this option is given twice,
the erroneous source line is additinally printed.
.SH PRESETTING PARAMETERS
Parameters need not neccessarily be given in the command line itself. Before
processing of command line parameters starts, AS will look if the
.B ASCMD
environment variable is defined. If it exists, its contents will be
treated as additional command line parameters whose syntax is absolutely
equal to normal command line parameters. An exception is made if the
variable's contents start with a '@' sign; in such a case, the string after
the '@' sign is treated as the name of a file that contains the options.
Such a file (also called a 'key file') has the advantage that it allows
the options to be written in different lines, and it does not have a size
limit. Some operating systems (like MS-DOS) have a length limit on
command lines and environment variable contents, so the key file may be
your only option if you have a lot of lengthy parameters for AS.
As parameters given in the
.B ASCMD
environment variable or a key file are processed prior to the command line
itself, and can therefore be overridden by command line parameters.
.SH NATIONAL LANGUAGE SUPPORT
AS supports the needs of different languages and countries in the sense that
it will try to adapt to the language and date/time formats valid for the
current environment. Upon startup, the COUNTRY setting made in the
CONFIG.SYS file is queried for DOS and OS/2 implementations of AS. For
UNIX systems, AS tries to read the LC_TIME resp. LC_MESSAGES environment
variables to find out the correct format for date/time outputs resp. the
local language. If this fails, the LC_ALL and finally LANG variables are
probed. If none of these environment variables points to a specific local
environment resp. contains a locale specification unknown to AS, the
standard english/C locale is used.
The messages AS can output in different languages are stored in separate
files with the extension '.msg' . AS will search for these files in the
following directories:
- The current directory
- The directory the executable of AS was loaded from (only on DOS platforms version >=3.0 or if path was explicitly specified)
- The directory specified in the AS_MSGPATH environment variable resp. the directories listed in the PATH environment variable if AS_MSGPATH does not exist.
- The LIBDIR directory set at compile time from the Makefile.
.SH RETURN CODES
Depending on the assembly's turnout,
.B asl
will generate different return codes:
.TP
.B 0
No errors, warnings might have occured.
.TP
.B 1
No command line parameters were given, AS printed a short list
of possible command line parameters and terminated thereafter.
.TP
.B 2
Errors occured during assembly of at least one source file, no
code file was generated for the corresponding source file(s).
.TP
.B 3
A fatal error occured during assembly that forced immediate
program termination. Code files may be generated, but are probably
unusuable.
.TP
.B 4
Program termination already occured during initialization. This
might be either due to a incorrect command line parameter or an error
during loading the program's overlay file (only possible on MS-DOS).
.TP
.B 255
During initialization, an internal error happened that should not
occur. If the reaction is reproducable, note down the situation and
send a bug report to the author.
.SH EXAMPLES
To assemble a source file
.B file1.asm
without any additional bells and whistles, use:
.PP
.B asl file1
.PP
which will create an output file
.B file1.p
given that there are no errors. If you additionally want a listing and
rename the output file to
.B a.out,
use
.PP
.B asl -L file1 -o a.out
.PP
To make the listing as comprehensive as possible and to get more detailed
error messages, use:
.PP
.B asl -LuCIs -t 16 -nx file1
.SH TIPS
calling AS without any parameters will print a short help containing all
command line parameters and implemented target processors, while calling
with command line parameters but without any source file name will result
in AS asking for a source file name on the console.
.SH SEE ALSO
plist(1), pbind(1), p2hex(1), p2bin(1)
.SH HISTORY
AS originally appeared as a DOS program in 1989, written in
Borland-Pascal, and was ported to C and UNIX in 1996.
.SH BUGS
There are too many options.
Command line interpreters of some operating systems reserve some
characters for their own use, so it might be necessary to give
command line parameters with certain tricks (e.g., with the help
of escape characters).
.SH AUTHOR(S)
Alfred Arnold (a.arnold@kfa-juelich.de), and a few others...

2
asl.def Normal file
View File

@ -0,0 +1,2 @@
STACKSIZE 40960

1341
asmallg.c Normal file

File diff suppressed because it is too large Load Diff

21
asmallg.h Normal file
View File

@ -0,0 +1,21 @@
/* codeallg.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* von allen Codegeneratoren benutzte Pseudobefehle */
/* */
/* Historie: 10. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void SetCPU(CPUVar NewCPU, Boolean NotPrev);
extern Boolean SetNCPU(char *Name, Boolean NotPrev);
extern void AddONOFF(char *InstName, Boolean *Flag, char *FlagName, Boolean Persist);
extern void ClearONOFF(void);
extern Boolean CodeGlobalPseudo(void);
extern void codeallg_init(void);

239
asmcode.c Normal file
View File

@ -0,0 +1,239 @@
/* asmcode.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung der Code-Datei */
/* */
/* Historie: 18. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include "version.h"
#include "endian.h"
#include "chunks.h"
#include "asmdef.h"
#include "asmsub.h"
static Word LenSoFar;
static LongInt RecPos,LenPos;
#define CodeBufferSize 512
static Word CodeBufferFill;
static Byte CodeBuffer[CodeBufferSize+1];
/**
static Boolean Write2(void *Buffer)
BEGIN
Boolean OK;
if (BigEndian) WSwap(Buffer,2);
OK=(fwrite(Buffer,1,2,PrgFile)==2);
if (BigEndian) WSwap(Buffer,2);
return OK;
END
static Boolean Write4(void *Buffer)
BEGIN
Boolean OK;
if (BigEndian) DSwap(Buffer,4);
OK=(fwrite(Buffer,1,4,PrgFile)==4);
if (BigEndian) DSwap(Buffer,4);
return OK;
END
**/
static void FlushBuffer(void)
BEGIN
if (CodeBufferFill>0)
BEGIN
if (fwrite(CodeBuffer,1,CodeBufferFill,PrgFile)!=CodeBufferFill) ChkIO(10004);
CodeBufferFill=0;
END
END
void DreheCodes(void)
BEGIN
int z;
LongInt l=CodeLen*Granularity();
switch (ActListGran)
BEGIN
case 2:
for (z=0; z<(l>>1); z++)
WAsmCode[z]=((WAsmCode[z]&0xff)<<8)+((WAsmCode[z]&0xff00)>>8);
break;
case 4:
for (z=0; z<(l>>2); z++)
{
#ifdef __STDC__
DAsmCode[z]=((DAsmCode[z]&0xff000000u)>>24)+
((DAsmCode[z]&0x00ff0000u)>>8)+
((DAsmCode[z]&0x0000ff00u)<<8)+
((DAsmCode[z]&0x000000ffu)<<24);
#else
DAsmCode[z]=((DAsmCode[z]&0xff000000)>>24)+
((DAsmCode[z]&0x00ff0000)>>8)+
((DAsmCode[z]&0x0000ff00)<<8)+
((DAsmCode[z]&0x000000ff)<<24);
#endif
}
break;
END
END
/*--- neuen Record in Codedatei anlegen. War der bisherige leer, so wird ---
---- dieser ueberschrieben. ------------------------------------------------*/
static void WrRecHeader(void)
BEGIN
Byte b;
if (ActPC!=SegCode)
BEGIN
b=FileHeaderDataRec; if (fwrite(&b,1,1,PrgFile)!=1) ChkIO(10004);
END
if (fwrite(&HeaderID,1,1,PrgFile)!=1) ChkIO(10004);
if (ActPC!=SegCode)
BEGIN
b=ActPC; if (fwrite(&b,1,1,PrgFile)!=1) ChkIO(10004);
b=Grans[ActPC]; if (fwrite(&b,1,1,PrgFile)!=1) ChkIO(10004);
END
END
void NewRecord(LargeWord NStart)
BEGIN
LongInt h;
LongWord PC;
FlushBuffer();
if (LenSoFar==0)
BEGIN
if (fseek(PrgFile,RecPos,SEEK_SET)!=0) ChkIO(10003);
WrRecHeader();
h=NStart;
if (NOT Write4(PrgFile,&h)) ChkIO(10004);
LenPos=ftell(PrgFile);
if (NOT Write2(PrgFile,&LenSoFar)) ChkIO(10004);
END
else
BEGIN
h=ftell(PrgFile);
if (fseek(PrgFile,LenPos,SEEK_SET)!=0) ChkIO(10003);
if (NOT Write2(PrgFile,&LenSoFar)) ChkIO(10004);
if (fseek(PrgFile,h,SEEK_SET)!=0) ChkIO(10003);
RecPos=h; LenSoFar=0;
WrRecHeader();
PC=NStart;
if (NOT Write4(PrgFile,&PC)) ChkIO(10004);
LenPos=ftell(PrgFile);
if (NOT Write2(PrgFile,&LenSoFar)) ChkIO(10004);
END
END
/*--- Codedatei eroeffnen --------------------------------------------------*/
void OpenFile(void)
BEGIN
Word h;
errno=0;
PrgFile=fopen(OutName,OPENWRMODE);
if (PrgFile==Nil) ChkIO(10001);
errno=0; h=FileMagic;
if (NOT Write2(PrgFile,&h)) ChkIO(10004);
CodeBufferFill=0;
RecPos=ftell(PrgFile); LenSoFar=0;
NewRecord(PCs[ActPC]);
END
/*---- Codedatei schliessen -------------------------------------------------*/
void CloseFile(void)
BEGIN
Byte Head;
String h;
LongWord Adr;
sprintf(h,"AS %s/%s-%s",Version,ARCHPRNAME,ARCHSYSNAME);
NewRecord(PCs[ActPC]);
fseek(PrgFile,RecPos,SEEK_SET);
if (StartAdrPresent)
BEGIN
Head=FileHeaderStartAdr;
if (fwrite(&Head,sizeof(Head),1,PrgFile)!=1) ChkIO(10004);
Adr=StartAdr;
if (NOT Write4(PrgFile,&Adr)) ChkIO(10004);
END
Head=FileHeaderEnd;
if (fwrite(&Head,sizeof(Head),1,PrgFile)!=1) ChkIO(10004);
if (fwrite(h,1,strlen(h),PrgFile)!=strlen(h)) ChkIO(10004);
fclose(PrgFile); if (Magic!=0) unlink(OutName);
END
/*--- erzeugten Code einer Zeile in Datei ablegen ---------------------------*/
void WriteBytes(void)
BEGIN
Word ErgLen;
if (CodeLen==0) return; ErgLen=CodeLen*Granularity();
if ((TurnWords!=0)!=(BigEndian!=0)) DreheCodes();
if (((LongInt)LenSoFar)+((LongInt)ErgLen)>0xffff) NewRecord(PCs[ActPC]);
if (CodeBufferFill+ErgLen<CodeBufferSize)
BEGIN
memcpy(CodeBuffer+CodeBufferFill,BAsmCode,ErgLen);
CodeBufferFill+=ErgLen;
END
else
BEGIN
FlushBuffer();
if (ErgLen<CodeBufferSize)
BEGIN
memcpy(CodeBuffer,BAsmCode,ErgLen); CodeBufferFill=ErgLen;
END
else if (fwrite(BAsmCode,1,ErgLen,PrgFile)!=ErgLen) ChkIO(10004);
END
LenSoFar+=ErgLen;
if ((TurnWords!=0)!=(BigEndian!=0)) DreheCodes();
END
void RetractWords(Word Cnt)
BEGIN
Word ErgLen;
ErgLen=Cnt*Granularity();
if (LenSoFar<ErgLen)
BEGIN
WrError(1950); return;
END
if (MakeUseList) DeleteChunk(SegChunks+ActPC,ProgCounter()-Cnt,Cnt);
PCs[ActPC]-=Cnt;
if (CodeBufferFill>=ErgLen) CodeBufferFill-=ErgLen;
else
BEGIN
if (fseek(PrgFile,-(ErgLen-CodeBufferFill),SEEK_CUR)==-1)
ChkIO(10004);
CodeBufferFill=0;
END
LenSoFar-=ErgLen;
Retracted=True;
END
void asmcode_init(void)
BEGIN
END

27
asmcode.h Normal file
View File

@ -0,0 +1,27 @@
/* asmcode.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung der Code-Datei */
/* */
/* Historie: 18. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern Word LenSoFar;
extern LongInt RecPos;
extern void DreheCodes(void);
extern void NewRecord(LargeWord NStart);
extern void OpenFile(void);
extern void CloseFile(void);
extern void WriteBytes(void);
extern void RetractWords(Word Cnt);
extern void asmcode_init(void);

320
asmdebug.c Normal file
View File

@ -0,0 +1,320 @@
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung der Debug-Informationen zur Assemblierzeit */
/* */
/* Historie: 16. 5.1996 Grundsteinlegung */
/* 24. 7.1998 NoICE-Format */
/* 25. 7.1998 Adresserfassung Dateien */
/* 16. 8.1998 Case-Sensitivitaet NoICE */
/* NoICE-Zeileninfo nach Dateien sortiert */
/* 29. 1.1999 uninitialisierten Speicherzugriff beseitigt */
/* 2. 5.1999 optional mehrere Records im Atmel-Format schreiben */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include "endian.h"
#include "strutil.h"
#include "chunks.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "asmfnums.h"
#include "asmdebug.h"
typedef struct
{
Boolean InMacro;
LongInt LineNum;
Integer FileName;
ShortInt Space;
LargeInt Address;
Word Code;
} TLineInfo;
typedef struct _TLineInfoList
{
struct _TLineInfoList *Next;
TLineInfo Contents;
} TLineInfoList,*PLineInfoList;
String TempFileName;
FILE *TempFile;
PLineInfoList LineInfoRoot;
void AddLineInfo(Boolean InMacro, LongInt LineNum, char *FileName,
ShortInt Space, LargeInt Address, LargeInt Len)
BEGIN
PLineInfoList PNeu, PFirst, PLast, Run, Link;
int RecCnt, z;
Integer FNum;
/* wieviele Records schreiben ? */
if ((DebugMode == DebugAtmel) AND (CodeLen > 1)) RecCnt = CodeLen;
else RecCnt = 1;
FNum = GetFileNum(FileName);
/* Einfuegepunkt in Liste finden */
Run = LineInfoRoot;
if (Run == Nil)
Link = Nil;
else
BEGIN
while ((Run->Next != Nil) AND (Run->Next->Contents.Space < Space)) Run = Run->Next;
while ((Run->Next != Nil) AND (Run->Next->Contents.FileName < FNum)) Run = Run->Next;
while ((Run->Next != Nil) AND (Run->Next->Contents.Address < Address)) Run = Run->Next;
Link = Run->Next;
END
/* neue Teilliste bilden */
PLast = PFirst = NULL;
for (z = 0; z < RecCnt; z++)
BEGIN
PNeu = (PLineInfoList) malloc(sizeof(TLineInfoList));
PNeu->Contents.InMacro = InMacro;
PNeu->Contents.LineNum = LineNum;
PNeu->Contents.FileName = FNum;
PNeu->Contents.Space = Space;
PNeu->Contents.Address = Address + z;
PNeu->Contents.Code = ((CodeLen < z + 1) OR (DontPrint)) ? 0 : WAsmCode[z];
if (z == 0) PFirst = PNeu;
if (PLast != NULL) PLast->Next = PNeu;
PLast = PNeu;
END
/* Teilliste einhaengen */
if (Run == Nil) LineInfoRoot = PFirst;
else Run->Next = PFirst;
PLast->Next = Link;
if (Space == SegCode)
AddAddressRange(FNum, Address, Len);
END
void InitLineInfo(void)
BEGIN
TempFileName[0]='\0'; LineInfoRoot=Nil;
END
void ClearLineInfo(void)
BEGIN
PLineInfoList Run;
if (TempFileName[0]!='\0')
BEGIN
fclose(TempFile); unlink(TempFileName);
END
while (LineInfoRoot!=Nil)
BEGIN
Run=LineInfoRoot; LineInfoRoot=LineInfoRoot->Next;
free(Run);
END
InitLineInfo();
END
static void DumpDebugInfo_MAP(void)
BEGIN
PLineInfoList Run;
Integer ActFile;
int ModZ;
ShortInt ActSeg;
FILE *MAPFile;
String MAPName,Tmp;
strmaxcpy(MAPName,SourceFile,255); KillSuffix(MAPName); AddSuffix(MAPName,MapSuffix);
MAPFile=fopen(MAPName,"w"); if (MAPFile==Nil) ChkIO(10001);
Run=LineInfoRoot; ActSeg=(-1); ActFile=(-1); ModZ=0;
while (Run!=Nil)
BEGIN
if (Run->Contents.Space!=ActSeg)
BEGIN
ActSeg=Run->Contents.Space;
if (ModZ!=0)
BEGIN
errno=0; fprintf(MAPFile,"\n"); ChkIO(10004);
END
ModZ=0;
errno=0; fprintf(MAPFile,"Segment %s\n",SegNames[ActSeg]); ChkIO(10004);
ActFile=(-1);
END
if (Run->Contents.FileName!=ActFile)
BEGIN
ActFile=Run->Contents.FileName;
if (ModZ!=0)
BEGIN
errno=0; fprintf(MAPFile,"\n"); ChkIO(10004);
END
ModZ=0;
errno=0; fprintf(MAPFile,"File %s\n",GetFileName(Run->Contents.FileName)); ChkIO(10004);
END;
errno=0;
sprintf(Tmp,LongIntFormat,Run->Contents.LineNum);
fprintf(MAPFile,"%5s:%s ",Tmp,HexString(Run->Contents.Address,8));
ChkIO(10004);
if (++ModZ==5)
BEGIN
errno=0; fprintf(MAPFile,"\n"); ChkIO(10004); ModZ=0;
END
Run=Run->Next;
END
if (ModZ!=0)
BEGIN
errno=0; fprintf(MAPFile,"\n"); ChkIO(10004);
END
PrintDebSymbols(MAPFile);
PrintDebSections(MAPFile);
fclose(MAPFile);
END
static void DumpDebugInfo_Atmel(void)
BEGIN
static char *OBJString="AVR Object File";
PLineInfoList Run;
LongInt FNamePos,RecPos;
FILE *OBJFile;
String OBJName;
char *FName;
Byte TByte,TNum,NameCnt;
int z;
LongInt LTurn;
Word WTurn;
strmaxcpy(OBJName,SourceFile,255);
KillSuffix(OBJName); AddSuffix(OBJName,OBJSuffix);
OBJFile=fopen(OBJName,OPENWRMODE); if (OBJFile==Nil) ChkIO(10001);
/* initialer Kopf, Positionen noch unbekannt */
FNamePos=0; RecPos=0;
if (NOT Write4(OBJFile,&FNamePos)) ChkIO(10004);
if (NOT Write4(OBJFile,&RecPos)) ChkIO(10004);
TByte=9; if (fwrite(&TByte,1,1,OBJFile)!=1) ChkIO(10004);
NameCnt=GetFileCount()-1; if (fwrite(&NameCnt,1,1,OBJFile)!=1) ChkIO(10004);
if (fwrite(OBJString,1,strlen(OBJString)+1,OBJFile)!=strlen(OBJString)+1) ChkIO(10004);
/* Objekt-Records */
RecPos=ftell(OBJFile);
for (Run=LineInfoRoot; Run!=Nil; Run=Run->Next)
if (Run->Contents.Space==SegCode)
BEGIN
LTurn=Run->Contents.Address; if (NOT BigEndian) DSwap(&LTurn,4);
if (fwrite(((Byte *) &LTurn)+1,1,3,OBJFile)!=3) ChkIO(10004);
WTurn=Run->Contents.Code; if (NOT BigEndian) WSwap(&WTurn,2);
if (fwrite(&WTurn,1,2,OBJFile)!=2) ChkIO(10004);
TNum=Run->Contents.FileName-1; if (fwrite(&TNum,1,1,OBJFile)!=1) ChkIO(10004);
WTurn=Run->Contents.LineNum; if (NOT BigEndian) WSwap(&WTurn,2);
if (fwrite(&WTurn,1,2,OBJFile)!=2) ChkIO(10004);
TNum=Ord(Run->Contents.InMacro); if (fwrite(&TNum,1,1,OBJFile)!=1) ChkIO(10004);
END
/* Dateinamen */
FNamePos=ftell(OBJFile);
for (z=1; z<=NameCnt; z++)
BEGIN
FName=NamePart(GetFileName(z));
if (fwrite(FName,1,strlen(FName)+1,OBJFile)!=strlen(FName)+1) ChkIO(10004);
END
TByte=0;
if (fwrite(&TByte,1,1,OBJFile)!=1) ChkIO(10004);
/* korrekte Positionen in Kopf schreiben */
rewind(OBJFile);
if (NOT BigEndian) DSwap(&FNamePos,4);
if (fwrite(&FNamePos,1,4,OBJFile)!=4) ChkIO(10004);
if (NOT BigEndian) DSwap(&RecPos,4);
if (fwrite(&RecPos,1,4,OBJFile)!=4) ChkIO(10004);
fclose(OBJFile);
END
static void DumpDebugInfo_NOICE(void)
BEGIN
PLineInfoList Run;
Integer ActFile;
FILE *MAPFile;
String MAPName,Tmp1,Tmp2;
LargeWord Start,End;
Boolean HadLines;
strmaxcpy(MAPName,SourceFile,255); KillSuffix(MAPName); AddSuffix(MAPName,".noi");
MAPFile=fopen(MAPName,"w"); if (MAPFile==Nil) ChkIO(10001);
fprintf(MAPFile,"CASE %d\n",(CaseSensitive) ? 1 : 0);
PrintNoISymbols(MAPFile);
for (ActFile=0; ActFile<GetFileCount(); ActFile++)
BEGIN
HadLines=FALSE;
Run=LineInfoRoot;
while (Run!=Nil)
BEGIN
if ((Run->Contents.Space==SegCode) AND (Run->Contents.FileName==ActFile))
BEGIN
if (NOT HadLines)
BEGIN
GetAddressRange(ActFile,&Start,&End);
sprintf(Tmp1,LargeIntFormat,Start);
errno=0;
fprintf(MAPFile,"FILE %s %s\n",GetFileName(Run->Contents.FileName),Tmp1);
ChkIO(10004);
END
errno=0;
sprintf(Tmp1,LongIntFormat,Run->Contents.LineNum);
sprintf(Tmp2,LargeIntFormat,Run->Contents.Address-Start);
fprintf(MAPFile,"LINE %s %s\n",Tmp1,Tmp2);
ChkIO(10004);
HadLines=TRUE;
END
Run=Run->Next;
END
if (HadLines)
BEGIN
sprintf(Tmp1,LongIntFormat,End);
errno=0; fprintf(MAPFile,"ENDFILE %s\n",Tmp1); ChkIO(10004);
END
END
fclose(MAPFile);
END
void DumpDebugInfo(void)
BEGIN
switch (DebugMode)
BEGIN
case DebugMAP: DumpDebugInfo_MAP(); break;
case DebugAtmel: DumpDebugInfo_Atmel(); break;
case DebugNoICE: DumpDebugInfo_NOICE(); break;
default: break;
END
END
void asmdebug_init(void)
BEGIN
END

20
asmdebug.h Normal file
View File

@ -0,0 +1,20 @@
/* asmdebug.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung der Debug-Informationen zur Assemblierzeit */
/* */
/* Historie: 16. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void AddLineInfo(Boolean InMacro, LongInt LineNum, char *FileName,
ShortInt Space, LargeInt Address, LargeInt Len);
extern void InitLineInfo(void);
extern void ClearLineInfo(void);
extern void DumpDebugInfo(void);
extern void asmdebug_init(void);

315
asmdef.c Normal file
View File

@ -0,0 +1,315 @@
/* asmdef.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* global benutzte Variablen */
/* */
/* Historie: 4. 5.1996 Grundsteinlegung */
/* 24. 6.1998 Zeichenübersetzungstabellen */
/* 25. 7.1998 PassNo --> Integer */
/* 17. 8.1998 InMacroFlag hierher verschoben */
/* 18. 8.1998 RadixBase hinzugenommen */
/* ArgStr-Feld war eins zu kurz */
/* 19. 8.1998 BranchExt-Variablen */
/* 29. 8.1998 ActListGran hinzugenommen */
/* 11. 9.1998 ROMDATA-Segment hinzugenommen */
/* 1. 1.1999 SegLimits dazugenommen */
/* SegInits --> LargeInt */
/* 9. 1.1999 ChkPC jetzt mit Adresse als Parameter */
/* 18. 1.1999 PCSymbol initialisiert */
/* 17. 4.1999 DefCPU hinzugenommen */
/* 30. 5.1999 OutRadixBase hinzugenommen */
/* 5.11.1999 ExtendErrors von Boolean nach ShortInt */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include "stringlists.h"
#include "chunks.h"
#include "asmdef.h"
#include "asmsub.h"
char SrcSuffix[]=".asm"; /* Standardendungen: Hauptdatei */
char IncSuffix[]=".inc"; /* Includedatei */
char PrgSuffix[]=".p"; /* Programmdatei */
char LstSuffix[]=".lst"; /* Listingdatei */
char MacSuffix[]=".mac"; /* Makroausgabe */
char PreSuffix[]=".i"; /* Ausgabe Makroprozessor */
char LogSuffix[]=".log"; /* Fehlerdatei */
char MapSuffix[]=".map"; /* Debug-Info/Map-Format */
char OBJSuffix[]=".obj";
char *EnvName="ASCMD"; /* Environment-Variable fuer Default-
Parameter */
char *SegNames[PCMax+1]={"NOTHING","CODE","DATA","IDATA","XDATA","YDATA",
"BITDATA","IO","REG","ROMDATA"};
char SegShorts[PCMax+1]={'-','C','D','I','X','Y','B','P','R','O'};
LongInt Magic=0x1b34244d;
char *InfoMessCopyright="(C) 1992,1998 Alfred Arnold";
/** ValidSymChars:SET OF Char=['A'..'Z','a'..'z',#128..#165,'0'..'9','_','.']; **/
StringPtr SourceFile; /* Hauptquelldatei */
StringPtr ClrEol; /* String fuer loeschen bis Zeilenende */
StringPtr CursUp; /* " " Cursor hoch */
LargeWord PCs[StructSeg+1]; /* Programmzaehler */
LargeWord StartAdr; /* Programmstartadresse */
Boolean StartAdrPresent; /* " definiert? */
LargeWord Phases[StructSeg+1]; /* Verschiebungen */
Word Grans[StructSeg+1]; /* Groesse der Adressierungselemente */
Word ListGrans[StructSeg+1]; /* Wortgroesse im Listing */
ChunkList SegChunks[StructSeg+1]; /* Belegungen */
Integer ActPC; /* gewaehlter Programmzaehler */
Boolean PCsUsed[StructSeg+1]; /* PCs bereits initialisiert ? */
LargeInt SegInits[PCMax+1]; /* Segmentstartwerte */
LargeInt SegLimits[PCMax+1]; /* Segmentgrenzwerte */
LongInt ValidSegs; /* erlaubte Segmente */
Boolean ENDOccured; /* END-Statement aufgetreten ? */
Boolean Retracted; /* Codes zurueckgenommen ? */
Boolean ListToStdout,ListToNull; /* Listing auf Konsole/Nulldevice ? */
Word TypeFlag; /* Welche Adressraeume genutzt ? */
ShortInt SizeFlag; /* Welche Operandengroessen definiert ? */
Integer PassNo; /* Durchlaufsnummer */
Integer JmpErrors; /* Anzahl fraglicher Sprungfehler */
Boolean ThrowErrors; /* Fehler verwerfen bei Repass ? */
Boolean Repass; /* noch ein Durchlauf erforderlich */
Byte MaxSymPass; /* Pass, nach dem Symbole definiert sein muessen */
Byte ShareMode; /* 0=kein SHARED,1=Pascal-,2=C-Datei, 3=ASM-Datei */
DebugType DebugMode; /* Ausgabeformat Debug-Datei */
Byte ListMode; /* 0=kein Listing,1=Konsole,2=auf Datei */
Byte ListOn; /* Listing erzeugen ? */
Boolean MakeUseList; /* Belegungsliste ? */
Boolean MakeCrossList; /* Querverweisliste ? */
Boolean MakeSectionList; /* Sektionsliste ? */
Boolean MakeIncludeList; /* Includeliste ? */
Boolean RelaxedMode; /* alle Integer-Syntaxen zulassen ? */
Byte ListMask; /* Listingmaske */
ShortInt ExtendErrors; /* erweiterte Fehlermeldungen */
Boolean NumericErrors; /* Fehlermeldungen mit Nummer */
Boolean CodeOutput; /* Code erzeugen */
Boolean MacProOutput; /* Makroprozessorausgabe schreiben */
Boolean MacroOutput; /* gelesene Makros schreiben */
Boolean QuietMode; /* keine Meldungen */
Boolean HardRanges; /* Bereichsfehler echte Fehler ? */
char *DivideChars; /* Trennzeichen fuer Parameter. Inhalt Read Only! */
Boolean HasAttrs; /* Opcode hat Attribut */
char *AttrChars; /* Zeichen, mit denen Attribut abgetrennt wird */
Boolean MsgIfRepass; /* Meldungen, falls neuer Pass erforderlich */
Integer PassNoForMessage; /* falls ja: ab welchem Pass ? */
Boolean CaseSensitive; /* Gross/Kleinschreibung unterscheiden ? */
FILE *PrgFile; /* Codedatei */
StringPtr ErrorPath,ErrorName; /* Ausgabedatei Fehlermeldungen */
StringPtr OutName; /* Name Code-Datei */
Boolean IsErrorOpen;
StringPtr CurrFileName; /* mom. bearbeitete Datei */
LongInt MomLineCounter; /* Position in mom. Datei */
LongInt CurrLine; /* virtuelle Position */
LongInt LineSum; /* Gesamtzahl Quellzeilen */
LongInt MacLineSum; /* inkl. Makroexpansion */
LongInt NOPCode; /* Maschinenbefehl NOP zum Stopfen */
Boolean TurnWords; /* TRUE = Motorola-Wortformat */
/* FALSE = Intel-Wortformat */
Byte HeaderID; /* Kennbyte des Codeheaders */
char *PCSymbol; /* Symbol, womit Programmzaehler erreicht wird. Inhalt Read Only! */
TConstMode ConstMode;
Boolean SetIsOccupied; /* TRUE: SET ist Prozessorbefehl */
#ifdef __PROTOS__
void (*MakeCode)(void); /* Codeerzeugungsprozedur */
Boolean (*ChkPC)(LargeWord Addr);/* ueberprueft Codelaengenueberschreitungen */
Boolean (*IsDef)(void); /* ist Label nicht als solches zu werten ? */
void (*SwitchFrom)(void); /* bevor von einer CPU weggeschaltet wird */
void (*InternSymbol)(char *Asc, TempResult *Erg); /* vordefinierte Symbole ? */
void (*InitPassProc)(void); /* Funktion zur Vorinitialisierung vor einem Pass */
void (*ClearUpProc)(void); /* Aufraeumen nach Assemblierung */
#else
void (*MakeCode)();
Boolean (*ChkPC)();
Boolean (*IsDef)();
void (*SwitchFrom)();
void (*InternSymbol)();
void (*InitPassProc)();
void (*ClearUpProc)();
#endif
StringPtr IncludeList; /* Suchpfade fuer Includedateien */
Integer IncDepth,NextIncDepth; /* Verschachtelungstiefe INCLUDEs */
FILE *ErrorFile; /* Fehlerausgabe */
FILE *LstFile; /* Listdatei */
FILE *ShareFile; /* Sharefile */
FILE *MacProFile; /* Makroprozessorausgabe */
FILE *MacroFile; /* Ausgabedatei Makroliste */
Boolean InMacroFlag; /* momentan wird Makro expandiert */
StringPtr LstName; /* Name der Listdatei */
StringPtr MacroName,MacProName;
Boolean DoLst,NextDoLst; /* Listing an */
StringPtr ShareName; /* Name des Sharefiles */
/** PrgName:String; { Name der Codedatei }**/
CPUVar MomCPU,MomVirtCPU; /* definierter/vorgegaukelter Prozessortyp */
char DefCPU[20]; /* per Kommandozeile vorgegebene CPU */
char MomCPUIdent[10]; /* dessen Name in ASCII */
PCPUDef FirstCPUDef; /* Liste mit Prozessordefinitionen */
CPUVar CPUCnt; /* Gesamtzahl Prozessoren */
Boolean FPUAvail; /* Koprozessor erlaubt ? */
Boolean DoPadding; /* auf gerade Byte-Zahl ausrichten ? */
Boolean SupAllowed; /* Supervisormode freigegeben */
Boolean Maximum; /* CPU nicht kastriert */
Boolean DoBranchExt; /* Spruenge automatisch verlaengern */
LargeWord RadixBase; /* Default-Zahlensystem im Formelparser*/
LargeWord OutRadixBase; /* dito fuer Ausgabe */
StringPtr LabPart,OpPart,AttrPart, /* Komponenten der Zeile */
ArgPart,CommPart,LOpPart;
char AttrSplit;
ArgStrField ArgStr; /* Komponenten des Arguments */
Byte ArgCnt; /* Argumentzahl */
StringPtr OneLine; /* eingelesene Zeile */
Byte LstCounter; /* Zeilenzaehler fuer automatischen Umbruch */
Word PageCounter[ChapMax+1]; /* hierarchische Seitenzaehler */
Byte ChapDepth; /* momentane Kapitelverschachtelung */
StringPtr ListLine; /* alternative Ausgabe vor Listing fuer EQU */
Byte PageLength,PageWidth; /* Seitenlaenge/breite in Zeilen/Spalten */
Boolean LstMacroEx; /* Makroexpansionen auflisten */
StringPtr PrtInitString; /* Druckerinitialisierungsstring */
StringPtr PrtExitString; /* Druckerdeinitialisierungsstring */
StringPtr PrtTitleString; /* Titelzeile */
StringPtr ExtendError; /* erweiterte Fehlermeldung */
LongInt MomSectionHandle; /* mom. Namensraum */
PSaveSection SectionStack; /* gespeicherte Sektionshandles */
LongInt CodeLen; /* Laenge des erzeugten Befehls */
LongWord *DAsmCode; /* Zwischenspeicher erzeugter Code */
Word *WAsmCode;
Byte *BAsmCode;
Boolean DontPrint; /* Flag:PC veraendert, aber keinen Code erzeugt */
Word ActListGran; /* uebersteuerte List-Granularitaet */
/** MultiFace:RECORD Case Byte OF
0:(Feld:WordField);
1:(Val32:Single);
2:(Val64:Double);
3:(Val80:Extended);
4:(ValCo:Comp);
END;**/
Byte StopfZahl; /* Anzahl der im 2.Pass festgestellten
ueberfluessigen Worte, die mit NOP ge-
fuellt werden muessen */
Boolean SuppWarns;
PTransTable TransTables, /* Liste mit Codepages */
CurrTransTable; /* aktuelle Codepage */
PFunction FirstFunction; /* Liste definierter Funktionen */
PDefinement FirstDefine; /* Liste von Praeprozessor-Defines */
PStructure StructureStack; /* momentan offene Strukturen */
int StructSaveSeg; /* gesichertes Segment waehrend Strukturdef.*/
PSaveState FirstSaveState; /* gesicherte Zustaende */
Boolean MakeDebug; /* Debugginghilfe */
FILE *Debug;
void AsmDefInit(void)
BEGIN
LongInt z;
DoLst=True; PassNo=1; MaxSymPass=1;
LineSum=0;
for (z=0; z<=ChapMax; PageCounter[z++]=0);
LstCounter=0; ChapDepth=0;
PrtInitString[0]='\0'; PrtExitString[0]='\0'; PrtTitleString[0]='\0';
ExtendError[0]='\0';
CurrFileName[0]='\0'; MomLineCounter=0;
FirstFunction=Nil; FirstDefine=Nil; FirstSaveState=Nil;
END
void NullProc(void)
BEGIN
END
void Default_InternSymbol(char *Asc, TempResult *Erg)
BEGIN
Erg->Typ=TempNone;
END
static char *GetString(void)
BEGIN
return malloc(256*sizeof(char));
END
void asmdef_init(void)
BEGIN
int z;
InitPassProc=NullProc;
ClearUpProc=NullProc;
FirstCPUDef=Nil;
CPUCnt=0;
SwitchFrom=NullProc;
InternSymbol=Default_InternSymbol;
DAsmCode=(LongWord *) malloc(MaxCodeLen/4);
WAsmCode=(Word *) DAsmCode;
BAsmCode=(Byte *) DAsmCode;
RelaxedMode=True; ConstMode=ConstModeC;
/* auf diese Weise wird PCSymbol defaultmaessig nicht erreichbar
da das schon von den Konstantenparsern im Formelparser abgefangen
wuerde */
PCSymbol = "1";
*DefCPU = '\0';
for (z=0; z<=ParMax; z++) ArgStr[z]=GetString();
SourceFile=GetString();
ClrEol=GetString();
CursUp=GetString();
ErrorPath=GetString();
ErrorName=GetString();
OutName=GetString();
CurrFileName=GetString();
IncludeList=GetString();
LstName=GetString();
MacroName=GetString();
MacProName=GetString();
ShareName=GetString();
LabPart=GetString();
OpPart=GetString();
AttrPart=GetString();
ArgPart=GetString();
CommPart=GetString();
LOpPart=GetString();
OneLine=GetString();
ListLine=GetString();
PrtInitString=GetString();
PrtExitString=GetString();
PrtTitleString=GetString();
ExtendError=GetString();
END

400
asmdef.h Normal file
View File

@ -0,0 +1,400 @@
/* asmdef.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* global benutzte Variablen und Definitionen */
/* */
/* Historie: 4. 5.1996 Grundsteinlegung */
/* 24. 6.1998 Zeichenübersetzungstabellen */
/* 24. 7.1998 Debug-Modus NoICE */
/* 25. 7.1998 PassNo --> Integer */
/* 17. 8.1998 InMacroFlag hierher verschoben */
/* 18. 8.1998 RadixBase hinzugenommen */
/* ArgStr-Feld war eins zu kurz */
/* 19. 8.1998 BranchExt-Variablen */
/* 29. 8.1998 ActListGran hinzugenommen */
/* 1. 1.1999 SegLimits dazugenommen */
/* SegInits --> LargeInt */
/* 9. 1.1999 ChkPC jetzt mit Adresse als Parameter */
/* 17. 4.1999 DefCPU hinzugenommen */
/* 30. 5.1999 OutRadixBase hinzugenommen */
/* 10. 7.1999 Symbolrecord hierher verschoben */
/* 22. 9.1999 RelocEntry definiert */
/* 5.11.1999 ExtendErrors von Boolean nach ShortInt */
/* */
/*****************************************************************************/
#include "chunks.h"
#include "fileformat.h"
typedef Byte CPUVar;
typedef struct _TCPUDef
{
struct _TCPUDef *Next;
char *Name;
CPUVar Number,Orig;
void (*SwitchProc)(
#ifdef __PROTOS__
void
#endif
);
} TCPUDef,*PCPUDef;
typedef enum {TempInt,TempFloat,TempString,TempNone} TempType;
typedef struct _RelocEntry
{
struct _RelocEntry *Next;
char *Ref;
Byte Add;
} TRelocEntry, *PRelocEntry;
typedef struct
{
TempType Typ;
PRelocEntry Relocs;
union
{
LargeInt Int;
Double Float;
String Ascii;
} Contents;
} TempResult;
typedef struct
{
TempType Typ;
TRelocEntry *Relocs;
union
{
LargeInt IWert;
Double FWert;
char *SWert;
} Contents;
} SymbolVal;
typedef struct _TCrossRef
{
struct _TCrossRef *Next;
Byte FileNum;
LongInt LineNum;
Integer OccNum;
} TCrossRef,*PCrossRef;
typedef struct _SymbolEntry
{
struct _SymbolEntry *Left,*Right;
ShortInt Balance;
LongInt Attribute;
char *SymName;
Byte SymType;
ShortInt SymSize;
Boolean Defined,Used,Changeable;
SymbolVal SymWert;
PCrossRef RefList;
Byte FileNum;
LongInt LineNum;
TRelocEntry *Relocs;
} SymbolEntry,*SymbolPtr;
typedef struct _TPatchEntry
{
struct _TPatchEntry *Next;
LargeWord Address;
Byte *RelocType;
} TPatchEntry, *PPatchEntry;
typedef enum {DebugNone,DebugMAP,DebugAOUT,DebugCOFF,DebugELF,DebugAtmel,DebugNoICE} DebugType;
#define Char_NUL 0
#define Char_BEL '\a'
#define Char_BS '\b'
#define Char_HT 9
#define Char_LF '\n'
#define Char_FF 12
#define Char_CR 13
#define Char_ESC 27
#ifdef HAS64
#define MaxLargeInt 0x7fffffffffffffffll
#else
#define MaxLargeInt 0x7fffffffl
#endif
extern char SrcSuffix[],IncSuffix[],PrgSuffix[],LstSuffix[],
MacSuffix[],PreSuffix[],LogSuffix[],MapSuffix[],
OBJSuffix[];
#define MomCPUName "MOMCPU" /* mom. Prozessortyp */
#define MomCPUIdentName "MOMCPUNAME" /* mom. Prozessortyp */
#define SupAllowedName "INSUPMODE" /* privilegierte Befehle erlaubt */
#define DoPaddingName "PADDING" /* Padding an */
#define MaximumName "INMAXMODE" /* CPU im Maximum-Modus */
#define FPUAvailName "HASFPU" /* FPU-Befehle erlaubt */
#define LstMacroExName "MACEXP" /* expandierte Makros anzeigen */
#define ListOnName "LISTON" /* Listing an/aus */
#define RelaxedName "RELAXED" /* alle Zahlenschreibweisen zugelassen */
#define SrcModeName "INSRCMODE" /* CPU im Quellcode-kompatiblen Modus */
#define BigEndianName "BIGENDIAN" /* Datenablage MSB first */
#define BranchExtName "BRANCHEXT" /* Spruenge autom. verlaengern */
#define FlagTrueName "TRUE" /* Flagkonstanten */
#define FlagFalseName "FALSE"
#define PiName "CONSTPI" /* Zahl Pi */
#define DateName "DATE" /* Datum & Zeit */
#define TimeName "TIME"
#define VerName "VERSION" /* speichert Versionsnummer */
#define CaseSensName "CASESENSITIVE" /* zeigt Gross/Kleinunterscheidung an */
#define Has64Name "HAS64" /* arbeitet Parser mit 64-Bit-Integers ? */
#define ArchName "ARCHITECTURE" /* Zielarchitektur von AS */
#define AttrName "ATTRIBUTE" /* Attributansprache in Makros */
#define DefStackName "DEFSTACK" /* Default-Stack */
extern char *EnvName;
#define ParMax 20
#define ChapMax 4
#define StructSeg (PCMax+1)
extern char *SegNames[PCMax+1];
extern char SegShorts[PCMax+1];
extern LongInt Magic;
#define AscOfs '0'
#define MaxCodeLen 1024
extern char *InfoMessCopyright;
typedef void (*SimpProc)(
#ifdef __PROTOS__
void
#endif
);
typedef Word WordField[6]; /* fuer Zahlenumwandlung */
typedef char *ArgStrField[ParMax+1];/* Feld mit Befehlsparametern */
typedef char *StringPtr;
typedef enum {ConstModeIntel, /* Hex xxxxh, Okt xxxxo, Bin xxxxb */
ConstModeMoto, /* Hex $xxxx, Okt @xxxx, Bin %xxxx */
ConstModeC} /* Hex 0x..., Okt 0...., Bin ----- */
TConstMode;
typedef struct _TFunction
{
struct _TFunction *Next;
Byte ArguCnt;
StringPtr Name,Definition;
} TFunction,*PFunction;
typedef struct _TTransTable
{
struct _TTransTable *Next;
char *Name;
unsigned char *Table;
} TTransTable,*PTransTable;
typedef struct _TSaveState
{
struct _TSaveState *Next;
CPUVar SaveCPU;
Integer SavePC;
Byte SaveListOn;
Boolean SaveLstMacroEx;
PTransTable SaveTransTable;
} TSaveState,*PSaveState;
typedef struct _TForwardSymbol
{
struct _TForwardSymbol *Next;
StringPtr Name;
LongInt DestSection;
} TForwardSymbol,*PForwardSymbol;
typedef struct _TSaveSection
{
struct _TSaveSection *Next;
PForwardSymbol LocSyms,GlobSyms,ExportSyms;
LongInt Handle;
} TSaveSection,*PSaveSection;
typedef struct _TDefinement
{
struct _TDefinement *Next;
StringPtr TransFrom,TransTo;
Byte Compiled[256];
} TDefinement,*PDefinement;
typedef struct _TStructure
{
struct _TStructure *Next;
Boolean DoExt;
char *Name;
LargeWord CurrPC;
} TStructure,*PStructure;
extern StringPtr SourceFile;
extern StringPtr ClrEol;
extern StringPtr CursUp;
extern LargeWord PCs[StructSeg+1];
extern LargeWord StartAdr;
extern Boolean StartAdrPresent;
extern LargeWord Phases[StructSeg+1];
extern Word Grans[StructSeg+1];
extern Word ListGrans[StructSeg+1];
extern ChunkList SegChunks[StructSeg+1];
extern Integer ActPC;
extern Boolean PCsUsed[StructSeg+1];
extern LargeInt SegInits[PCMax+1];
extern LargeInt SegLimits[PCMax+1];
extern LongInt ValidSegs;
extern Boolean ENDOccured;
extern Boolean Retracted;
extern Boolean ListToStdout,ListToNull;
extern Word TypeFlag;
extern ShortInt SizeFlag;
extern Integer PassNo;
extern Integer JmpErrors;
extern Boolean ThrowErrors;
extern Boolean Repass;
extern Byte MaxSymPass;
extern Byte ShareMode;
extern DebugType DebugMode;
extern Byte ListMode;
extern Byte ListOn;
extern Boolean MakeUseList;
extern Boolean MakeCrossList;
extern Boolean MakeSectionList;
extern Boolean MakeIncludeList;
extern Boolean RelaxedMode;
extern Byte ListMask;
extern ShortInt ExtendErrors;
extern LongInt MomSectionHandle;
extern PSaveSection SectionStack;
extern LongInt CodeLen;
extern Byte *BAsmCode;
extern Word *WAsmCode;
extern LongWord *DAsmCode;
extern Boolean DontPrint;
extern Word ActListGran;
extern Boolean NumericErrors;
extern Boolean CodeOutput;
extern Boolean MacProOutput;
extern Boolean MacroOutput;
extern Boolean QuietMode;
extern Boolean HardRanges;
extern char *DivideChars;
extern Boolean HasAttrs;
extern char *AttrChars;
extern Boolean MsgIfRepass;
extern Integer PassNoForMessage;
extern Boolean CaseSensitive;
extern FILE *PrgFile;
extern StringPtr ErrorPath,ErrorName;
extern StringPtr OutName;
extern Boolean IsErrorOpen;
extern StringPtr CurrFileName;
extern LongInt CurrLine;
extern LongInt MomLineCounter;
extern LongInt LineSum;
extern LongInt MacLineSum;
extern LongInt NOPCode;
extern Boolean TurnWords;
extern Byte HeaderID;
extern char *PCSymbol;
extern TConstMode ConstMode;
extern Boolean SetIsOccupied;
extern void (*MakeCode)(void);
extern Boolean (*ChkPC)(LargeWord Addr);
extern Boolean (*IsDef)(void);
extern void (*SwitchFrom)(void);
extern void (*InternSymbol)(char *Asc, TempResult *Erg);
extern void (*InitPassProc)(void);
extern void (*ClearUpProc)(void);
extern StringPtr IncludeList;
extern Integer IncDepth,NextIncDepth;
extern FILE *ErrorFile;
extern FILE *LstFile;
extern FILE *ShareFile;
extern FILE *MacProFile;
extern FILE *MacroFile;
extern Boolean InMacroFlag;
extern StringPtr LstName,MacroName,MacProName;
extern Boolean DoLst,NextDoLst;
extern StringPtr ShareName;
extern CPUVar MomCPU,MomVirtCPU;
extern char DefCPU[20];
extern char MomCPUIdent[10];
extern PCPUDef FirstCPUDef;
extern CPUVar CPUCnt;
extern Boolean FPUAvail;
extern Boolean DoPadding;
extern Boolean SupAllowed;
extern Boolean Maximum;
extern Boolean DoBranchExt;
extern LargeWord RadixBase, OutRadixBase;
extern StringPtr LabPart,OpPart,AttrPart,ArgPart,CommPart,LOpPart;
extern char AttrSplit;
extern ArgStrField ArgStr;
extern Byte ArgCnt;
extern StringPtr OneLine;
extern Byte LstCounter;
extern Word PageCounter[ChapMax+1];
extern Byte ChapDepth;
extern StringPtr ListLine;
extern Byte PageLength,PageWidth;
extern Boolean LstMacroEx;
extern StringPtr PrtInitString;
extern StringPtr PrtExitString;
extern StringPtr PrtTitleString;
extern StringPtr ExtendError;
extern Byte StopfZahl;
extern Boolean SuppWarns;
#define CharTransTable CurrTransTable->Table
extern PTransTable TransTables,CurrTransTable;
extern PFunction FirstFunction;
extern PDefinement FirstDefine;
extern PStructure StructureStack;
extern int StructSaveSeg;
extern PSaveState FirstSaveState;
extern Boolean MakeDebug;
extern FILE *Debug;
extern void AsmDefInit(void);
extern void NullProc(void);
extern void Default_InternSymbol(char *Asc, TempResult *Erg);
extern void asmdef_init(void);

167
asmfnums.c Normal file
View File

@ -0,0 +1,167 @@
/* asmfnums.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung von Datei-Nummern */
/* */
/* Historie: 15. 5.1996 Grundsteinlegung */
/* 25. 7.1998 GetFileName jetzt mit int statt Byte */
/* Verwaltung Adreßbereiche */
/* Caching FileCount */
/* 16. 8.1998 Ruecksetzen Adressbereiche */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include "strutil.h"
#include "chunks.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmfnums.h"
#ifdef HAS64
#define ADRMAX 9223372036854775807ll;
#else
#define ADRMAX 4294967295l;
#endif
typedef struct _TToken
{
struct _TToken *Next;
LargeWord FirstAddr,LastAddr;
char *Name;
} TToken,*PToken;
static PToken FirstFile;
static int FileCount;
void InitFileList(void)
BEGIN
FirstFile=Nil; FileCount=0;
END
void ClearFileList(void)
BEGIN
PToken F;
while (FirstFile!=Nil)
BEGIN
F=FirstFile->Next;
free(FirstFile->Name);
free(FirstFile);
FirstFile=F;
END
FileCount=0;
END
static PToken SearchToken(int Num)
BEGIN
PToken Lauf=FirstFile;
while (Num>0)
BEGIN
if (Lauf==Nil) return Nil;
Num--; Lauf=Lauf->Next;
END
return Lauf;
END
void AddFile(char *FName)
BEGIN
PToken Lauf,Neu;
if (GetFileNum(FName)!=-1) return;
Neu=(PToken) malloc(sizeof(TToken));
Neu->Next=Nil;
Neu->Name=strdup(FName);
Neu->FirstAddr=ADRMAX;
Neu->LastAddr=0;
if (FirstFile==Nil) FirstFile=Neu;
else
BEGIN
Lauf=FirstFile;
while (Lauf->Next!=Nil) Lauf=Lauf->Next;
Lauf->Next=Neu;
END
FileCount++;
END
Integer GetFileNum(char *Name)
BEGIN
PToken FLauf=FirstFile;
int Cnt=0;
while ((FLauf!=Nil) AND (strcmp(FLauf->Name,Name)!=0))
BEGIN
Cnt++;
FLauf=FLauf->Next;
END
return (FLauf==Nil)?(-1):(Cnt);
END
char *GetFileName(int Num)
BEGIN
PToken Lauf=SearchToken(Num);
static char *Dummy="";
return (Lauf==Nil)?(Dummy):(Lauf->Name);
END
Integer GetFileCount(void)
BEGIN
return FileCount;
END
void AddAddressRange(int File, LargeWord Start, LargeWord Len)
BEGIN
PToken Lauf=SearchToken(File);
if (Lauf==Nil) return;
if (Start<Lauf->FirstAddr) Lauf->FirstAddr=Start;
if ((Len+=Start-1)>Lauf->LastAddr) Lauf->LastAddr=Len;
END
void GetAddressRange(int File, LargeWord *Start, LargeWord *End)
BEGIN
PToken Lauf=SearchToken(File);
if (Lauf==Nil)
BEGIN
*Start=ADRMAX; *End=0;
END
else
BEGIN
*Start=Lauf->FirstAddr; *End=Lauf->LastAddr;
END
END
void ResetAddressRanges(void)
BEGIN
PToken Run;
for (Run=FirstFile; Run!=Nil; Run=Run->Next)
BEGIN
Run->FirstAddr=ADRMAX;
Run->LastAddr=0;
END
END
void asmfnums_init(void)
BEGIN
FirstFile=Nil; FileCount=0;
END

29
asmfnums.h Normal file
View File

@ -0,0 +1,29 @@
/* asmfnums.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung von Datei-Nummern */
/* */
/* Historie: 15. 5.96 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void InitFileList(void);
extern void ClearFileList(void);
extern void AddFile(char *FName);
extern Integer GetFileNum(char *Name);
extern char *GetFileName(int Num);
extern Integer GetFileCount(void);
extern void AddAddressRange(int File, LargeWord Start, LargeWord Len);
extern void GetAddressRange(int File, LargeWord *Start, LargeWord *End);
extern void ResetAddressRanges(void);
extern void asmfnums_init(void);

433
asmif.c Normal file
View File

@ -0,0 +1,433 @@
/* asmif.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Befehle zur bedingten Assemblierung */
/* */
/* Historie: 15. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include <ctype.h>
#include "bpemu.h"
#include "chunks.h"
#include "strutil.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "asmif.h"
PIfSave FirstIfSave;
Boolean IfAsm; /* FALSE: in einer neg. IF-Sequenz-->kein Code */
static Boolean ActiveIF;
static LongInt GetIfVal(char *Cond)
BEGIN
Boolean IfOK;
LongInt Tmp;
FirstPassUnknown=False;
Tmp=EvalIntExpression(Cond,Int32,&IfOK);
if ((FirstPassUnknown) OR (NOT IfOK))
BEGIN
Tmp=1;
if (FirstPassUnknown) WrError(1820);
else if (NOT IfOK) WrError(1135);
END
return Tmp;
END
static void AddBoolFlag(Boolean Flag)
BEGIN
strmaxcpy(ListLine,Flag?"=>TRUE":"=>FALSE",255);
END
static void PushIF(LongInt IfExpr)
BEGIN
PIfSave NewSave;
NewSave=(PIfSave) malloc(sizeof(TIfSave));
NewSave->NestLevel=SaveIFs()+1;
NewSave->Next=FirstIfSave; NewSave->SaveIfAsm=IfAsm;
NewSave->State=IfState_IFIF; NewSave->CaseFound=(IfExpr!=0);
FirstIfSave=NewSave;
IfAsm=(IfAsm AND (IfExpr!=0));
END
static void CodeIF(void)
BEGIN
LongInt IfExpr;
ActiveIF=IfAsm;
if (NOT IfAsm) IfExpr=1;
else if (ArgCnt!=1)
BEGIN
WrError(1110); IfExpr=1;
END
else IfExpr=GetIfVal(ArgStr[1]);
if (IfAsm) AddBoolFlag(IfExpr!=0);
PushIF(IfExpr);
END
static void CodeIFDEF(void)
BEGIN
LongInt IfExpr;
Boolean Defined;
ActiveIF=IfAsm;
if (NOT IfAsm) IfExpr=1;
else if (ArgCnt!=1)
BEGIN
WrError(1110); IfExpr=1;
END
else
BEGIN
Defined=IsSymbolDefined(ArgStr[1]);
if (IfAsm)
strmaxcpy(ListLine,(Defined)?"=>DEFINED":"=>UNDEFINED",255);
if (Memo("IFDEF")) IfExpr=(Defined)?1:0;
else IfExpr=(Defined)?0:1;
END
PushIF(IfExpr);
END
static void CodeIFUSED(void)
BEGIN
LongInt IfExpr;
Boolean Used;
ActiveIF=IfAsm;
if (NOT IfAsm) IfExpr=1;
else if (ArgCnt!=1)
BEGIN
WrError(1110); IfExpr=1;
END
else
BEGIN
Used=IsSymbolUsed(ArgStr[1]);
if (IfAsm)
strmaxcpy(ListLine,(Used)?"=>USED":"=>UNUSED",255);
if (Memo("IFUSED")) IfExpr=(Used)?1:0;
else IfExpr=(Used)?0:1;
END
PushIF(IfExpr);
END
void CodeIFEXIST(void)
BEGIN
LongInt IfExpr;
Boolean Found;
String NPath;
ActiveIF=IfAsm;
if (NOT IfAsm) IfExpr=1;
else if (ArgCnt!=1)
BEGIN
WrError(1110); IfExpr=1;
END
else
BEGIN
strmaxcpy(ArgPart,ArgStr[1],255);
if (*ArgPart=='"') strcpy(ArgPart,ArgPart+1);
if (ArgPart[strlen(ArgPart)-1]=='"') ArgPart[strlen(ArgPart)-1]='\0';
AddSuffix(ArgPart,IncSuffix);
strmaxcpy(NPath,IncludeList,255); strmaxprep(NPath,".:",255);
Found=(*(FSearch(ArgPart,NPath))!='\0');
if (IfAsm)
strmaxcpy(ListLine,(Found)?"=>FOUND":"=>NOT FOUND",255);
if (Memo("IFEXIST")) IfExpr=(Found)?1:0;
else IfExpr=(Found)?0:1;
END
PushIF(IfExpr);
END
static void CodeIFB(void)
BEGIN
Boolean Blank=True;
LongInt IfExpr;
int z;
ActiveIF=IfAsm;
if (NOT IfAsm) IfExpr=1;
else
BEGIN
for (z=1; z<=ArgCnt; z++) if (strlen(ArgStr[z++])>0) Blank=False;
if (IfAsm)
strmaxcpy(ListLine,(Blank)?"=>BLANK":"=>NOT BLANK",255);
if (Memo("IFB")) IfExpr=(Blank)?1:0;
else IfExpr=(Blank)?0:1;
END
PushIF(IfExpr);
END
static void CodeELSEIF(void)
BEGIN
LongInt IfExpr;
if (FirstIfSave==Nil) WrError(1840);
else if (ArgCnt==0)
BEGIN
if (FirstIfSave->State!=IfState_IFIF) WrError(1480);
else if (FirstIfSave->SaveIfAsm) AddBoolFlag(IfAsm=(NOT FirstIfSave->CaseFound));
FirstIfSave->State=IfState_IFELSE;
END
else if (ArgCnt==1)
BEGIN
if (FirstIfSave->State!=IfState_IFIF) WrError(1480);
else
BEGIN
if (NOT FirstIfSave->SaveIfAsm) IfExpr=1;
else if (FirstIfSave->CaseFound) IfExpr=0;
else IfExpr=GetIfVal(ArgStr[1]);
IfAsm=((FirstIfSave->SaveIfAsm) AND (IfExpr!=0) AND (NOT FirstIfSave->CaseFound));
if (FirstIfSave->SaveIfAsm) AddBoolFlag(IfExpr!=0);
if (IfExpr!=0) FirstIfSave->CaseFound=True;
END
END
else WrError(1110);
ActiveIF=(FirstIfSave==Nil) OR (FirstIfSave->SaveIfAsm);
END
static void CodeENDIF(void)
BEGIN
PIfSave NewSave;
if (ArgCnt!=0) WrError(1110);
if (FirstIfSave==Nil) WrError(1840);
else
BEGIN
if ((FirstIfSave->State!=IfState_IFIF) AND (FirstIfSave->State!=IfState_IFELSE)) WrError(1480);
else
BEGIN
IfAsm=FirstIfSave->SaveIfAsm;
NewSave=FirstIfSave; FirstIfSave=NewSave->Next;
free(NewSave);
END
END
ActiveIF=IfAsm;
END
static void EvalIfExpression(char *Cond, TempResult *erg)
BEGIN
FirstPassUnknown=False;
EvalExpression(Cond,erg);
if ((erg->Typ==TempNone) OR (FirstPassUnknown))
BEGIN
erg->Typ=TempInt; erg->Contents.Int=1;
if (FirstPassUnknown) WrError(1820);
END
END
static void CodeSWITCH(void)
BEGIN
PIfSave NewSave;
ActiveIF=IfAsm;
NewSave=(PIfSave) malloc(sizeof(TIfSave));
NewSave->NestLevel=SaveIFs()+1;
NewSave->Next=FirstIfSave; NewSave->SaveIfAsm=IfAsm;
NewSave->CaseFound=False; NewSave->State=IfState_CASESWITCH;
if (ArgCnt!=1)
BEGIN
NewSave->SaveExpr.Typ=TempInt;
NewSave->SaveExpr.Contents.Int=1;
if (IfAsm) WrError(1110);
END
else
BEGIN
EvalIfExpression(ArgStr[1],&(NewSave->SaveExpr));
SetListLineVal(&(NewSave->SaveExpr));
END
FirstIfSave=NewSave;
END
static void CodeCASE(void)
BEGIN
Boolean eq;
int z;
TempResult t;
if (FirstIfSave==Nil) WrError(1840);
else if (ArgCnt==0) WrError(1110);
else
BEGIN
if ((FirstIfSave->State!=IfState_CASESWITCH) AND (FirstIfSave->State!=IfState_CASECASE)) WrError(1480);
else
BEGIN
if (NOT FirstIfSave->SaveIfAsm) eq=True;
else if (FirstIfSave->CaseFound) eq=False;
else
BEGIN
eq=False; z=1;
do
BEGIN
EvalIfExpression(ArgStr[z],&t);
eq=(FirstIfSave->SaveExpr.Typ==t.Typ);
if (eq)
switch (t.Typ)
BEGIN
case TempInt: eq=(t.Contents.Int==FirstIfSave->SaveExpr.Contents.Int); break;
case TempFloat: eq=(t.Contents.Float==FirstIfSave->SaveExpr.Contents.Float); break;
case TempString: eq=(strcmp(t.Contents.Ascii,FirstIfSave->SaveExpr.Contents.Ascii)==0); break;
case TempNone: eq=False; break;
END
z++;
END
while ((NOT eq) AND (z<=ArgCnt));
END;
IfAsm=((FirstIfSave->SaveIfAsm) AND (eq) AND (NOT FirstIfSave->CaseFound));
if (FirstIfSave->SaveIfAsm) AddBoolFlag(eq AND (NOT FirstIfSave->CaseFound));
if (eq) FirstIfSave->CaseFound=True;
FirstIfSave->State=IfState_CASECASE;
END
END
ActiveIF=(FirstIfSave==Nil) OR (FirstIfSave->SaveIfAsm);
END
static void CodeELSECASE(void)
BEGIN
if (ArgCnt!=0) WrError(1110);
else
BEGIN
if ((FirstIfSave->State!=IfState_CASESWITCH) AND (FirstIfSave->State!=IfState_CASECASE)) WrError(1480);
else IfAsm=(FirstIfSave->SaveIfAsm AND (NOT FirstIfSave->CaseFound));
if (FirstIfSave->SaveIfAsm) AddBoolFlag(NOT FirstIfSave->CaseFound);
FirstIfSave->CaseFound=True;
FirstIfSave->State=IfState_CASEELSE;
END
ActiveIF=(FirstIfSave==Nil) OR (FirstIfSave->SaveIfAsm);
END
static void CodeENDCASE(void)
BEGIN
PIfSave NewSave;
if (ArgCnt!=0) WrError(1110);
if (FirstIfSave==Nil) WrError(1840);
else
BEGIN
if ((FirstIfSave->State!=IfState_CASESWITCH)
AND (FirstIfSave->State!=IfState_CASECASE)
AND (FirstIfSave->State!=IfState_CASEELSE)) WrError(1480);
else
BEGIN
IfAsm=FirstIfSave->SaveIfAsm;
if (NOT FirstIfSave->CaseFound) WrError(100);
NewSave=FirstIfSave; FirstIfSave=NewSave->Next;
free(NewSave);
END
END
ActiveIF=IfAsm;
END
Boolean CodeIFs(void)
BEGIN
Boolean Result=True;
ActiveIF=False;
switch (toupper(*OpPart))
BEGIN
case 'I':
if (Memo("IF")) CodeIF();
else if ((Memo("IFDEF")) OR (Memo("IFNDEF"))) CodeIFDEF();
else if ((Memo("IFUSED")) OR (Memo("IFNUSED"))) CodeIFUSED();
else if ((Memo("IFEXIST")) OR (Memo("IFNEXIST"))) CodeIFEXIST();
else if ((Memo("IFB")) OR (Memo("IFNB"))) CodeIFB();
else Result=False;
break;
case 'E':
if ((Memo("ELSE")) OR (Memo("ELSEIF"))) CodeELSEIF();
else if (Memo("ENDIF")) CodeENDIF();
else if (Memo("ELSECASE")) CodeELSECASE();
else if (Memo("ENDCASE")) CodeENDCASE();
else Result=False;
break;
case 'S':
if (Memo("SWITCH")) CodeSWITCH();
else Result=False;
break;
case 'C':
if (Memo("CASE")) CodeCASE();
else Result=False;
break;
default:
Result=False;
END
return Result;
END
Integer SaveIFs(void)
BEGIN
return (FirstIfSave==Nil) ? 0 : FirstIfSave->NestLevel;
END
void RestoreIFs(Integer Level)
BEGIN
PIfSave OldSave;
while ((FirstIfSave!=Nil) AND (FirstIfSave->NestLevel!=Level))
BEGIN
OldSave=FirstIfSave; FirstIfSave=OldSave->Next;
IfAsm=OldSave->SaveIfAsm;
free(OldSave);
END
END
Boolean IFListMask(void)
BEGIN
switch (ListOn)
BEGIN
case 0: return True;
case 1: return False;
case 2: return ((NOT ActiveIF) AND (NOT IfAsm));
case 3: return (ActiveIF OR (NOT IfAsm));
END
return True;
END
void AsmIFInit(void)
BEGIN
IfAsm=True;
END
void asmif_init(void)
BEGIN
END

37
asmif.h Normal file
View File

@ -0,0 +1,37 @@
/* asmif.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Befehle zur bedingten Assemblierung */
/* */
/* Historie: 15. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
typedef struct _TIfSave
{
struct _TIfSave *Next;
Integer NestLevel;
Boolean SaveIfAsm;
TempResult SaveExpr;
enum {IfState_IFIF,IfState_IFELSE,
IfState_CASESWITCH,IfState_CASECASE,IfState_CASEELSE} State;
Boolean CaseFound;
} TIfSave,*PIfSave;
extern Boolean IfAsm;
extern PIfSave FirstIfSave;
extern Boolean CodeIFs(void);
extern void AsmIFInit(void);
extern Integer SaveIFs(void);
extern void RestoreIFs(Integer Level);
extern Boolean IFListMask(void);
extern void asmif_init(void);

116
asminclist.c Normal file
View File

@ -0,0 +1,116 @@
/* asminclist.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung der Include-Verschachtelungsliste */
/* */
/* Historie: 16. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include "strutil.h"
#include "chunks.h"
#include "nls.h"
#include "nlmessages.h"
#include "as.rsc"
#include "asmfnums.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asminclist.h"
typedef void **PFileArray;
typedef struct _TFileNode
{
Integer Name;
Integer Len;
struct _TFileNode *Parent;
PFileArray Subs;
} TFileNode,*PFileNode;
static PFileNode Root,Curr;
void PushInclude(char *S)
BEGIN
PFileNode Neu;
Neu=(PFileNode) malloc(sizeof(TFileNode));
Neu->Name=GetFileNum(S);
Neu->Len=0; Neu->Subs=Nil;
Neu->Parent=Curr;
if (Root==Nil) Root=Neu;
if (Curr==Nil) Curr=Neu;
else
BEGIN
if (Curr->Len==0)
Curr->Subs=(PFileArray) malloc(sizeof(void *));
else
Curr->Subs=(PFileArray) realloc(Curr->Subs,sizeof(void *)*(Curr->Len+1));
Curr->Subs[Curr->Len++]=(void *)Neu;
Curr=Neu;
END
END
void PopInclude(void)
BEGIN
if (Curr!=Nil) Curr=Curr->Parent;
END
static void PrintIncludeList_PrintNode(PFileNode Node, int Indent)
BEGIN
int z;
String h;
ChkStack();
if (Node!=Nil)
BEGIN
strmaxcpy(h,Blanks(Indent),255);
strmaxcat(h,GetFileName(Node->Name),255);
WrLstLine(h);
for (z=0; z<Node->Len; z++) PrintIncludeList_PrintNode(Node->Subs[z],Indent+5);
END
END
void PrintIncludeList(void)
BEGIN
NewPage(ChapDepth,True);
WrLstLine(getmessage(Num_ListIncludeListHead1));
WrLstLine(getmessage(Num_ListIncludeListHead2));
WrLstLine("");
PrintIncludeList_PrintNode(Root,0);
END
static void ClearIncludeList_ClearNode(PFileNode Node)
BEGIN
int z;
ChkStack();
if (Node!=Nil)
BEGIN
for (z=0; z<Node->Len; ClearIncludeList_ClearNode(Node->Subs[z++]));
if (Node->Len>0) free(Node->Subs);
free(Node);
END
END
void ClearIncludeList(void)
BEGIN
ClearIncludeList_ClearNode(Root);
Curr=Nil; Root=Nil;
END
void asminclist_init(void)
BEGIN
Root=Nil; Curr=Nil;
END

19
asminclist.h Normal file
View File

@ -0,0 +1,19 @@
/* asminclist.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung der Include-Verschachtelungsliste */
/* */
/* Historie: 16. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void PushInclude(char *S);
extern void PopInclude(void);
extern void PrintIncludeList(void);
extern void ClearIncludeList(void);
extern void asminclist_init(void);

277
asmitree.c Normal file
View File

@ -0,0 +1,277 @@
/* asmitree.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Opcode-Abfrage als Binaerbaum */
/* */
/* Historie: 30.10.1996 Grundsteinlegung */
/* 8.10.1997 Hash-Tabelle */
/* 6.12.1998 dynamisches Kopieren der Namen */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include "chunks.h"
#include "strutil.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmitree.h"
/*---------------------------------------------------------------------------*/
static Boolean AddSingle(PInstTreeNode *Node, char *NName, InstProc NProc, Word NIndex)
BEGIN
PInstTreeNode p1,p2;
Boolean Result=False;
ChkStack();
if (*Node==Nil)
BEGIN
*Node=(PInstTreeNode) malloc(sizeof(TInstTreeNode));
(*Node)->Left=Nil; (*Node)->Right=Nil;
(*Node)->Proc=NProc; (*Node)->Index=NIndex;
(*Node)->Balance=0;
(*Node)->Name=strdup(NName);
Result=True;
END
else if (strcmp(NName,(*Node)->Name)<0)
BEGIN
if (AddSingle(&((*Node)->Left),NName,NProc,NIndex))
switch ((*Node)->Balance)
BEGIN
case 1:
(*Node)->Balance=0;
break;
case 0:
(*Node)->Balance=(-1);
Result=True;
break;
case -1:
p1=(*Node)->Left;
if (p1->Balance==-1)
BEGIN
(*Node)->Left=p1->Right; p1->Right=(*Node);
(*Node)->Balance=0; *Node=p1;
END
else
BEGIN
p2=p1->Right;
p1->Right=p2->Left; p2->Left=p1;
(*Node)->Left=p2->Right; p2->Right=(*Node);
if (p2->Balance==-1) (*Node)->Balance= 1; else (*Node)->Balance=0;
if (p2->Balance== 1) p1 ->Balance=(-1); else p1 ->Balance=0;
*Node=p2;
END
(*Node)->Balance=0;
break;
END
END
else
BEGIN
if (AddSingle(&((*Node)->Right),NName,NProc,NIndex))
switch ((*Node)->Balance)
BEGIN
case -1:
(*Node)->Balance=0;
break;
case 0:
(*Node)->Balance=1;
Result=True;
break;
case 1:
p1=(*Node)->Right;
if (p1->Balance==1)
BEGIN
(*Node)->Right=p1->Left; p1->Left=(*Node);
(*Node)->Balance=0; *Node=p1;
END
else
BEGIN
p2=p1->Left;
p1->Left=p2->Right; p2->Right=p1;
(*Node)->Right=p2->Left; p2->Left=(*Node);
if (p2->Balance== 1) (*Node)->Balance=(-1); else (*Node)->Balance=0;
if (p2->Balance==-1) p1 ->Balance= 1; else p1 ->Balance=0;
*Node=p2;
END
(*Node)->Balance=0;
break;
END
END
return Result;
END
void AddInstTree(PInstTreeNode *Root, char *NName, InstProc NProc, Word NIndex)
BEGIN
AddSingle(Root,NName,NProc,NIndex);
END
static void ClearSingle(PInstTreeNode *Node)
BEGIN
ChkStack();
if (*Node!=Nil)
BEGIN
free((*Node)->Name);
ClearSingle(&((*Node)->Left));
ClearSingle(&((*Node)->Right));
free(*Node); *Node=Nil;
END
END
void ClearInstTree(PInstTreeNode *Root)
BEGIN
ClearSingle(Root);
END
Boolean SearchInstTree(PInstTreeNode Root, char *OpPart)
BEGIN
int z;
z=0;
while ((Root!=Nil) AND (strcmp(Root->Name,OpPart)!=0))
BEGIN
Root=(strcmp(OpPart,Root->Name)<0)? Root->Left : Root->Right;
z++;
END
if (Root==Nil) return False;
else
BEGIN
Root->Proc(Root->Index);
return True;
END
END
static void PNode(PInstTreeNode Node, Word Lev)
BEGIN
ChkStack();
if (Node!=Nil)
BEGIN
PNode(Node->Left,Lev+1);
printf("%*s %s %p %p %d\n",5*Lev,"",Node->Name,Node->Left,Node->Right,Node->Balance);
PNode(Node->Right,Lev+1);
END
END
void PrintInstTree(PInstTreeNode Root)
BEGIN
PNode(Root,0);
END
/*----------------------------------------------------------------------------*/
static int GetKey(char *Name, LongWord TableSize)
BEGIN
register unsigned char *p;
LongWord tmp=0;
for (p=(unsigned char *)Name; *p!='\0'; p++) tmp=(tmp<<2)+((LongWord)*p);
return tmp%TableSize;
END
PInstTable CreateInstTable(int TableSize)
BEGIN
int z;
PInstTableEntry tmp;
PInstTable tab;
tmp=(PInstTableEntry) malloc(sizeof(TInstTableEntry)*TableSize);
for (z=0; z<TableSize; z++) tmp[z].Name=Nil;
tab=(PInstTable) malloc(sizeof(TInstTable));
tab->Fill=0; tab->Size=TableSize; tab->Entries=tmp; tab->Dynamic=FALSE;
return tab;
END
void SetDynamicInstTable(PInstTable Table)
BEGIN
Table->Dynamic=TRUE;
END
void DestroyInstTable(PInstTable tab)
BEGIN
int z;
if (tab->Dynamic)
for (z=0; z<tab->Size; z++)
free(tab->Entries[z].Name);
free(tab->Entries);
free(tab);
END
void AddInstTable(PInstTable tab, char *Name, Word Index, InstProc Proc)
BEGIN
LongWord h0=GetKey(Name,tab->Size),z=0;
/* mindestens ein freies Element lassen, damit der Sucher garantiert terminiert */
if (tab->Size-1<=tab->Fill) exit(255);
while (1)
BEGIN
if (tab->Entries[h0].Name==Nil)
BEGIN
tab->Entries[h0].Name=(tab->Dynamic) ? strdup(Name) : Name;
tab->Entries[h0].Proc=Proc;
tab->Entries[h0].Index=Index;
tab->Entries[h0].Coll=z;
tab->Fill++;
return;
END
z++;
if ((++h0)==tab->Size) h0=0;
END
END
void RemoveInstTable(PInstTable tab, char *Name)
BEGIN
LongWord h0=GetKey(Name,tab->Size);
while (1)
BEGIN
if (tab->Entries[h0].Name==Nil) return;
else if (strcmp(tab->Entries[h0].Name,Name)==0)
BEGIN
tab->Entries[h0].Name=Nil;
tab->Entries[h0].Proc=Nil;
tab->Fill--;
return;
END
if ((++h0)==tab->Size) h0=0;
END
END
Boolean LookupInstTable(PInstTable tab, char *Name)
BEGIN
LongWord h0=GetKey(Name,tab->Size);
while (1)
BEGIN
if (tab->Entries[h0].Name==Nil) return False;
else if (strcmp(tab->Entries[h0].Name,Name)==0)
BEGIN
tab->Entries[h0].Proc(tab->Entries[h0].Index);
return True;
END
if ((++h0)==tab->Size) h0=0;
END
END
void PrintInstTable(FILE *stream, PInstTable tab)
BEGIN
int z;
for (z=0; z<tab->Size; z++)
if (tab->Entries[z].Name!=Nil)
fprintf(stream,"[%3d]: %-10s Index %4d Coll %2d\n",z,tab->Entries[z].Name,tab->Entries[z].Index,tab->Entries[z].Coll);
END
/*----------------------------------------------------------------------------*/
void asmitree_init(void)
BEGIN
END

65
asmitree.h Normal file
View File

@ -0,0 +1,65 @@
/* asmitree.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Opcode-Abfrage als Binaerbaum */
/* */
/* Historie: 30.10.1996 Grundsteinlegung */
/* 6.12.1998 dynamische Variante */
/* */
/*****************************************************************************/
typedef void (*InstProc)(
#ifdef __PROTOS__
Word Index
#endif
);
typedef struct _TInstTreeNode
{
struct _TInstTreeNode *Left,*Right;
InstProc Proc;
char *Name;
Word Index;
ShortInt Balance;
} TInstTreeNode,*PInstTreeNode;
typedef struct _TInstTableEntry
{
InstProc Proc;
char *Name;
Word Index;
int Coll;
}
TInstTableEntry,*PInstTableEntry;
typedef struct
{
int Fill,Size;
Boolean Dynamic;
PInstTableEntry Entries;
} TInstTable,*PInstTable;
extern void AddInstTree(PInstTreeNode *Root, char *NName, InstProc NProc, Word NIndex);
extern void ClearInstTree(PInstTreeNode *Root);
extern Boolean SearchInstTree(PInstTreeNode Root, char *OpPart);
extern void PrintInstTree(PInstTreeNode Root);
extern PInstTable CreateInstTable(int TableSize);
extern void SetDynamicInstTable(PInstTable Table);
extern void DestroyInstTable(PInstTable tab);
extern void AddInstTable(PInstTable tab, char *Name, Word Index, InstProc Proc);
extern void RemoveInstTable(PInstTable tab, char *Name);
extern Boolean LookupInstTable(PInstTable tab, char *Name);
extern void PrintInstTable(FILE *stream, PInstTable tab);
extern void asmitree_init(void);

503
asmmac.c Normal file
View File

@ -0,0 +1,503 @@
/* asmmac.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Unterroutinen des Makroprozessors */
/* */
/* Historie: 16. 5.1996 Grundsteinlegung */
/* 1. 7.1998 Korrektur Boyer-Moore-Algorithmus, wenn Ungleichheit */
/* nicht direkt am Ende */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include <ctype.h>
#include "nls.h"
#include "nlmessages.h"
#include "as.rsc"
#include "stringlists.h"
#include "strutil.h"
#include "chunks.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "asmif.h"
#include "asmmac.h"
PInputTag FirstInputTag;
POutputTag FirstOutputTag;
/*=== Praeprozessor =======================================================*/
/*-------------------------------------------------------------------------*/
/* Verwaltung define-Symbole */
static void FreeDefine(PDefinement P)
BEGIN
free(P->TransFrom);
free(P->TransTo);
free(P);
END
static void EnterDefine(char *Name, char *Definition)
BEGIN
PDefinement Neu;
int z,l;
if (NOT ChkSymbName(Name))
BEGIN
WrXError(1020,Name); return;
END;
Neu=FirstDefine;
while (Neu!=Nil)
BEGIN
if (strcmp(Neu->TransFrom,Name)==0)
BEGIN
if (PassNo==1) WrXError(1000,Name); return;
END;
Neu=Neu->Next;
END
Neu=(PDefinement) malloc(sizeof(TDefinement));
Neu->Next=FirstDefine;
Neu->TransFrom=strdup(Name); if (NOT CaseSensitive) NLS_UpString(Neu->TransFrom);
Neu->TransTo=strdup(Definition);
l=strlen(Name);
for (z=0; z<256; Neu->Compiled[z++]=l);
for (z=0; z<l-1; z++) Neu->Compiled[(unsigned int)Neu->TransFrom[z]]=l-(z+1);
FirstDefine=Neu;
END
static void RemoveDefine(char *Name_O)
BEGIN
PDefinement Lauf,Del;
String Name;
strmaxcpy(Name,Name_O,255);
if (NOT CaseSensitive) NLS_UpString(Name);
Del=Nil;
if (FirstDefine!=Nil)
BEGIN
if (strcmp(FirstDefine->TransFrom,Name)==0)
BEGIN
Del=FirstDefine; FirstDefine=FirstDefine->Next;
END
else
BEGIN
Lauf=FirstDefine;
while ((Lauf->Next!=Nil) AND (strcmp(Lauf->Next->TransFrom,Name)!=0))
Lauf=Lauf->Next;
if (Lauf->Next!=Nil)
BEGIN
Del=Lauf->Next; Lauf->Next=Del->Next;
END
END
END
if (Del==Nil) WrXError(1010,Name);
else FreeDefine(Del);
END
void PrintDefineList(void)
BEGIN
PDefinement Lauf;
String OneS;
if (FirstDefine==Nil) return;
NewPage(ChapDepth,True);
WrLstLine(getmessage(Num_ListDefListHead1));
WrLstLine(getmessage(Num_ListDefListHead2));
WrLstLine("");
Lauf=FirstDefine;
while (Lauf!=Nil)
BEGIN
strmaxcpy(OneS,Lauf->TransFrom,255);
strmaxcat(OneS,Blanks(10-(strlen(Lauf->TransFrom)%10)),255);
strmaxcat(OneS," = ",255);
strmaxcat(OneS,Lauf->TransTo,255);
WrLstLine(OneS);
Lauf=Lauf->Next;
END
WrLstLine("");
END
void ClearDefineList(void)
BEGIN
PDefinement Temp;
while (FirstDefine!=Nil)
BEGIN
Temp=FirstDefine; FirstDefine=FirstDefine->Next;
FreeDefine(Temp);
END
END
/*------------------------------------------------------------------------*/
/* Interface */
void Preprocess(void)
BEGIN
String h,Cmd,Arg;
char *p;
p=strchr(OneLine,'#')+1;
strmaxcpy(h,p,255);
p=FirstBlank(h);
if (p==Nil)
BEGIN
strmaxcpy(Cmd,h,255); *h='\0';
END
else SplitString(h,Cmd,h,p);
KillPrefBlanks(h); KillPostBlanks(h);
if (NOT IfAsm) return;
if (strcasecmp(Cmd,"DEFINE")==0)
BEGIN
p=FirstBlank(h);
if (p!=Nil)
BEGIN
SplitString(h,Arg,h,p); KillPrefBlanks(h);
EnterDefine(Arg,h);
END
END
else if (strcasecmp(Cmd,"UNDEF")==0) RemoveDefine(h);
CodeLen=0;
END
static Boolean ExpandDefines_NErl(char inp)
BEGIN
return (((inp>='0') AND (inp<='9')) OR ((inp>='A') AND (inp<='Z')) OR ((inp>='a') AND (inp<='z')));
END
#define t_toupper(ch) ((CaseSensitive) ? (ch) : (toupper(ch)))
void ExpandDefines(char *Line)
BEGIN
PDefinement Lauf;
sint LPos,Diff,p,p2,p3,z,z2,FromLen,ToLen,LineLen;
Lauf=FirstDefine;
while (Lauf!=Nil)
BEGIN
LPos=0; FromLen=strlen(Lauf->TransFrom); ToLen=strlen(Lauf->TransTo);
Diff=ToLen-FromLen;
do
BEGIN
/* Stelle, ab der verbatim, suchen -->p */
p=LPos;
while ((p<strlen(Line)) AND (Line[p]!='\'') AND (Line[p]!='"')) p++;
/* nach Quellstring suchen, ersetzen, bis keine Treffer mehr */
p2=LPos;
do
BEGIN
z2=0;
while ((z2>=0) AND (p2<=p-FromLen))
BEGIN
z2=FromLen-1; z=p2+z2;
while ((z2>=0) AND (t_toupper(Line[z])==Lauf->TransFrom[z2]))
BEGIN
z2--; z--;
END
if (z2>=0) p2+=Lauf->Compiled[(unsigned int)t_toupper(Line[p2+FromLen-1])];
END
if (z2==-1)
BEGIN
if (((p2==0) OR (NOT ExpandDefines_NErl(Line[p2-1])))
AND ((p2+FromLen==p) OR (NOT ExpandDefines_NErl(Line[p2+FromLen]))))
BEGIN
if (Diff!=0)
memmove(Line+p2+ToLen,Line+p2+FromLen,strlen(Line)-p2-FromLen+1);
memcpy(Line+p2,Lauf->TransTo,ToLen);
p+=Diff; /* !!! */
p2+=ToLen;
END
else p2+=FromLen;
END
END
while (z2==-1);
/* Endposition verbatim suchen */
p3=p+1; LineLen=strlen(Line);
while ((p3<LineLen) AND (Line[p3]!=Line[p])) p3++;
/* Zaehler entsprechend herauf */
LPos=p3+1;
END
while (LPos<=LineLen-FromLen);
Lauf=Lauf->Next;
END
END
/*=== Makrolistenverwaltung ===============================================*/
typedef struct _TMacroNode
{
struct _TMacroNode *Left,*Right; /* Soehne im Baum */
ShortInt Balance;
LongInt DefSection; /* Gueltigkeitssektion */
Boolean Defined;
PMacroRec Contents;
} TMacroNode,*PMacroNode;
static PMacroNode MacroRoot;
static Boolean AddMacro_AddNode(PMacroNode *Node, PMacroRec Neu,
LongInt DefSect, Boolean Protest)
BEGIN
Boolean Grown;
PMacroNode p1,p2;
Boolean Result;
int SErg;
ChkStack();
if (*Node==Nil)
BEGIN
*Node=(PMacroNode) malloc(sizeof(TMacroNode));
(*Node)->Left=Nil; (*Node)->Right=Nil;
(*Node)->Balance=0; (*Node)->Defined=True;
(*Node)->DefSection=DefSect; (*Node)->Contents=Neu;
return True;
END
else Result=False;
SErg=StrCmp(Neu->Name,(*Node)->Contents->Name,DefSect,(*Node)->DefSection);
if (SErg>0)
BEGIN
Grown=AddMacro_AddNode(&((*Node)->Right),Neu,DefSect,Protest);
if ((BalanceTree) AND (Grown))
switch ((*Node)->Balance)
BEGIN
case -1:
(*Node)->Balance=0;
break;
case 0:
(*Node)->Balance=1; Result=True;
break;
case 1:
p1=(*Node)->Right;
if (p1->Balance==1)
BEGIN
(*Node)->Right=p1->Left; p1->Left=(*Node);
(*Node)->Balance=0; *Node=p1;
END
else
BEGIN
p2=p1->Left;
p1->Left=p2->Right; p2->Right=p1;
(*Node)->Right=p2->Left; p2->Left=(*Node);
if (p2->Balance== 1) (*Node)->Balance=(-1); else (*Node)->Balance=0;
if (p2->Balance==-1) p1 ->Balance= 1; else p1 ->Balance=0;
*Node=p2;
END
(*Node)->Balance=0;
break;
END
END
else if (SErg<0)
BEGIN
Grown=AddMacro_AddNode(&((*Node)->Left),Neu,DefSect,Protest);
if ((BalanceTree) AND (Grown))
switch ((*Node)->Balance)
BEGIN
case 1:
(*Node)->Balance=0;
break;
case 0:
(*Node)->Balance=(-1); Result=True;
break;
case -1:
p1=(*Node)->Left;
if (p1->Balance==-1)
BEGIN
(*Node)->Left=p1->Right; p1->Right=(*Node);
(*Node)->Balance=0; *Node=p1;
END
else
BEGIN
p2=p1->Right;
p1->Right=p2->Left; p2->Left=p1;
(*Node)->Left=p2->Right; p2->Right=(*Node);
if (p2->Balance==-1) (*Node)->Balance= 1; else (*Node)->Balance=0;
if (p2->Balance== 1) p1 ->Balance=(-1); else p1 ->Balance=0;
*Node=p2;
END
(*Node)->Balance=0;
break;
END
END
else
BEGIN
if ((*Node)->Defined)
if (Protest) WrXError(1815,Neu->Name);
else
BEGIN
ClearMacroRec(&((*Node)->Contents)); (*Node)->Contents=Neu;
(*Node)->DefSection=DefSect;
END
else
BEGIN
ClearMacroRec(&((*Node)->Contents)); (*Node)->Contents=Neu;
(*Node)->DefSection=DefSect; (*Node)->Defined=True;
END
END
return Result;
END
void AddMacro(PMacroRec Neu, LongInt DefSect, Boolean Protest)
BEGIN
if (NOT CaseSensitive) NLS_UpString(Neu->Name);
AddMacro_AddNode(&MacroRoot,Neu,DefSect,Protest);
END
static Boolean FoundMacro_FNode(LongInt Handle,PMacroRec *Erg, char *Part)
BEGIN
PMacroNode Lauf;
int CErg;
Lauf=MacroRoot; CErg=2;
while ((Lauf!=Nil) AND (CErg!=0))
BEGIN
if ((CErg=StrCmp(Part,Lauf->Contents->Name,Handle,Lauf->DefSection))<0) Lauf=Lauf->Left;
else if (CErg>0) Lauf=Lauf->Right;
END
if (Lauf!=Nil) *Erg=Lauf->Contents;
return (Lauf!=Nil);
END
Boolean FoundMacro(PMacroRec *Erg)
BEGIN
PSaveSection Lauf;
String Part;
strmaxcpy(Part,LOpPart,255); if (NOT CaseSensitive) NLS_UpString(Part);
if (FoundMacro_FNode(MomSectionHandle,Erg,Part)) return True;
Lauf=SectionStack;
while (Lauf!=Nil)
BEGIN
if (FoundMacro_FNode(Lauf->Handle,Erg,Part)) return True;
Lauf=Lauf->Next;
END
return False;
END
static void ClearMacroList_ClearNode(PMacroNode *Node)
BEGIN
ChkStack();
if (*Node==Nil) return;
ClearMacroList_ClearNode(&((*Node)->Left));
ClearMacroList_ClearNode(&((*Node)->Right));
ClearMacroRec(&((*Node)->Contents)); free(*Node); *Node=Nil;
END
void ClearMacroList(void)
BEGIN
ClearMacroList_ClearNode(&MacroRoot);
END
static void ResetMacroDefines_ResetNode(PMacroNode Node)
BEGIN
ChkStack();
if (Node==Nil) return;
ResetMacroDefines_ResetNode(Node->Left);
ResetMacroDefines_ResetNode(Node->Right);
Node->Defined=False;
END
void ResetMacroDefines(void)
BEGIN
ResetMacroDefines_ResetNode(MacroRoot);
END
void ClearMacroRec(PMacroRec *Alt)
BEGIN
free((*Alt)->Name);
ClearStringList(&((*Alt)->FirstLine));
free(*Alt); *Alt=Nil;
END
static void PrintMacroList_PNode(PMacroNode Node, LongInt *Sum, Boolean *cnt, char *OneS)
BEGIN
String h;
strmaxcpy(h,Node->Contents->Name,255);
if (Node->DefSection!=-1)
BEGIN
strmaxcat(h,"[",255);
strmaxcat(h,GetSectionName(Node->DefSection),255);
strmaxcat(h,"]",255);
END
strmaxcat(OneS,h,255);
if (strlen(h)<37) strmaxcat(OneS,Blanks(37-strlen(h)),255);
if (NOT (*cnt)) strmaxcat(OneS," | ",255);
else
BEGIN
WrLstLine(OneS); OneS[0]='\0';
END
*cnt=NOT (*cnt); (*Sum)++;
END
static void PrintMacroList_PrintNode(PMacroNode Node, LongInt *Sum, Boolean *cnt, char *OneS)
BEGIN
if (Node==Nil) return;
ChkStack();
PrintMacroList_PrintNode(Node->Left,Sum,cnt,OneS);
PrintMacroList_PNode(Node,Sum,cnt,OneS);
PrintMacroList_PrintNode(Node->Right,Sum,cnt,OneS);
END
void PrintMacroList(void)
BEGIN
String OneS;
Boolean cnt;
LongInt Sum;
if (MacroRoot==Nil) return;
NewPage(ChapDepth,True);
WrLstLine(getmessage(Num_ListMacListHead1));
WrLstLine(getmessage(Num_ListMacListHead2));
WrLstLine("");
OneS[0]='\0'; cnt=False; Sum=0;
PrintMacroList_PrintNode(MacroRoot,&Sum,&cnt,OneS);
if (cnt)
BEGIN
OneS[strlen(OneS)-1]='\0';
WrLstLine(OneS);
END
WrLstLine("");
sprintf(OneS,"%7d",Sum);
strmaxcat(OneS,getmessage((Sum==1)?Num_ListMacSumMsg:Num_ListMacSumsMsg),255);
WrLstLine(OneS);
WrLstLine("");
END
/*=== Eingabefilter Makroprozessor ========================================*/
void asmmac_init(void)
BEGIN
MacroRoot=Nil;
END

105
asmmac.h Normal file
View File

@ -0,0 +1,105 @@
/* asmmac.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Unterroutinen des Makroprozessors */
/* */
/* Historie: 16. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
typedef struct _MacroRec
{
char *Name; /* Name des Makros */
Byte ParamCount; /* Anzahl Parameter */
StringList FirstLine; /* Zeiger auf erste Zeile */
Boolean Used; /* wird gerade benutzt-verhindert Rekusion */
Boolean LocMacExp; /* Makroexpansion wird aufgelistet */
} MacroRec,*PMacroRec;
#define BufferArraySize 1024
typedef struct _TInputTag
{
struct _TInputTag *Next;
Boolean IsMacro;
Integer IfLevel;
Boolean First;
Boolean OrigDoLst;
LongInt StartLine;
Boolean (*Processor)(
#ifdef __PROTOS__
struct _TInputTag *P, char *erg
#endif
);
LongInt ParCnt,ParZ;
StringList Params;
LongInt LineCnt,LineZ;
StringRecPtr Lines;
String SpecName,SaveAttr;
Boolean IsEmpty;
FILE *Datei;
void *Buffer;
void (*Cleanup)(
#ifdef __PROTOS__
struct _TInputTag *P
#endif
);
void (*Restorer)(
#ifdef __PROTOS__
struct _TInputTag *P
#endif
);
Boolean (*GetPos)(
#ifdef __PROTOS__
struct _TInputTag *P, char *Dest
#endif
);
} TInputTag,*PInputTag;
typedef struct _TOutputTag
{
struct _TOutputTag *Next;
void (*Processor)(
#ifdef __PROTOS__
void
#endif
);
Integer NestLevel;
PInputTag Tag;
PMacroRec Mac;
StringList Params;
LongInt PubSect,GlobSect;
Boolean DoExport,DoGlobCopy;
String GName;
} TOutputTag,*POutputTag;
extern PInputTag FirstInputTag;
extern POutputTag FirstOutputTag;
extern void Preprocess(void);
extern void AddMacro(PMacroRec Neu, LongInt DefSect, Boolean Protest);
extern Boolean FoundMacro(PMacroRec *Erg);
extern void ClearMacroList(void);
extern void ResetMacroDefines(void);
extern void ClearMacroRec(PMacroRec *Alt);
extern void PrintMacroList(void);
extern void PrintDefineList(void);
extern void ClearDefineList(void);
extern void ExpandDefines(char *Line);
extern void asmmac_init(void);

3822
asmpars.c Normal file

File diff suppressed because it is too large Load Diff

207
asmpars.h Normal file
View File

@ -0,0 +1,207 @@
/* asmpars.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung von Symbolen und das ganze Drumherum... */
/* */
/* Historie: 5. 5.1996 Grundsteinlegung */
/* 26. 6.1998 Codepages */
/* 16. 8.1998 NoICE-Symbolausgabe */
/* 6.12.1998 UInt14 */
/* 12. 7.1999 angefangen mit externen Symbolen */
/* */
/*****************************************************************************/
typedef enum {UInt1 ,
UInt2 ,
UInt3 ,
SInt4 ,UInt4 , Int4 ,
SInt5 ,UInt5 , Int5 ,
UInt6 ,
SInt7 ,UInt7 ,
SInt8 ,UInt8 , Int8 ,
UInt9 ,
UInt10 , Int10 ,
UInt11 ,
UInt12 , Int12 ,
UInt13 ,
UInt14 ,
UInt15 ,
SInt16 ,UInt16 , Int16 ,
UInt18 ,
SInt20 ,UInt20 , Int20 ,
UInt22 ,
SInt24 ,UInt24 , Int24 ,
SInt32 ,UInt32 , Int32 ,
#ifdef HAS64
Int64 ,
#endif
IntTypeCnt} IntType;
typedef enum {Float32,Float64,Float80,FloatDec,FloatCo,FloatTypeCnt} FloatType;
extern LargeWord IntMasks[IntTypeCnt];
extern LargeInt IntMins[IntTypeCnt];
extern LargeInt IntMaxs[IntTypeCnt];
extern Boolean FirstPassUnknown;
extern Boolean SymbolQuestionable;
extern Boolean UsesForwards;
extern LongInt MomLocHandle;
extern LongInt LocHandleCnt;
extern Boolean BalanceTree;
extern LongInt MomLocHandle;
extern void AsmParsInit(void);
extern Boolean SingleBit(LargeInt Inp, LargeInt *Erg);
extern LargeInt ConstIntVal(char *Asc_O, IntType Typ, Boolean *Ok);
extern Double ConstFloatVal(char *Asc_O, FloatType Typ, Boolean *Ok);
extern void ConstStringVal(char *Asc, char *Erg, Boolean *OK);
extern Boolean RangeCheck(LargeInt Wert, IntType Typ);
extern Boolean FloatRangeCheck(Double Wert, FloatType Typ);
extern Boolean IdentifySection(char *Name, LongInt *Erg);
extern Boolean ExpandSymbol(char *Name);
extern void EnterIntSymbol(char *Name_O, LargeInt Wert, Byte Typ, Boolean MayChange);
extern void EnterExtSymbol(char *Name_O, LargeInt Wert, Byte Typ, Boolean MayChange);
extern void EnterFloatSymbol(char *Name_O, Double Wert, Boolean MayChange);
extern void EnterStringSymbol(char *Name_O, char *Wert, Boolean MayChange);
extern Boolean GetIntSymbol(char *Name, LargeInt *Wert);
extern Boolean GetFloatSymbol(char *Name, Double *Wert);
extern Boolean GetStringSymbol(char *Name, char *Wert);
extern void PrintSymbolList(void);
extern void PrintDebSymbols(FILE *f);
extern void PrintNoISymbols(FILE *f);
extern void PrintSymbolTree(void);
extern void ClearSymbolList(void);
extern void ResetSymbolDefines(void);
extern void PrintSymbolDepth(void);
extern void SetSymbolSize(char *Name, ShortInt Size);
extern ShortInt GetSymbolSize(char *Name);
extern Boolean IsSymbolFloat(char *Name);
extern Boolean IsSymbolString(char *Name);
extern Boolean IsSymbolDefined(char *Name);
extern Boolean IsSymbolUsed(char *Name);
extern Boolean IsSymbolChangeable(char *Name);
extern Integer GetSymbolType(char *Name);
extern void EvalExpression(char *Asc_O, TempResult *Erg);
extern LargeInt EvalIntExpression(char *Asc, IntType Typ, Boolean *OK);
extern Double EvalFloatExpression(char *Asc, FloatType Typ, Boolean *OK);
extern void EvalStringExpression(char *Asc, Boolean *OK, char *Result);
extern Boolean PushSymbol(char *SymName_O, char *StackName_O);
extern Boolean PopSymbol(char *SymName_O, char *StackName_O);
extern void ClearStacks(void);
extern void EnterFunction(char *FName, char *FDefinition, Byte NewCnt);
extern PFunction FindFunction(char *Name);
extern void PrintFunctionList(void);
extern void ClearFunctionList(void);
extern void AddDefSymbol(char *Name, TempResult *Value);
extern void RemoveDefSymbol(char *Name);
extern void CopyDefSymbols(void);
extern void PrintCrossList(void);
extern void ClearCrossList(void);
extern LongInt GetSectionHandle(char *SName_O, Boolean AddEmpt, LongInt Parent);
extern char *GetSectionName(LongInt Handle);
extern void SetMomSection(LongInt Handle);
extern void AddSectionUsage(LongInt Start, LongInt Length);
extern void PrintSectionList(void);
extern void PrintDebSections(FILE *f);
extern void ClearSectionList(void);
extern void SetFlag(Boolean *Flag, char *Name, Boolean Wert);
extern LongInt GetLocHandle(void);
extern void PushLocHandle(LongInt NewLoc);
extern void PopLocHandle(void);
extern void ClearLocStack(void);
extern void AddRegDef(char *Orig, char *Repl);
extern Boolean FindRegDef(char *Name, char **Erg);
extern void TossRegDefs(LongInt Sect);
extern void CleanupRegDefs(void);
extern void ClearRegDefs(void);
extern void PrintRegDefs(void);
extern void ClearCodepages(void);
extern void PrintCodepages(void);
extern void asmpars_init(void);

133
asmrelocs.c Normal file
View File

@ -0,0 +1,133 @@
/* asmrelocs.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung von Relokationslisten */
/* */
/* Historie: 25. 7.1999 Grundsteinlegung */
/* 1. 8.1999 Merge-Funktion implementiert */
/* 8. 8.1999 Reloc-Liste gespeichert */
/* 15. 9.1999 fehlende Includes */
/* Add in Merge */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include "strutil.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmrelocs.h"
/*---------------------------------------------------------------------------*/
PRelocEntry LastRelocs = Nil;
/*---------------------------------------------------------------------------*/
PRelocEntry MergeRelocs(PRelocEntry *list1, PRelocEntry *list2,
Boolean Add)
BEGIN
PRelocEntry PRun1, PRun2, PPrev, PNext, PLast, PRes;
PRun1 = *list1; PLast = PRes = Nil;
/* ueber alle in Liste 1 */
while (PRun1 != Nil)
BEGIN
/* Uebereinstimmung suchen, die sich aufhebt */
PNext = PRun1->Next;
PRun2 = *list2; PPrev = Nil;
while (PRun2 != Nil)
if ((strcasecmp(PRun1->Ref, PRun2->Ref) == 0) AND ((PRun1->Add != PRun2->Add) != Add))
BEGIN
/* gefunden -> beide weg */
free(PRun1->Ref); free(PRun2->Ref);
if (PPrev == Nil) *list2 = PRun2->Next;
else PPrev->Next = PRun2->Next;
free(PRun2); free(PRun1); PRun1 = Nil;
break;
END
else
BEGIN
PPrev = PRun2; PRun2 = PRun2->Next;
END
/* ansonsten an Ergebnisliste anhaengen */
if (PRun1 != Nil)
if (PLast == Nil) PRes = PLast = PRun1;
else
BEGIN
PLast->Next = PRun1; PLast = PRun1;
END
PRun1 = PNext;
END
/* Reste aus Liste 2 nicht vergessen */
if (PLast == Nil) PRes = *list2;
else PLast->Next = *list2;
/* Quellisten jetzt leer */
*list1 = *list2 = Nil;
/* fertich */
return PRes;
END
void InvertRelocs(PRelocEntry *erg, PRelocEntry *src)
BEGIN
PRelocEntry SRun;
for (SRun = *src; SRun != Nil; SRun = SRun->Next)
SRun->Add = NOT (SRun->Add);
*erg = *src;
END
void FreeRelocs(PRelocEntry *list)
BEGIN
PRelocEntry Run;
while (*list != Nil)
BEGIN
Run = *list;
*list = (*list)->Next;
free(Run->Ref);
free(Run);
END
END
PRelocEntry DupRelocs(PRelocEntry src)
BEGIN
PRelocEntry First, Run, SRun, Neu;
First = Run = Nil;
for (SRun = src; SRun != Nil; SRun = SRun->Next)
BEGIN
Neu = (PRelocEntry) malloc(sizeof(TRelocEntry));
Neu->Next = Nil;
Neu->Ref = strdup(SRun->Ref);
Neu->Add = SRun->Add;
if (First == Nil) First = Neu;
else Run->Next = Neu;
Run = Neu;
END
return First;
END
void SetRelocs(PRelocEntry List)
BEGIN
if (LastRelocs != Nil)
BEGIN
WrError(1155);
FreeRelocs(&LastRelocs);
END
LastRelocs = List;
END

22
asmrelocs.h Normal file
View File

@ -0,0 +1,22 @@
/* asmrelocs.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung von Relokationslisten */
/* */
/* Historie: 25. 7.1999 Grundsteinlegung */
/* 8. 8.1999 Reloc-Liste gespeichert */
/*****************************************************************************/
extern PRelocEntry LastRelocs;
extern PRelocEntry MergeRelocs(PRelocEntry *list1, PRelocEntry *list2,
Boolean Add);
extern void InvertRelocs(PRelocEntry *erg, PRelocEntry *src);
extern void FreeRelocs(PRelocEntry *list);
extern PRelocEntry DupRelocs(PRelocEntry src);
extern void SetRelocs(PRelocEntry List);

1526
asmsub.c Normal file

File diff suppressed because it is too large Load Diff

166
asmsub.h Normal file
View File

@ -0,0 +1,166 @@
/* asmsub.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Unterfunktionen, vermischtes */
/* */
/* Historie: 4. 5. 1996 Grundsteinlegung */
/* Historie: 13. 8.1997 KillBlanks-Funktionen nach stringutil.c geschoben */
/* 17. 8.1998 Unterfunktion zur Buchhaltung Adressbereiche */
/* 18. 4.1999 Ausgabeliste Sharefiles */
/* */
/*****************************************************************************/
typedef void (*TSwitchProc)(
#ifdef __PROTOS__
void
#endif
);
extern Word ErrorCount,WarnCount;
extern void AsmSubInit(void);
extern long GTime(void);
extern CPUVar AddCPU(char *NewName, TSwitchProc Switcher);
extern Boolean AddCPUAlias(char *OrigName, char *AliasName);
extern void PrintCPUList(TSwitchProc NxtProc);
extern void ClearCPUList(void);
extern void UpString(char *s);
extern char *QuotPos(char *s, char Zeichen);
extern char *RQuotPos(char *s, char Zeichen);
extern char *FirstBlank(char *s);
extern void SplitString(char *Source, char *Left, char *Right, char *Trenner);
extern void TranslateString(char *s);
extern ShortInt StrCmp(char *s1, char *s2, LongInt Hand1, LongInt Hand2);
/*#define Memo(s) ((*OpPart==*(s)) AND (strcmp(OpPart,(s))==0))*/
#define Memo(s) (strcmp(OpPart,(s))==0)
extern void AddSuffix(char *s, char *Suff);
extern void KillSuffix(char *s);
extern char *NamePart(char *Name);
extern char *PathPart(char *Name);
extern char *FloatString(Double f);
extern void StrSym(TempResult *t, Boolean WithSystem, char *Dest);
extern void ResetPageCounter(void);
extern void NewPage(ShortInt Level, Boolean WithFF);
extern void WrLstLine(char *Line);
extern void SetListLineVal(TempResult *t);
extern LargeWord ProgCounter(void);
extern LargeWord EProgCounter(void);
extern Word Granularity(void);
extern Word ListGran(void);
extern void ChkSpace(Byte Space);
extern void PrintChunk(ChunkList *NChunk);
extern void PrintUseList(void);
extern void ClearUseList(void);
extern void CompressLine(char *TokNam, Byte Num, char *Line);
extern void ExpandLine(char *TokNam, Byte Num, char *Line);
extern void KillCtrl(char *Line);
extern void ChkStack(void);
extern void ResetStack(void);
extern LongWord StackRes(void);
extern void AddCopyright(char *NewLine);
extern void WriteCopyrights(TSwitchProc NxtProc);
extern Boolean ChkSymbName(char *sym);
extern Boolean ChkMacSymbName(char *sym);
extern void WrErrorString(char *Message, char *Add, Boolean Warning, Boolean Fatal);
extern void WrError(Word Num);
extern void WrXError(Word Num, char *Message);
extern Boolean ChkRange(LargeInt Value, LargeInt Min, LargeInt Max);
extern void ChkIO(Word ErrNo);
extern void AddIncludeList(char *NewPath);
extern void RemoveIncludeList(char *RemPath);
extern void ClearOutList(void);
extern void AddToOutList(char *NewName);
extern void RemoveFromOutList(char *OldName);
extern char *GetFromOutList(void);
extern void ClearShareOutList(void);
extern void AddToShareOutList(char *NewName);
extern void RemoveFromShareOutList(char *OldName);
extern char *GetFromShareOutList(void);
extern void BookKeeping(void);
extern long DTime(long t1, long t2);
extern void asmsub_init(void);

46
bincmp.c Normal file
View File

@ -0,0 +1,46 @@
#include <stdio.h>
int main(argc,argv)
int argc;
char **argv;
{
FILE *f1,*f2;
unsigned char c1,c2;
long pos=0;
if (argc!=3)
{
fprintf(stderr,"calling convention: %s <file1> <file2>\n",argv[0]);
return 1;
}
f1=fopen(argv[1],"rb");
if (f1==NULL)
{
perror(argv[1]); return 2;
}
f2=fopen(argv[2],"rb");
if (f2==NULL)
{
perror(argv[2]); return 2;
}
while ((!feof(f1))&&(!feof(f2)))
{
fread(&c1,1,1,f1); fread(&c2,1,1,f2);
if (c1!=c2)
{
fprintf(stderr,"compare error at position %d\n",pos);
fclose(f1); fclose(f2); return 3;
}
pos++;
}
if (feof(f1)!=feof(f2))
{
fprintf(stderr,"files have different sizes\n");
fclose(f1); fclose(f2); return 4;
}
fclose(f1); fclose(f2); return 0;
}

239
bpemu.c Normal file
View File

@ -0,0 +1,239 @@
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Emulation einiger Borland-Pascal-Funktionen */
/* */
/* Historie: 20. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include "strutil.h"
#include "bpemu.h"
#ifdef __MSDOS__
#include <dos.h>
#include <dir.h>
#endif
#if defined( __EMX__ ) || defined( __IBMC__ )
#include <os2.h>
#endif
char *FExpand(char *Src)
BEGIN
static String CurrentDir;
String Copy;
#ifdef DRSEP
String DrvPart;
#if defined( __EMX__ ) || defined( __IBMC__ )
ULONG DrvNum,Dummy;
#else
int DrvNum;
#endif
#endif
char *p,*p2;
strmaxcpy(Copy,Src,255);
#ifdef DRSEP
p=strchr(Copy,DRSEP);
if (p!=Nil)
BEGIN
memcpy(DrvPart,Copy,p-Copy); DrvPart[p-Copy]='\0'; strcpy(Copy,p+1);
END
else *DrvPart='\0';
#endif
#ifdef __MSDOS__
if (*DrvPart=='\0')
BEGIN
DrvNum=getdisk(); *DrvPart=DrvNum+'A'; DrvPart[1]='\0'; DrvNum++;
END
else DrvNum=toupper(*DrvPart)-'@';
getcurdir(DrvNum,CurrentDir);
#else
#if defined( __EMX__ ) || defined( __IBMC__ )
if (*DrvPart=='\0')
BEGIN
DosQueryCurrentDisk(&DrvNum,&Dummy);
*DrvPart=DrvNum+'@'; DrvPart[1]='\0';
END
else DrvNum=toupper(*DrvPart)-'@';
Dummy=255; DosQueryCurrentDir(DrvNum,(PBYTE) CurrentDir,&Dummy);
#else
#ifdef _WIN32
getcwd(CurrentDir,255);
for (p=CurrentDir; *p!='\0'; p++)
if (*p=='/') *p='\\';
#else
getcwd(CurrentDir,255);
#endif
#endif
#endif
if (CurrentDir[strlen(CurrentDir)-1]!=PATHSEP) strmaxcat(CurrentDir,SPATHSEP,255);
if (*CurrentDir!=PATHSEP) strmaxprep(CurrentDir,SPATHSEP,255);
if (*Copy==PATHSEP)
BEGIN
strmaxcpy(CurrentDir,SPATHSEP,255); strcpy(Copy,Copy+1);
END
#ifdef DRSEP
strmaxprep(CurrentDir,SDRSEP,255);
strmaxprep(CurrentDir,DrvPart,255);
#endif
while((p=strchr(Copy,PATHSEP))!=Nil)
BEGIN
*p='\0';
if (strcmp(Copy,".")==0);
else if ((strcmp(Copy,"..")==0) AND (strlen(CurrentDir)>1))
BEGIN
CurrentDir[strlen(CurrentDir)-1]='\0';
p2=strrchr(CurrentDir,PATHSEP); p2[1]='\0';
END
else
BEGIN
strmaxcat(CurrentDir,Copy,255); strmaxcat(CurrentDir,SPATHSEP,255);
END
strcpy(Copy,p+1);
END
strmaxcat(CurrentDir,Copy,255);
return CurrentDir;
END
char *FSearch(char *File, char *Path)
BEGIN
static String Component;
char *p,*start,Save='\0';
FILE *Dummy;
Boolean OK;
Dummy=fopen(File,"r"); OK=(Dummy!=Nil);
if (OK)
BEGIN
fclose(Dummy);
strmaxcpy(Component,File,255); return Component;
END
start=Path;
do
BEGIN
if (*start=='\0') break;
p=strchr(start,DIRSEP);
if (p!=Nil)
BEGIN
Save=(*p); *p='\0';
END
strmaxcpy(Component,start,255);
strmaxcat(Component,SPATHSEP,255);
strmaxcat(Component,File,255);
if (p!=Nil) *p=Save;
Dummy=fopen(Component,"r"); OK=(Dummy!=Nil);
if (OK)
BEGIN
fclose(Dummy);
return Component;
END
start=p+1;
END
while (p!=Nil);
*Component='\0'; return Component;
END
long FileSize(FILE *file)
BEGIN
long Save=ftell(file),Size;
fseek(file,0,SEEK_END);
Size=ftell(file);
fseek(file,Save,SEEK_SET);
return Size;
END
Byte Lo(Word inp)
BEGIN
return (inp&0xff);
END
Byte Hi(Word inp)
BEGIN
return ((inp>>8)&0xff);
END
Boolean Odd(int inp)
BEGIN
return ((inp&1)==1);
END
Boolean DirScan(char *Mask, charcallback callback)
BEGIN
char Name[1024];
#ifdef __MSDOS__
struct ffblk blk;
int res;
char *pos;
res=findfirst(Mask,&blk,FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_LABEL|FA_DIREC|FA_ARCH);
if (res<0) return False;
pos=strrchr(Mask,PATHSEP); if (pos==Nil) pos=strrchr(Mask,DRSEP);
if (pos==Nil) pos=Mask; else pos++;
memcpy(Name,Mask,pos-Mask);
while (res==0)
BEGIN
if ((blk.ff_attrib&(FA_LABEL|FA_DIREC))==0)
BEGIN
strcpy(Name+(pos-Mask),blk.ff_name);
callback(Name);
END
res=findnext(&blk);
END
return True;
#else
#if defined ( __EMX__ ) || defined ( __IBMC__ )
HDIR hdir=1;
FILEFINDBUF3 buf;
ULONG rescnt;
USHORT res;
char *pos;
rescnt=1; res=DosFindFirst(Mask,&hdir,0x16,&buf,sizeof(buf),&rescnt,1);
if (res!=0) return False;
pos=strrchr(Mask,PATHSEP); if (pos==Nil) pos=strrchr(Mask,DRSEP);
if (pos==Nil) pos=Mask; else pos++;
memcpy(Name,Mask,pos-Mask);
while (res==0)
BEGIN
strcpy(Name+(pos-Mask),buf.achName); callback(Name);
res=DosFindNext(hdir,&buf,sizeof(buf),&rescnt);
END
return True;
#else
strmaxcpy(Name,Mask,255); callback(Name); return True;
#endif
#endif
END
LongInt GetFileTime(char *Name)
BEGIN
struct stat st;
if (stat(Name,&st)==-1) return 0;
else return st.st_mtime;
END
void bpemu_init(void)
BEGIN
END

33
bpemu.h Normal file
View File

@ -0,0 +1,33 @@
/* bpemu.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Emulation einiger Borland-Pascal-Funktionen */
/* */
/* Historie: 20. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
typedef void (*charcallback)(
#ifdef __PROTOS__
char *Name
#endif
);
extern char *FExpand(char *Src);
extern char *FSearch(char *File, char *Path);
extern long FileSize(FILE *file);
extern Byte Lo(Word inp);
extern Byte Hi(Word inp);
extern Boolean Odd (int inp);
extern Boolean DirScan(char *Mask, charcallback callback);
extern LongInt GetFileTime(char *Name);
extern void bpemu_init(void);

729
changelog Normal file
View File

@ -0,0 +1,729 @@
------------------------------------------------------------------------------
v1.41r3 Aenderungen: (-->v1.41r4beta)
11.3.1996
- Bugfix : -l - Option funktionierte bei P2HEX nicht.
- Erweiterung : P2HEX/P2BIN koennen Dateiinhalte auf andere Adressen
verschieben.
- Erweiterung : P2HEX kann den Einsprungpunkt auch in Intel-Hex-Files
weitergeben.
- Erweiterung : Kommentare in SHARED-Anweisungen werden in die Share-Datei
weitergegeben.
- Aenderung : Als Kommentarzeichen wird fuer Share-Dateien im Pascal-Modus
(* ... *) anstelle { ... } verwendet. Dies erlaubt es,
die Dateien auch fuer Modula zu verwenden und sollte fuer
Pascal keine Nachteile mit sich bringen.
18.3.1996
- Bugfix : Kodierungsfehler im Z(3)80-Teil behoben:
- MTEST
- LD (IX/IY+n),r16
- MULTW/MULTUW/DIVUW [HL,]IX/IY/imm16
- LD r16,BC
- Bugfix : Fehlermeldungen ueber fehlende/fehlerhafte Key-Datei kamen
in der englischen Version noch auf Deutsch.
25.3.1996
- Bugfix : Erwaehnung der -quiet sowie -alias -Optionen fehlte in der
Online-Hilfe
- Erweiterung : 80C517 als Prozessortyp aufgenommen (+Register in STDDEF51.INC)
9.4.1996
- Erweiterung : MELPS-7700-Teil kennt jetzt auch die 7750er-Befehlssatzer-
weiterungen
6.5.1996
- Bugfix : VERSION-Variable stand noch auf 1.41r2
13.5.1996
- Erweiterung : MELPS-7700-Teil kennt jetzt auch die 7751er-Befehlssatzer-
weiterungen.
- Bugfix : einige haarstraeubende Nichtinitialisierungen von Variablen
beseitigt, die in Zusammenhang mit der Definition von Symbolen
in der Kommandozeile auftreten koennen.
28.5.1996
- Bugfix : Der Z80-Teil hatte bei IX/IY-Displacements ein Byte zu frueh
auf laengere Offsets umgeschaltet.
- Bugfix : Die \i und \h - Escapes funktionierten in Strings nicht.
- Bugfix : Die Bereichseingrenzung fuer 24-Bit-Zahlen war nicht korrekt.
29.5.1996
- Bugfix : Der 68000-Teil schrieb Bloedsinn in die Code-Datei, wenn in
einer Zeile genau ein Byte Code erzeugt wurde.
31.5.1996
- Bugfix : Im MELPS-7700-Teil funktionierten eine Reihe von Befehlen nicht mehr,
wenn man den 7751er als Ziel-CPU einstellte.
- Bugfix : Der SEL-Befehl des MCS-48-Teils gab bei einer falschen
Parameterzahl eine falsche Fehlermeldung aus.
10.6.1996
- Bugfix : bei P2HEX war die Bereichsueberpruefung fuer den
Datenadressbereich des DSK-Formats fehlerhaft
- Bugfix : einige Abfragen auf I/O-Fehler bei P2HEX und P2BIN fehlten
- Bugfix : der SFRB-Befehl gab einen falschen Wert im Listing aus
- Bugfix : BIGENDIAN funktionierte nicht fuer die ganze 8051-Familie,
sondern nur fuer den 80C251
- Bugfix : Bei 16-Bit-immediate-Werten im 8051-Modus war die
Bereichsabfrage nicht korrekt
- Bugfix : Wurde im 8051-Modus bei registerindirekter Adressierung ein
fehlerhafter Registername angegeben, gab es keine Fehlermeldung
- Bugfix : im 8051-Teil war die Benutzung von immediate-Operanden bei PUSH
nicht auf den 80C251 eingeschraenkt
- Bugfix : PUSH/POP DRk beim 80251 erzeugte fehlerhafte Codes
- Bugfix : bei 8051:ACALL/AJMP/ECALL/EJMP waren negative Adressen erlaubt
- Bugfix : im 80251-Modus war JG undefiniert, dafuer lieferte JSLE einen
falschen Opcode
- Bugfix : bei 80251: JMP wurden fuer sehr grosse Distanzen SJMPS erzeugt
- Bugfix : der MCS-51-DJNZ-Befehl gab fuer Distanzueberschreitungen eine
ungenaue Fehlermeldung aus
- Erweiterung : ueber die HAS64-Variable kann man jetzt abfragen, ob der
Parser mit 64 Bit arbeitet
- Erweiterung : DQ kann jetzt auch 64-Bit-Integers ablegen
------------------------------------------------------------------------------
v1.41r4 Aenderungen: (-->v1.41r5beta)
15.7.1996
- Bugfix : lag beim XA ein Normier-/Schiebebefehl mit 32-Bit-Operanden-
laenge auf einer ungeraden Adresse, so dass bei vorangestelltem
Label ein NOP eingeflickt werden musste, so wurde ein falscher
Code erzeugt.
- Bugfix : Im TLCS-900-Teil wurde ein Byte zu frueh auf laengere
Displacements beim Adressierungsmodus (reg+disp) umgeschaltet.
5.8.1996
- Bugfix : noch 1,2 Kleinigkeiten im XA-Teil beseitigt...
12.8.1996
- Bugfix : Der TLCS-900-Teil machte bei der Bearbeitung von 2-Operanden-
ALU-Befehlen (ADD,SUB,CMP...) auch weiter, wenn eine falschen
Anzahl von Parametern angegeben war.
- Bugfix : Im TLCS-900-Teil konnten bei der Benutzung vorwaertsreferen-
zierter Symbole fuer Schiebeamplituden Fehler auftreten
- Erweiterung : Um etwas kompatibler zum AS11 von Motorola zu werden, gibt es
jetzt im 68xx-Modus auch die Befehle FCC, FDB, FCB und RMB.
19.8.1996
- Bugfix : Im 65xx-Teil funktionierten die Angaben < bzw. > zur Er-
zwingung kurzer bzw. langer Adressen nicht korrekt
- Bugfix : INC/INC A bzw. DEC/DEC A funktionierten beim MELPS/740 nicht
26.8.1996
- Bugfix : in PIC16C8x-Teil war die Adressbereichsbegrenzung nicht korrekt
- Erweiterung : zusaetzlich M16C-Familie unterstuetzt
9.9.1996
- Erweiterung : zum M16C gibt es jetzt auch ein Includefile
- Erweiterung : zusaetzlich COP8-Familie unterstuetzt
- Bugfix : wurden im Zx80-Teil ADC oder SBC mit einer falschen
Operandenzahl benutzt, gab es eine falsche Fehlermeldung
- Bugfix : wurden im Z380-Teil INA, INAW, OUTA, OUTAW mit einer Adresse
>2GByte benutzt, konnte es Kodierungsfehler geben
- Erweiterung : zusaetzliche Befehle zur bedingten Assemblierung: IFB und IFNB
- Erweiterung : neuer EXITM-Befehl, um eine Makroexpansion vorzeitig
abzubrechen
- Bugfix : in den englische Fehlermeldungen geisterten noch einige
deutsche Woerter herum
16.9.1996
- Erweiterung : zusaetzlich MSP430 unterstuetzt
- Erweiterung : mit LISTING NOSKIPPED bzw. LISTING PURECODE kann man jetzt
nicht assemblierte Teile aus dem Listing ausschliessen
23.9.1996
- Bugfix : im PowerPC-Teil gab es noch einige Big<->Little-Endian-
Verdrehungen
4.10.1996
- Erweiterung : zusaetzlich 78K0 unterstuetzt
14.10.1996
- Bugfix : wurde beim Wiederholungsfaktor von DC.x die schliessende
Klammer vergessen, so gab es unvorhersagbare Reaktionen
anstatt einer Fehlermeldung
- Bugfix : die Attributabfrage bei PEA in 680x0-Teil war nicht korrekt
- Bugfix : wurde beim 68xx ein inkorrektes Indexregister verwendet, so
wurde kein Fehler gemeldet, sondern absolute Adressierung
erzeugt
- Bugfix : auf b endende Hex-Zahlen mit C-Syntax funktionierten im
RELAXED-Modus nicht
- Bugfix : Prozessornamen COP87L48-->COP87L84 korrigiert
- Bugfix : CBEQ beim 68HC08 erzeugte z.T. auch Code bei falschem
Adressierungsmodus
- Bugfix : P2HEX/P2BIN arbeiteten nicht korrekt bei Adressen > 2GByte
- Erweiterung : zusaetzlicher BINCLUDE-Befehl
- Bugfix : explizit kurze Adressen beim 6809 funktionierten nicht,
wenn DPR<>0 war
- Erweiterung : BIGENDIAN nun auch beim PowerPC
28.10.1996
- Bugfix : Beim 6804 war die Bereichsabfrage nicht korrekt (16 statt 12 Bit)
- Bugfix : Bei DC.x fuer den 68HC12 waren die Bytes paarweise verdreht
- Bugfix : Mit READ in Makros eingelesene Symbole wurden als lokal zum Makro definiert
- Bugfix : Beim 8086 gab es keine Fehlermeldung, wenn die schliessende Klammer (])
eines Adressausdruckes fehlte
- Bugfix : Beim 8086 wurde fuer Displacements von -128 versehentlich lange Adressierung
benutzt
- Bugfix : INS/EXT beim V30/35 erzeugten auch Code , wenn der Adressierungsmodus ungueltig
war
- Bugfix : wurde beim 8085 bei LDAX/STAX ein falsches Register benutzt, gab es eine unsinnige
Fehlermeldung
- Bugfix : Beim 8086 gab es bei falschem Adressierungsmodus in einigen Faellen doppelte
Fehlermeldungen
- Bugfix : Beim PowerPC waren bei MTSPR/MFSPR/MTDCR/MFDCR die 5-Bit-Komponenten der Register-
nummer verdreht
- Bugfix : wurden beim 8086 8-Bit-immediate-Werte mit Vorwaertsreferenzen benutzt, so gab es
in einigen Faellen Fehler wegen Bereichsueberschreitungen
5.11.1996
- Erweiterung : DC.X funktioniert jetzt auch bei 68xx
- Bugfix : wurde beim TLCS90 bei CALL, JMP oder RET eine ungueltige
Bedingung benutzt, gab es keine Fehlermeldung
- Erweiterung : Funktionen TOLOWER, LOWSTRING
11.11.1996 (alaaf...)
- Bugfix : bei MELPS7751 als Ziel funktionierten einige Befehle nicht
- Bugfix : wurde beim Z8 ein ungueltiges Register fuer indizierte Adressierung angegeben,
so gab es eine bloede Fehlermeldung
19.12.1996
- Bugfix : beim H8/300(H): wurde bei Logikanweisungen mit einem C am Ende
die Argumentzahl nicht kontrolliert
- Bugfix : bei 32-bittiger Anzeige im Listing wurden keine Vornullen
ausgegeben
- Bugfix : die relativen Sprungbefehle beim TMS370 erlaubten nur Adressen von
0..255 als Argument
- Bugfix : beim MELPS4500 war versehentlich das DATA-Segment gesperrt
- Bugfix : beim 16C8x war Konstantenablage im Codesegment nur 12-bittig
zugelassen
- Bugfix : bei einem REPT-Argument <1 erfolgte trotzdem ein Durchlauf
- Aenderung : Fehlernummern fuer fatale Fehler wurden von Basis 2000 auf
Basis 10000 geschoben
- Erweiterung : Konstantenablage ist jetzt auch im Codesegment zugelassen
2.1.1997
- Bugfix : beim M16C war die Abfrage auf ungueltige Adressierungsmodi
bei LDE/STE/INC/DEC/NOT/ROT/JMPS/ADJNZ nicht korrekt
- Bugfix : beim MSP gab es keinen Abbruch bei ungueltiger Operandengroesse
- Bugfix : beim MSP gab es keine Fehlermeldung wenn fuer BYTE ein
Float-Argument verwendet wurde
- Bugfix : beim MSP wurde das nicht erlaubte Attribut bei RETI nicht
abgeprueft
- Erweiterung : PADDING geht jetzt auch beim MSP
- Bugfix : die automatische Laengenumschaltung fuer relative Spruenge
arbeitete beim H8/500 fehlerhaft
- Bugfix : beim H8/500 gab es eine falsche Meldung bei absoluten
Adressen ausserhalb der aktuellen Seite
- Bugfix : beim 78C1x war der erlaube Displacement-Bereich in Adressen
zu gross
- Bugfix : Der SER-Befehl beim AVR erzeugte bisweilen keinen Code
- Bugfix : Im 75K0-Teil wurden fuer Prozessoren >=75104 bisweilen
keine Steuerregister akzeptiert
21.1.1997
- Bugfix : wurde ein NEWPAGE-Befehl ohne Argument benutzt, kam
bisweilen keine Reaktion
- Bugfix : bei bitbedingten Sprungbefehlen des XA, die auf einer
ungeraden Adresse mit vorangestelltem Label lagen, gab
es Kodierungsfehler
- Bugfix : wurden mit dem POPU-Befehl des XA gleichzeitig Register
aus der unteren und oberen Haelfte geholt, war die Reihen-
folge der Einzelbefehle nicht spiegelbildlich zu PUSH/PUSHU
- Bugfix : Der MUL-Befehl des 6805 wurde erst fuer den 68HC08 erlaubt
- Bugfix : indizierte Adressierungsarten mit automatischem Inkrement/
Dekrement erzeugten ein falsches Postbyte
------------------------------------------------------------------------------
v1.41r5 Aenderungen: (-->v1.41r6beta)
7.2.1997
- Bugfix : Die BITPOS-Funktion arbeitete nicht korrekt.
- Aenderung : Wird ein Makro in einem mit IF... ausgeschlossenen Teil
referiert, so erfolgt die (MACRO)-Anzeige im Listing
nicht mehr, als Zeichen, dass nicht expandiert wird.
- Bugfix : Die meisten Include-Files arbeiteten im case-sensitiven
Modus nicht korrekt.
- Bugfix : Im TMS-370-Teil waren alle 16-Bit-Teile von Instruktionen
verdreht (little statt big endian) abgelegt.
- Bugfix : Im TMS-370-Teil wurde das #-Zeichen nicht immer akzeptiert.
- Bugfix : Die DIVLU-Instruktion beim 166er war versehentlich als
DIVUL abgelegt.
- Erweiterung : Zusaetzliche Prozessorfamilien: ST9, SC/MP und TMS7000
13.3.1997
- Bugfix : Bei grossen 8051-Programmen konnte es bei den Befehlen
CJNE, DJNZ, JNB, JB und JBC zu out-of-branch-Fehlern
kommen, obwohl das Ziel eigentlich innerhalb der Sprung-
weite lag.
- Erweiterung : Zusaetzliche Prozessorfamilien: MCS-296, TMS9900
17.3.1997
- Erweiterung : neue Z8-Derivate
- Erweiterung : Beruecksichtigung der Maskenfehler des 80C504
24.3.1997
- Bugfix : Die t-Option funktionierte verkehrtherum
- Bugfix : bei grossen 8051-Programmen konnte es bei Vorwaersspruengen
Fehler ueber zu lange Sprungdistanzen geben
- Bugfix : Wenn beim 680x0 die Adressierungsart d16(An) eine Vor-
waertsreferenz enthielt, gab es Fehler.
1.4.1997
- Erweiterung : Schreiben von Debug-Informationen moeglich
- Erweiterung : Includefiles fuer Siemens SAB C501/2/4
- Erweiterung : Includefile fuer 80C163/165 erweitert
5.5.1997
- Erweiterung : Sektionsinfo in Debug-Meldungen
26.5.1997
- Erweiterung : Stack-Verbrauch im Parser reduziert (zu Gunsten der OS/2-
Version)
- Erweiterung : < > >> als Praefixe fuer MELPS-7700 zugelassen
- Erweiterung : DB, DW... auch fuer MELPS-7700 zugelassen
9.6.1997
- Bugfix : BTST akzeptierte kein ueberfluessiges .B Attribut
- Bugfix : der AVR-Teil ist jetzt den offiziellen Typen angepasst
12.6.1997
- Bugfix : Vorwaertsdeklarationen beim 68xx gaben noch Probleme bei
Befehlen, die nur kurze absolute Adressen kennen
------------------------------------------------------------------------------
v1.41r6 Aenderungen: (-->v1.41r7beta)
28.7.1997
- Bugfix : traten keine Fehler auf, so wurde eine alte Error-Log-Datei
nicht beseitigt
- Erweiterung : Ueber die ARCHITECTURE-Variable kann jetzt die Zielplattform
von AS abgefragt werden
- Aenderung : PADDING ist nur noch fuer die 680x0-Familie defaultmaessig
eingeschaltet
11.8.1997
- Erweiterung : Definition von Strukturen ueber STRUCT/ENDSTRUCT
21.8.1997
- Bugfix : beim MELPS7700 wurden fuer DEC abs8 und ICN abs8 gleiche
Opcodes erzeugt
1.9.1997
- Erweiterung : Unterstuetzung des Atmel HEX- und OBJ-Formates
29.9.1997
- Bugfix : Die Operandenreihenfolgen fuer Schiebe- und Immediate-Befehle
beim TMS9900 waren nicht korrekt, und einfache Integerzahlen
als Registerangaben waren nicht erlaubt.
- Erweiterung : Unterstuetzung der 68040-Steuerregister fuer MOVEC
9.10.1997
- Bugfix : CALL beim 80C166 ergab nicht immer korrekte Bedingungs-Codes
20.10.1997
- Bugfix : DUP spielte bei Argumenten <=0 verrueckt
- Erweiterung : STRLEN()-Funktion
- Erweiterung : Registersymbole fuer Atmel AVR
22.10.1997
- Bugfix : Eine Reihe von Kodierungen im 80C251-Teil waren noch verkehrt
27.10.1997
- Erweiterung : P2BIN und P2HEX koennen jetzt optional die Quelldateien nach
Umwandlung loeschen
- Erweiterung : P2BIN kann jetzt dem Image die Startadresse voranstellen
- Erweiterung : Unterstuetzung der undokumentierten 6502-Befehle
17.11.1997
- Erweiterung : 68K-Teil kennt Motorola ColdFire
20.11.1997
- Bugfix : MOVBZ/MOVBS funktionierten in der Kombination 'rn,abs'
nicht
3.12.1997
- Bugfix : BINCLUDE arbeitete nicht korrekt, wenn nur der Offset
angegeben war
12.1.1998
- Bugfix : in REG166.INC war das CAPREL-Register fuer einige 80C16x-
Varianten falsch beschrieben
- Bugfix : EXTP legte fuer 80C16x die Bits in einer falschen Reihenfolge
ab.
26.1.1998
- Erweiterung : Die Pseudo-Befehle BYT/FCB,ADR/FDB und FCC erlauben jetzt auch
den von DC.x her bekannten Wiederholungsfaktor.
- Bugfix : MOVC beim 8051 gab keine Fehlermeldung bei einem ungueltigen
zweiten Parameter aus.
16.1.1998
- Bugfix : BINCLUDE, die zweite...
13.4.1998
- Bugfix : EQU/SET akzeptierten kein leeres Argument, um typenlose Symbole
zu definieren
- Bugfix : LDD/STD beim AVR kamen nicht mit symbolischen Offsets zurecht
- Erweiterung : 320C6x-Support
....
- Bugfix : Ungültige Bitadressen erzeugten z.T. beim 80C16x keine
Fehlermeldungen
- Erweiterung : Registersymbole auch für 80C16x
25.5.1998
- Bugfix : TST ab 68020 funktionierte nicht mit Adreßregister
2.6.1998
- Bugfix : TST ab 68020 funktionierte nicht mit immediate/PC-relativ
- Bugfix : Adressierungsart ([pc]) funktionierte im 68K-Teil nicht
- Bugfix : MTCRF im PowerPC-Teil war nicht korrekt implementiert
- Bugfix : DATA im AVR-Teil verschlampte letztes Argument (nur C-Version)
- Bugfix : In STDDEF60.INC waren einige PPC403-Register falsch definiert
- Bugfix : MOVE vom/zum CCR war als Byte-Operation kodiert
............
- Bugfix : DD und DQ legten Daten immer in Little-Endian ab, egal
von der Einstellung mit BIGENDIAN
------------------------------------------------------------------------------
v1.41r7 Aenderungen: (-->v1.41r8beta)
2.7.1998
- Erweiterung : String-Funktionen STRSUB und STRSTR
- Erweiterung : CODEPAGE-Anweisung
- Bugfix : Manual-Pages machten Probleme mit catman unter Solaris
- Bugfix : Zeilen, die nur aus Label bzw. Kommentar bestanden, wurden
nicht in den Makroprozessoroutput übernommen
- Bugfix : DEFINEs arbeiteten nicht korrekt
- Erweiterung : neue Argumentvarianten für CHARSET
21.8.1998
- Bugfix : einige Bereichsmasken im Parser waren falsch gesetzt
- Erweiterung : Backslash-Ausdrücke in Character/String-Konstanten jetzt
auch in hex oder oktal möglich
- Bugfix : kurze 8051-Bitadressen wurden im 80251-Sourcemodus unnötig
in lange Adressen umgewandelt.
- Aenderung : nicht mit XA-PSW-Bits kollidierende 51er-Flags haben jetzt
wieder die Originalnamen
- Bugfix : Befehle mit genau 20 Argumenten gaben einen Crash
- Erweiterung : RADIX-Befehl zur Festlegung des Default-Zahlensystems
- Erweiterung : statt ELSEIF darf auch ELSE geschrieben werden
- Bugfix : im Testprogramm T_FULL09 wurde an einigen Stellen ELSE statt
ELSEIF benutzt
- Erweiterung : statt = darf auch == geschrieben werden
24.9.1998 [Bld 3]
- Bugfix : Fuer MOV dir8,Rm im 80251-Teil wurde ein falscher Code erzeugt
(Fehler im Manual!)
- Erweiterung : i960-Unterstuetzung
- Erweiterung : NEC uPD7720/25-Unterstützung
- Bugfix : einige Kodierungsfehler im M16C-Teil behoben
18.10.1998 [Bld 4]
- Erweiterung : NEC uPD77230-Unterstützung
- Erweiterung : BRANCHEXT fuer XA funktioniert jetzt auch für BR
- Erweiterung : Fehlermeldungen mit > > > am Anfang
- Bugfix : TRAPA für H8/300H nachgetragen
- Bugfix : LDD/STD mit <Reg>+<Symbol> klappte nicht
25.10.1998 [Bld 5]
- Bugfix : direkt indizierte Adressierung mit 16-Bit-Displacement
ergab ein falsches Postbyte beim 68HC12
10. 1.1999 [Bld 6]
- Bugfix : bei X/Y-Indizierung wurde im 65xx-Teil das Indexregister
nicht sauber abgeprueft
- Erweiterung : SYM53C8xx-Unterstützung
- Erweiterung : i4004-Unterstützung
- Bugfix : Der Adressbereich fuer die neueren 80C166-Derivate stand
noch auf 0-3ffffh statt 0-ffffffh
- Bugfix : Für PIC16C64/84 ist zusätzlich der Adreßbereich von $2000
bis $2007 eingeschaltet. (oder ist das eine Erweiterung?
Ick wees nich...)
- Bugfix : Wenn der vom einem Befehl erzeugte Code über eine Record-
Grenze im P-File hinausging, gab es eine fehlerhafte Folge-
adresse im neuen Record.
- Bugfix : Wenn mit BINCLUDE Daten von mehr als 64K eingezogen wurden
(strenggenommen, wenn BINCLUDE zur Anlage eines neuen
Records in der P-Datei führte), gab es fehlerhafte Adressen
im Record, außerdem fehlte die Prüfung auf Segmentgrenzen-
überschreitung
17. 1.1999 [Bld 7]
- Erweiterung : Der 680x0-Teil legt die Länge äußerer Displacements jetzt
selber fest.
27. 1.1999 [Bld 8]
- Bugfix : Die implizite Erweiterung von Registern auf -paare klappte
nicht auf allen Zielplattformen (680x0)
- Bugfix : SBCD wurde falsch kodiert (680x0)
1. 2.1999 [Bld 9]
- Bugfix : Weil einige Formatstrings nicht portabel waren, knallte
es bisweilen unter DOS/DPMI
8. 2.1999 [Bld 10]
- Bugfix : Eine Reihe von Kodierungsfehlern im M16C-Teil beseitigt
19. 4.1999 [Bld 11]
- Erweiterung : Befehle / Register PPC403-MMU
- Erweiterung : National SC144xx-Support
- Bugfix : Angabe von Symbol-Defines in der Kommandozeile, die nicht
einfache Konstanten sind, konnten zu Abstürzen führen
- Erweiterung : Kommandozeilenoption, um CPU-Typ zu setzen
- Erweiterung : In der Kommandozeile kann ein Key-File referenziert werden
- Erweiterung : In der Kommandozeile kann die Zieldatei für Shared-Definitionen
gesetzt werden
20. 4.1999 [Bld 11]
- Bugfix : Parameterbereich B_RST für Ziel SC14xxx falsch
2. 5.1999 [Bld 12]
- Erweiterung : WRAPMODE-Befehl fuer Atmel AVR
- Änderung : In Atmel-Debugfiles wird für jedes Wort eines Maschinenbefehls ein
Record geschrieben, nicht mehr nur für das erste
6. 7.1999 [Bld 14]
- Erweiterung : Unterstützung der TMS320C20x-Befehlsuntermenge
- Erweiterung : hexadezimale Adressangaben für die Hilfsprogramm können jetzt
auch in C-Notation gemacht werden
- Erweiterung : OUTRADIX-Befehl
- Änderung : Syntax für 4004-Registerpaare ist jetzt R[02468ABCE]R[13579BDF]
- Erweiterung : Unterstützung Fujitsu F²MC8L
- Bugfix : FMOVE <ea>,FPm funktionierte mit <ea> = D1 nicht (680x0)
- Bugfix : FSMOVE und FDMOVE fuer 68040 fehlten noch
- Erweiterung : Kommandozeilenoption für P2HEX, um Minimalgröße S-Records zu
setzen
- Bugfix : -l - Option in P2HEX funktionierte nicht
15. 9.1999 [Bld 15]
- Erweiterung : Fairchild ACE als Prozessorziel
- Bugfix : Probleme mit dem NULL-Device und dem NLS-Support einiger Linux-
Distributionen behoben
- Erweiterung : REG-Statement fuer PowerPCs
- Bugfix : Registerpaarsyntax fuer 4004 korrigiert
- Erweiterung : Minimalrecordlaenge fuer P2HEX

237
chardefs.h Normal file
View File

@ -0,0 +1,237 @@
#ifndef _chardefs_h
#define _chardefs_h
#ifdef CHARSET_ISO8859_1
#define CH_ae "\344"
#define CH_ee "\353"
#define CH_ie "\357"
#define CH_oe "\366"
#define CH_ue "\374"
#define CH_Ae "\304"
#define CH_Ee "\313"
#define CH_Ie "\317"
#define CH_Oe "\326"
#define CH_Ue "\334"
#define CH_sz "\337"
#define CH_e2 "\262"
#define CH_mu "\265"
#define CH_agrave "\340"
#define CH_Agrave "\300"
#define CH_egrave "\350"
#define CH_Egrave "\310"
#define CH_igrave "\354"
#define CH_Igrave "\314"
#define CH_ograve "\362"
#define CH_Ograve "\322"
#define CH_ugrave "\371"
#define CH_Ugrave "\331"
#define CH_aacute "\341"
#define CH_Aacute "\301"
#define CH_eacute "\351"
#define CH_Eacute "\311"
#define CH_iacute "\355"
#define CH_Iacute "\315"
#define CH_oacute "\363"
#define CH_Oacute "\323"
#define CH_uacute "\372"
#define CH_Uacute "\332"
#define CH_acirc "\342"
#define CH_Acirc "\302"
#define CH_ecirc "\352"
#define CH_Ecirc "\312"
#define CH_icirc "\356"
#define CH_Icirc "\316"
#define CH_ocirc "\364"
#define CH_Ocirc "\324"
#define CH_ucirc "\373"
#define CH_Ucirc "\333"
#define CH_ccedil "\347"
#define CH_Ccedil "\307"
#define CH_ntilde "\361"
#define CH_Ntilde "\321"
#define CH_aring "\345"
#define CH_Aring "\305"
#define CH_aelig "\346"
#define CH_Aelig "\306"
#define CH_oslash "\370"
#define CH_Oslash "\330"
#define CH_iquest "\277"
#define CH_iexcl "\241"
#endif
#ifdef CHARSET_IBM437
#define CH_ae "\204"
#define CH_ee "\211"
#define CH_ie "\213"
#define CH_oe "\224"
#define CH_ue "\201"
#define CH_Ae "\216"
#define CH_Ee "Ee"
#define CH_Ie "Ie"
#define CH_Oe "\231"
#define CH_Ue "\232"
#define CH_sz "\341"
#define CH_e2 "\375"
#define CH_mu "\346"
#define CH_agrave "\205"
#define CH_Agrave "`A"
#define CH_egrave "\212"
#define CH_Egrave "`E"
#define CH_igrave "\215"
#define CH_Igrave "`I"
#define CH_ograve "\225"
#define CH_Ograve "`O"
#define CH_ugrave "\227"
#define CH_Ugrave "\`U"
#define CH_aacute "\240"
#define CH_Aacute "'A"
#define CH_eacute "\202"
#define CH_Eacute "\220"
#define CH_iacute "\241"
#define CH_Iacute "'I"
#define CH_oacute "\242"
#define CH_Oacute "'O"
#define CH_uacute "\243"
#define CH_Uacute "'U"
#define CH_acirc "\203"
#define CH_Acirc "^A"
#define CH_ecirc "\210"
#define CH_Ecirc "^E"
#define CH_icirc "\214"
#define CH_Icirc "^I"
#define CH_ocirc "\223"
#define CH_Ocirc "^O"
#define CH_ucirc "\226"
#define CH_Ucirc "\^U"
#define CH_ccedil "\207"
#define CH_Ccedil "\200"
#define CH_ntilde "\244"
#define CH_Ntilde "\245"
#define CH_aring "\206"
#define CH_Aring "\217"
#define CH_aelig "\221"
#define CH_Aelig "\222"
#define CH_oslash "o"
#define CH_Oslash "O"
#define CH_iquest "\250"
#define CH_iexcl "\255"
#endif
#ifdef CHARSET_IBM850
#define CH_ae "\204"
#define CH_ee "\211"
#define CH_ie "\213"
#define CH_oe "\224"
#define CH_ue "\201"
#define CH_Ae "\216"
#define CH_Ee "\323"
#define CH_Ie "\330"
#define CH_Oe "\231"
#define CH_Ue "\232"
#define CH_sz "\341"
#define CH_e2 "\375"
#define CH_mu "\346"
#define CH_agrave "\205"
#define CH_Agrave "\267"
#define CH_egrave "\212"
#define CH_Egrave "\324"
#define CH_igrave "\215"
#define CH_Igrave "\336"
#define CH_ograve "\225"
#define CH_Ograve "\343"
#define CH_ugrave "\227"
#define CH_Ugrave "\353"
#define CH_aacute "\240"
#define CH_Aacute "\265"
#define CH_eacute "\202"
#define CH_Eacute "\220"
#define CH_iacute "\241"
#define CH_Iacute "\326"
#define CH_oacute "\242"
#define CH_Oacute "\340"
#define CH_uacute "\243"
#define CH_Uacute "\351"
#define CH_acirc "\203"
#define CH_Acirc "\266"
#define CH_ecirc "\210"
#define CH_Ecirc "\322"
#define CH_icirc "\214"
#define CH_Icirc "\327"
#define CH_ocirc "\223"
#define CH_Ocirc "\342"
#define CH_ucirc "\226"
#define CH_Ucirc "\352"
#define CH_ccedil "\207"
#define CH_Ccedil "\200"
#define CH_ntilde "\244"
#define CH_Ntilde "\245"
#define CH_aring "\206"
#define CH_Aring "\217"
#define CH_aelig "\221"
#define CH_Aelig "\222"
#define CH_oslash "\233"
#define CH_Oslash "\235"
#define CH_iquest "\250"
#define CH_iexcl "\255"
#endif
#ifdef CHARSET_ASCII7
#define CH_ae "ae"
#define CH_ee "ee"
#define CH_ie "ie"
#define CH_oe "oe"
#define CH_ue "ue"
#define CH_Ae "Ae"
#define CH_Ee "Ee"
#define CH_Ie "Ie"
#define CH_Oe "Oe"
#define CH_Ue "Ue"
#define CH_sz "ss"
#define CH_e2 "^2"
#define CH_mu "u"
#define CH_agrave "`a"
#define CH_Agrave "`A"
#define CH_egrave "`e"
#define CH_Egrave "`E"
#define CH_igrave "`i"
#define CH_Igrave "`I"
#define CH_ograve "`o"
#define CH_Ograve "`O"
#define CH_ugrave "`u"
#define CH_Ugrave "`U"
#define CH_aacute "'a"
#define CH_Aacute "'A"
#define CH_eacute "'e"
#define CH_Eacute "'E"
#define CH_iacute "'i"
#define CH_Iacute "'I"
#define CH_oacute "'o"
#define CH_Oacute "'O"
#define CH_uacute "'u"
#define CH_Uacute "'U"
#define CH_acirc "^a"
#define CH_Acirc "^A"
#define CH_ecirc "^e"
#define CH_Ecirc "^E"
#define CH_icirc "^i"
#define CH_Icirc "^I"
#define CH_ocirc "^o"
#define CH_Ocirc "^O"
#define CH_ucirc "^u"
#define CH_Ucirc "^U"
#define CH_ccedil "c"
#define CH_Ccedil "C"
#define CH_ntilde "~n"
#define CH_Ntilde "~N"
#define CH_aring "a"
#define CH_Aring "A"
#define CH_aelig "ae"
#define CH_Aelig "AE"
#define CH_oslash "o"
#define CH_Oslash "O"
#define CH_iquest "!"
#define CH_iexcl "?"
#endif
#endif /* _chardefs_h */

228
chunks.c Normal file
View File

@ -0,0 +1,228 @@
/* chunks.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung von Adressbereichslisten */
/* */
/* Historie: 16. 5.1996 Grundsteinlegung */
/* 16. 8.1998 Min/Max-Ausgabe */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include "strutil.h"
#include "chunks.h"
/*--------------------------------------------------------------------------*/
/* eine Chunkliste initialisieren */
void InitChunk(ChunkList *NChunk)
BEGIN
NChunk->RealLen=0;
NChunk->AllocLen=0;
NChunk->Chunks=Nil;
END
void ClearChunk(ChunkList *NChunk)
BEGIN
if (NChunk->AllocLen>0) free(NChunk->Chunks);
InitChunk(NChunk);
END
/*--------------------------------------------------------------------------*/
/* eine Chunkliste um einen Eintrag erweitern */
static Boolean Overlap(LargeWord Start1, LargeWord Len1, LargeWord Start2, LargeWord Len2)
BEGIN
return ((Start1==Start2)
OR ((Start2>Start1) AND (Start1+Len1>=Start2))
OR ((Start1>Start2) AND (Start2+Len2>=Start1)));
END
static void SetChunk(OneChunk *NChunk, LargeWord Start1, LargeWord Len1,
LargeWord Start2, LargeWord Len2)
BEGIN
NChunk->Start =min(Start1,Start2);
NChunk->Length=max(Start1+Len1-1,Start2+Len2-1)-NChunk->Start+1;
END
static void IncChunk(ChunkList *NChunk)
BEGIN
if (NChunk->RealLen+1>NChunk->AllocLen)
BEGIN
if (NChunk->RealLen==0)
NChunk->Chunks=(OneChunk *) malloc(sizeof(OneChunk));
else
NChunk->Chunks=(OneChunk *) realloc(NChunk->Chunks,sizeof(OneChunk)*(NChunk->RealLen+1));
NChunk->AllocLen=NChunk->RealLen+1;
END
END
Boolean AddChunk(ChunkList *NChunk, LargeWord NewStart, LargeWord NewLen, Boolean Warn)
BEGIN
Word z,f1=0,f2=0;
Boolean Found;
LongInt PartSum;
Boolean Result;
Result=False;
if (NewLen==0) return Result;
/* herausfinden, ob sich das neue Teil irgendwo mitanhaengen laesst */
Found=False;
for (z=0; z<NChunk->RealLen; z++)
if (Overlap(NewStart,NewLen,NChunk->Chunks[z].Start,NChunk->Chunks[z].Length))
BEGIN
Found=True; f1=z; break;
END
/* Fall 1: etwas gefunden : */
if (Found)
BEGIN
/* gefundene Chunk erweitern */
PartSum=NChunk->Chunks[f1].Length+NewLen;
SetChunk(NChunk->Chunks+f1,NewStart,NewLen,NChunk->Chunks[f1].Start,NChunk->Chunks[f1].Length);
if (Warn)
if (PartSum!=NChunk->Chunks[f1].Length) Result=True;
/* schauen, ob sukzessiv neue Chunks angebunden werden koennen */
do
BEGIN
Found=False;
for (z=1; z<NChunk->RealLen; z++)
if (z!=f1)
if (Overlap(NChunk->Chunks[z].Start,NChunk->Chunks[z].Length,NChunk->Chunks[f1].Start,NChunk->Chunks[f1].Length))
BEGIN
Found=True; f2=z; break;
END
if (Found)
BEGIN
SetChunk(NChunk->Chunks+f1,NChunk->Chunks[f1].Start,NChunk->Chunks[f1].Length,NChunk->Chunks[f2].Start,NChunk->Chunks[f2].Length);
NChunk->Chunks[f2]=NChunk->Chunks[--NChunk->RealLen];
END
END
while (Found);
END
/* ansonsten Feld erweitern und einschreiben */
else
BEGIN
IncChunk(NChunk);
NChunk->Chunks[NChunk->RealLen].Length=NewLen;
NChunk->Chunks[NChunk->RealLen].Start=NewStart;
NChunk->RealLen++;
END
return Result;
END
/*--------------------------------------------------------------------------*/
/* Ein Stueck wieder austragen */
void DeleteChunk(ChunkList *NChunk, LargeWord DelStart, LargeWord DelLen)
BEGIN
Word z;
LargeWord OStart;
if (DelLen==0) return;
z=0;
while (z<=NChunk->RealLen)
BEGIN
if (Overlap(DelStart,DelLen,NChunk->Chunks[z].Start,NChunk->Chunks[z].Length))
BEGIN
if (NChunk->Chunks[z].Start>=DelStart)
if (DelStart+DelLen>=NChunk->Chunks[z].Start+NChunk->Chunks[z].Length)
BEGIN
/* ganz loeschen */
NChunk->Chunks[z]=NChunk->Chunks[--NChunk->RealLen];
END
else
BEGIN
/* unten abschneiden */
OStart=NChunk->Chunks[z].Start; NChunk->Chunks[z].Start=DelStart+DelLen;
NChunk->Chunks[z].Start-=NChunk->Chunks[z].Start-OStart;
END
else
if (DelStart+DelLen>=NChunk->Chunks[z].Start+NChunk->Chunks[z].Length)
BEGIN
/* oben abschneiden */
NChunk->Chunks[z].Length=DelStart-NChunk->Chunks[z].Start;
/* wenn Laenge 0, ganz loeschen */
if (NChunk->Chunks[z].Length==0)
BEGIN
NChunk->Chunks[z]=NChunk->Chunks[--NChunk->RealLen];
END
END
else
BEGIN
/* teilen */
IncChunk(NChunk);
NChunk->Chunks[NChunk->RealLen].Start=DelStart+DelLen;
NChunk->Chunks[NChunk->RealLen].Length=NChunk->Chunks[z].Start+NChunk->Chunks[z].Length-NChunk->Chunks[NChunk->RealLen].Start;
NChunk->Chunks[z].Length=DelStart-NChunk->Chunks[z].Start;
END
END
z++;
END
END
/*--------------------------------------------------------------------------*/
/* Minimaladresse holen */
LargeWord ChunkMin(ChunkList *NChunk)
BEGIN
LongInt z;
LargeWord t=(LargeWord) -1;
if (NChunk->RealLen==0) return 0;
for (z=0; z<NChunk->RealLen; z++)
if (NChunk->Chunks[z].Start<t) t=NChunk->Chunks[z].Start;
return t;
END
/*--------------------------------------------------------------------------*/
/* Maximaladresse holen */
LargeWord ChunkMax(ChunkList *NChunk)
BEGIN
LongInt z;
LargeWord t=(LargeWord) 0;
if (NChunk->RealLen==0) return 0;
for (z=0; z<NChunk->RealLen; z++)
if (NChunk->Chunks[z].Start+NChunk->Chunks[z].Length-1>t)
t=NChunk->Chunks[z].Start+NChunk->Chunks[z].Length-1;
return t;
END
/*--------------------------------------------------------------------------*/
/* Menge holen */
LargeWord ChunkSum(ChunkList *NChunk)
BEGIN
LongInt z;
LargeWord Sum=0;
for (z=0; z<NChunk->RealLen; z++)
Sum+=NChunk->Chunks[z].Length;
return Sum;
END
void chunks_init(void)
BEGIN
END

44
chunks.h Normal file
View File

@ -0,0 +1,44 @@
#ifndef _CHUNKS_H
#define _CHUNKS_H
/* chunks.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verwaltung von Adressbereichslisten */
/* */
/* Historie: 16. 5.1996 Grundsteinlegung */
/* 16. 8.1998 Min/Max-Ausgabe */
/* */
/*****************************************************************************/
typedef struct
{
LargeWord Start,Length;
} OneChunk;
typedef struct
{
Word RealLen,AllocLen;
OneChunk *Chunks;
} ChunkList;
extern Boolean AddChunk(ChunkList *NChunk, LargeWord NewStart, LargeWord NewLen, Boolean Warn);
extern void DeleteChunk(ChunkList *NChunk, LargeWord DelStart, LargeWord DelLen);
extern void InitChunk(ChunkList *NChunk);
extern void ClearChunk(ChunkList *NChunk);
extern LargeWord ChunkMin(ChunkList *NChunk);
extern LargeWord ChunkMax(ChunkList *NChunk);
extern LargeWord ChunkSum(ChunkList *NChunk);
extern void chunks_init(void);
#endif /* _CHUNKS_H */

222
cmdarg.c Normal file
View File

@ -0,0 +1,222 @@
/* cmdarg.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verarbeitung Kommandozeilenparameter */
/* */
/* Historie: 4. 5.1996 Grundsteinlegung */
/* 1. 6.1996 Empty-Funktion */
/* 17. 4.1999 Key-Files in Kommandozeile */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include <ctype.h>
#include "strutil.h"
#include "cmdarg.h"
#include "nls.h"
#include "nlmessages.h"
#include "cmdarg.rsc"
LongInt ParamCount; /* Kommandozeilenparameter */
char **ParamStr;
TMsgCat MsgCat;
static void ClrBlanks(char *tmp)
BEGIN
int cnt;
for (cnt=0; isspace((unsigned int) tmp[cnt]); cnt++);
if (cnt>0) strcpy(tmp,tmp+cnt);
END
Boolean ProcessedEmpty(CMDProcessed Processed)
BEGIN
int z;
for (z=1; z<=ParamCount; z++)
if (Processed[z]) return False;
return True;
END
static void ProcessFile(char *Name_O, CMDRec *Def, Integer Cnt, CMDErrCallback ErrProc);
static CMDResult ProcessParam(CMDRec *Def, Integer Cnt, char *O_Param,
char *O_Next, Boolean AllowLink,
CMDErrCallback ErrProc)
BEGIN
int Start;
Boolean Negate;
int z,Search;
CMDResult TempRes;
String s,Param,Next;
strncpy(Param,O_Param,255);
strncpy(Next,O_Next,255);
if ((*Next == '-') OR (*Next == '+') OR (*Next == '@')) *Next = '\0';
if (*Param == '@')
BEGIN
if (AllowLink)
BEGIN
ProcessFile(Param + 1, Def, Cnt, ErrProc);
return CMDOK;
END
else
BEGIN
fprintf(stderr, "%s\n", catgetmessage(&MsgCat, Num_ErrMsgNoKeyInFile));
return CMDErr;
END
END
if ((*Param == '-') OR (*Param == '+'))
BEGIN
Negate=(*Param=='+'); Start=1;
if (Param[Start]=='#')
BEGIN
for (z=Start+1; z<strlen(Param); z++) Param[z]=toupper(Param[z]);
Start++;
END
else if (Param[Start]=='~')
BEGIN
for (z=Start+1; z<strlen(Param); z++) Param[z]=tolower(Param[z]);
Start++;
END
TempRes=CMDOK;
Search=0;
strncpy(s,Param+Start,255);
for (z=0; z<strlen(s); z++) s[z]=toupper(s[z]);
for (Search=0; Search<Cnt; Search++)
if ((strlen(Def[Search].Ident)>1) AND (strcmp(s,Def[Search].Ident)==0)) break;
if (Search<Cnt)
TempRes=Def[Search].Callback(Negate,Next);
else
for (z=Start; z<strlen(Param); z++)
if (TempRes!=CMDErr)
BEGIN
Search=0;
for (Search=0; Search<Cnt; Search++)
if ((strlen(Def[Search].Ident)==1) AND (Def[Search].Ident[0]==Param[z])) break;
if (Search>=Cnt) TempRes=CMDErr;
else
switch (Def[Search].Callback(Negate,Next))
BEGIN
case CMDErr: TempRes=CMDErr; break;
case CMDArg: TempRes=CMDArg; break;
case CMDOK: break;
case CMDFile: break; /** **/
END
END
return TempRes;
END
else return CMDFile;
END
static void DecodeLine(CMDRec *Def, Integer Cnt, char *OneLine,
CMDErrCallback ErrProc)
BEGIN
int z;
char *EnvStr[256],*start,*p;
int EnvCnt=0;
ClrBlanks(OneLine);
if ((*OneLine!='\0') AND (*OneLine!=';'))
BEGIN
start=OneLine;
while (*start!='\0')
BEGIN
EnvStr[EnvCnt++]=start;
p=strchr(start,' '); if (p==Nil) p=strchr(start, '\t');
if (p!=Nil)
BEGIN
*p='\0'; start=p+1;
while (isspace((unsigned int) *start)) start++;
END
else start+=strlen(start);
END
EnvStr[EnvCnt]=start;
for (z=0; z<EnvCnt; z++)
switch (ProcessParam(Def, Cnt, EnvStr[z], EnvStr[z+1], False, ErrProc))
BEGIN
case CMDErr:
case CMDFile: ErrProc(True,EnvStr[z]); break;
case CMDArg: z++; break;
case CMDOK: break;
END
END
END
static void ProcessFile(char *Name_O, CMDRec *Def, Integer Cnt, CMDErrCallback ErrProc)
BEGIN
FILE *KeyFile;
String Name, OneLine;
strmaxcpy(Name, Name_O, 255);
ClrBlanks(OneLine);
KeyFile=fopen(Name, "r");
if (KeyFile == Nil) ErrProc(True, catgetmessage(&MsgCat, Num_ErrMsgKeyFileNotFound));
while (NOT feof(KeyFile))
BEGIN
errno = 0; ReadLn(KeyFile, OneLine);
if ((errno != 0) AND (NOT feof(KeyFile)))
ErrProc(True, catgetmessage(&MsgCat, Num_ErrMsgKeyFileError));
DecodeLine(Def, Cnt, OneLine, ErrProc);
END
fclose(KeyFile);
END
void ProcessCMD(CMDRec *Def, Integer Cnt, CMDProcessed Unprocessed,
char *EnvName, CMDErrCallback ErrProc)
BEGIN
int z;
String OneLine;
if (getenv(EnvName)==Nil) OneLine[0]='\0';
else strncpy(OneLine,getenv(EnvName),255);
if (OneLine[0]=='@')
ProcessFile(OneLine + 1, Def, Cnt, ErrProc);
else DecodeLine(Def,Cnt,OneLine,ErrProc);
for (z=0; z<=ParamCount; Unprocessed[z++]=(z!=0));
for (z=1; z<=ParamCount; z++)
if (Unprocessed[z])
switch (ProcessParam(Def, Cnt, ParamStr[z], (z < ParamCount) ? ParamStr[z + 1] : "",
True, ErrProc))
BEGIN
case CMDErr: ErrProc(False,ParamStr[z]); break;
case CMDOK: Unprocessed[z]=False; break;
case CMDArg: Unprocessed[z]=Unprocessed[z+1]=False; break;
case CMDFile: break; /** **/
END
END
char *GetEXEName(void)
BEGIN
static String s;
char *pos;
strcpy(s,ParamStr[0]);
do
BEGIN
pos=strchr(s,'/');
if (pos!=Nil) strcpy(s,pos+1);
END
while (pos!=Nil);
pos=strchr(s,'.'); if (pos!=Nil) *pos='\0';
return s;
END
void cmdarg_init(char *ProgPath)
BEGIN
opencatalog(&MsgCat,"cmdarg.msg",ProgPath,MsgId1,MsgId2);
END

46
cmdarg.h Normal file
View File

@ -0,0 +1,46 @@
/* cmdarg.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Verarbeitung Kommandozeilenparameter */
/* */
/* Historie: 4. 5.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
typedef enum {CMDErr,CMDFile,CMDOK,CMDArg} CMDResult;
typedef CMDResult (*CMDCallback)(
#ifdef __PROTOS__
Boolean NegFlag, char *Arg
#endif
);
typedef void (*CMDErrCallback)
(
#ifdef __PROTOS__
Boolean InEnv, char *Arg
#endif
);
typedef struct
{
char Ident[11];
CMDCallback Callback;
} CMDRec;
#define MAXPARAM 256
typedef Boolean CMDProcessed[MAXPARAM+1];
extern LongInt ParamCount;
extern char **ParamStr;
extern Boolean ProcessedEmpty(CMDProcessed Processed);
extern void ProcessCMD(CMDRec *Def, Integer Cnt, CMDProcessed Unprocessed,
char *EnvName, CMDErrCallback ErrProc);
extern char *GetEXEName(void);
extern void cmdarg_init(char *ProgPath);

24
cmdarg.res Normal file
View File

@ -0,0 +1,24 @@
;* decodecmd.res
;*****************************************************************************
;* AS-Portierung *
;* *
;* Definition der Fehlermeldungen, die beim Einlesen auftreten koennen *
;* *
;* Historie: 5. 5.1996 Grundsteinlegung *
;* 18. 4.1999 Fehlermeldung Indirektion im Key-File *
;* *
;*****************************************************************************
Include header.res
Message ErrMsgKeyFileNotFound
"Key-Datei nicht gefunden"
"key file not found"
Message ErrMsgKeyFileError
"Fehler beim Lesen der Key-Datei"
"error reading key file"
Message ErrMsgNoKeyInFile
"Referenz auf Key-Datei in Key-Datei nicht erlaubt"
"no references to a key file from inside a key file"

1697
code166.c Normal file

File diff suppressed because it is too large Load Diff

11
code166.h Normal file
View File

@ -0,0 +1,11 @@
/* code166.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* AS-Codegenerator Siemens 80C16x */
/* */
/* Historie: 11.11.1996 (alaaf) Grundsteinlegung */
/* */
/*****************************************************************************/
extern void code166_init(void);

448
code16c5x.c Normal file
View File

@ -0,0 +1,448 @@
/* code16c5x.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* AS - Codegenerator fuer PIC16C5x */
/* */
/* Historie: 19.8.1996 Grundsteinlegung */
/* 7. 7.1998 Fix Zugriffe auf CharTransTable wg. signed chars */
/* 17. 8.1998 RES mit Bookkeeping */
/* 3. 1.1999 ChkPC-Anpassung */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include "strutil.h"
#include "chunks.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "codepseudo.h"
#include "codevars.h"
typedef struct
{
char *Name;
Word Code;
} FixedOrder;
typedef struct
{
char *Name;
Word Code;
Byte DefaultDir;
} AriOrder;
#define FixedOrderCnt 5
#define LitOrderCnt 5
#define AriOrderCnt 14
#define BitOrderCnt 4
#define FOrderCnt 2
#define D_CPU16C54 0
#define D_CPU16C55 1
#define D_CPU16C56 2
#define D_CPU16C57 3
static FixedOrder *FixedOrders;
static FixedOrder *LitOrders;
static AriOrder *AriOrders;
static FixedOrder *BitOrders;
static FixedOrder *FOrders;
static CPUVar CPU16C54,CPU16C55,CPU16C56,CPU16C57;
/*-------------------------------------------------------------------------*/
static void AddFixed(char *NName, Word NCode)
BEGIN
if (InstrZ>=FixedOrderCnt) exit(255);
FixedOrders[InstrZ].Name=NName;
FixedOrders[InstrZ++].Code=NCode;
END
static void AddLit(char *NName, Word NCode)
BEGIN
if (InstrZ>=LitOrderCnt) exit(255);
LitOrders[InstrZ].Name=NName;
LitOrders[InstrZ++].Code=NCode;
END
static void AddAri(char *NName, Word NCode, Byte NDef)
BEGIN
if (InstrZ>=AriOrderCnt) exit(255);
AriOrders[InstrZ].Name=NName;
AriOrders[InstrZ].Code=NCode;
AriOrders[InstrZ++].DefaultDir=NDef;
END
static void AddBit(char *NName, Word NCode)
BEGIN
if (InstrZ>=BitOrderCnt) exit(255);
BitOrders[InstrZ].Name=NName;
BitOrders[InstrZ++].Code=NCode;
END
static void AddF(char *NName, Word NCode)
BEGIN
if (InstrZ>=FOrderCnt) exit(255);
FOrders[InstrZ].Name=NName;
FOrders[InstrZ++].Code=NCode;
END
static void InitFields(void)
BEGIN
FixedOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*FixedOrderCnt); InstrZ=0;
AddFixed("CLRW" , 0x040);
AddFixed("NOP" , 0x000);
AddFixed("CLRWDT", 0x004);
AddFixed("OPTION", 0x002);
AddFixed("SLEEP" , 0x003);
LitOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*LitOrderCnt); InstrZ=0;
AddLit("ANDLW", 0xe00);
AddLit("IORLW", 0xd00);
AddLit("MOVLW", 0xc00);
AddLit("RETLW", 0x800);
AddLit("XORLW", 0xf00);
AriOrders=(AriOrder *) malloc(sizeof(AriOrder)*AriOrderCnt); InstrZ=0;
AddAri("ADDWF" , 0x1c0, 0);
AddAri("ANDWF" , 0x140, 0);
AddAri("COMF" , 0x240, 1);
AddAri("DECF" , 0x0c0, 1);
AddAri("DECFSZ", 0x2c0, 1);
AddAri("INCF" , 0x280, 1);
AddAri("INCFSZ", 0x3c0, 1);
AddAri("IORWF" , 0x100, 0);
AddAri("MOVF" , 0x200, 0);
AddAri("RLF" , 0x340, 1);
AddAri("RRF" , 0x300, 1);
AddAri("SUBWF" , 0x080, 0);
AddAri("SWAPF" , 0x380, 1);
AddAri("XORWF" , 0x180, 0);
BitOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*BitOrderCnt); InstrZ=0;
AddBit("BCF" , 0x400);
AddBit("BSF" , 0x500);
AddBit("BTFSC", 0x600);
AddBit("BTFSS", 0x700);
FOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*FOrderCnt); InstrZ=0;
AddF("CLRF" , 0x060);
AddF("MOVWF", 0x020);
END
static void DeinitFields(void)
BEGIN
free(FixedOrders);
free(LitOrders);
free(AriOrders);
free(BitOrders);
free(FOrders);
END
/*-------------------------------------------------------------------------*/
static Word ROMEnd(void)
BEGIN
switch (MomCPU-CPU16C54)
BEGIN
case D_CPU16C54:
case D_CPU16C55: return 511;
case D_CPU16C56: return 1023;
case D_CPU16C57: return 2047;
default: return 0;
END
END
static Boolean DecodePseudo(void)
BEGIN
Word Size;
Boolean ValOK;
int z;
TempResult t;
char *p;
LongInt MinV,MaxV;
if (Memo("SFR"))
BEGIN
CodeEquate(SegData,0,0x1f);
return True;
END
if (Memo("RES"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Size=EvalIntExpression(ArgStr[1],Int16,&ValOK);
if (FirstPassUnknown) WrError(1820);
if ((ValOK) AND (NOT FirstPassUnknown))
BEGIN
DontPrint=True;
CodeLen=Size;
BookKeeping();
END
END
return True;
END
if (Memo("DATA"))
BEGIN
MaxV=(ActPC==SegCode)?4095:255; MinV=(-((MaxV+1) >> 1));
if (ArgCnt==0) WrError(1110);
else
BEGIN
ValOK=True;
for (z=1; z<=ArgCnt; z++)
if (ValOK)
BEGIN
FirstPassUnknown=False;
EvalExpression(ArgStr[z],&t);
if ((FirstPassUnknown) AND (t.Typ==TempInt)) t.Contents.Int&=MaxV;
switch (t.Typ)
BEGIN
case TempInt:
if (ChkRange(t.Contents.Int,MinV,MaxV))
if (ActPC==SegCode) WAsmCode[CodeLen++]=t.Contents.Int & MaxV;
else BAsmCode[CodeLen++]=t.Contents.Int & MaxV;
break;
case TempFloat:
WrError(1135); ValOK=False;
break;
case TempString:
for (p=t.Contents.Ascii; *p!='\0'; p++)
if (ActPC==SegCode)
WAsmCode[CodeLen++]=CharTransTable[((usint) *p)&0xff];
else
BAsmCode[CodeLen++]=CharTransTable[((usint) *p)&0xff];
break;
default:
ValOK=False;
END
END
if (NOT ValOK) CodeLen=0;
END
return True;
END
if (Memo("ZERO"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Size=EvalIntExpression(ArgStr[1],Int16,&ValOK);
if (FirstPassUnknown) WrError(1820);
if ((ValOK) AND (NOT FirstPassUnknown))
if ((Size << 1)>MaxCodeLen) WrError(1920);
else
BEGIN
CodeLen=Size;
memset(WAsmCode,0,2*Size);
END
END
return True;
END
return False;
END
static void MakeCode_16C5X(void)
BEGIN
Boolean OK;
Word AdrWord;
int z;
CodeLen=0; DontPrint=False;
/* zu ignorierendes */
if (Memo("")) return;
/* Pseudoanweisungen */
if (DecodePseudo()) return;
/* Anweisungen ohne Argument */
for (z=0; z<FixedOrderCnt; z++)
if (Memo(FixedOrders[z].Name))
BEGIN
if (ArgCnt!=0) WrError(1110);
else
BEGIN
CodeLen=1; WAsmCode[0]=FixedOrders[z].Code;
END
return;
END
/* nur ein Literal als Argument */
for (z=0; z<LitOrderCnt; z++)
if (Memo(LitOrders[z].Name))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],Int8,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]=LitOrders[z].Code+(AdrWord & 0xff);
END
END
return;
END
/* W-mit-f-Operationen */
for (z=0; z<AriOrderCnt; z++)
if (Memo(AriOrders[z].Name))
BEGIN
if ((ArgCnt==0) OR (ArgCnt>2)) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],UInt5,&OK);
if (OK)
BEGIN
ChkSpace(SegData);
WAsmCode[0]=AriOrders[z].Code+(AdrWord & 0x1f);
if (ArgCnt==1)
BEGIN
CodeLen=1; WAsmCode[0]+=AriOrders[z].DefaultDir << 5;
END
else if (strcasecmp(ArgStr[2],"W")==0) CodeLen=1;
else if (strcasecmp(ArgStr[2],"F")==0)
BEGIN
CodeLen=1; WAsmCode[0]+=0x20;
END
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],UInt1,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]+=AdrWord << 5;
END
END
END
END
return;
END
for (z=0; z<BitOrderCnt; z++)
if (Memo(BitOrders[z].Name))
BEGIN
if (ArgCnt!=2) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],UInt3,&OK);
if (OK)
BEGIN
WAsmCode[0]=EvalIntExpression(ArgStr[1],UInt5,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]+=BitOrders[z].Code+(AdrWord << 5);
ChkSpace(SegData);
END
END
END
return;
END
for (z=0; z<FOrderCnt; z++)
if (Memo(FOrders[z].Name))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],UInt5,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]=FOrders[z].Code+AdrWord;
ChkSpace(SegData);
END
END
return;
END
if (Memo("TRIS"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],UInt3,&OK);
if (OK)
if (ChkRange(AdrWord,5,7))
BEGIN
CodeLen=1; WAsmCode[0]=0x000+AdrWord;
ChkSpace(SegData);
END
END
return;
END
if ((Memo("CALL")) OR (Memo("GOTO")))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],UInt16,&OK);
if (OK)
if (AdrWord>ROMEnd()) WrError(1320);
else if ((Memo("CALL")) AND ((AdrWord & 0x100)!=0)) WrError(1905);
else
BEGIN
ChkSpace(SegCode);
if (((ProgCounter() ^ AdrWord) & 0x200)!=0)
WAsmCode[CodeLen++]=0x4a3+((AdrWord & 0x200) >> 1); /* BCF/BSF 3,5 */
if (((ProgCounter() ^ AdrWord) & 0x400)!=0)
WAsmCode[CodeLen++]=0x4c3+((AdrWord & 0x400) >> 2); /* BCF/BSF 3,6 */
if (Memo("CALL")) WAsmCode[CodeLen++]=0x900+(AdrWord & 0xff);
else WAsmCode[CodeLen++]=0xa00+(AdrWord & 0x1ff);
END
END
return;
END;
WrXError(1200,OpPart);
END
static Boolean IsDef_16C5X(void)
BEGIN
return Memo("SFR");
END
static void SwitchFrom_16C5X()
BEGIN
DeinitFields();
END
static void SwitchTo_16C5X(void)
BEGIN
TurnWords=False; ConstMode=ConstModeMoto; SetIsOccupied=False;
PCSymbol="*"; HeaderID=0x71; NOPCode=0x000;
DivideChars=","; HasAttrs=False;
ValidSegs=(1<<SegCode)+(1<<SegData);
Grans[SegCode]=2; ListGrans[SegCode]=2; SegInits[SegCode]=0;
SegLimits[SegCode] = ROMEnd();
Grans[SegData]=1; ListGrans[SegData]=1; SegInits[SegCode]=0;
SegLimits[SegData] = 0x1f;
MakeCode=MakeCode_16C5X; IsDef=IsDef_16C5X;
SwitchFrom=SwitchFrom_16C5X; InitFields();
END
void code16c5x_init(void)
BEGIN
CPU16C54=AddCPU("16C54",SwitchTo_16C5X);
CPU16C55=AddCPU("16C55",SwitchTo_16C5X);
CPU16C56=AddCPU("16C56",SwitchTo_16C5X);
CPU16C57=AddCPU("16C57",SwitchTo_16C5X);
END

12
code16c5x.h Normal file
View File

@ -0,0 +1,12 @@
/* code16c5x.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* AS - Codegenerator fuer PIC16C5x */
/* */
/* Historie: 19.8.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void code16c5x_init(void);

472
code16c8x.c Normal file
View File

@ -0,0 +1,472 @@
/* code16c8x.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* AS-Codegenerator PIC16C8x */
/* */
/* Historie: 21.8.1996 Grundsteinlegung */
/* 7. 7.1998 Fix Zugriffe auf CharTransTable wg. signed chars */
/* 18. 8.1998 Bookkeeping-Aufruf bei RES */
/* 3. 1.1999 ChkPC-Anpassung */
/* Sonderadressbereich PIC16C84 */
/* 2. 10.1999 ChkPC wurde nicht angebunden... */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include "chunks.h"
#include "strutil.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "codepseudo.h"
#include "codevars.h"
/*---------------------------------------------------------------------------*/
typedef struct
{
char *Name;
Word Code;
} FixedOrder;
typedef struct
{
char *Name;
Word Code;
Byte DefaultDir;
} AriOrder;
#define D_CPU16C64 0
#define D_CPU16C84 1
#define FixedOrderCnt 7
#define LitOrderCnt 7
#define AriOrderCnt 14
#define BitOrderCnt 4
#define FOrderCnt 2
static FixedOrder *FixedOrders;
static FixedOrder *LitOrders;
static AriOrder *AriOrders;
static FixedOrder *BitOrders;
static FixedOrder *FOrders;
static CPUVar CPU16C64,CPU16C84;
/*--------------------------------------------------------------------------*/
static void AddFixed(char *NName, Word NCode)
BEGIN
if (InstrZ>=FixedOrderCnt) exit(255);
FixedOrders[InstrZ].Name=NName;
FixedOrders[InstrZ++].Code=NCode;
END
static void AddLit(char *NName, Word NCode)
BEGIN
if (InstrZ>=LitOrderCnt) exit(255);
LitOrders[InstrZ].Name=NName;
LitOrders[InstrZ++].Code=NCode;
END
static void AddAri(char *NName, Word NCode, Byte NDir)
BEGIN
if (InstrZ>=AriOrderCnt) exit(255);
AriOrders[InstrZ].Name=NName;
AriOrders[InstrZ].Code=NCode;
AriOrders[InstrZ++].DefaultDir=NDir;
END
static void AddBit(char *NName, Word NCode)
BEGIN
if (InstrZ>=BitOrderCnt) exit(255);
BitOrders[InstrZ].Name=NName;
BitOrders[InstrZ++].Code=NCode;
END
static void AddF(char *NName, Word NCode)
BEGIN
if (InstrZ>=FOrderCnt) exit(255);
FOrders[InstrZ].Name=NName;
FOrders[InstrZ++].Code=NCode;
END
static void InitFields(void)
BEGIN
FixedOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*FixedOrderCnt); InstrZ=0;
AddFixed("CLRW" , 0x0100);
AddFixed("NOP" , 0x0000);
AddFixed("CLRWDT", 0x0064);
AddFixed("OPTION", 0x0062);
AddFixed("SLEEP" , 0x0063);
AddFixed("RETFIE", 0x0009);
AddFixed("RETURN", 0x0008);
LitOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*LitOrderCnt); InstrZ=0;
AddLit("ADDLW", 0x3e00);
AddLit("ANDLW", 0x3900);
AddLit("IORLW", 0x3800);
AddLit("MOVLW", 0x3000);
AddLit("RETLW", 0x3400);
AddLit("SUBLW", 0x3c00);
AddLit("XORLW", 0x3a00);
AriOrders=(AriOrder *) malloc(sizeof(AriOrder)*AriOrderCnt); InstrZ=0;
AddAri("ADDWF" , 0x0700, 0);
AddAri("ANDWF" , 0x0500, 0);
AddAri("COMF" , 0x0900, 1);
AddAri("DECF" , 0x0300, 1);
AddAri("DECFSZ", 0x0b00, 1);
AddAri("INCF" , 0x0a00, 1);
AddAri("INCFSZ", 0x0f00, 1);
AddAri("IORWF" , 0x0400, 0);
AddAri("MOVF" , 0x0800, 0);
AddAri("RLF" , 0x0d00, 1);
AddAri("RRF" , 0x0c00, 1);
AddAri("SUBWF" , 0x0200, 0);
AddAri("SWAPF" , 0x0e00, 1);
AddAri("XORWF" , 0x0600, 0);
BitOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*BitOrderCnt); InstrZ=0;
AddBit("BCF" , 0x1000);
AddBit("BSF" , 0x1400);
AddBit("BTFSC", 0x1800);
AddBit("BTFSS", 0x1c00);
FOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*FOrderCnt); InstrZ=0;
AddF("CLRF" , 0x0180);
AddF("MOVWF", 0x0080);
END
static void DeinitFields(void)
BEGIN
free(FixedOrders);
free(LitOrders);
free(AriOrders);
free(BitOrders);
free(FOrders);
END
/*--------------------------------------------------------------------------*/
static Word ROMEnd(void)
BEGIN
switch (MomCPU-CPU16C64)
BEGIN
case D_CPU16C64: return 0x7ff;
case D_CPU16C84: return 0x3ff;
default: return 0;
END
END
static Word EvalFExpression(char *Asc, Boolean *OK)
BEGIN
LongInt h;
h=EvalIntExpression(Asc,UInt9,OK);
if (*OK)
BEGIN
ChkSpace(SegData); return (h & 0x7f);
END
else return 0;
END
static Boolean DecodePseudo(void)
BEGIN
Word Size;
Boolean ValOK;
int z;
char *p;
TempResult t;
LongInt MinV,MaxV;
if (Memo("SFR"))
BEGIN
CodeEquate(SegData,0,511);
return True;
END
if (Memo("RES"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Size=EvalIntExpression(ArgStr[1],Int16,&ValOK);
if (FirstPassUnknown) WrError(1820);
if ((ValOK) AND (NOT FirstPassUnknown))
BEGIN
DontPrint=True;
CodeLen=Size;
BookKeeping();
END
END
return True;
END
if (Memo("DATA"))
BEGIN
MaxV=(ActPC==SegCode)?16383:255; MinV=(-((MaxV+1) >> 1));
if (ArgCnt==0) WrError(1110);
else
BEGIN
ValOK=True;
for (z=1; z<=ArgCnt; z++)
if (ValOK)
BEGIN
FirstPassUnknown=False;
EvalExpression(ArgStr[z],&t);
if ((FirstPassUnknown) AND (t.Typ==TempInt)) t.Contents.Int&=MaxV;
switch (t.Typ)
BEGIN
case TempInt:
if (ChkRange(t.Contents.Int,MinV,MaxV))
if (ActPC==SegCode) WAsmCode[CodeLen++]=t.Contents.Int & MaxV;
else BAsmCode[CodeLen++]=t.Contents.Int & MaxV;
break;
case TempFloat:
WrError(1135); ValOK=False;
break;
case TempString:
for (p=t.Contents.Ascii; *p!='\0'; p++)
if (ActPC==SegCode)
WAsmCode[CodeLen++]=CharTransTable[((usint) *p)&0xff];
else
BAsmCode[CodeLen++]=CharTransTable[((usint) *p)&0xff];
break;
default:
ValOK=False;
END
END
if (NOT ValOK) CodeLen=0;
END
return True;
END
if (Memo("ZERO"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Size=EvalIntExpression(ArgStr[1],Int16,&ValOK);
if (FirstPassUnknown) WrError(1820);
if ((ValOK) AND (NOT FirstPassUnknown))
if (Size << 1>MaxCodeLen) WrError(1920);
else
BEGIN
CodeLen=Size;
memset(WAsmCode,0,2*Size);
END
END
return True;
END
return False;
END
static void MakeCode_16c8x(void)
BEGIN
Boolean OK;
Word AdrWord;
int z;
CodeLen=0; DontPrint=False;
/* zu ignorierendes */
if (Memo("")) return;
/* Pseudoanweisungen */
if (DecodePseudo()) return;
/* Anweisungen ohne Argument */
for (z=0; z<FixedOrderCnt; z++)
if (Memo(FixedOrders[z].Name))
BEGIN
if (ArgCnt!=0) WrError(1110);
else
BEGIN
CodeLen=1; WAsmCode[0]=FixedOrders[z].Code;
if (Memo("OPTION")) WrError(130);
END
return;
END
/* nur ein Literal als Argument */
for (z=0; z<LitOrderCnt; z++)
if (Memo(LitOrders[z].Name))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],Int8,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]=LitOrders[z].Code+(AdrWord & 0xff);
END
END
return;
END
/* W-mit-f-Operationen */
for (z=0; z<AriOrderCnt; z++)
if (Memo(AriOrders[z].Name))
BEGIN
if ((ArgCnt==0) OR (ArgCnt>2)) WrError(1110);
else
BEGIN
AdrWord=EvalFExpression(ArgStr[1],&OK);
if (OK)
BEGIN
WAsmCode[0]=AriOrders[z].Code+AdrWord;
if (ArgCnt==1)
BEGIN
CodeLen=1; WAsmCode[0]+=AriOrders[z].DefaultDir << 7;
END
else if (strcasecmp(ArgStr[2],"W")==0) CodeLen=1;
else if (strcasecmp(ArgStr[2],"F")==0)
BEGIN
CodeLen=1; WAsmCode[0]+=0x80;
END
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],UInt1,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]+=AdrWord << 7;
END
END
END
END
return;
END
for (z=0; z<BitOrderCnt; z++)
if (Memo(BitOrders[z].Name))
BEGIN
if (ArgCnt!=2) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],UInt3,&OK);
if (OK)
BEGIN
WAsmCode[0]=EvalFExpression(ArgStr[1],&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]+=BitOrders[z].Code+(AdrWord << 7);
END
END
END
return;
END
for (z=0; z<FOrderCnt; z++)
if (Memo(FOrders[z].Name))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalFExpression(ArgStr[1],&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]=FOrders[z].Code+AdrWord;
END
END
return;
END
if (Memo("TRIS"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
AdrWord=EvalIntExpression(ArgStr[1],UInt3,&OK);
if (FirstPassUnknown) AdrWord=5;
if (OK)
if (ChkRange(AdrWord,5,6))
BEGIN
CodeLen=1; WAsmCode[0]=0x0060+AdrWord;
ChkSpace(SegData); WrError(130);
END
END
return;
END
if ((Memo("CALL")) OR (Memo("GOTO")))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],Int16,&OK);
if (OK)
if (AdrWord>ROMEnd()) WrError(1320);
else
BEGIN
ChkSpace(SegCode);
if (((ProgCounter() ^ AdrWord) & 0x800)!=0)
WAsmCode[CodeLen++]=0x118a+((AdrWord & 0x800) >> 1); /* BCF/BSF 10,3 */
if (((ProgCounter() ^ AdrWord) & 0x1000)!=0)
WAsmCode[CodeLen++]=0x120a+((AdrWord & 0x400) >> 2); /* BCF/BSF 10,4 */
if (Memo("CALL")) WAsmCode[CodeLen++]=0x2000+(AdrWord & 0x7ff);
else WAsmCode[CodeLen++]=0x2800+(AdrWord & 0x7ff);
END
END
return;
END
WrXError(1200,OpPart);
END
static Boolean IsDef_16c8x(void)
BEGIN
return (Memo("SFR"));
END
static Boolean ChkPC_16c8x(LargeWord Addr)
BEGIN
if ((ActPC == SegCode) AND (Addr > SegLimits[SegCode]))
BEGIN
return ((Addr >= 0x2000) AND (Addr <= 0x2007));
END
else return (Addr <= SegLimits[ActPC]);
END
static void SwitchFrom_16c8x(void)
BEGIN
DeinitFields();
END
static void SwitchTo_16c8x(void)
BEGIN
TurnWords=False; ConstMode=ConstModeMoto; SetIsOccupied=False;
PCSymbol="*"; HeaderID=0x70; NOPCode=0x0000;
DivideChars=","; HasAttrs=False;
ValidSegs=(1<<SegCode)+(1<<SegData);
Grans[SegCode]=2; ListGrans[SegCode]=2; SegInits[SegCode]=0;
SegLimits[SegCode] = ROMEnd() + 0x300;
Grans[SegData]=1; ListGrans[SegData]=1; SegInits[SegData]=0;
SegLimits[SegData] = 0x1ff;
ChkPC = ChkPC_16c8x;
MakeCode=MakeCode_16c8x; IsDef=IsDef_16c8x;
SwitchFrom=SwitchFrom_16c8x; InitFields();
END
void code16c8x_init(void)
BEGIN
CPU16C64=AddCPU("16C64",SwitchTo_16c8x);
CPU16C84=AddCPU("16C84",SwitchTo_16c8x);
END

11
code16c8x.h Normal file
View File

@ -0,0 +1,11 @@
/* code16c8x.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* AS-Codegenerator PIC16C8x */
/* */
/* Historie: 21.8.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void code16c8x_init(void);

521
code17c4x.c Normal file
View File

@ -0,0 +1,521 @@
/* code17c4x.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Codegenerator PIC17C4x */
/* */
/* Historie: 21.8.1996 Grundsteinlegung */
/* 7. 7.1998 Fix Zugriffe auf CharTransTable wg. signed chars */
/* 18. 8.1998 Bookkeeping-Aufruf in RES */
/* 3. 1.1999 ChkPC-Anpassung */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include <ctype.h>
#include "bpemu.h"
#include "strutil.h"
#include "chunks.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "codepseudo.h"
#include "codevars.h"
/*---------------------------------------------------------------------------*/
typedef struct
{
char *Name;
Word Code;
} FixedOrder;
typedef struct
{
char *Name;
Word DefaultDir;
Word Code;
} AriOrder;
#define FixedOrderCnt 5
#define LittOrderCnt 8
#define AriOrderCnt 23
#define BitOrderCnt 5
#define FOrderCnt 5
/*---------------------------------------------------------------------------*/
static FixedOrder *FixedOrders;
static FixedOrder *LittOrders;
static AriOrder *AriOrders;
static FixedOrder *BitOrders;
static FixedOrder *FOrders;
static CPUVar CPU17C42;
/*---------------------------------------------------------------------------*/
static void AddFixed(char *NName, Word NCode)
BEGIN
if (InstrZ>=FixedOrderCnt) exit(255);
FixedOrders[InstrZ].Name=NName;
FixedOrders[InstrZ++].Code=NCode;
END
static void AddLitt(char *NName, Word NCode)
BEGIN
if (InstrZ>=LittOrderCnt) exit(255);
LittOrders[InstrZ].Name=NName;
LittOrders[InstrZ++].Code=NCode;
END
static void AddAri(char *NName, Word NDef, Word NCode)
BEGIN
if (InstrZ>=AriOrderCnt) exit(255);
AriOrders[InstrZ].Name=NName;
AriOrders[InstrZ].Code=NCode;
AriOrders[InstrZ++].DefaultDir=NDef;
END
static void AddBit(char *NName, Word NCode)
BEGIN
if (InstrZ>=BitOrderCnt) exit(255);
BitOrders[InstrZ].Name=NName;
BitOrders[InstrZ++].Code=NCode;
END
static void AddF(char *NName, Word NCode)
BEGIN
if (InstrZ>=FOrderCnt) exit(255);
FOrders[InstrZ].Name=NName;
FOrders[InstrZ++].Code=NCode;
END
static void InitFields(void)
BEGIN
FixedOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*FixedOrderCnt); InstrZ=0;
AddFixed("RETFIE", 0x0005);
AddFixed("RETURN", 0x0002);
AddFixed("CLRWDT", 0x0004);
AddFixed("NOP" , 0x0000);
AddFixed("SLEEP" , 0x0003);
LittOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*LittOrderCnt); InstrZ=0;
AddLitt("MOVLB", 0xb800);
AddLitt("ADDLW", 0xb100);
AddLitt("ANDLW", 0xb500);
AddLitt("IORLW", 0xb300);
AddLitt("MOVLW", 0xb000);
AddLitt("SUBLW", 0xb200);
AddLitt("XORLW", 0xb400);
AddLitt("RETLW", 0xb600);
AriOrders=(AriOrder *) malloc(sizeof(AriOrder)*AriOrderCnt); InstrZ=0;
AddAri("ADDWF" , 0, 0x0e00);
AddAri("ADDWFC", 0, 0x1000);
AddAri("ANDWF" , 0, 0x0a00);
AddAri("CLRF" , 1, 0x2800);
AddAri("COMF" , 1, 0x1200);
AddAri("DAW" , 1, 0x2e00);
AddAri("DECF" , 1, 0x0600);
AddAri("INCF" , 1, 0x1400);
AddAri("IORWF" , 0, 0x0800);
AddAri("NEGW" , 1, 0x2c00);
AddAri("RLCF" , 1, 0x1a00);
AddAri("RLNCF" , 1, 0x2200);
AddAri("RRCF" , 1, 0x1800);
AddAri("RRNCF" , 1, 0x2000);
AddAri("SETF" , 1, 0x2a00);
AddAri("SUBWF" , 0, 0x0400);
AddAri("SUBWFB", 0, 0x0200);
AddAri("SWAPF" , 1, 0x1c00);
AddAri("XORWF" , 0, 0x0c00);
AddAri("DECFSZ", 1, 0x1600);
AddAri("DCFSNZ", 1, 0x2600);
AddAri("INCFSZ", 1, 0x1e00);
AddAri("INFSNZ", 1, 0x2400);
BitOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*BitOrderCnt); InstrZ=0;
AddBit("BCF" , 0x8800);
AddBit("BSF" , 0x8000);
AddBit("BTFSC", 0x9800);
AddBit("BTFSS", 0x9000);
AddBit("BTG" , 0x3800);
FOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*FOrderCnt); InstrZ=0;
AddF("MOVWF" , 0x0100);
AddF("CPFSEQ", 0x3100);
AddF("CPFSGT", 0x3200);
AddF("CPFSLT", 0x3000);
AddF("TSTFSZ", 0x3300);
END
static void DeinitFields(void)
BEGIN
free(FixedOrders);
free(LittOrders);
free(AriOrders);
free(BitOrders);
free(FOrders);
END
/*---------------------------------------------------------------------------*/
static Boolean DecodePseudo(void)
BEGIN
Word Size;
Boolean ValOK;
int z,z2;
TempResult t;
LongInt MinV,MaxV;
if (Memo("SFR"))
BEGIN
CodeEquate(SegData,0,0xff);
return True;
END
if (Memo("RES"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Size=EvalIntExpression(ArgStr[1],Int16,&ValOK);
if (FirstPassUnknown) WrError(1820);
if ((ValOK) AND (NOT FirstPassUnknown))
BEGIN
DontPrint=True;
CodeLen=Size;
BookKeeping();
END
END
return True;
END
if (Memo("DATA"))
BEGIN
MaxV=(ActPC==SegCode)?65535:255; MinV=(-((MaxV+1) >> 1));
if (ArgCnt==0) WrError(1110);
else
BEGIN
ValOK=True;
for (z=1; z<=ArgCnt; z++)
if (ValOK)
BEGIN
FirstPassUnknown=False;
EvalExpression(ArgStr[z],&t);
if ((FirstPassUnknown) AND (t.Typ==TempInt)) t.Contents.Int&=MaxV;
switch (t.Typ)
BEGIN
case TempInt:
if (ChkRange(t.Contents.Int,MinV,MaxV))
if (ActPC==SegCode) WAsmCode[CodeLen++]=t.Contents.Int;
else BAsmCode[CodeLen++]=t.Contents.Int;
break;
case TempFloat:
WrError(1135); ValOK=False;
break;
case TempString:
for (z2=0; z2<strlen(t.Contents.Ascii); z2++)
BEGIN
Size=CharTransTable[((usint) t.Contents.Ascii[z2])&0xff];
if (ActPC==SegData) BAsmCode[CodeLen++]=Size;
else if ((z2&1)==0) WAsmCode[CodeLen++]=Size;
else WAsmCode[CodeLen-1]+=Size<<8;
END
break;
default: ValOK=False;
END
END
if (NOT ValOK) CodeLen=0;
END
return True;
END
if (Memo("ZERO"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Size=EvalIntExpression(ArgStr[1],Int16,&ValOK);
if (FirstPassUnknown) WrError(1820);
if ((ValOK) AND (NOT FirstPassUnknown))
if ((Size << 1)>MaxCodeLen) WrError(1920);
else
BEGIN
CodeLen=Size;
memset(WAsmCode,0,2*Size);
END
END
return True;
END
return False;
END
static void MakeCode_17c4x(void)
BEGIN
Boolean OK;
Word AdrWord;
int z;
CodeLen=0; DontPrint=False;
/* zu ignorierendes */
if (Memo("")) return;
/* Pseudoanweisungen */
if (DecodePseudo()) return;
/* kein Argument */
for (z=0; z<FixedOrderCnt; z++)
if (Memo(FixedOrders[z].Name))
BEGIN
if (ArgCnt!=0) WrError(1110);
else
BEGIN
CodeLen=1; WAsmCode[0]=FixedOrders[z].Code;
END
return;
END
/* konstantes Argument */
for (z=0; z<LittOrderCnt; z++)
if (Memo(LittOrders[z].Name))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],Int8,&OK);
if (OK)
BEGIN
WAsmCode[0]=LittOrders[z].Code+(AdrWord & 0xff); CodeLen=1;
END
END
return;
END
/* W-mit-f-Operationen */
for (z=0; z<AriOrderCnt; z++)
if (Memo(AriOrders[z].Name))
BEGIN
if ((ArgCnt==0) OR (ArgCnt>2)) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],Int8,&OK);
if (OK)
BEGIN
ChkSpace(SegData);
WAsmCode[0]=AriOrders[z].Code+(AdrWord & 0xff);
if (ArgCnt==1)
BEGIN
CodeLen=1; WAsmCode[0]+=AriOrders[z].DefaultDir << 8;
END
else if (strcasecmp(ArgStr[2],"W")==0) CodeLen=1;
else if (strcasecmp(ArgStr[2],"F")==0)
BEGIN
CodeLen=1; WAsmCode[0]+=0x100;
END
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],UInt1,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]+=(AdrWord << 8);
END
END
END
END
return;
END
/* Bitoperationen */
for (z=0; z<BitOrderCnt; z++)
if (Memo(BitOrders[z].Name))
BEGIN
if (ArgCnt!=2) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],UInt3,&OK);
if (OK)
BEGIN
WAsmCode[0]=EvalIntExpression(ArgStr[1],Int8,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]+=BitOrders[z].Code+(AdrWord << 8);
ChkSpace(SegData);
END
END
END
return;
END
/* Register als Operand */
for (z=0; z<FOrderCnt; z++)
if (Memo(FOrders[z].Name))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],Int8,&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]=FOrders[z].Code+AdrWord;
ChkSpace(SegData);
END
END
return;
END
if ((Memo("MOVFP")) OR (Memo("MOVPF")))
BEGIN
if (ArgCnt!=2) WrError(1110);
else
BEGIN
if (Memo("MOVFP"))
BEGIN
strcpy(ArgStr[3],ArgStr[1]);
strcpy(ArgStr[1],ArgStr[2]);
strcpy(ArgStr[2],ArgStr[3]);
END
AdrWord=EvalIntExpression(ArgStr[1],UInt5,&OK);
if (OK)
BEGIN
WAsmCode[0]=EvalIntExpression(ArgStr[2],Int8,&OK);
if (OK)
BEGIN
WAsmCode[0]=Lo(WAsmCode[0])+(AdrWord << 8)+0x4000;
if (Memo("MOVFP")) WAsmCode[0]+=0x2000;
CodeLen=1;
END
END
END
return;
END
if ((Memo("TABLRD")) OR (Memo("TABLWT")))
BEGIN
if (ArgCnt!=3) WrError(1110);
else
BEGIN
WAsmCode[0]=Lo(EvalIntExpression(ArgStr[3],Int8,&OK));
if (OK)
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],UInt1,&OK);
if (OK)
BEGIN
WAsmCode[0]+=AdrWord << 8;
AdrWord=EvalIntExpression(ArgStr[1],UInt1,&OK);
if (OK)
BEGIN
WAsmCode[0]+=0xa800+(AdrWord << 9);
if (Memo("TABLWT")) WAsmCode[0]+=0x400;
CodeLen=1;
END
END
END
END;
return;
END
if ((Memo("TLRD")) OR (Memo("TLWT")))
BEGIN
if (ArgCnt!=2) WrError(1110);
else
BEGIN
WAsmCode[0]=Lo(EvalIntExpression(ArgStr[2],Int8,&OK));
if (OK)
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],UInt1,&OK);
if (OK)
BEGIN
WAsmCode[0]+=(AdrWord << 9)+0xa000;
if (Memo("TLWT")) WAsmCode[0]+=0x400;
CodeLen=1;
END
END
END
return;
END
if ((Memo("CALL")) OR (Memo("GOTO")))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],UInt16,&OK);
if (OK)
if (((ProgCounter() ^ AdrWord) & 0xe000)!=0) WrError(1910);
else
BEGIN
WAsmCode[0]=0xc000+(AdrWord & 0x1fff);
if (Memo("CALL")) WAsmCode[0]+=0x2000;
CodeLen=1;
END
END
return;
END
if (Memo("LCALL"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[1],UInt16,&OK);
if (OK)
BEGIN
CodeLen=3;
WAsmCode[0]=0xb000+Hi(AdrWord);
WAsmCode[1]=0x0103;
WAsmCode[2]=0xb700+Lo(AdrWord);
END
END
return;
END
WrXError(1200,OpPart);
END
static Boolean IsDef_17c4x(void)
BEGIN
return Memo("SFR");
END
static void SwitchFrom_17c4x(void)
BEGIN
DeinitFields();
END
static void SwitchTo_17c4x(void)
BEGIN
TurnWords=False; ConstMode=ConstModeMoto; SetIsOccupied=False;
PCSymbol="*"; HeaderID=0x72; NOPCode=0x0000;
DivideChars=","; HasAttrs=False;
ValidSegs=(1<<SegCode)+(1<<SegData);
Grans[SegCode]=2; ListGrans[SegCode]=2; SegInits[SegCode]=0;
SegLimits[SegCode] = 0xffff;
Grans[SegData]=1; ListGrans[SegData]=1; SegInits[SegData]=0;
SegLimits[SegData] = 0xff;
MakeCode=MakeCode_17c4x; IsDef=IsDef_17c4x;
SwitchFrom=SwitchFrom_17c4x; InitFields();
END
void code17c4x_init(void)
BEGIN
CPU17C42=AddCPU("17C42",SwitchTo_17c4x);
END

11
code17c4x.h Normal file
View File

@ -0,0 +1,11 @@
/* code17c4x.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Codegenerator PIC17C4x */
/* */
/* Historie: 21.8.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void code17c4x_init(void);

887
code29k.c Normal file
View File

@ -0,0 +1,887 @@
/* code29k.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Codegenerator AM29xxx-Familie */
/* */
/* Historie: 18.11.1996 Grundsteinlegung */
/* 3. 1.1999 ChkPC-Anpassung */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include <ctype.h>
#include "nls.h"
#include "strutil.h"
#include "bpemu.h"
#include "stringlists.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "asmallg.h"
#include "codepseudo.h"
#include "codevars.h"
typedef struct
{
char *Name;
Boolean MustSup;
CPUVar MinCPU;
LongWord Code;
} StdOrder;
typedef struct
{
char *Name;
Boolean HasReg,HasInd;
CPUVar MinCPU;
LongWord Code;
} JmpOrder;
typedef struct
{
char *Name;
LongWord Code;
} SPReg;
#define StdOrderCount 51
#define NoImmOrderCount 22
#define VecOrderCount 10
#define JmpOrderCount 5
#define FixedOrderCount 2
#define MemOrderCount 7
#define SPRegCount 28
static StdOrder *StdOrders;
static StdOrder *NoImmOrders;
static StdOrder *VecOrders;
static JmpOrder *JmpOrders;
static StdOrder *FixedOrders;
static StdOrder *MemOrders;
static SPReg *SPRegs;
static CPUVar CPU29000,CPU29240,CPU29243,CPU29245;
static LongInt Reg_RBP;
static StringList Emulations;
static SimpProc SaveInitProc;
/*-------------------------------------------------------------------------*/
static void AddStd(char *NName, CPUVar NMin, Boolean NSup, LongWord NCode)
BEGIN
if (InstrZ>=StdOrderCount) exit(255);
StdOrders[InstrZ].Name=NName;
StdOrders[InstrZ].Code=NCode;
StdOrders[InstrZ].MustSup=NSup;
StdOrders[InstrZ++].MinCPU=NMin;
END
static void AddNoImm(char *NName, CPUVar NMin, Boolean NSup, LongWord NCode)
BEGIN
if (InstrZ>=NoImmOrderCount) exit(255);
NoImmOrders[InstrZ].Name=NName;
NoImmOrders[InstrZ].Code=NCode;
NoImmOrders[InstrZ].MustSup=NSup;
NoImmOrders[InstrZ++].MinCPU=NMin;
END
static void AddVec(char *NName, CPUVar NMin, Boolean NSup, LongWord NCode)
BEGIN
if (InstrZ>=VecOrderCount) exit(255);
VecOrders[InstrZ].Name=NName;
VecOrders[InstrZ].Code=NCode;
VecOrders[InstrZ].MustSup=NSup;
VecOrders[InstrZ++].MinCPU=NMin;
END
static void AddJmp(char *NName, CPUVar NMin, Boolean NHas, Boolean NInd, LongWord NCode)
BEGIN
if (InstrZ>=JmpOrderCount) exit(255);
JmpOrders[InstrZ].Name=NName;
JmpOrders[InstrZ].HasReg=NHas;
JmpOrders[InstrZ].HasInd=NInd;
JmpOrders[InstrZ].Code=NCode;
JmpOrders[InstrZ++].MinCPU=NMin;
END
static void AddFixed(char *NName, CPUVar NMin, Boolean NSup, LongWord NCode)
BEGIN
if (InstrZ>=FixedOrderCount) exit(255);
FixedOrders[InstrZ].Name=NName;
FixedOrders[InstrZ].Code=NCode;
FixedOrders[InstrZ].MustSup=NSup;
FixedOrders[InstrZ++].MinCPU=NMin;
END
static void AddMem(char *NName, CPUVar NMin, Boolean NSup, LongWord NCode)
BEGIN
if (InstrZ>=MemOrderCount) exit(255);
MemOrders[InstrZ].Name=NName;
MemOrders[InstrZ].Code=NCode;
MemOrders[InstrZ].MustSup=NSup;
MemOrders[InstrZ++].MinCPU=NMin;
END
static void AddSP(char *NName, LongWord NCode)
BEGIN
if (InstrZ>=SPRegCount) exit(255);
SPRegs[InstrZ].Name=NName;
SPRegs[InstrZ++].Code=NCode;
END
static void InitFields(void)
BEGIN
StdOrders=(StdOrder *) malloc(sizeof(StdOrder)*StdOrderCount); InstrZ=0;
AddStd("ADD" ,CPU29245,False,0x14); AddStd("ADDC" ,CPU29245,False,0x1c);
AddStd("ADDCS" ,CPU29245,False,0x18); AddStd("ADDCU" ,CPU29245,False,0x1a);
AddStd("ADDS" ,CPU29245,False,0x10); AddStd("ADDU" ,CPU29245,False,0x12);
AddStd("AND" ,CPU29245,False,0x90); AddStd("ANDN" ,CPU29245,False,0x9c);
AddStd("CPBYTE" ,CPU29245,False,0x2e); AddStd("CPEQ" ,CPU29245,False,0x60);
AddStd("CPGE" ,CPU29245,False,0x4c); AddStd("CPGEU" ,CPU29245,False,0x4e);
AddStd("CPGT" ,CPU29245,False,0x48); AddStd("CPGTU" ,CPU29245,False,0x4a);
AddStd("CPLE" ,CPU29245,False,0x44); AddStd("CPLEU" ,CPU29245,False,0x46);
AddStd("CPLT" ,CPU29245,False,0x40); AddStd("CPLTU" ,CPU29245,False,0x42);
AddStd("CPNEQ" ,CPU29245,False,0x62); AddStd("DIV" ,CPU29245,False,0x6a);
AddStd("DIV0" ,CPU29245,False,0x68); AddStd("DIVL" ,CPU29245,False,0x6c);
AddStd("DIVREM" ,CPU29245,False,0x6e); AddStd("EXBYTE" ,CPU29245,False,0x0a);
AddStd("EXHW" ,CPU29245,False,0x7c); AddStd("EXTRACT",CPU29245,False,0x7a);
AddStd("INBYTE" ,CPU29245,False,0x0c); AddStd("INHW" ,CPU29245,False,0x78);
AddStd("MUL" ,CPU29245,False,0x64); AddStd("MULL" ,CPU29245,False,0x66);
AddStd("MULU" ,CPU29245,False,0x74); AddStd("NAND" ,CPU29245,False,0x9a);
AddStd("NOR" ,CPU29245,False,0x98); AddStd("OR" ,CPU29245,False,0x92);
AddStd("SLL" ,CPU29245,False,0x80); AddStd("SRA" ,CPU29245,False,0x86);
AddStd("SRL" ,CPU29245,False,0x82); AddStd("SUB" ,CPU29245,False,0x24);
AddStd("SUBC" ,CPU29245,False,0x2c); AddStd("SUBCS" ,CPU29245,False,0x28);
AddStd("SUBCU" ,CPU29245,False,0x2a); AddStd("SUBR" ,CPU29245,False,0x34);
AddStd("SUBRC" ,CPU29245,False,0x3c); AddStd("SUBRCS" ,CPU29245,False,0x38);
AddStd("SUBRCU" ,CPU29245,False,0x3a); AddStd("SUBRS" ,CPU29245,False,0x30);
AddStd("SUBRU" ,CPU29245,False,0x32); AddStd("SUBS" ,CPU29245,False,0x20);
AddStd("SUBU" ,CPU29245,False,0x22); AddStd("XNOR" ,CPU29245,False,0x96);
AddStd("XOR" ,CPU29245,False,0x94);
NoImmOrders=(StdOrder *) malloc(sizeof(StdOrder)*NoImmOrderCount); InstrZ=0;
AddNoImm("DADD" ,CPU29000,False,0xf1); AddNoImm("DDIV" ,CPU29000,False,0xf7);
AddNoImm("DEQ" ,CPU29000,False,0xeb); AddNoImm("DGE" ,CPU29000,False,0xef);
AddNoImm("DGT" ,CPU29000,False,0xed); AddNoImm("DIVIDE" ,CPU29000,False,0xe1);
AddNoImm("DIVIDU" ,CPU29000,False,0xe3); AddNoImm("DMUL" ,CPU29000,False,0xf5);
AddNoImm("DSUB" ,CPU29000,False,0xf3); AddNoImm("FADD" ,CPU29000,False,0xf0);
AddNoImm("FDIV" ,CPU29000,False,0xf6); AddNoImm("FDMUL" ,CPU29000,False,0xf9);
AddNoImm("FEQ" ,CPU29000,False,0xea); AddNoImm("FGE" ,CPU29000,False,0xee);
AddNoImm("FGT" ,CPU29000,False,0xec); AddNoImm("FMUL" ,CPU29000,False,0xf4);
AddNoImm("FSUB" ,CPU29000,False,0xf2); AddNoImm("MULTIPLU",CPU29243,False,0xe2);
AddNoImm("MULTIPLY",CPU29243,False,0xe0); AddNoImm("MULTM" ,CPU29243,False,0xde);
AddNoImm("MULTMU" ,CPU29243,False,0xdf); AddNoImm("SETIP" ,CPU29245,False,0x9e);
VecOrders=(StdOrder *) malloc(sizeof(StdOrder)*VecOrderCount); InstrZ=0;
AddVec("ASEQ" ,CPU29245,False,0x70); AddVec("ASGE" ,CPU29245,False,0x5c);
AddVec("ASGEU" ,CPU29245,False,0x5e); AddVec("ASGT" ,CPU29245,False,0x58);
AddVec("ASGTU" ,CPU29245,False,0x5a); AddVec("ASLE" ,CPU29245,False,0x54);
AddVec("ASLEU" ,CPU29245,False,0x56); AddVec("ASLT" ,CPU29245,False,0x50);
AddVec("ASLTU" ,CPU29245,False,0x52); AddVec("ASNEQ" ,CPU29245,False,0x72);
JmpOrders=(JmpOrder *) malloc(sizeof(JmpOrder)*JmpOrderCount); InstrZ=0;
AddJmp("CALL" ,CPU29245,True ,True ,0xa8); AddJmp("JMP" ,CPU29245,False,True ,0xa0);
AddJmp("JMPF" ,CPU29245,True ,True ,0xa4); AddJmp("JMPFDEC",CPU29245,True ,False,0xb4);
AddJmp("JMPT" ,CPU29245,True ,True ,0xac);
FixedOrders=(StdOrder *) malloc(sizeof(StdOrder)*FixedOrderCount); InstrZ=0;
AddFixed("HALT" ,CPU29245,True,0x89); AddFixed("IRET" ,CPU29245,True,0x88);
MemOrders=(StdOrder *) malloc(sizeof(StdOrder)*MemOrderCount); InstrZ=0;
AddMem("LOAD" ,CPU29245,False,0x16); AddMem("LOADL" ,CPU29245,False,0x06);
AddMem("LOADM" ,CPU29245,False,0x36); AddMem("LOADSET",CPU29245,False,0x26);
AddMem("STORE" ,CPU29245,False,0x1e); AddMem("STOREL" ,CPU29245,False,0x0e);
AddMem("STOREM" ,CPU29245,False,0x3e);
SPRegs=(SPReg *) malloc(sizeof(SPReg)*SPRegCount); InstrZ=0;
AddSP("VAB", 0);
AddSP("OPS", 1);
AddSP("CPS", 2);
AddSP("CFG", 3);
AddSP("CHA", 4);
AddSP("CHD", 5);
AddSP("CHC", 6);
AddSP("RBP", 7);
AddSP("TMC", 8);
AddSP("TMR", 9);
AddSP("PC0", 10);
AddSP("PC1", 11);
AddSP("PC2", 12);
AddSP("MMU", 13);
AddSP("LRU", 14);
AddSP("CIR", 29);
AddSP("CDR", 30);
AddSP("IPC", 128);
AddSP("IPA", 129);
AddSP("IPB", 130);
AddSP("Q", 131);
AddSP("ALU", 132);
AddSP("BP", 133);
AddSP("FC", 134);
AddSP("CR", 135);
AddSP("FPE", 160);
AddSP("INTE",161);
AddSP("FPS", 162);
END
static void DeinitFields(void)
BEGIN
free(StdOrders);
free(NoImmOrders);
free(VecOrders);
free(JmpOrders);
free(FixedOrders);
free(MemOrders);
free(SPRegs);
END
/*-------------------------------------------------------------------------*/
static void ChkSup(void)
BEGIN
if (NOT SupAllowed) WrError(50);
END
static Boolean IsSup(LongWord RegNo)
BEGIN
return ((RegNo<0x80) OR (RegNo>=0xa0));
END
static Boolean ChkCPU(CPUVar Min)
BEGIN
if (MomCPU>=Min) return True;
else return (StringListPresent(Emulations,OpPart));
END
/*-------------------------------------------------------------------------*/
static Boolean DecodeReg(char *Asc, LongWord *Erg)
BEGIN
Boolean io,OK;
if ((strlen(Asc)>=2) AND (toupper(*Asc)=='R'))
BEGIN
*Erg=ConstLongInt(Asc+1,&io);
OK=((io) AND (*Erg<=255));
END
else if ((strlen(Asc)>=3) AND (toupper(*Asc)=='G') AND (toupper(Asc[1])=='R'))
BEGIN
*Erg=ConstLongInt(Asc+2,&io);
OK=((io) AND (*Erg<=127));
END
else if ((strlen(Asc)>=3) AND (toupper(*Asc)=='L') AND (toupper(Asc[1])=='R'))
BEGIN
*Erg=ConstLongInt(Asc+2,&io);
OK=((io) AND (*Erg<=127));
*Erg+=128;
END
else OK=False;
if (OK)
if ((*Erg<127) AND (Odd(Reg_RBP >> ((*Erg) >> 4)))) ChkSup();
return OK;
END
static Boolean DecodeSpReg(char *Asc_O, LongWord *Erg)
BEGIN
int z;
String Asc;
strmaxcpy(Asc,Asc_O,255); NLS_UpString(Asc);
for (z=0; z<SPRegCount; z++)
if (strcmp(Asc,SPRegs[z].Name)==0)
BEGIN
*Erg=SPRegs[z].Code;
break;
END
return (z<SPRegCount);
END
/*-------------------------------------------------------------------------*/
static Boolean DecodePseudo(void)
BEGIN
#define ASSUME29KCount 1
static ASSUMERec ASSUME29Ks[ASSUME29KCount]=
{{"RBP", &Reg_RBP, 0, 0xff, 0x00000000}};
int z;
if (Memo("ASSUME"))
BEGIN
CodeASSUME(ASSUME29Ks,ASSUME29KCount);
return True;
END
if (Memo("EMULATED"))
BEGIN
if (ArgCnt<1) WrError(1110);
else
for (z=1; z<=ArgCnt; z++)
BEGIN
NLS_UpString(ArgStr[z]);
if (NOT StringListPresent(Emulations,ArgStr[z]))
AddStringListLast(&Emulations,ArgStr[z]);
END
return True;
END
return False;
END
static void MakeCode_29K(void)
BEGIN
int z,l;
LongWord Dest,Src1,Src2,Src3,AdrLong;
LongInt AdrInt;
Boolean OK;
CodeLen=0; DontPrint=False;
/* Nullanweisung */
if (Memo("") AND (*AttrPart=='\0') AND (ArgCnt==0)) return;
/* Pseudoanweisungen */
if (DecodePseudo()) return;
if (DecodeIntelPseudo(True)) return;
/* Variante 1: Register <-- Register op Register/uimm8 */
for (z=0; z<StdOrderCount; z++)
if (Memo(StdOrders[z].Name))
BEGIN
if ((ArgCnt>3) OR (ArgCnt<2)) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrXError(1445,ArgStr[1]);
else
BEGIN
OK=True;
if (ArgCnt==2) Src1=Dest;
else OK=DecodeReg(ArgStr[2],&Src1);
if (NOT OK) WrXError(1445,ArgStr[2]);
else
BEGIN
if (DecodeReg(ArgStr[ArgCnt],&Src2))
BEGIN
OK=True; Src3=0;
END
else
BEGIN
Src2=EvalIntExpression(ArgStr[ArgCnt],UInt8,&OK);
Src3=0x1000000;
END
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=(StdOrders[z].Code << 24)+Src3+(Dest << 16)+(Src1 << 8)+Src2;
if (StdOrders[z].MustSup) ChkSup();
END
END
END
return;
END
/* Variante 2: Register <-- Register op Register */
for (z=0; z<NoImmOrderCount; z++)
if (Memo(NoImmOrders[z].Name))
BEGIN
if ((ArgCnt>3) OR (ArgCnt<2)) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrXError(1445,ArgStr[1]);
else
BEGIN
OK=True;
if (ArgCnt==2) Src1=Dest;
else OK=DecodeReg(ArgStr[2],&Src1);
if (NOT OK) WrError(1445);
else if (NOT DecodeReg(ArgStr[ArgCnt],&Src2)) WrError(1445);
else
BEGIN
CodeLen=4;
DAsmCode[0]=(NoImmOrders[z].Code << 24)+(Dest << 16)+(Src1 << 8)+Src2;
if (NoImmOrders[z].MustSup) ChkSup();
END
END
return;
END
/* Variante 3: Vektor <-- Register op Register/uimm8 */
for (z=0; z<VecOrderCount; z++)
if (Memo(VecOrders[z].Name))
BEGIN
if (ArgCnt!=3) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Dest=EvalIntExpression(ArgStr[1],UInt8,&OK);
if (FirstPassUnknown) Dest=64;
if (OK)
if (NOT DecodeReg(ArgStr[2],&Src1)) WrError(1445);
else
BEGIN
if (DecodeReg(ArgStr[ArgCnt],&Src2))
BEGIN
OK=True; Src3=0;
END
else
BEGIN
Src2=EvalIntExpression(ArgStr[ArgCnt],UInt8,&OK);
Src3=0x1000000;
END
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=(VecOrders[z].Code << 24)+Src3+(Dest << 16)+(Src1 << 8)+Src2;
if ((VecOrders[z].MustSup) OR (Dest<=63)) ChkSup();
END
END
END
return;
END
/* Variante 4: ohne Operanden */
for (z=0; z<FixedOrderCount; z++)
if (Memo(FixedOrders[z].Name))
BEGIN
if (ArgCnt!=0) WrError(1110);
else
BEGIN
CodeLen=4; DAsmCode[0]=FixedOrders[z].Code << 24;
if (FixedOrders[z].MustSup) ChkSup();
END
return;
END
/* Variante 5 : [0], Speichersteuerwort, Register, Register/uimm8 */
for (z=0; z<MemOrderCount; z++)
if (Memo(MemOrders[z].Name))
BEGIN
if ((ArgCnt!=3) AND (ArgCnt!=4)) WrError(1110);
else
BEGIN
if (ArgCnt==3)
BEGIN
OK=True; AdrLong=0;
END
else
BEGIN
AdrLong=EvalIntExpression(ArgStr[1],Int32,&OK);
if (OK) OK=ChkRange(AdrLong,0,0);
END
if (OK)
BEGIN
Dest=EvalIntExpression(ArgStr[ArgCnt-2],UInt7,&OK);
if (OK)
if (DecodeReg(ArgStr[ArgCnt-1],&Src1))
BEGIN
if (DecodeReg(ArgStr[ArgCnt],&Src2))
BEGIN
OK=True; Src3=0;
END
else
BEGIN
Src2=EvalIntExpression(ArgStr[ArgCnt],UInt8,&OK);
Src3=0x1000000;
END
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=(MemOrders[z].Code << 24)+Src3+(Dest << 16)+(Src1 << 8)+Src2;
if (MemOrders[z].MustSup) ChkSup();
END
END
END
END
return;
END
/* Sprungbefehle */
for (z=0; z<JmpOrderCount; z++)
BEGIN
l=strlen(JmpOrders[z].Name);
if ((strncmp(OpPart,JmpOrders[z].Name,l)==0) AND ((OpPart[l]=='\0') OR (OpPart[l]=='I')))
BEGIN
if (ArgCnt!=1+Ord(JmpOrders[z].HasReg)) WrError(1110);
else if (DecodeReg(ArgStr[ArgCnt],&Src1))
BEGIN
if (NOT JmpOrders[z].HasReg)
BEGIN
Dest=0; OK=True;
END
else OK=DecodeReg(ArgStr[1],&Dest);
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=((JmpOrders[z].Code+0x20) << 24)+(Dest << 8)+Src1;
END
END
else if (OpPart[l]=='I') WrError(1445);
else
BEGIN
if (NOT JmpOrders[z].HasReg)
BEGIN
Dest=0; OK=True;
END
else OK=DecodeReg(ArgStr[1],&Dest);
if (OK)
BEGIN
AdrLong=EvalIntExpression(ArgStr[ArgCnt],Int32,&OK);
AdrInt=AdrLong-EProgCounter();
if (OK)
if ((AdrLong & 3)!=0) WrError(1325);
else if ((AdrInt<=0x1ffff) AND (AdrInt>=-0x20000))
BEGIN
CodeLen=4;
AdrLong-=EProgCounter();
DAsmCode[0]=(JmpOrders[z].Code << 24)
+((AdrLong & 0x3fc00) << 6)
+(Dest << 8)+((AdrLong & 0x3fc) >> 2);
END
else if ((NOT SymbolQuestionable) AND (AdrLong>0x3fffff)) WrError(1370);
else
BEGIN
CodeLen=4;
DAsmCode[0]=((JmpOrders[z].Code+1) << 24)
+((AdrLong & 0x3fc00) << 6)
+(Dest << 8)+((AdrLong & 0x3fc) >> 2);
END
END
END
return;
END
END
/* Sonderfaelle */
if (Memo("CLASS"))
BEGIN
if (ArgCnt!=3) WrError(1110);
else if (NOT ChkCPU(CPU29000)) WrError(1500);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrError(1445);
else if (NOT DecodeReg(ArgStr[2],&Src1)) WrError(1445);
else
BEGIN
Src2=EvalIntExpression(ArgStr[3],UInt2,&OK);
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=0xe6000000+(Dest << 16)+(Src1 << 8)+Src2;
END
END
return;
END
if (Memo("EMULATE"))
BEGIN
if (ArgCnt!=3) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Dest=EvalIntExpression(ArgStr[1],UInt8,&OK);
if (FirstPassUnknown) Dest=64;
if (OK)
if (NOT DecodeReg(ArgStr[2],&Src1)) WrError(1445);
else if (NOT DecodeReg(ArgStr[ArgCnt],&Src2)) WrError(1445);
else
BEGIN
CodeLen=4;
DAsmCode[0]=0xd7000000+(Dest << 16)+(Src1 << 8)+Src2;
if (Dest<=63) ChkSup();
END
END
return;
END
if (Memo("SQRT"))
BEGIN
if ((ArgCnt!=3) AND (ArgCnt!=2)) WrError(1110);
else if (NOT ChkCPU(CPU29000)) WrError(1500);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrError(1445);
else
BEGIN
if (ArgCnt==2)
BEGIN
OK=True; Src1=Dest;
END
else OK=DecodeReg(ArgStr[2],&Src1);
if (NOT OK) WrError(1445);
else
BEGIN
Src2=EvalIntExpression(ArgStr[ArgCnt],UInt2,&OK);
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=0xe5000000+(Dest << 16)+(Src1 << 8)+Src2;
END
END
END
return;
END
if (Memo("CLZ"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrError(1445);
else
BEGIN
if (DecodeReg(ArgStr[2],&Src1))
BEGIN
OK=True; Src3=0;
END
else
BEGIN
Src1=EvalIntExpression(ArgStr[2],UInt8,&OK);
Src3=0x1000000;
END
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=0x08000000+Src3+(Dest << 16)+Src1;
END
END
return;
END
if (Memo("CONST"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrError(1445);
else
BEGIN
AdrLong=EvalIntExpression(ArgStr[2],Int32,&OK);
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=((AdrLong & 0xff00) << 8)+(Dest << 8)+(AdrLong & 0xff);
AdrLong=AdrLong >> 16;
if (AdrLong==0xffff) DAsmCode[0]+=0x01000000;
else
BEGIN
DAsmCode[0]+=0x03000000;
if (AdrLong!=0)
BEGIN
CodeLen=8;
DAsmCode[1]=0x02000000+((AdrLong & 0xff00) << 16)+(Dest << 8)+(AdrLong & 0xff);
END
END
END
END
return;
END
if ((Memo("CONSTH")) OR (Memo("CONSTN")))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrError(1445);
else
BEGIN
FirstPassUnknown=False;
AdrLong=EvalIntExpression(ArgStr[2],Int32,&OK);
if (FirstPassUnknown) AdrLong&=0xffff;
if ((Memo("CONSTN")) AND ((AdrLong >> 16)==0xffff)) AdrLong&=0xffff;
if (ChkRange(AdrLong,0,0xffff))
BEGIN
CodeLen=4;
DAsmCode[0]=0x1000000+((AdrLong & 0xff00) << 8)+(Dest << 8)+(AdrLong & 0xff);
if (Memo("CONSTH")) DAsmCode[0]+=0x1000000;
END
END
return;
END
if (Memo("CONVERT"))
BEGIN
if (ArgCnt!=6) WrError(1110);
else if (NOT ChkCPU(CPU29000)) WrError(1500);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrError(1445);
else if (NOT DecodeReg(ArgStr[2],&Src1)) WrError(1445);
else
BEGIN
Src2=0;
Src2+=EvalIntExpression(ArgStr[3],UInt1,&OK) << 7;
if (OK)
BEGIN
Src2+=EvalIntExpression(ArgStr[4],UInt3,&OK) << 4;
if (OK)
BEGIN
Src2+=EvalIntExpression(ArgStr[5],UInt2,&OK) << 2;
if (OK)
BEGIN
Src2+=EvalIntExpression(ArgStr[6],UInt2,&OK);
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=0xe4000000+(Dest << 16)+(Src1 << 8)+Src2;
END
END
END
END
END
return;
END
if (Memo("EXHWS"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrError(1445);
else if (NOT DecodeReg(ArgStr[2],&Src1)) WrError(1445);
else
BEGIN
CodeLen=4;
DAsmCode[0]=0x7e000000+(Dest << 16)+(Src1 << 8);
END
return;
END
if ((Memo("INV")) OR (Memo("IRETINV")))
BEGIN
if (ArgCnt>1) WrError(1110);
else
BEGIN
if (ArgCnt==0)
BEGIN
Src1=0; OK=True;
END
else Src1=EvalIntExpression(ArgStr[1],UInt2,&OK);
if (OK)
BEGIN
CodeLen=4;
DAsmCode[0]=Src1 << 16;
if (Memo("INV")) DAsmCode[0]+=0x9f000000;
else DAsmCode[0]+=0x8c000000;
ChkSup();
END
END
return;
END
if (Memo("MFSR"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrXError(1445,ArgStr[1]);
else if (NOT DecodeSpReg(ArgStr[2],&Src1)) WrXError(1440,ArgStr[2]);
else
BEGIN
DAsmCode[0]=0xc6000000+(Dest << 16)+(Src1 << 8);
CodeLen=4; if (IsSup(Src1)) ChkSup();
END
return;
END
if (Memo("MTSR"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeSpReg(ArgStr[1],&Dest)) WrXError(1440,ArgStr[1]);
else if (NOT DecodeReg(ArgStr[2],&Src1)) WrXError(1445,ArgStr[2]);
else
BEGIN
DAsmCode[0]=0xce000000+(Dest << 8)+Src1;
CodeLen=4; if (IsSup(Dest)) ChkSup();
END
return;
END
if (Memo("MTSRIM"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeSpReg(ArgStr[1],&Dest)) WrXError(1440,ArgStr[1]);
else
BEGIN
Src1=EvalIntExpression(ArgStr[2],UInt16,&OK);
if (OK)
BEGIN
DAsmCode[0]=0x04000000+((Src1 & 0xff00) << 8)+(Dest << 8)+Lo(Src1);
CodeLen=4; if (IsSup(Dest)) ChkSup();
END
END
return;
END
if (Memo("MFTLB"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrXError(1445,ArgStr[1]);
else if (NOT DecodeReg(ArgStr[2],&Src1)) WrXError(1445,ArgStr[2]);
else
BEGIN
DAsmCode[0]=0xb6000000+(Dest << 16)+(Src1 << 8);
CodeLen=4; ChkSup();
END
return;
END
if (Memo("MTTLB"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else if (NOT DecodeReg(ArgStr[1],&Dest)) WrXError(1445,ArgStr[1]);
else if (NOT DecodeReg(ArgStr[2],&Src1)) WrXError(1445,ArgStr[2]);
else
BEGIN
DAsmCode[0]=0xbe000000+(Dest << 8)+Src1;
CodeLen=4; ChkSup();
END
return;
END
/* unbekannter Befehl */
WrXError(1200,OpPart);
END
static void InitCode_29K(void)
BEGIN
SaveInitProc();
Reg_RBP=0; ClearStringList(&Emulations);
END
static Boolean IsDef_29K(void)
BEGIN
return False;
END
static void SwitchFrom_29K(void)
BEGIN
DeinitFields(); ClearONOFF();
END
static void SwitchTo_29K(void)
BEGIN
TurnWords=True; ConstMode=ConstModeC; SetIsOccupied=False;
PCSymbol="$"; HeaderID=0x29; NOPCode=0x000000000;
DivideChars=","; HasAttrs=False;
ValidSegs=1<<SegCode;
Grans[SegCode]=1; ListGrans[SegCode]=4; SegInits[SegCode]=0;
#ifdef __STDC__
SegLimits[SegCode] = 0xfffffffful;
#else
SegLimits[SegCode] = 0xffffffffl;
#endif
MakeCode=MakeCode_29K; IsDef=IsDef_29K;
AddONOFF("SUPMODE", &SupAllowed, SupAllowedName,False);
SwitchFrom=SwitchFrom_29K; InitFields();
END
void code29k_init(void)
BEGIN
CPU29245=AddCPU("AM29245",SwitchTo_29K);
CPU29243=AddCPU("AM29243",SwitchTo_29K);
CPU29240=AddCPU("AM29240",SwitchTo_29K);
CPU29000=AddCPU("AM29000",SwitchTo_29K);
Emulations=Nil;
SaveInitProc=InitPassProc; InitPassProc=InitCode_29K;
END

11
code29k.h Normal file
View File

@ -0,0 +1,11 @@
/* code29k.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Codegenerator AM29xxx-Familie */
/* */
/* Historie: 18.11.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void code29k_init(void);

553
code3201x.c Normal file
View File

@ -0,0 +1,553 @@
/* code3201x.c */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Codegenerator TMS3201x-Familie */
/* */
/* Historie: 28.11.1996 Grundsteinlegung */
/* 7. 7.1998 Fix Zugriffe auf CharTransTable wg. signed chars */
/* 18. 8.1992 BookKeeping-Aufruf in RES */
/* 2. 1.1999 ChkPC-Anpassung */
/* */
/*****************************************************************************/
#include "stdinc.h"
#include <string.h>
#include <ctype.h>
#include "bpemu.h"
#include "strutil.h"
#include "chunks.h"
#include "asmdef.h"
#include "asmsub.h"
#include "asmpars.h"
#include "codepseudo.h"
#include "codevars.h"
typedef struct
{
char *Name;
Word Code;
} FixedOrder;
typedef struct
{
char *Name;
Word Code;
Boolean Must1;
} AdrOrder;
typedef struct
{
char *Name;
Word Code;
Word AllowShifts;
} AdrShiftOrder;
typedef struct
{
char *Name;
Word Code;
Integer Min,Max;
Word Mask;
} ImmOrder;
#define FixedOrderCnt 14
#define JmpOrderCnt 11
#define AdrOrderCnt 21
#define AdrShiftOrderCnt 5
#define ImmOrderCnt 3
static Word AdrMode;
static Boolean AdrOK;
static CPUVar CPU32010,CPU32015;
static FixedOrder *FixedOrders;
static FixedOrder *JmpOrders;
static AdrOrder *AdrOrders;
static AdrShiftOrder *AdrShiftOrders;
static ImmOrder *ImmOrders;
/*----------------------------------------------------------------------------*/
static void AddFixed(char *NName, Word NCode)
BEGIN
if (InstrZ>=FixedOrderCnt) exit(255);
FixedOrders[InstrZ].Name=NName;
FixedOrders[InstrZ++].Code=NCode;
END
static void AddJmp(char *NName, Word NCode)
BEGIN
if (InstrZ>=JmpOrderCnt) exit(255);
JmpOrders[InstrZ].Name=NName;
JmpOrders[InstrZ++].Code=NCode;
END
static void AddAdr(char *NName, Word NCode, Word NMust1)
BEGIN
if (InstrZ>=AdrOrderCnt) exit(255);
AdrOrders[InstrZ].Name=NName;
AdrOrders[InstrZ].Code=NCode;
AdrOrders[InstrZ++].Must1=NMust1;
END
static void AddAdrShift(char *NName, Word NCode, Word NAllow)
BEGIN
if (InstrZ>=AdrShiftOrderCnt) exit(255);
AdrShiftOrders[InstrZ].Name=NName;
AdrShiftOrders[InstrZ].Code=NCode;
AdrShiftOrders[InstrZ++].AllowShifts=NAllow;
END
static void AddImm(char *NName, Word NCode, Integer NMin, Integer NMax, Word NMask)
BEGIN
if (InstrZ>=ImmOrderCnt) exit(255);
ImmOrders[InstrZ].Name=NName;
ImmOrders[InstrZ].Code=NCode;
ImmOrders[InstrZ].Min=NMin;
ImmOrders[InstrZ].Max=NMax;
ImmOrders[InstrZ++].Mask=NMask;
END
static void InitFields(void)
BEGIN
FixedOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*FixedOrderCnt); InstrZ=0;
AddFixed("ABS" , 0x7f88); AddFixed("APAC" , 0x7f8f);
AddFixed("CALA" , 0x7f8c); AddFixed("DINT" , 0x7f81);
AddFixed("EINT" , 0x7f82); AddFixed("NOP" , 0x7f80);
AddFixed("PAC" , 0x7f8e); AddFixed("POP" , 0x7f9d);
AddFixed("PUSH" , 0x7f9c); AddFixed("RET" , 0x7f8d);
AddFixed("ROVM" , 0x7f8a); AddFixed("SOVM" , 0x7f8b);
AddFixed("SPAC" , 0x7f90); AddFixed("ZAC" , 0x7f89);
JmpOrders=(FixedOrder *) malloc(sizeof(FixedOrder)*JmpOrderCnt); InstrZ=0;
AddJmp("B" , 0xf900); AddJmp("BANZ" , 0xf400);
AddJmp("BGEZ" , 0xfd00); AddJmp("BGZ" , 0xfc00);
AddJmp("BIOZ" , 0xf600); AddJmp("BLEZ" , 0xfb00);
AddJmp("BLZ" , 0xfa00); AddJmp("BNZ" , 0xfe00);
AddJmp("BV" , 0xf500); AddJmp("BZ" , 0xff00);
AddJmp("CALL" , 0xf800);
AdrOrders=(AdrOrder *) malloc(sizeof(AdrOrder)*AdrOrderCnt); InstrZ=0;
AddAdr("ADDH" , 0x6000, False); AddAdr("ADDS" , 0x6100, False);
AddAdr("AND" , 0x7900, False); AddAdr("DMOV" , 0x6900, False);
AddAdr("LDP" , 0x6f00, False); AddAdr("LST" , 0x7b00, False);
AddAdr("LT" , 0x6a00, False); AddAdr("LTA" , 0x6c00, False);
AddAdr("LTD" , 0x6b00, False); AddAdr("MAR" , 0x6800, False);
AddAdr("MPY" , 0x6d00, False); AddAdr("OR" , 0x7a00, False);
AddAdr("SST" , 0x7c00, True ); AddAdr("SUBC" , 0x6400, False);
AddAdr("SUBH" , 0x6200, False); AddAdr("SUBS" , 0x6300, False);
AddAdr("TBLR" , 0x6700, False); AddAdr("TBLW" , 0x7d00, False);
AddAdr("XOR" , 0x7800, False); AddAdr("ZALH" , 0x6500, False);
AddAdr("ZALS" , 0x6600, False);
AdrShiftOrders=(AdrShiftOrder *) malloc(sizeof(AdrShiftOrder)*AdrShiftOrderCnt); InstrZ=0;
AddAdrShift("ADD" , 0x0000, 0xffff);
AddAdrShift("LAC" , 0x2000, 0xffff);
AddAdrShift("SACH" , 0x5800, 0x0013);
AddAdrShift("SACL" , 0x5000, 0x0001);
AddAdrShift("SUB" , 0x1000, 0xffff);
ImmOrders=(ImmOrder *) malloc(sizeof(ImmOrder)*ImmOrderCnt); InstrZ=0;
AddImm("LACK", 0x7e00, 0, 255, 0xff);
AddImm("LDPK", 0x6e00, 0, 1, 0x1);
AddImm("MPYK", 0x8000, -4096, 4095, 0x1fff);
END
static void DeinitFields(void)
BEGIN
free(FixedOrders);
free(JmpOrders);
free(AdrOrders);
free(AdrShiftOrders);
free(ImmOrders);
END
/*----------------------------------------------------------------------------*/
static Word EvalARExpression(char *Asc, Boolean *OK)
BEGIN
*OK=True;
if (strcasecmp(Asc,"AR0")==0) return 0;
if (strcasecmp(Asc,"AR1")==0) return 1;
return EvalIntExpression(Asc,UInt1,OK);
END
static void DecodeAdr(char *Arg, int Aux, Boolean Must1)
BEGIN
Byte h;
char *p;
AdrOK=False;
if ((strcmp(Arg,"*")==0) OR (strcmp(Arg,"*-")==0) OR (strcmp(Arg,"*+")==0))
BEGIN
AdrMode=0x88;
if (strlen(Arg)==2)
AdrMode+=(Arg[1]=='+') ? 0x20 : 0x10;
if (Aux<=ArgCnt)
BEGIN
h=EvalARExpression(ArgStr[Aux],&AdrOK);
if (AdrOK)
BEGIN
AdrMode&=0xf7; AdrMode+=h;
END
END
else AdrOK=True;
END
else if (Aux<=ArgCnt) WrError(1110);
else
BEGIN
h=0;
if ((strlen(Arg)>3) AND (strncasecmp(Arg,"DAT",3)==0))
BEGIN
AdrOK=True;
for (p=Arg+3; *p!='\0'; p++)
if ((*p>'9') OR (*p<'0')) AdrOK=False;
if (AdrOK) h=EvalIntExpression(Arg+3,UInt8,&AdrOK);
END
if (NOT AdrOK) h=EvalIntExpression(Arg,Int8,&AdrOK);
if (AdrOK)
if ((Must1) AND (h<0x80) AND (NOT FirstPassUnknown))
BEGIN
WrError(1315); AdrOK=False;
END
else
BEGIN
AdrMode=h & 0x7f; ChkSpace(SegData);
END
END
END
static Boolean DecodePseudo(void)
BEGIN
Word Size;
int z,z2;
char *p;
TempResult t;
Boolean OK;
if (Memo("PORT"))
BEGIN
CodeEquate(SegIO,0,7);
return True;
END
if (Memo("RES"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
FirstPassUnknown=False;
Size=EvalIntExpression(ArgStr[1],Int16,&OK);
if (FirstPassUnknown) WrError(1820);
if ((OK) AND (NOT FirstPassUnknown))
BEGIN
DontPrint=True;
CodeLen=Size;
BookKeeping();
END
END
return True;
END
if (Memo("DATA"))
BEGIN
if (ArgCnt==0) WrError(1110);
else
BEGIN
OK=True;
for (z=1; z<=ArgCnt; z++)
if (OK)
BEGIN
EvalExpression(ArgStr[z],&t);
switch (t.Typ)
BEGIN
case TempInt:
if ((t.Contents.Int<-32768) OR (t.Contents.Int>0xffff))
BEGIN
WrError(1320); OK=False;
END
else WAsmCode[CodeLen++]=t.Contents.Int;
break;
case TempFloat:
WrError(1135); OK=False;
break;
case TempString:
for (p=t.Contents.Ascii,z2=0; *p!='\0'; p++,z2++)
BEGIN
if ((z2&1)==0)
WAsmCode[CodeLen]=CharTransTable[((usint)*p)&0xff];
else
WAsmCode[CodeLen++]+=((Word) CharTransTable[((usint)*p)&0xff]) << 8;
END
if ((z2&1)==0) CodeLen++;
break;
default:
OK=False;
END
END
if (NOT OK) CodeLen=0;
END
return True;
END
return False;
END
static void MakeCode_3201X(void)
BEGIN
Boolean OK,HasSh;
Word AdrWord;
LongInt AdrLong;
int z,Cnt;
CodeLen=0; DontPrint=False;
/* zu ignorierendes */
if (Memo("")) return;
/* Pseudoanweisungen */
if (DecodePseudo()) return;
/* kein Argument */
for (z=0; z<FixedOrderCnt; z++)
if (Memo(FixedOrders[z].Name))
BEGIN
if (ArgCnt!=0) WrError(1110);
else
BEGIN
CodeLen=1; WAsmCode[0]=FixedOrders[z].Code;
END
return;
END
/* Spruenge */
for (z=0; z<JmpOrderCnt; z++)
if (Memo(JmpOrders[z].Name))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
WAsmCode[1]=EvalIntExpression(ArgStr[1],UInt12,&OK);
if (OK)
BEGIN
CodeLen=2; WAsmCode[0]=JmpOrders[z].Code;
END
END
return;
END
/* nur Adresse */
for (z=0; z<AdrOrderCnt; z++)
if (Memo(AdrOrders[z].Name))
BEGIN
if ((ArgCnt<1) OR (ArgCnt>2)) WrError(1110);
else
BEGIN
DecodeAdr(ArgStr[1],2,AdrOrders[z].Must1);
if (AdrOK)
BEGIN
CodeLen=1; WAsmCode[0]=AdrOrders[z].Code+AdrMode;
END
END
return;
END
/* Adresse & schieben */
for (z=0; z<AdrShiftOrderCnt; z++)
if (Memo(AdrShiftOrders[z].Name))
BEGIN
if ((ArgCnt<1) OR (ArgCnt>3)) WrError(1110);
else
BEGIN
if (*ArgStr[1]=='*')
if (ArgCnt==2)
if (strncasecmp(ArgStr[2],"AR",2)==0)
BEGIN
HasSh=False; Cnt=2;
END
else
BEGIN
HasSh=True; Cnt=3;
END
else
BEGIN
HasSh=True; Cnt=3;
END
else
BEGIN
Cnt=3; HasSh=(ArgCnt==2);
END
DecodeAdr(ArgStr[1],Cnt,False);
if (AdrOK)
BEGIN
if (NOT HasSh)
BEGIN
OK=True; AdrWord=0;
END
else
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],Int4,&OK);
if ((OK) AND (FirstPassUnknown)) AdrWord=0;
END
if (OK)
if ((AdrShiftOrders[z].AllowShifts & (1 << AdrWord))==0) WrError(1380);
else
BEGIN
CodeLen=1; WAsmCode[0]=AdrShiftOrders[z].Code+AdrMode+(AdrWord << 8);
END
END
END
return;
END
/* Ein/Ausgabe */
if ((Memo("IN")) OR (Memo("OUT")))
BEGIN
if ((ArgCnt<2) OR (ArgCnt>3)) WrError(1110);
else
BEGIN
DecodeAdr(ArgStr[1],3,False);
if (AdrOK)
BEGIN
AdrWord=EvalIntExpression(ArgStr[2],UInt3,&OK);
if (OK)
BEGIN
ChkSpace(SegIO);
CodeLen=1;
WAsmCode[0]=0x4000+AdrMode+(AdrWord << 8);
if (Memo("OUT")) WAsmCode[0]+=0x800;
END
END
END
return;
END
/* konstantes Argument */
for (z=0; z<ImmOrderCnt; z++)
if (Memo(ImmOrders[z].Name))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrLong=EvalIntExpression(ArgStr[1],Int32,&OK);
if (OK)
BEGIN
if (FirstPassUnknown) AdrLong&=ImmOrders[z].Mask;
if (AdrLong<ImmOrders[z].Min) WrError(1315);
else if (AdrLong>ImmOrders[z].Max) WrError(1320);
else
BEGIN
CodeLen=1; WAsmCode[0]=ImmOrders[z].Code+(AdrLong & ImmOrders[z].Mask);
END
END
END
return;
END
/* mit Hilfsregistern */
if (Memo("LARP"))
BEGIN
if (ArgCnt!=1) WrError(1110);
else
BEGIN
AdrWord=EvalARExpression(ArgStr[1],&OK);
if (OK)
BEGIN
CodeLen=1; WAsmCode[0]=0x6880+AdrWord;
END
END
return;
END
if ((Memo("LAR")) OR (Memo("SAR")))
BEGIN
if ((ArgCnt<2) OR (ArgCnt>3)) WrError(1110);
else
BEGIN
AdrWord=EvalARExpression(ArgStr[1],&OK);
if (OK)
BEGIN
DecodeAdr(ArgStr[2],3,False);
if (AdrOK)
BEGIN
CodeLen=1;
WAsmCode[0]=0x3000+AdrMode+(AdrWord << 8);
if (Memo("LAR")) WAsmCode[0]+=0x800;
END
END
END
return;
END
if (Memo("LARK"))
BEGIN
if (ArgCnt!=2) WrError(1110);
else
BEGIN
AdrWord=EvalARExpression(ArgStr[1],&OK);
if (OK)
BEGIN
WAsmCode[0]=EvalIntExpression(ArgStr[2],Int8,&OK);
if (OK)
BEGIN
CodeLen=1;
WAsmCode[0]=Lo(WAsmCode[0])+0x7000+(AdrWord << 8);
END
END
END
return;
END
WrXError(1200,OpPart);
END
static Boolean IsDef_3201X(void)
BEGIN
return (Memo("PORT"));
END
static void SwitchFrom_3201X(void)
BEGIN
DeinitFields();
END
static void SwitchTo_3201X(void)
BEGIN
TurnWords=False; ConstMode=ConstModeIntel; SetIsOccupied=False;
PCSymbol="$"; HeaderID=0x74; NOPCode=0x7f80;
DivideChars=","; HasAttrs=False;
ValidSegs=(1<<SegCode)|(1<<SegData)|(1<<SegIO);
Grans[SegCode]=2; ListGrans[SegCode]=2; SegInits[SegCode]=0;
SegLimits[SegCode] = 0xfff;
Grans[SegData]=2; ListGrans[SegData]=2; SegInits[SegData]=0;
SegLimits[SegData] = (MomCPU==CPU32010) ? 0x8f : 0xff;
Grans[SegIO ]=2; ListGrans[SegIO ]=2; SegInits[SegIO ]=0;
SegLimits[SegIO ] = 7;
MakeCode=MakeCode_3201X; IsDef=IsDef_3201X;
SwitchFrom=SwitchFrom_3201X; InitFields();
END
void code3201x_init(void)
BEGIN
CPU32010=AddCPU("32010",SwitchTo_3201X);
CPU32015=AddCPU("32015",SwitchTo_3201X);
END

11
code3201x.h Normal file
View File

@ -0,0 +1,11 @@
/* code3201x.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Codegenerator TMS3201x-Familie */
/* */
/* Historie: 28.11.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void code3201x_init(void);

1122
code3202x.c Normal file

File diff suppressed because it is too large Load Diff

9
code3202x.h Normal file
View File

@ -0,0 +1,9 @@
/*
* AS-Portierung
*
* AS-Codegeneratormodul fuer die Texas Instruments TMS320C2x-Familie
*
* 19.08.96: Erstellung
*/
extern void code3202x_init(void);

1511
code3203x.c Normal file

File diff suppressed because it is too large Load Diff

11
code3203x.h Normal file
View File

@ -0,0 +1,11 @@
/* code3203x.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Codegenerator TMS320C3x-Familie */
/* */
/* Historie: 12.12.1996 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void code3203x_init(void);

1852
code3205x.c Normal file

File diff suppressed because it is too large Load Diff

9
code3205x.h Normal file
View File

@ -0,0 +1,9 @@
/*
* AS-Portierung
*
* AS-Codegeneratormodul fuer die Texas Instruments TMS320C5x-Familie
*
* 19.08.96: Erstellung
*/
extern void code3205x_init(void);

2313
code3206x.c Normal file

File diff suppressed because it is too large Load Diff

12
code3206x.h Normal file
View File

@ -0,0 +1,12 @@
/* code3206x.h */
/*****************************************************************************/
/* AS-Portierung */
/* */
/* Codegenerator TMS320C6x-Familie */
/* */
/* Historie: 24.2.1998 Grundsteinlegung */
/* */
/*****************************************************************************/
extern void code3206x_init(void);

1117
code370.c Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More