aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2011-03-03 18:44:02 +0100
committerPatrick McHardy <kaber@trash.net>2011-03-03 18:44:02 +0100
commit1f3e92989e4b9f3e00aaf7729b3dd2f7c044667e (patch)
tree866b0bbd1d7257634098e05f33781d259614b7b6
Import ASL
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--BENCHES330
-rw-r--r--INSTALL99
-rw-r--r--Makefile157
-rw-r--r--Makefile.def-samples/MakeDef.cad25
-rw-r--r--Makefile.def-samples/MakeDef.dos32
-rw-r--r--Makefile.def-samples/MakeDef.dpmi30
-rw-r--r--Makefile.def-samples/Makefile.def-alpha-dec-osf13.227
-rw-r--r--Makefile.def-samples/Makefile.def-alpha-dec-osf14.027
-rw-r--r--Makefile.def-samples/Makefile.def-alpha-unknown-linux2.x.x25
-rw-r--r--Makefile.def-samples/Makefile.def-hppa-hp-hpux-10.028
-rw-r--r--Makefile.def-samples/Makefile.def-hppa-hp-hpux-9.026
-rw-r--r--Makefile.def-samples/Makefile.def-i386-unknown-dpmi30
-rw-r--r--Makefile.def-samples/Makefile.def-i386-unknown-linux2.x.x27
-rw-r--r--Makefile.def-samples/Makefile.def-i386-unknown-msdos32
-rw-r--r--Makefile.def-samples/Makefile.def-i386-unknown-os233
-rw-r--r--Makefile.def-samples/Makefile.def-i386-unknown-os2-visualage31
-rw-r--r--Makefile.def-samples/Makefile.def-i386-unknown-win3228
-rw-r--r--Makefile.def-samples/Makefile.def-m68k-pcs-munix325
-rw-r--r--Makefile.def-samples/Makefile.def-m68k-sun-netbsd1.228
-rw-r--r--Makefile.def-samples/Makefile.def-mips-dec-netbsd1.228
-rw-r--r--Makefile.def-samples/Makefile.def-mips-dec-ultrix4.325
-rw-r--r--Makefile.def-samples/Makefile.def-mips-sgi-irix6.225
-rw-r--r--Makefile.def-samples/Makefile.def-mips64-sgi-irix6.425
-rw-r--r--Makefile.def-samples/Makefile.def-rs6k-ibm-aix4128
-rw-r--r--Makefile.def-samples/Makefile.def-sparc-sun-solaris2.x24
-rw-r--r--Makefile.def-samples/Makefile.def-sparc-sun-sunos4.1.325
-rw-r--r--Makefile.def-samples/Makefile.def-vax-dec-ultrix4.125
-rw-r--r--Makefile.def.tmpl25
-rwxr-xr-xMakefile.dos120
-rw-r--r--Makefile.os2100
-rw-r--r--README98
-rw-r--r--README.DOS26
-rw-r--r--README.KR55
-rw-r--r--README.LANGS197
-rw-r--r--README.OS226
-rw-r--r--TODO6
-rw-r--r--a2k.c193
-rw-r--r--addcr.c14
-rw-r--r--as.c2985
-rw-r--r--as.h11
-rw-r--r--as.res983
-rw-r--r--as1750.c1295
-rw-r--r--as1750.h18
-rw-r--r--asl.1377
-rw-r--r--asl.def2
-rw-r--r--asmallg.c1341
-rw-r--r--asmallg.h21
-rw-r--r--asmcode.c239
-rw-r--r--asmcode.h27
-rw-r--r--asmdebug.c320
-rw-r--r--asmdebug.h20
-rw-r--r--asmdef.c315
-rw-r--r--asmdef.h400
-rw-r--r--asmfnums.c167
-rw-r--r--asmfnums.h29
-rw-r--r--asmif.c433
-rw-r--r--asmif.h37
-rw-r--r--asminclist.c116
-rw-r--r--asminclist.h19
-rw-r--r--asmitree.c277
-rw-r--r--asmitree.h65
-rw-r--r--asmmac.c503
-rw-r--r--asmmac.h105
-rw-r--r--asmpars.c3822
-rw-r--r--asmpars.h207
-rw-r--r--asmrelocs.c133
-rw-r--r--asmrelocs.h22
-rw-r--r--asmsub.c1526
-rw-r--r--asmsub.h166
-rw-r--r--bincmp.c46
-rw-r--r--bpemu.c239
-rw-r--r--bpemu.h33
-rw-r--r--changelog729
-rw-r--r--chardefs.h237
-rw-r--r--chunks.c228
-rw-r--r--chunks.h44
-rw-r--r--cmdarg.c222
-rw-r--r--cmdarg.h46
-rw-r--r--cmdarg.res24
-rw-r--r--code166.c1697
-rw-r--r--code166.h11
-rw-r--r--code16c5x.c448
-rw-r--r--code16c5x.h12
-rw-r--r--code16c8x.c472
-rw-r--r--code16c8x.h11
-rw-r--r--code17c4x.c521
-rw-r--r--code17c4x.h11
-rw-r--r--code29k.c887
-rw-r--r--code29k.h11
-rw-r--r--code3201x.c553
-rw-r--r--code3201x.h11
-rw-r--r--code3202x.c1122
-rw-r--r--code3202x.h9
-rw-r--r--code3203x.c1511
-rw-r--r--code3203x.h11
-rw-r--r--code3205x.c1852
-rw-r--r--code3205x.h9
-rw-r--r--code3206x.c2313
-rw-r--r--code3206x.h12
-rw-r--r--code370.c1117
-rw-r--r--code370.h11
-rw-r--r--code4004.c503
-rw-r--r--code4004.h11
-rw-r--r--code4500.c397
-rw-r--r--code4500.h11
-rw-r--r--code47c00.c1126
-rw-r--r--code47c00.h11
-rw-r--r--code48.c998
-rw-r--r--code48.h11
-rw-r--r--code51.c2304
-rw-r--r--code51.h11
-rw-r--r--code53c8xx.c1055
-rw-r--r--code53c8xx.h11
-rw-r--r--code56k.c2566
-rw-r--r--code56k.h11
-rw-r--r--code601.c2017
-rw-r--r--code601.h11
-rw-r--r--code65.c736
-rw-r--r--code65.h11
-rw-r--r--code68.c847
-rw-r--r--code68.h11
-rw-r--r--code6804.c451
-rw-r--r--code6804.h11
-rw-r--r--code6805.c786
-rw-r--r--code6805.h11
-rw-r--r--code6809.c1318
-rw-r--r--code6809.h11
-rw-r--r--code6812.c1143
-rw-r--r--code6812.h11
-rw-r--r--code6816.c1073
-rw-r--r--code6816.h11
-rw-r--r--code68k.c4428
-rw-r--r--code68k.h11
-rw-r--r--code7000.c1315
-rw-r--r--code7000.h11
-rw-r--r--code75k0.c1436
-rw-r--r--code75k0.h11
-rw-r--r--code7700.c1304
-rw-r--r--code7700.h11
-rw-r--r--code7720.c587
-rw-r--r--code7720.h11
-rw-r--r--code77230.c1024
-rw-r--r--code77230.h11
-rw-r--r--code78c10.c978
-rw-r--r--code78c10.h11
-rw-r--r--code78k0.c1228
-rw-r--r--code78k0.h11
-rw-r--r--code8008.c356
-rw-r--r--code8008.h11
-rw-r--r--code85.c423
-rw-r--r--code85.h11
-rw-r--r--code86.c2600
-rw-r--r--code86.h11
-rw-r--r--code87c800.c1316
-rw-r--r--code87c800.h11
-rw-r--r--code8x30x.c559
-rw-r--r--code8x30x.h11
-rw-r--r--code90c141.c1293
-rw-r--r--code90c141.h11
-rw-r--r--code96.c1253
-rw-r--r--code96.h11
-rw-r--r--code960.c767
-rw-r--r--code960.h11
-rw-r--r--code96c141.c2331
-rw-r--r--code96c141.h11
-rw-r--r--code97c241.c2190
-rw-r--r--code97c241.h11
-rw-r--r--code9900.c685
-rw-r--r--code9900.h11
-rw-r--r--codeace.c767
-rw-r--r--codeace.h11
-rw-r--r--codeavr.c784
-rw-r--r--codeavr.h11
-rw-r--r--codecop8.c727
-rw-r--r--codecop8.h11
-rw-r--r--codeflt1750.c158
-rw-r--r--codeflt1750.h7
-rw-r--r--codefmc8.c1017
-rw-r--r--codefmc8.h11
-rw-r--r--codeh8_3.c1707
-rw-r--r--codeh8_3.h11
-rw-r--r--codeh8_5.c1510
-rw-r--r--codeh8_5.h11
-rw-r--r--codem16.c2819
-rw-r--r--codem16.h11
-rw-r--r--codem16c.c2360
-rw-r--r--codem16c.h11
-rw-r--r--codemcore.c806
-rw-r--r--codemcore.h11
-rw-r--r--codemsp.c539
-rw-r--r--codemsp.h11
-rw-r--r--codepseudo.c1246
-rw-r--r--codepseudo.h37
-rw-r--r--codesc14xxx.c441
-rw-r--r--codesc14xxx.h16
-rw-r--r--codescmp.c326
-rw-r--r--codescmp.h11
-rw-r--r--codest6.c634
-rw-r--r--codest6.h11
-rw-r--r--codest7.c878
-rw-r--r--codest7.h11
-rw-r--r--codest9.c1878
-rw-r--r--codest9.h11
-rw-r--r--codetms7.c954
-rw-r--r--codetms7.h11
-rw-r--r--codevars.c14
-rw-r--r--codevars.h12
-rw-r--r--codexa.c1975
-rw-r--r--codexa.h11
-rw-r--r--codez8.c856
-rw-r--r--codez8.h11
-rw-r--r--codez80.c2814
-rw-r--r--codez80.h11
-rw-r--r--datatypes.h55
-rw-r--r--doc_DE/Makefile37
-rw-r--r--doc_DE/as.tex11792
-rw-r--r--doc_DE/dina4.sty135
-rw-r--r--doc_DE/pscomm.tex16
-rw-r--r--doc_DE/pscpu.tex420
-rw-r--r--doc_DE/tabids.tex33
-rw-r--r--doc_DE/taborg1.tex48
-rw-r--r--doc_DE/taborg2.tex49
-rw-r--r--doc_DE/taborg3.tex51
-rw-r--r--doc_DE/taborg4.tex11
-rw-r--r--doc_EN/Makefile36
-rw-r--r--doc_EN/as.tex11521
-rw-r--r--endian.c333
-rw-r--r--endian.h54
-rw-r--r--equs.h6
-rw-r--r--fileformat.h40
-rw-r--r--findhyphen.c270
-rw-r--r--findhyphen.h9
-rw-r--r--grhyph.c569
-rw-r--r--grhyph.h12
-rw-r--r--header.res6
-rw-r--r--headids.c124
-rw-r--r--headids.h28
-rw-r--r--hex.c72
-rw-r--r--hex.h19
-rw-r--r--include/80c50x.inc257
-rw-r--r--include/80c552.inc228
-rw-r--r--include/bitfuncs.inc85
-rw-r--r--include/ctype.inc94
-rw-r--r--include/h8_3048.inc560
-rw-r--r--include/reg166.inc780
-rw-r--r--include/reg251.inc225
-rw-r--r--include/reg29k.inc127
-rw-r--r--include/reg53x.inc344
-rw-r--r--include/reg683xx.inc700
-rw-r--r--include/reg7000.inc120
-rw-r--r--include/reg78k0.inc245
-rw-r--r--include/reg96.inc610
-rw-r--r--include/regavr.inc329
-rw-r--r--include/regcop8.inc242
-rw-r--r--include/reghc12.inc228
-rw-r--r--include/regm16c.inc421
-rw-r--r--include/regmsp.inc227
-rw-r--r--include/regst9.inc624
-rw-r--r--include/regz380.inc68
-rw-r--r--include/stddef04.inc54
-rw-r--r--include/stddef16.inc188
-rw-r--r--include/stddef17.inc116
-rw-r--r--include/stddef18.inc262
-rw-r--r--include/stddef2x.inc53
-rw-r--r--include/stddef37.inc527
-rw-r--r--include/stddef3x.inc96
-rw-r--r--include/stddef47.inc279
-rw-r--r--include/stddef51.inc374
-rw-r--r--include/stddef56k.inc69
-rw-r--r--include/stddef5x.inc109
-rw-r--r--include/stddef60.inc674
-rw-r--r--include/stddef62.inc147
-rw-r--r--include/stddef75.inc699
-rw-r--r--include/stddef87.inc218
-rw-r--r--include/stddef90.inc129
-rw-r--r--include/stddef96.inc170
-rw-r--r--include/stddefxa.inc405
-rw-r--r--include/stddefz8.inc56
-rw-r--r--install.bat24
-rw-r--r--install.cmd24
-rwxr-xr-xinstall.sh66
-rw-r--r--ioerrs.c193
-rw-r--r--ioerrs.h13
-rw-r--r--ioerrs.res212
-rw-r--r--makedefs.files35
-rw-r--r--makedefs.src53
-rw-r--r--makedefs.str41
-rw-r--r--marks.asm29
-rw-r--r--nlmessages.c210
-rw-r--r--nlmessages.h24
-rw-r--r--nls.c644
-rw-r--r--nls.h60
-rw-r--r--objdefs.dos14
-rw-r--r--objdefs.unix14
-rw-r--r--p2bin.1241
-rw-r--r--p2bin.c536
-rw-r--r--p2bin.res46
-rw-r--r--p2hex.1288
-rw-r--r--p2hex.c987
-rw-r--r--p2hex.res77
-rw-r--r--pascstyle.h17
-rw-r--r--pbind.1145
-rw-r--r--pbind.c182
-rw-r--r--pbind.res34
-rw-r--r--plist.184
-rw-r--r--plist.c169
-rw-r--r--plist.res57
-rw-r--r--reltypes.c9
-rw-r--r--rescomp.c433
-rw-r--r--specchars.h13
-rw-r--r--stdhandl.c110
-rw-r--r--stdhandl.h21
-rw-r--r--stdinc.h45
-rw-r--r--stringlists.c151
-rw-r--r--stringlists.h43
-rw-r--r--strutil.c461
-rw-r--r--strutil.h70
-rw-r--r--sysdefs.h774
-rw-r--r--tests/t_166/asflags0
-rw-r--r--tests/t_166/t_166.asm232
-rw-r--r--tests/t_166/t_166.doc5
-rw-r--r--tests/t_166/t_166.oribin0 -> 534 bytes
-rw-r--r--tests/t_16c5x/asflags0
-rwxr-xr-xtests/t_16c5x/t_16c5x.asm45
-rw-r--r--tests/t_16c5x/t_16c5x.doc5
-rwxr-xr-xtests/t_16c5x/t_16c5x.oribin0 -> 70 bytes
-rw-r--r--tests/t_16c84/asflags0
-rw-r--r--tests/t_16c84/t_16c84.asm53
-rw-r--r--tests/t_16c84/t_16c84.doc5
-rw-r--r--tests/t_16c84/t_16c84.oribin0 -> 90 bytes
-rw-r--r--tests/t_17c42/asflags0
-rw-r--r--tests/t_17c42/t_17c42.asm66
-rw-r--r--tests/t_17c42/t_17c42.doc5
-rw-r--r--tests/t_17c42/t_17c42.oribin0 -> 112 bytes
-rw-r--r--tests/t_251/asflags0
-rw-r--r--tests/t_251/t_251.asm399
-rw-r--r--tests/t_251/t_251.doc5
-rw-r--r--tests/t_251/t_251.oribin0 -> 1035 bytes
-rw-r--r--tests/t_296/asflags0
-rw-r--r--tests/t_296/t_296.asm132
-rw-r--r--tests/t_296/t_296.doc6
-rwxr-xr-xtests/t_296/t_296.oribin0 -> 463 bytes
-rw-r--r--tests/t_29k/asflags0
-rw-r--r--tests/t_29k/t_29k.asm80
-rw-r--r--tests/t_29k/t_29k.doc5
-rw-r--r--tests/t_29k/t_29k.oribin0 -> 220 bytes
-rw-r--r--tests/t_32/asflags0
-rw-r--r--tests/t_32/t_32.asm39
-rw-r--r--tests/t_32/t_32.doc6
-rw-r--r--tests/t_32/t_32.oribin0 -> 134 bytes
-rw-r--r--tests/t_3201x/asflags0
-rw-r--r--tests/t_3201x/t_3201x.asm74
-rw-r--r--tests/t_3201x/t_3201x.doc5
-rw-r--r--tests/t_3201x/t_3201x.oribin0 -> 148 bytes
-rw-r--r--tests/t_3203x/asflags0
-rw-r--r--tests/t_3203x/t_3203x.asm271
-rw-r--r--tests/t_3203x/t_3203x.doc5
-rwxr-xr-xtests/t_3203x/t_3203x.oribin0 -> 816 bytes
-rw-r--r--tests/t_3205x/asflags0
-rw-r--r--tests/t_3205x/t_3205x.asm499
-rw-r--r--tests/t_3205x/t_3205x.doc7
-rw-r--r--tests/t_3205x/t_3205x.oribin0 -> 866 bytes
-rw-r--r--tests/t_3206x/asflags0
-rw-r--r--tests/t_3206x/t_3206x.asm241
-rw-r--r--tests/t_3206x/t_3206x.doc5
-rw-r--r--tests/t_3206x/t_3206x.oribin0 -> 744 bytes
-rw-r--r--tests/t_370/asflags0
-rw-r--r--tests/t_370/t_370.asm163
-rw-r--r--tests/t_370/t_370.doc5
-rw-r--r--tests/t_370/t_370.oribin0 -> 317 bytes
-rw-r--r--tests/t_4004/asflags0
-rw-r--r--tests/t_4004/t_4004.asm205
-rw-r--r--tests/t_4004/t_4004.doc5
-rw-r--r--tests/t_4004/t_4004.oribin0 -> 240 bytes
-rw-r--r--tests/t_403/asflags0
-rw-r--r--tests/t_403/t_403.asm27
-rw-r--r--tests/t_403/t_403.doc6
-rw-r--r--tests/t_403/t_403.oribin0 -> 64 bytes
-rw-r--r--tests/t_4500/asflags0
-rw-r--r--tests/t_4500/t_4500.asm109
-rw-r--r--tests/t_4500/t_4500.doc5
-rw-r--r--tests/t_4500/t_4500.oribin0 -> 246 bytes
-rw-r--r--tests/t_47c00/asflags0
-rw-r--r--tests/t_47c00/t_47c00.asm255
-rw-r--r--tests/t_47c00/t_47c00.doc5
-rw-r--r--tests/t_47c00/t_47c00.oribin0 -> 529 bytes
-rw-r--r--tests/t_48/asflags0
-rw-r--r--tests/t_48/t_48.asm178
-rw-r--r--tests/t_48/t_48.doc5
-rw-r--r--tests/t_48/t_48.oribin0 -> 137 bytes
-rw-r--r--tests/t_56000/asflags0
-rw-r--r--tests/t_56000/t_56000.asm244
-rw-r--r--tests/t_56000/t_56000.doc5
-rw-r--r--tests/t_56000/t_56000.oribin0 -> 980 bytes
-rw-r--r--tests/t_56300/asflags0
-rw-r--r--tests/t_56300/t_56300.asm1462
-rw-r--r--tests/t_56300/t_56300.doc6
-rw-r--r--tests/t_56300/t_56300.oribin0 -> 6788 bytes
-rw-r--r--tests/t_65/asflags0
-rwxr-xr-xtests/t_65/t_65.asm283
-rw-r--r--tests/t_65/t_65.doc5
-rwxr-xr-xtests/t_65/t_65.oribin0 -> 460 bytes
-rw-r--r--tests/t_6502u/asflags0
-rw-r--r--tests/t_6502u/t_6502u.asm110
-rw-r--r--tests/t_6502u/t_6502u.doc7
-rw-r--r--tests/t_6502u/t_6502u.oribin0 -> 207 bytes
-rw-r--r--tests/t_6804/asflags0
-rw-r--r--tests/t_6804/t_6804.asm72
-rw-r--r--tests/t_6804/t_6804.doc5
-rw-r--r--tests/t_6804/t_6804.oribin0 -> 92 bytes
-rw-r--r--tests/t_68040/asflags0
-rw-r--r--tests/t_68040/t_68040.asm29
-rw-r--r--tests/t_68040/t_68040.doc6
-rw-r--r--tests/t_68040/t_68040.oribin0 -> 60 bytes
-rw-r--r--tests/t_6805/asflags0
-rwxr-xr-xtests/t_6805/t_6805.asm244
-rw-r--r--tests/t_6805/t_6805.doc5
-rwxr-xr-xtests/t_6805/t_6805.oribin0 -> 405 bytes
-rw-r--r--tests/t_6808/asflags0
-rw-r--r--tests/t_6808/t_6808.asm406
-rw-r--r--tests/t_6808/t_6808.doc6
-rw-r--r--tests/t_6808/t_6808.oribin0 -> 671 bytes
-rw-r--r--tests/t_6812/asflags0
-rw-r--r--tests/t_6812/t_6812.asm644
-rw-r--r--tests/t_6812/t_6812.doc5
-rw-r--r--tests/t_6812/t_6812.oribin0 -> 1104 bytes
-rw-r--r--tests/t_6816/asflags0
-rw-r--r--tests/t_6816/t_6816.asm1037
-rw-r--r--tests/t_6816/t_6816.doc5
-rw-r--r--tests/t_6816/t_6816.oribin0 -> 2874 bytes
-rw-r--r--tests/t_7000/asflags0
-rw-r--r--tests/t_7000/t_7000.asm249
-rw-r--r--tests/t_7000/t_7000.doc5
-rw-r--r--tests/t_7000/t_7000.oribin0 -> 428 bytes
-rw-r--r--tests/t_75k0/asflags0
-rw-r--r--tests/t_75k0/t_75k0.asm191
-rw-r--r--tests/t_75k0/t_75k0.doc5
-rw-r--r--tests/t_75k0/t_75k0.oribin0 -> 262 bytes
-rw-r--r--tests/t_7700/asflags0
-rw-r--r--tests/t_7700/t_7700.asm356
-rw-r--r--tests/t_7700/t_7700.doc5
-rw-r--r--tests/t_7700/t_7700.oribin0 -> 934 bytes
-rw-r--r--tests/t_7720/asflags0
-rw-r--r--tests/t_7720/t_7720.asm141
-rw-r--r--tests/t_7720/t_7720.doc5
-rw-r--r--tests/t_7720/t_7720.oribin0 -> 392 bytes
-rw-r--r--tests/t_77230/asflags0
-rw-r--r--tests/t_77230/t_77230.asm245
-rw-r--r--tests/t_77230/t_77230.doc5
-rw-r--r--tests/t_77230/t_77230.oribin0 -> 668 bytes
-rw-r--r--tests/t_7725/asflags0
-rw-r--r--tests/t_7725/t_7725.asm171
-rw-r--r--tests/t_7725/t_7725.doc5
-rw-r--r--tests/t_7725/t_7725.oribin0 -> 508 bytes
-rw-r--r--tests/t_78c1x/asflags0
-rw-r--r--tests/t_78c1x/t_78c1x.asm258
-rw-r--r--tests/t_78c1x/t_78c1x.doc5
-rw-r--r--tests/t_78c1x/t_78c1x.oribin0 -> 465 bytes
-rw-r--r--tests/t_78k0/asflags0
-rw-r--r--tests/t_78k0/t_78k0.asm291
-rw-r--r--tests/t_78k0/t_78k0.doc5
-rw-r--r--tests/t_78k0/t_78k0.oribin0 -> 606 bytes
-rw-r--r--tests/t_85/asflags0
-rw-r--r--tests/t_85/t_85.asm134
-rw-r--r--tests/t_85/t_85.doc5
-rw-r--r--tests/t_85/t_85.oribin0 -> 180 bytes
-rw-r--r--tests/t_87c800/asflags0
-rw-r--r--tests/t_87c800/t_87c800.asm310
-rw-r--r--tests/t_87c800/t_87c800.doc5
-rw-r--r--tests/t_87c800/t_87c800.oribin0 -> 609 bytes
-rw-r--r--tests/t_8x30x/asflags0
-rw-r--r--tests/t_8x30x/t_8x30x.asm57
-rw-r--r--tests/t_8x30x/t_8x30x.doc5
-rw-r--r--tests/t_8x30x/t_8x30x.oribin0 -> 80 bytes
-rw-r--r--tests/t_96/asflags0
-rw-r--r--tests/t_96/t_96.asm217
-rw-r--r--tests/t_96/t_96.doc5
-rw-r--r--tests/t_96/t_96.oribin0 -> 531 bytes
-rw-r--r--tests/t_960/asflags0
-rw-r--r--tests/t_960/t_960.asm101
-rw-r--r--tests/t_960/t_960.doc5
-rw-r--r--tests/t_960/t_960.oribin0 -> 404 bytes
-rw-r--r--tests/t_97c241/asflags0
-rw-r--r--tests/t_97c241/t_97c241.asm336
-rw-r--r--tests/t_97c241/t_97c241.doc5
-rw-r--r--tests/t_97c241/t_97c241.oribin0 -> 1100 bytes
-rw-r--r--tests/t_9900/asflags0
-rw-r--r--tests/t_9900/t_9900.asm222
-rw-r--r--tests/t_9900/t_9900.doc5
-rw-r--r--tests/t_9900/t_9900.oribin0 -> 550 bytes
-rw-r--r--tests/t_ace/asflags0
-rw-r--r--tests/t_ace/t_ace.asm132
-rw-r--r--tests/t_ace/t_ace.doc5
-rw-r--r--tests/t_ace/t_ace.oribin0 -> 159 bytes
-rw-r--r--tests/t_avr/asflags0
-rw-r--r--tests/t_avr/t_avr.asm229
-rw-r--r--tests/t_avr/t_avr.doc5
-rw-r--r--tests/t_avr/t_avr.oribin0 -> 238 bytes
-rw-r--r--tests/t_bas52/asflags0
-rw-r--r--tests/t_bas52/bas52.clk18
-rw-r--r--tests/t_bas52/bas52.fp1616
-rw-r--r--tests/t_bas52/bas52.out75
-rw-r--r--tests/t_bas52/bas52.pgm125
-rw-r--r--tests/t_bas52/bas52.pwm25
-rw-r--r--tests/t_bas52/bas52.rst111
-rw-r--r--tests/t_bas52/bas52.tl16
-rw-r--r--tests/t_bas52/look52.inc779
-rw-r--r--tests/t_bas52/t_bas52.asm4644
-rw-r--r--tests/t_bas52/t_bas52.doc11
-rw-r--r--tests/t_bas52/t_bas52.inc2
-rw-r--r--tests/t_bas52/t_bas52.oribin0 -> 8192 bytes
-rw-r--r--tests/t_buf32/asflags0
-rw-r--r--tests/t_buf32/t_buf32.asm4883
-rw-r--r--tests/t_buf32/t_buf32.doc5
-rw-r--r--tests/t_buf32/t_buf32.inc2
-rw-r--r--tests/t_buf32/t_buf32.oribin0 -> 8192 bytes
-rw-r--r--tests/t_cop8/asflags0
-rw-r--r--tests/t_cop8/t_cop8.asm128
-rw-r--r--tests/t_cop8/t_cop8.doc5
-rw-r--r--tests/t_cop8/t_cop8.oribin0 -> 262 bytes
-rw-r--r--tests/t_f2mc8l/asflags0
-rw-r--r--tests/t_f2mc8l/t_f2mc8l.asm242
-rw-r--r--tests/t_f2mc8l/t_f2mc8l.doc5
-rw-r--r--tests/t_f2mc8l/t_f2mc8l.oribin0 -> 314 bytes
-rw-r--r--tests/t_fl90/asflags0
-rw-r--r--tests/t_fl90/cpu_time.inc170
-rw-r--r--tests/t_fl90/float.inc1601
-rw-r--r--tests/t_fl90/macros.inc57
-rw-r--r--tests/t_fl90/mon.inc11
-rw-r--r--tests/t_fl90/t_fl90.asm179
-rw-r--r--tests/t_fl90/t_fl90.doc6
-rw-r--r--tests/t_fl90/t_fl90.oribin0 -> 5466 bytes
-rw-r--r--tests/t_fl900/asflags0
-rw-r--r--tests/t_fl900/conout.inc154
-rw-r--r--tests/t_fl900/cpu_time.inc240
-rw-r--r--tests/t_fl900/float.inc973
-rw-r--r--tests/t_fl900/macros.inc16
-rw-r--r--tests/t_fl900/t_fl900.asm166
-rw-r--r--tests/t_fl900/t_fl900.doc6
-rw-r--r--tests/t_fl900/t_fl900.inc2
-rwxr-xr-xtests/t_fl900/t_fl900.oribin0 -> 3408 bytes
-rw-r--r--tests/t_full09/asflags1
-rw-r--r--tests/t_full09/t_full09.asm1604
-rw-r--r--tests/t_full09/t_full09.doc6
-rw-r--r--tests/t_full09/t_full09.oribin0 -> 7308 bytes
-rw-r--r--tests/t_h8_3/asflags0
-rw-r--r--tests/t_h8_3/t_h8_3.asm353
-rw-r--r--tests/t_h8_3/t_h8_3.doc5
-rw-r--r--tests/t_h8_3/t_h8_3.oribin0 -> 1156 bytes
-rw-r--r--tests/t_h8_5/asflags0
-rw-r--r--tests/t_h8_5/t_h8_5.asm229
-rw-r--r--tests/t_h8_5/t_h8_5.doc5
-rw-r--r--tests/t_h8_5/t_h8_5.oribin0 -> 407 bytes
-rw-r--r--tests/t_m16c/asflags0
-rw-r--r--tests/t_m16c/t_m16c.asm4051
-rw-r--r--tests/t_m16c/t_m16c.doc6
-rw-r--r--tests/t_m16c/t_m16c.oribin0 -> 15722 bytes
-rw-r--r--tests/t_mcore/asflags0
-rw-r--r--tests/t_mcore/t_mcore.asm140
-rw-r--r--tests/t_mcore/t_mcore.doc5
-rw-r--r--tests/t_mcore/t_mcore.oribin0 -> 240 bytes
-rw-r--r--tests/t_mic51/DEBUG.ASM532
-rw-r--r--tests/t_mic51/MAKRO1.ASM542
-rw-r--r--tests/t_mic51/MEM1.ASM727
-rw-r--r--tests/t_mic51/RUN1.ASM773
-rw-r--r--tests/t_mic51/TAST1.ASM250
-rw-r--r--tests/t_mic51/TEACH1.ASM504
-rw-r--r--tests/t_mic51/asflags1
-rw-r--r--tests/t_mic51/defKey.inc83
-rw-r--r--tests/t_mic51/defModul.inc18
-rw-r--r--tests/t_mic51/defMsg.inc141
-rw-r--r--tests/t_mic51/defParam.inc46
-rw-r--r--tests/t_mic51/defgequ.inc48
-rw-r--r--tests/t_mic51/defint.inc234
-rw-r--r--tests/t_mic51/defmacro.inc175
-rw-r--r--tests/t_mic51/net_lcd.inc33
-rw-r--r--tests/t_mic51/t_mic51.asm2197
-rw-r--r--tests/t_mic51/t_mic51.doc6
-rw-r--r--tests/t_mic51/t_mic51.inc165
-rwxr-xr-xtests/t_mic51/t_mic51.oribin0 -> 17582 bytes
-rw-r--r--tests/t_mic51/t_mod1.asm487
-rw-r--r--tests/t_msp/asflags0
-rw-r--r--tests/t_msp/t_msp.asm116
-rw-r--r--tests/t_msp/t_msp.doc5
-rw-r--r--tests/t_msp/t_msp.oribin0 -> 363 bytes
-rw-r--r--tests/t_parsys/asflags1
-rw-r--r--tests/t_parsys/float.i681226
-rw-r--r--tests/t_parsys/float81.i68293
-rw-r--r--tests/t_parsys/parsys.i68115
-rw-r--r--tests/t_parsys/t_parsys.asm994
-rw-r--r--tests/t_parsys/t_parsys.doc8
-rw-r--r--tests/t_parsys/t_parsys.inc10
-rw-r--r--tests/t_parsys/t_parsys.oribin0 -> 7516 bytes
-rw-r--r--tests/t_scmp/asflags0
-rw-r--r--tests/t_scmp/t_scmp.asm59
-rw-r--r--tests/t_scmp/t_scmp.doc5
-rwxr-xr-xtests/t_scmp/t_scmp.oribin0 -> 68 bytes
-rw-r--r--tests/t_secdrive/asflags0
l---------tests/t_secdrive/lowlevel.inc1
-rw-r--r--tests/t_secdrive/secparam.inc1619
-rw-r--r--tests/t_secdrive/t_secdrive.asm1476
-rw-r--r--tests/t_secdrive/t_secdrive.doc9
-rwxr-xr-xtests/t_secdrive/t_secdrive.oribin0 -> 11271 bytes
-rw-r--r--tests/t_secdrive/wd1002xt.inc773
-rw-r--r--tests/t_secdrive/wd1003at.inc952
-rw-r--r--tests/t_st6/asflags0
-rwxr-xr-xtests/t_st6/t_st6.asm82
-rw-r--r--tests/t_st6/t_st6.doc5
-rwxr-xr-xtests/t_st6/t_st6.oribin0 -> 102 bytes
-rw-r--r--tests/t_st7/asflags0
-rw-r--r--tests/t_st7/t_st7.asm561
-rw-r--r--tests/t_st7/t_st7.doc5
-rw-r--r--tests/t_st7/t_st7.oribin0 -> 1313 bytes
-rw-r--r--tests/t_st9/asflags0
-rw-r--r--tests/t_st9/t_st9.asm1243
-rw-r--r--tests/t_st9/t_st9.doc5
-rwxr-xr-xtests/t_st9/t_st9.oribin0 -> 3290 bytes
-rw-r--r--tests/t_tms7/asflags0
-rwxr-xr-xtests/t_tms7/t_tms7.asm364
-rw-r--r--tests/t_tms7/t_tms7.doc5
-rwxr-xr-xtests/t_tms7/t_tms7.oribin0 -> 696 bytes
-rw-r--r--tests/t_xa/asflags0
-rw-r--r--tests/t_xa/t_xa.asm603
-rw-r--r--tests/t_xa/t_xa.doc5
-rw-r--r--tests/t_xa/t_xa.oribin0 -> 1525 bytes
-rw-r--r--tests/t_z380/asflags0
-rw-r--r--tests/t_z380/t_z380.asm677
-rw-r--r--tests/t_z380/t_z380.doc5
-rw-r--r--tests/t_z380/t_z380.oribin0 -> 1650 bytes
-rw-r--r--tests/t_z8/asflags0
-rw-r--r--tests/t_z8/t_z8.asm116
-rw-r--r--tests/t_z8/t_z8.doc5
-rw-r--r--tests/t_z8/t_z8.oribin0 -> 180 bytes
-rwxr-xr-xtests/testall38
-rw-r--r--tests/testall.bat117
-rw-r--r--tests/testall.cmd117
-rw-r--r--tests/warnlog.DE35
-rw-r--r--tests/warnlog.EN35
-rw-r--r--tex2doc.c2247
-rw-r--r--tex2html.c2570
-rw-r--r--tools.res35
-rw-r--r--tools2.res70
-rw-r--r--toolutils.c293
-rw-r--r--toolutils.h52
-rw-r--r--tsc.h3
-rw-r--r--umlaut.c65
-rw-r--r--unumlaut.c91
-rw-r--r--ushyph.c696
-rw-r--r--ushyph.h14
-rw-r--r--version.c28
-rw-r--r--version.h12
651 files changed, 204302 insertions, 0 deletions
diff --git a/BENCHES b/BENCHES
new file mode 100644
index 0000000..767ec86
--- /dev/null
+++ b/BENCHES
@@ -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 ;-)
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..ca7234d
--- /dev/null
+++ b/INSTALL
@@ -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
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..41ddbaa
--- /dev/null
+++ b/Makefile
@@ -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
diff --git a/Makefile.def-samples/MakeDef.cad b/Makefile.def-samples/MakeDef.cad
new file mode 100644
index 0000000..11ba842
--- /dev/null
+++ b/Makefile.def-samples/MakeDef.cad
@@ -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
diff --git a/Makefile.def-samples/MakeDef.dos b/Makefile.def-samples/MakeDef.dos
new file mode 100644
index 0000000..444f7ca
--- /dev/null
+++ b/Makefile.def-samples/MakeDef.dos
@@ -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
diff --git a/Makefile.def-samples/MakeDef.dpmi b/Makefile.def-samples/MakeDef.dpmi
new file mode 100644
index 0000000..bf2ed48
--- /dev/null
+++ b/Makefile.def-samples/MakeDef.dpmi
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-alpha-dec-osf13.2 b/Makefile.def-samples/Makefile.def-alpha-dec-osf13.2
new file mode 100644
index 0000000..7f88057
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-alpha-dec-osf13.2
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-alpha-dec-osf14.0 b/Makefile.def-samples/Makefile.def-alpha-dec-osf14.0
new file mode 100644
index 0000000..784fbc5
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-alpha-dec-osf14.0
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-alpha-unknown-linux2.x.x b/Makefile.def-samples/Makefile.def-alpha-unknown-linux2.x.x
new file mode 100644
index 0000000..369572e
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-alpha-unknown-linux2.x.x
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-hppa-hp-hpux-10.0 b/Makefile.def-samples/Makefile.def-hppa-hp-hpux-10.0
new file mode 100644
index 0000000..9f08148
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-hppa-hp-hpux-10.0
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-hppa-hp-hpux-9.0 b/Makefile.def-samples/Makefile.def-hppa-hp-hpux-9.0
new file mode 100644
index 0000000..cb64e8d
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-hppa-hp-hpux-9.0
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-i386-unknown-dpmi b/Makefile.def-samples/Makefile.def-i386-unknown-dpmi
new file mode 100644
index 0000000..bf2ed48
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-i386-unknown-dpmi
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-i386-unknown-linux2.x.x b/Makefile.def-samples/Makefile.def-i386-unknown-linux2.x.x
new file mode 100644
index 0000000..ae0fbd0
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-i386-unknown-linux2.x.x
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-i386-unknown-msdos b/Makefile.def-samples/Makefile.def-i386-unknown-msdos
new file mode 100644
index 0000000..444f7ca
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-i386-unknown-msdos
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-i386-unknown-os2 b/Makefile.def-samples/Makefile.def-i386-unknown-os2
new file mode 100644
index 0000000..4fdab90
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-i386-unknown-os2
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-i386-unknown-os2-visualage b/Makefile.def-samples/Makefile.def-i386-unknown-os2-visualage
new file mode 100644
index 0000000..b076f9f
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-i386-unknown-os2-visualage
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-i386-unknown-win32 b/Makefile.def-samples/Makefile.def-i386-unknown-win32
new file mode 100644
index 0000000..d46abdb
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-i386-unknown-win32
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-m68k-pcs-munix3 b/Makefile.def-samples/Makefile.def-m68k-pcs-munix3
new file mode 100644
index 0000000..11ba842
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-m68k-pcs-munix3
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-m68k-sun-netbsd1.2 b/Makefile.def-samples/Makefile.def-m68k-sun-netbsd1.2
new file mode 100644
index 0000000..6c49567
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-m68k-sun-netbsd1.2
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-mips-dec-netbsd1.2 b/Makefile.def-samples/Makefile.def-mips-dec-netbsd1.2
new file mode 100644
index 0000000..f0770f9
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-mips-dec-netbsd1.2
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-mips-dec-ultrix4.3 b/Makefile.def-samples/Makefile.def-mips-dec-ultrix4.3
new file mode 100644
index 0000000..fe6b04e
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-mips-dec-ultrix4.3
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-mips-sgi-irix6.2 b/Makefile.def-samples/Makefile.def-mips-sgi-irix6.2
new file mode 100644
index 0000000..5e7574e
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-mips-sgi-irix6.2
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-mips64-sgi-irix6.4 b/Makefile.def-samples/Makefile.def-mips64-sgi-irix6.4
new file mode 100644
index 0000000..e2187d4
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-mips64-sgi-irix6.4
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-rs6k-ibm-aix41 b/Makefile.def-samples/Makefile.def-rs6k-ibm-aix41
new file mode 100644
index 0000000..0634744
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-rs6k-ibm-aix41
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-sparc-sun-solaris2.x b/Makefile.def-samples/Makefile.def-sparc-sun-solaris2.x
new file mode 100644
index 0000000..5d4ecb1
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-sparc-sun-solaris2.x
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-sparc-sun-sunos4.1.3 b/Makefile.def-samples/Makefile.def-sparc-sun-sunos4.1.3
new file mode 100644
index 0000000..f470d8d
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-sparc-sun-sunos4.1.3
@@ -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
diff --git a/Makefile.def-samples/Makefile.def-vax-dec-ultrix4.1 b/Makefile.def-samples/Makefile.def-vax-dec-ultrix4.1
new file mode 100644
index 0000000..8f2381a
--- /dev/null
+++ b/Makefile.def-samples/Makefile.def-vax-dec-ultrix4.1
@@ -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
diff --git a/Makefile.def.tmpl b/Makefile.def.tmpl
new file mode 100644
index 0000000..a11b1e6
--- /dev/null
+++ b/Makefile.def.tmpl
@@ -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
diff --git a/Makefile.dos b/Makefile.dos
new file mode 100755
index 0000000..8858b44
--- /dev/null
+++ b/Makefile.dos
@@ -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
diff --git a/Makefile.os2 b/Makefile.os2
new file mode 100644
index 0000000..5c967d9
--- /dev/null
+++ b/Makefile.os2
@@ -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
diff --git a/README b/README
new file mode 100644
index 0000000..3656479
--- /dev/null
+++ b/README
@@ -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 .
diff --git a/README.DOS b/README.DOS
new file mode 100644
index 0000000..5f476c2
--- /dev/null
+++ b/README.DOS
@@ -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 .
+
diff --git a/README.KR b/README.KR
new file mode 100644
index 0000000..7347391
--- /dev/null
+++ b/README.KR
@@ -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...
diff --git a/README.LANGS b/README.LANGS
new file mode 100644
index 0000000..2e5eeda
--- /dev/null
+++ b/README.LANGS
@@ -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
diff --git a/README.OS2 b/README.OS2
new file mode 100644
index 0000000..4e59cc1
--- /dev/null
+++ b/README.OS2
@@ -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...
+
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..7b2fa19
--- /dev/null
+++ b/TODO
@@ -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
diff --git a/a2k.c b/a2k.c
new file mode 100644
index 0000000..43685f9
--- /dev/null
+++ b/a2k.c
@@ -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;
+} \ No newline at end of file
diff --git a/addcr.c b/addcr.c
new file mode 100644
index 0000000..85e6147
--- /dev/null
+++ b/addcr.c
@@ -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;
+} \ No newline at end of file
diff --git a/as.c b/as.c
new file mode 100644
index 0000000..1ce4579
--- /dev/null
+++ b/as.c
@@ -0,0 +1,2985 @@
+/* as.c */
+/*****************************************************************************/
+/* AS-Portierung */
+/* */
+/* Hauptmodul */
+/* */
+/* Historie: 4. 5.1996 Grundsteinlegung */
+/* 24. 6.1998 Zeichenübersetzungstabellen */
+/* 30. 6.1998 Ausgabe in MacPro-File auch wenn Zeile nur aus */
+/* Kommentar oder Label besteht */
+/* 18. 7.1998 IRPC-Statement */
+/* 24. 7.1998 Debug-Modus NoICE */
+/* 25. 7.1998 Formate glattgezogen */
+/* 16. 8.1998 Datei-Adressbereiche zurücksetzen */
+/* 17. 8.1998 InMacroFlag nach asmdef verschoben */
+/* 19. 8.1998 BranchExt-Initialisierung */
+/* 25. 8.1998 i960-Initialisierung */
+/* 28. 8.1998 32-Bit-Listen gehen auch korrekt mit */
+/* Codelaengen != 4*n um */
+/* 30. 8.1998 uPD7720-Initialisierung */
+/* Einrueckung fuer 'R' in Retracted-Zeilen im Listing */
+/* war nicht korrekt */
+/* 13. 9.1998 uPD77230-Initialisierung */
+/* 30. 9.1998 SYM53C8xx-Initialisierung */
+/* 3.12.1998 8008-Initialisierung */
+/* 9. 1.1999 PCs erst nach Schreiben des Codes hochzaehlen */
+/* ChkPC mit Adresse als Parameter */
+/* 30. 1.1999 Formate maschinenunabhaengig gemacht */
+/* 12. 2.1999 Compilerwarnungen beseitigt */
+/* 25. 3.1999 SC14xxx-Initialisierung */
+/* 17. 4.1999 CPU per Kommandozeile setzen */
+/* 18. 4.1999 Ausgabeliste Sharefiles */
+/* 4. 7.1999 F2MC8-Initialisierung */
+/* 8. 8.1999 Externliste immer am Ende einer Zeile loeschen */
+/* 14. 8.1999 Initialisierung ACE */
+/* 5.11.1999 ExtendErrors, 2. Stufe */
+/* */
+/*****************************************************************************/
+
+#include "stdinc.h"
+#include <string.h>
+#include <ctype.h>
+#include <setjmp.h>
+
+#include "version.h"
+#include "endian.h"
+#include "bpemu.h"
+
+#include "stdhandl.h"
+#include "cmdarg.h"
+#include "nls.h"
+#include "nlmessages.h"
+#include "as.rsc"
+#include "ioerrs.h"
+#include "strutil.h"
+#include "stringlists.h"
+#include "asmitree.h"
+#include "chunks.h"
+#include "asminclist.h"
+#include "asmfnums.h"
+#include "asmdef.h"
+#include "asmsub.h"
+#include "asmpars.h"
+#include "asmmac.h"
+#include "asmif.h"
+#include "asmcode.h"
+#include "asmdebug.h"
+#include "asmrelocs.h"
+#include "asmallg.h"
+#include "codepseudo.h"
+#include "as.h"
+
+#include "code68k.h"
+#include "code56k.h"
+#include "code601.h"
+#include "codemcore.h"
+#include "code68.h"
+#include "code6805.h"
+#include "code6809.h"
+#include "code6812.h"
+#include "code6816.h"
+#include "codeh8_3.h"
+#include "codeh8_5.h"
+#include "code7000.h"
+#include "code65.h"
+#include "code7700.h"
+#include "code4500.h"
+#include "codem16.h"
+#include "codem16c.h"
+#include "code4004.h"
+#include "code8008.h"
+#include "code48.h"
+#include "code51.h"
+#include "code96.h"
+#include "code85.h"
+#include "code86.h"
+#include "code960.h"
+#include "code8x30x.h"
+#include "codexa.h"
+#include "codeavr.h"
+#include "code29k.h"
+#include "code166.h"
+#include "codez80.h"
+#include "codez8.h"
+#include "code96c141.h"
+#include "code90c141.h"
+#include "code87c800.h"
+#include "code47c00.h"
+#include "code97c241.h"
+#include "code16c5x.h"
+#include "code16c8x.h"
+#include "code17c4x.h"
+#include "codest6.h"
+#include "codest7.h"
+#include "codest9.h"
+#include "code6804.h"
+#include "code3201x.h"
+#include "code3202x.h"
+#include "code3203x.h"
+#include "code3205x.h"
+#include "code3206x.h"
+#include "code9900.h"
+#include "codetms7.h"
+#include "code370.h"
+#include "codemsp.h"
+#include "codescmp.h"
+#include "codecop8.h"
+#include "codesc14xxx.h"
+#include "codeace.h"
+#include "code78c10.h"
+#include "code75k0.h"
+#include "code78k0.h"
+#include "code7720.h"
+#include "code77230.h"
+#include "code53c8xx.h"
+#include "codefmc8.h"
+#include "as1750.h"
+/** Code21xx};**/
+
+/**
+VAR
+ ParCnt,k:Integer;
+ CPU:CPUVar;**/
+static String FileMask;
+static long StartTime,StopTime;
+static Boolean GlobErrFlag;
+static Boolean MasterFile;
+
+/*=== Zeilen einlesen ======================================================*/
+
+
+#if 0
+#define dbgentry(str) printf("***enter %s\n",str);
+#define dbgexit(str) printf("***exit %s\n",str);
+#else
+#define dbgentry(str) {}
+#define dbgexit(str) {}
+#endif
+
+ static void NULL_Restorer(PInputTag PInp)
+BEGIN
+END
+
+ static Boolean NULL_GetPos(PInputTag PInp, char *dest)
+BEGIN
+ *dest='\0'; return False;
+END
+
+ static void GenerateProcessor(PInputTag *PInp)
+BEGIN
+ *PInp=(PInputTag) malloc(sizeof(TInputTag));
+ (*PInp)->IsMacro=False;
+ (*PInp)->Next=Nil;
+ (*PInp)->First=True;
+ (*PInp)->OrigDoLst=DoLst;
+ (*PInp)->StartLine=CurrLine;
+ (*PInp)->ParCnt=0; (*PInp)->ParZ=0;
+ InitStringList(&((*PInp)->Params));
+ (*PInp)->LineCnt=0; (*PInp)->LineZ=1;
+ (*PInp)->Lines=Nil;
+ (*PInp)->SpecName[0]='\0';
+ (*PInp)->IsEmpty=False;
+ (*PInp)->Buffer=Nil;
+ (*PInp)->Datei=Nil;
+ (*PInp)->IfLevel=SaveIFs();
+ (*PInp)->Restorer=NULL_Restorer;
+ (*PInp)->GetPos=NULL_GetPos;
+END
+
+/*=========================================================================*/
+/* Listing erzeugen */
+
+ static void MakeList_Gen2Line(char *h, Word EffLen, Word *n)
+BEGIN
+ int z,Rest;
+
+ Rest=EffLen-(*n); if (Rest>8) Rest=8; if (DontPrint) Rest=0;
+ for (z=0; z<(Rest>>1); z++)
+ BEGIN
+ strmaxcat(h,HexString(WAsmCode[(*n)>>1],4),255);
+ strmaxcat(h," ",255);
+ (*n)+=2;
+ END
+ if ((Rest&1)!=0)
+ BEGIN
+ strmaxcat(h,HexString(BAsmCode[*n],2),255);
+ strmaxcat(h," ",255);
+ (*n)++;
+ END
+ for (z=1; z<=(8-Rest)>>1; z++)
+ strmaxcat(h," ",255);
+END
+
+ static void MakeList_Gen4Line(char *h, Word EffLen, Word *n)
+BEGIN
+ int z,Rest,wr=0;
+
+ Rest=EffLen-(*n); if (Rest>8) Rest=8; if (DontPrint) Rest=0;
+ for (z=0; z<(Rest>>2); z++)
+ BEGIN
+ strmaxcat(h,HexString(DAsmCode[(*n)>>2],8),255);
+ strmaxcat(h," ",255);
+ (*n)+=4; wr+=9;
+ END
+ for (z=0; z<(Rest&3); z++)
+ BEGIN
+ strmaxcat(h,HexString(BAsmCode[(*n)++],2),255);
+ strmaxcat(h," ",255);
+ wr+=3;
+ END
+ strmaxcat(h,Blanks(20-wr),255);
+END
+
+ static void MakeList(void)
+BEGIN
+ String h,h2,Tmp;
+ Byte i,k;
+ Word n;
+ Word EffLen;
+
+ EffLen=CodeLen*Granularity();
+
+ if ((NOT ListToNull) AND (DoLst) AND ((ListMask&1)!=0) AND (NOT IFListMask()))
+ BEGIN
+ /* Zeilennummer / Programmzaehleradresse: */
+
+ if (IncDepth==0) strmaxcpy(h2," ",255);
+ else
+ BEGIN
+ sprintf(Tmp,IntegerFormat,IncDepth);
+ sprintf(h2,"(%s)",Tmp);
+ END
+ if ((ListMask&0x10)!=0)
+ BEGIN
+ sprintf(h,"%5d/",CurrLine); strmaxcat(h2,h,255);
+ END
+ strmaxcpy(h,h2,255); strmaxcat(h,HexBlankString(EProgCounter()-CodeLen,8),255);
+ strmaxcat(h,Retracted?" R ":" : ",255);
+
+ /* Extrawurst in Listing ? */
+
+ if (*ListLine!='\0')
+ BEGIN
+ strmaxcat(h,ListLine,255);
+ strmaxcat(h,Blanks(20-strlen(ListLine)),255);
+ strmaxcat(h,OneLine,255);
+ WrLstLine(h);
+ *ListLine='\0';
+ END
+
+ /* Code ausgeben */
+
+ else
+ switch (ActListGran)
+ BEGIN
+ case 4:
+ n=0; MakeList_Gen4Line(h,EffLen,&n);
+ strmaxcat(h,OneLine,255); WrLstLine(h);
+ if (NOT DontPrint)
+ while (n<EffLen)
+ BEGIN
+ strmaxcpy(h," ",255);
+ MakeList_Gen4Line(h,EffLen,&n);
+ WrLstLine(h);
+ END
+ break;
+ case 2:
+ n=0; MakeList_Gen2Line(h,EffLen,&n);
+ strmaxcat(h,OneLine,255); WrLstLine(h);
+ if (NOT DontPrint)
+ while (n<EffLen)
+ BEGIN
+ strmaxcpy(h," ",255);
+ MakeList_Gen2Line(h,EffLen,&n);
+ WrLstLine(h);
+ END
+ break;
+ default:
+ if ((TurnWords) AND (Granularity()!=ActListGran)) DreheCodes();
+ for (i=0; i<6; i++)
+ if ((NOT DontPrint) AND (EffLen>i))
+ BEGIN
+ strmaxcat(h,HexString(BAsmCode[i],2),255); strmaxcat(h," ",255);
+ END
+ else strmaxcat(h," ",255);
+ strmaxcat(h," ",255); strmaxcat(h,OneLine,255);
+ WrLstLine(h);
+ if ((EffLen>6) AND (NOT DontPrint))
+ BEGIN
+ EffLen-=6;
+ n=EffLen/6; if ((EffLen%6)==0) n--;
+ for (i=0; i<=n; i++)
+ BEGIN
+ strmaxcpy(h," ",255);
+ for (k=0; k<6; k++)
+ if (EffLen>i*6+k)
+ BEGIN
+ strmaxcat(h,HexString(BAsmCode[i*6+k+6],2),255);
+ strmaxcat(h," ",255);
+ END
+ WrLstLine(h);
+ END
+ END
+ if ((TurnWords) AND (Granularity()!=ActListGran)) DreheCodes();
+ END
+
+ END
+END
+
+/*=========================================================================*/
+/* Makroprozessor */
+
+/*-------------------------------------------------------------------------*/
+/* allgemein gebrauchte Subfunktionen */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* werden gebraucht, um festzustellen, ob innerhalb eines Makrorumpfes weitere
+ Makroschachtelungen auftreten */
+
+ Boolean MacroStart(void)
+BEGIN
+ return ((Memo("MACRO")) OR (Memo("IRP")) OR (Memo("IRPC")) OR (Memo("REPT")) OR (Memo("WHILE")));
+END
+
+ Boolean MacroEnd(void)
+BEGIN
+ return (Memo("ENDM"));
+END
+
+/*-------------------------------------------------------------------------*/
+/* Dieser Einleseprozessor dient nur dazu, eine fehlerhafte Makrodefinition
+ bis zum Ende zu ueberlesen */
+
+ static void WaitENDM_Processor(void)
+BEGIN
+ POutputTag Tmp;
+
+ if (MacroStart()) FirstOutputTag->NestLevel++;
+ else if (MacroEnd()) FirstOutputTag->NestLevel--;
+ if (FirstOutputTag->NestLevel<=-1)
+ BEGIN
+ Tmp=FirstOutputTag;
+ FirstOutputTag=Tmp->Next;
+ free(Tmp);
+ END
+END
+
+ static void AddWaitENDM_Processor(void)
+BEGIN
+ POutputTag Neu;
+
+ Neu=(POutputTag) malloc(sizeof(TOutputTag));
+ Neu->Processor=WaitENDM_Processor;
+ Neu->NestLevel=0;
+ Neu->Next=FirstOutputTag;
+ FirstOutputTag=Neu;
+END
+
+/*-------------------------------------------------------------------------*/
+/* normale Makros */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Diese Routine leitet die Quellcodezeilen bei der Makrodefinition in den
+ Makro-Record um */
+
+ static void MACRO_OutProcessor(void)
+BEGIN
+ POutputTag Tmp;
+ int z;
+ StringRecPtr l;
+ PMacroRec GMacro;
+ String s;
+
+ if ((MacroOutput) AND (FirstOutputTag->DoExport))
+ BEGIN
+ errno=0;
+ fprintf(MacroFile,"%s\n",OneLine);
+ ChkIO(10004);
+ END
+ if (MacroStart()) FirstOutputTag->NestLevel++;
+ else if (MacroEnd()) FirstOutputTag->NestLevel--;
+ if (FirstOutputTag->NestLevel!=-1)
+ BEGIN
+ strmaxcpy(s,OneLine,255); KillCtrl(s);
+ l=FirstOutputTag->Params;
+ for (z=1; z<=FirstOutputTag->Mac->ParamCount; z++)
+ CompressLine(GetStringListNext(&l),z,s);
+ if (HasAttrs) CompressLine(AttrName,ParMax+1,s);
+ AddStringListLast(&(FirstOutputTag->Mac->FirstLine),s);
+ END
+
+ if (FirstOutputTag->NestLevel==-1)
+ BEGIN
+ if (IfAsm)
+ BEGIN
+ AddMacro(FirstOutputTag->Mac,FirstOutputTag->PubSect,True);
+ if ((FirstOutputTag->DoGlobCopy) AND (SectionStack!=Nil))
+ BEGIN
+ GMacro=(PMacroRec) malloc(sizeof(MacroRec));
+ GMacro->Name=strdup(FirstOutputTag->GName);
+ GMacro->ParamCount=FirstOutputTag->Mac->ParamCount;
+ GMacro->FirstLine=DuplicateStringList(FirstOutputTag->Mac->FirstLine);
+ AddMacro(GMacro,FirstOutputTag->GlobSect,False);
+ END
+ END
+ else ClearMacroRec(&(FirstOutputTag->Mac));
+
+ Tmp=FirstOutputTag; FirstOutputTag=Tmp->Next;
+ ClearStringList(&(Tmp->Params)); free(Tmp);
+ END
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Hierher kommen bei einem Makroaufruf die expandierten Zeilen */
+
+ Boolean MACRO_Processor(PInputTag PInp, char *erg)
+BEGIN
+ StringRecPtr Lauf;
+ int z;
+ Boolean Result;
+
+ Result=True;
+
+ Lauf=PInp->Lines; for (z=1; z<=PInp->LineZ-1; z++) Lauf=Lauf->Next;
+ strcpy(erg,Lauf->Content);
+ Lauf=PInp->Params;
+ for (z=1; z<=PInp->ParCnt; z++)
+ BEGIN
+ ExpandLine(Lauf->Content,z,erg);
+ Lauf=Lauf->Next;
+ END
+ if (HasAttrs) ExpandLine(PInp->SaveAttr,ParMax+1,erg);
+
+ CurrLine=PInp->StartLine;
+ InMacroFlag=True;
+
+ if (PInp->LineZ==1) PushLocHandle(GetLocHandle());
+
+ if (++(PInp->LineZ)>PInp->LineCnt) Result=False;
+
+ return Result;
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Initialisierung des Makro-Einleseprozesses */
+
+ static Boolean ReadMacro_SearchArg(char *Test, char *Comp, Boolean *Erg)
+BEGIN
+ if (strcasecmp(Test,Comp)==0)
+ BEGIN
+ *Erg=True; return True;
+ END
+ else if ((strlen(Test)>2) AND (strncasecmp(Test,"NO",2)==0) AND (strcasecmp(Test+2,Comp)==0))
+ BEGIN
+ *Erg=False; return True;
+ END
+ else return False;
+END
+
+ static Boolean ReadMacro_SearchSect(char *Test_O, char *Comp, Boolean *Erg, LongInt *Section)
+BEGIN
+ char *p;
+ String Test,Sect;
+
+ strmaxcpy(Test,Test_O,255); KillBlanks(Test);
+ p=strchr(Test,':');
+ if (p==Nil) *Sect='\0';
+ else
+ BEGIN
+ strmaxcpy(Sect,p+1,255); *p='\0';
+ END
+ if ((strlen(Test)>2) AND (strncasecmp(Test,"NO",2)==0) AND (strcasecmp(Test+2,Comp)==0))
+ BEGIN
+ *Erg=False; return True;
+ END
+ else if (strcasecmp(Test,Comp)==0)
+ BEGIN
+ *Erg=True;
+ return (IdentifySection(Sect,Section));
+ END
+ else return False;
+END
+
+ static void ReadMacro(void)
+BEGIN
+ String PList;
+ PSaveSection RunSection;
+ PMacroRec OneMacro;
+ int z1,z2;
+ POutputTag Neu;
+
+ Boolean DoMacExp,DoPublic;
+ LongInt HSect;
+ Boolean ErrFlag;
+
+ CodeLen=0; ErrFlag=False;
+
+ /* Makronamen pruefen */
+ /* Definition nur im ersten Pass */
+
+ if (PassNo!=1) ErrFlag=True;
+ else if (NOT ExpandSymbol(LabPart)) ErrFlag=True;
+ else if (NOT ChkSymbName(LabPart))
+ BEGIN
+ WrXError(1020,LabPart); ErrFlag=True;
+ END
+
+ Neu=(POutputTag) malloc(sizeof(TOutputTag));
+ Neu->Processor=MACRO_OutProcessor;
+ Neu->NestLevel=0;
+ Neu->Params=Nil;
+ Neu->DoExport=False;
+ Neu->DoGlobCopy=False;
+ Neu->Next=FirstOutputTag;
+
+ /* Argumente ueberpruefen */
+
+ DoMacExp=LstMacroEx; DoPublic=False;
+ *PList='\0'; z2=0;
+ for (z1=1; z1<=ArgCnt; z1++)
+ if ((ArgStr[z1][0]=='{') AND (ArgStr[z1][strlen(ArgStr[z1])-1]=='}'))
+ BEGIN
+ strcpy(ArgStr[z1],ArgStr[z1]+1); ArgStr[z1][strlen(ArgStr[z1])-1]='\0';
+ if (ReadMacro_SearchArg(ArgStr[z1],"EXPORT",&(Neu->DoExport)));
+ else if (ReadMacro_SearchArg(ArgStr[z1],"EXPAND",&DoMacExp))
+ BEGIN
+ strmaxcat(PList,",",255); strmaxcat(PList,ArgStr[z1],255);
+ END
+ else if (ReadMacro_SearchSect(ArgStr[z1],"GLOBAL",&(Neu->DoGlobCopy),&(Neu->GlobSect)));
+ else if (ReadMacro_SearchSect(ArgStr[z1],"PUBLIC",&DoPublic,&(Neu->PubSect)));
+ else
+ BEGIN
+ WrXError(1465,ArgStr[z1]); ErrFlag=True;
+ END
+ END
+ else
+ BEGIN
+ strmaxcat(PList,",",255); strmaxcat(PList,ArgStr[z1],255); z2++;
+ if (NOT ChkMacSymbName(ArgStr[z1]))
+ BEGIN
+ WrXError(1020,ArgStr[z1]); ErrFlag=True;
+ END
+ AddStringListLast(&(Neu->Params),ArgStr[z1]);
+ END
+
+ /* Abbruch bei Fehler */
+
+ if (ErrFlag)
+ BEGIN
+ ClearStringList(&(Neu->Params));
+ free(Neu);
+ AddWaitENDM_Processor();
+ return;
+ END
+
+ /* Bei Globalisierung Namen des Extramakros ermitteln */
+
+ if (Neu->DoGlobCopy)
+ BEGIN
+ strmaxcpy(Neu->GName,LabPart,255);
+ RunSection=SectionStack; HSect=MomSectionHandle;
+ while ((HSect!=Neu->GlobSect) AND (RunSection!=Nil))
+ BEGIN
+ strmaxprep(Neu->GName,"_",255); strmaxprep(Neu->GName,GetSectionName(HSect),255);
+ HSect=RunSection->Handle; RunSection=RunSection->Next;
+ END
+ END
+ if (NOT DoPublic) Neu->PubSect=MomSectionHandle;
+
+ OneMacro=(PMacroRec) malloc(sizeof(MacroRec)); Neu->Mac=OneMacro;
+ if ((MacroOutput) AND (Neu->DoExport))
+ BEGIN
+ if (strlen(PList)!=0) strcpy(PList,PList+1);
+ errno=0;
+ if (Neu->DoGlobCopy) fprintf(MacroFile,"%s MACRO %s\n",Neu->GName,PList);
+ else fprintf(MacroFile,"%s MACRO %s\n",LabPart,PList);
+ ChkIO(10004);
+ END
+ OneMacro->Used=False;
+ OneMacro->Name=strdup(LabPart);
+ OneMacro->ParamCount=z2;
+ OneMacro->FirstLine=Nil; OneMacro->LocMacExp=DoMacExp;
+
+ FirstOutputTag=Neu;
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Beendigung der Expansion eines Makros */
+
+ static void MACRO_Cleanup(PInputTag PInp)
+BEGIN
+ ClearStringList(&(PInp->Params));
+END
+
+ static Boolean MACRO_GetPos(PInputTag PInp, char *dest)
+BEGIN
+ String Tmp;
+
+ sprintf(Tmp,LongIntFormat,PInp->LineZ-1);
+ sprintf(dest,"%s(%s) ",PInp->SpecName,Tmp);
+ return False;
+END
+
+ static void MACRO_Restorer(PInputTag PInp)
+BEGIN
+ PopLocHandle();
+ DoLst=PInp->OrigDoLst;
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Dies initialisiert eine Makroexpansion */
+
+ static void ExpandMacro(PMacroRec OneMacro)
+BEGIN
+ int z1;
+ StringRecPtr Lauf;
+ PInputTag Tag;
+
+ CodeLen=0;
+
+ /* if (OneMacro->Used) WrError(1850);
+ else */
+
+ BEGIN
+ OneMacro->Used=True;
+
+ /* 1. Tag erzeugen */
+
+ GenerateProcessor(&Tag);
+ Tag->Processor=MACRO_Processor;
+ Tag->Restorer =MACRO_Restorer;
+ Tag->Cleanup =MACRO_Cleanup;
+ Tag->GetPos =MACRO_GetPos;
+ strmaxcpy(Tag->SpecName,OneMacro->Name,255);
+ strmaxcpy(Tag->SaveAttr,AttrPart,255);
+ Tag->IsMacro =True;
+
+ /* 2. Parameterzahl anpassen */
+
+ if (ArgCnt<OneMacro->ParamCount)
+ for (z1=ArgCnt+1; z1<=OneMacro->ParamCount; z1++) *(ArgStr[z1])='\0';
+ ArgCnt=OneMacro->ParamCount;
+
+ /* 3. Parameterliste aufbauen - umgekehrt einfacher */
+
+ for (z1=ArgCnt; z1>=1; z1--)
+ BEGIN
+ if (NOT CaseSensitive) UpString(ArgStr[z1]);
+ AddStringListFirst(&(Tag->Params),ArgStr[z1]);
+ END
+ Tag->ParCnt=ArgCnt;
+
+ /* 4. Zeilenliste anhaengen */
+
+ Tag->Lines=OneMacro->FirstLine; Tag->IsEmpty=(OneMacro->FirstLine==Nil);
+ Lauf=OneMacro->FirstLine;
+ while (Lauf!=Nil)
+ BEGIN
+ Tag->LineCnt++; Lauf=Lauf->Next;
+ END
+ END
+
+ /* 5. anhaengen */
+
+ if (IfAsm)
+ BEGIN
+ NextDoLst=(DoLst AND OneMacro->LocMacExp);
+ Tag->Next=FirstInputTag; FirstInputTag=Tag;
+ END
+ else
+ BEGIN
+ ClearStringList(&(Tag->Params)); free(Tag);
+ END
+END
+
+/*-------------------------------------------------------------------------*/
+/* vorzeitiger Abbruch eines Makros */
+
+ static void ExpandEXITM(void)
+BEGIN
+ if (ArgCnt!=0) WrError(1110);
+ else if (FirstInputTag==Nil) WrError(1805);
+ else if (NOT FirstInputTag->IsMacro) WrError(1805);
+ else if (IfAsm)
+ BEGIN
+ FirstInputTag->Cleanup(FirstInputTag);
+ RestoreIFs(FirstInputTag->IfLevel);
+ FirstInputTag->IsEmpty=True;
+ END
+END
+
+/*-------------------------------------------------------------------------*/
+/*--- IRP (was das bei MASM auch immer heissen mag...)
+ Ach ja: Individual Repeat! Danke Bernhard, jetzt hab'
+ ich's gerafft! -----------------------*/
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Diese Routine liefert bei der Expansion eines IRP-Statements die expan-
+ dierten Zeilen */
+
+ Boolean IRP_Processor(PInputTag PInp, char *erg)
+BEGIN
+ StringRecPtr Lauf;
+ int z;
+ Boolean Result;
+
+ Result=True;
+
+ Lauf=PInp->Lines; for (z=1; z<=PInp->LineZ-1; z++) Lauf=Lauf->Next;
+ strcpy(erg,Lauf->Content);
+ Lauf=PInp->Params; for (z=1; z<=PInp->ParZ-1; z++) Lauf=Lauf->Next;
+ ExpandLine(Lauf->Content,1,erg); CurrLine=PInp->StartLine+PInp->LineZ;
+
+ if (PInp->LineZ==1)
+ BEGIN
+ if (NOT PInp->First) PopLocHandle(); PInp->First=False;
+ PushLocHandle(GetLocHandle());
+ END
+
+
+ if (++(PInp->LineZ)>PInp->LineCnt)
+ BEGIN
+ PInp->LineZ=1;
+ if (++(PInp->ParZ)>PInp->ParCnt) Result=False;
+ END
+
+ return Result;
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Aufraeumroutine IRP/IRPC */
+
+ static void IRP_Cleanup(PInputTag PInp)
+BEGIN
+ StringRecPtr Lauf;
+
+ /* letzten Parameter sichern, wird evtl. noch fuer GetPos gebraucht!
+ ... SaveAttr ist aber frei */
+ if (PInp->Processor==IRP_Processor)
+ BEGIN
+ for (Lauf=PInp->Params; Lauf->Next!=Nil; Lauf=Lauf->Next);
+ strmaxcpy(PInp->SaveAttr,Lauf->Content,255);
+ END
+
+ ClearStringList(&(PInp->Lines));
+ ClearStringList(&(PInp->Params));
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Posisionsangabe im IRP(C) fuer Fehlermeldungen */
+
+ static Boolean IRP_GetPos(PInputTag PInp, char *dest)
+BEGIN
+ StringRecPtr Lauf=PInp->Params;
+ int z,z1=PInp->ParZ,z2=PInp->LineZ;
+ char *IRPType,*IRPVal,tmp[10];
+
+ if (PInp->Processor==IRP_Processor)
+ BEGIN
+ IRPType="IRP";
+ if (*PInp->SaveAttr!='\0') IRPVal=PInp->SaveAttr;
+ else
+ BEGIN
+ for (z=1; z<=z1-1; z++) Lauf=Lauf->Next;
+ IRPVal=Lauf->Content;
+ END
+ END
+ else
+ BEGIN
+ IRPType="IRPC";
+ sprintf(tmp,"'%c'",PInp->SpecName[z1-1]); IRPVal=tmp;
+ END
+
+ if (--z2<=0)
+ BEGIN
+ z2=PInp->LineCnt; z1--;
+ END
+ sprintf(dest,"%s:%s/%ld ",IRPType,IRPVal,(long)z2);
+
+ return False;
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Diese Routine sammelt waehrend der Definition eines IRP(C)-Statements die
+ Quellzeilen ein */
+
+ static void IRP_OutProcessor(void)
+BEGIN
+ POutputTag Tmp;
+ StringRecPtr Dummy;
+ String s;
+
+ /* Schachtelungen mitzaehlen */
+
+ if (MacroStart()) FirstOutputTag->NestLevel++;
+ else if (MacroEnd()) FirstOutputTag->NestLevel--;
+
+ /* falls noch nicht zuende, weiterzaehlen */
+
+ if (FirstOutputTag->NestLevel>-1)
+ BEGIN
+ strmaxcpy(s,OneLine,255); KillCtrl(s);
+ CompressLine(GetStringListFirst(FirstOutputTag->Params,&Dummy),1,s);
+ AddStringListLast(&(FirstOutputTag->Tag->Lines),s);
+ FirstOutputTag->Tag->LineCnt++;
+ END
+
+ /* alles zusammen? Dann umhaengen */
+
+ if (FirstOutputTag->NestLevel==-1)
+ BEGIN
+ Tmp=FirstOutputTag; FirstOutputTag=FirstOutputTag->Next;
+ Tmp->Tag->IsEmpty=(Tmp->Tag->Lines==Nil);
+ if (IfAsm)
+ BEGIN
+ NextDoLst=DoLst AND LstMacroEx;
+ Tmp->Tag->Next=FirstInputTag; FirstInputTag=Tmp->Tag;
+ END
+ else
+ BEGIN
+ ClearStringList(&(Tmp->Tag->Lines)); ClearStringList(&(Tmp->Tag->Params));
+ free(Tmp->Tag);
+ END
+ ClearStringList(&(Tmp->Params));
+ free(Tmp);
+ END
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Initialisierung der IRP-Bearbeitung */
+
+ static void ExpandIRP(void)
+BEGIN
+ String Parameter;
+ int z1;
+ PInputTag Tag;
+ POutputTag Neu;
+ Boolean ErrFlag;
+
+ /* 1.Parameter pruefen */
+
+ if (ArgCnt<2)
+ BEGIN
+ WrError(1110); ErrFlag=True;
+ END
+ else
+ BEGIN
+ strmaxcpy(Parameter,ArgStr[1],255);
+ if (NOT ChkMacSymbName(ArgStr[1]))
+ BEGIN
+ WrXError(1020,Parameter); ErrFlag=True;
+ END
+ else ErrFlag=False;
+ END
+ if (ErrFlag)
+ BEGIN
+ AddWaitENDM_Processor();
+ return;
+ END
+
+ /* 2. Tag erzeugen */
+
+ GenerateProcessor(&Tag);
+ Tag->ParCnt=ArgCnt-1;
+ Tag->Processor=IRP_Processor;
+ Tag->Restorer =MACRO_Restorer;
+ Tag->Cleanup =IRP_Cleanup;
+ Tag->GetPos =IRP_GetPos;
+ Tag->ParZ =1;
+ Tag->IsMacro =True;
+ *Tag->SaveAttr='\0';
+
+ /* 3. Parameterliste aufbauen; rueckwaerts einen Tucken schneller */
+
+ for (z1=ArgCnt; z1>=2; z1--)
+ BEGIN
+ UpString(ArgStr[z1]);
+ AddStringListFirst(&(Tag->Params),ArgStr[z1]);
+ END
+
+ /* 4. einbetten */
+
+ Neu=(POutputTag) malloc(sizeof(TOutputTag));
+ Neu->Next=FirstOutputTag;
+ Neu->Processor=IRP_OutProcessor;
+ Neu->NestLevel=0;
+ Neu->Tag=Tag;
+ Neu->Params=Nil; AddStringListFirst(&(Neu->Params),ArgStr[1]);
+ FirstOutputTag=Neu;
+END
+
+/*--- IRPC: dito für Zeichen eines Strings ---------------------------------*/
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Diese Routine liefert bei der Expansion eines IRPC-Statements die expan-
+ dierten Zeilen */
+
+ Boolean IRPC_Processor(PInputTag PInp, char *erg)
+BEGIN
+ StringRecPtr Lauf;
+ int z;
+ Boolean Result;
+ char tmp[5];
+
+ Result=True;
+
+ Lauf=PInp->Lines; for (z=1; z<=PInp->LineZ-1; z++) Lauf=Lauf->Next;
+ strcpy(erg,Lauf->Content);
+ *tmp=PInp->SpecName[PInp->ParZ-1]; tmp[1]='\0';
+ ExpandLine(tmp,1,erg); CurrLine=PInp->StartLine+PInp->LineZ;
+
+ if (PInp->LineZ==1)
+ BEGIN
+ if (NOT PInp->First) PopLocHandle(); PInp->First=False;
+ PushLocHandle(GetLocHandle());
+ END
+
+
+ if (++(PInp->LineZ)>PInp->LineCnt)
+ BEGIN
+ PInp->LineZ=1;
+ if (++(PInp->ParZ)>PInp->ParCnt) Result=False;
+ END
+
+ return Result;
+END
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+/* Initialisierung der IRPC-Bearbeitung */
+
+ static void ExpandIRPC(void)
+BEGIN
+ String Parameter;
+ PInputTag Tag;
+ POutputTag Neu;
+ Boolean ErrFlag;
+
+ /* 1.Parameter pruefen */
+
+ if (ArgCnt<2)
+ BEGIN
+ WrError(1110); ErrFlag=True;
+ END
+ else
+ BEGIN
+ strmaxcpy(Parameter,ArgStr[1],255);
+ if (NOT ChkMacSymbName(ArgStr[1]))
+ BEGIN
+ WrXError(1020,Parameter); ErrFlag=True;
+ END
+ else ErrFlag=False;
+ END
+ if (NOT ErrFlag)
+ BEGIN
+ EvalStringExpression(ArgStr[2],&ErrFlag,Parameter);
+ ErrFlag=NOT ErrFlag;
+ END
+ if (ErrFlag)
+ BEGIN
+ AddWaitENDM_Processor();
+ return;
+ END
+
+ /* 2. Tag erzeugen */
+
+ GenerateProcessor(&Tag);
+ Tag->ParCnt =strlen(Parameter);
+ Tag->Processor=IRPC_Processor;
+ Tag->Restorer =MACRO_Restorer;
+ Tag->Cleanup =IRP_Cleanup;
+ Tag->GetPos =IRP_GetPos;
+ Tag->ParZ =1;
+ Tag->IsMacro =True;
+ *Tag->SaveAttr='\0';
+ strmaxcpy(Tag->SpecName,Parameter,255);
+
+ /* 4. einbetten */
+
+ Neu=(POutputTag) malloc(sizeof(TOutputTag));
+ Neu->Next=FirstOutputTag;
+ Neu->Processor=IRP_OutProcessor;
+ Neu->NestLevel=0;
+ Neu->Tag=Tag;
+ Neu->Params=Nil; AddStringListFirst(&(Neu->Params),ArgStr[1]);
+ FirstOutputTag=Neu;
+END
+
+/*--- Repetition -----------------------------------------------------------*/
+
+ static void REPT_Cleanup(PInputTag PInp)
+BEGIN
+ ClearStringList(&(PInp->Lines));
+END
+
+ static Boolean REPT_GetPos(PInputTag PInp, char *dest)
+BEGIN
+ int z1=PInp->ParZ,z2=PInp->LineZ;
+
+ if (--z2<=0)
+ BEGIN
+ z2=PInp->LineCnt; z1--;
+ END
+ sprintf(dest,"REPT %ld/%ld",(long)z1,(long)z2);
+ return False;
+END
+
+ Boolean REPT_Processor(PInputTag PInp, char *erg)
+BEGIN
+ StringRecPtr Lauf;
+ int z;
+ Boolean Result;
+
+ Result=True;
+
+ Lauf=PInp->Lines; for(z=1; z<=PInp->LineZ-1; z++) Lauf=Lauf->Next;
+ strcpy(erg,Lauf->Content); CurrLine=PInp->StartLine+PInp->LineZ;
+
+ if (PInp->LineZ==1)
+ BEGIN
+ if (NOT PInp->First) PopLocHandle(); PInp->First=False;
+ PushLocHandle(GetLocHandle());
+ END
+
+ if ((++PInp->LineZ)>PInp->LineCnt)
+ BEGIN
+ PInp->LineZ=1;
+ if ((++PInp->ParZ)>PInp->ParCnt) Result=False;
+ END
+
+ return Result;
+END
+
+ static void REPT_OutProcessor(void)
+BEGIN
+ POutputTag Tmp;
+
+ /* Schachtelungen mitzaehlen */
+
+ if (MacroStart()) FirstOutputTag->NestLevel++;
+ else if (MacroEnd()) FirstOutputTag->NestLevel--;
+
+ /* falls noch nicht zuende, weiterzaehlen */
+
+ if (FirstOutputTag->NestLevel>-1)
+ BEGIN
+ AddStringListLast(&(FirstOutputTag->Tag->Lines),OneLine);
+ FirstOutputTag->Tag->LineCnt++;
+ END
+
+ /* alles zusammen? Dann umhaengen */
+
+ if (FirstOutputTag->NestLevel==-1)
+ BEGIN
+ Tmp=FirstOutputTag; FirstOutputTag=FirstOutputTag->Next;
+ Tmp->Tag->IsEmpty=(Tmp->Tag->Lines==Nil);
+ if ((IfAsm) AND (Tmp->Tag->ParCnt>0))
+ BEGIN
+ NextDoLst=(DoLst AND LstMacroEx);
+ Tmp->Tag->Next=FirstInputTag; FirstInputTag=Tmp->Tag;
+ END
+ else
+ BEGIN
+ ClearStringList(&(Tmp->Tag->Lines));
+ free(Tmp->Tag);
+ END
+ free(Tmp);
+ END
+END
+
+ static void ExpandREPT(void)
+BEGIN
+ Boolean ValOK;
+ LongInt ReptCount=0;
+ PInputTag Tag;
+ POutputTag Neu;
+ Boolean ErrFlag;
+
+ /* 1.Repetitionszahl ermitteln */
+
+ if (ArgCnt!=1)
+ BEGIN
+ WrError(1110); ErrFlag=True;
+ END
+ else
+ BEGIN
+ FirstPassUnknown=False;
+ ReptCount=EvalIntExpression(ArgStr[1],Int32,&ValOK);
+ if (FirstPassUnknown) WrError(1820);
+ ErrFlag=((NOT ValOK) OR (FirstPassUnknown));
+ END
+ if (ErrFlag)
+ BEGIN
+ AddWaitENDM_Processor();
+ return;
+ END
+
+ /* 2. Tag erzeugen */
+
+ GenerateProcessor(&Tag);
+ Tag->ParCnt=ReptCount;
+ Tag->Processor=REPT_Processor;
+ Tag->Restorer =MACRO_Restorer;
+ Tag->Cleanup =REPT_Cleanup;
+ Tag->GetPos =REPT_GetPos;
+ Tag->IsMacro =True;
+ Tag->ParZ=1;
+
+ /* 3. einbetten */
+
+ Neu=(POutputTag) malloc(sizeof(TOutputTag));
+ Neu->Processor=REPT_OutProcessor;
+ Neu->NestLevel=0;
+ Neu->Next=FirstOutputTag;
+ Neu->Tag=Tag;
+ FirstOutputTag=Neu;
+END
+
+/*- bedingte Wiederholung -------------------------------------------------------*/
+
+ static void WHILE_Cleanup(PInputTag PInp)
+BEGIN
+ ClearStringList(&(PInp->Lines));
+END
+
+ static Boolean WHILE_GetPos(PInputTag PInp, char *dest)
+BEGIN
+ int z1=PInp->ParZ,z2=PInp->LineZ;
+
+ if (--z2<=0)
+ BEGIN
+ z2=PInp->LineCnt; z1--;
+ END
+ sprintf(dest, "WHILE %ld/%ld", (long)z1, (long)z2);
+ return False;
+END
+
+ Boolean WHILE_Processor(PInputTag PInp, char *erg)
+BEGIN
+ StringRecPtr Lauf;
+ int z;
+ Boolean OK,Result;
+
+ CurrLine=PInp->StartLine+PInp->LineZ;
+
+ if (PInp->LineZ==1)
+ BEGIN
+ if (NOT PInp->First) PopLocHandle(); PInp->First=False;
+ PushLocHandle(GetLocHandle());
+ END
+ else OK=True;
+
+ Lauf=PInp->Lines; for (z=1; z<=PInp->LineZ-1; z++) Lauf=Lauf->Next;
+ strcpy(erg,Lauf->Content);
+
+ if ((++PInp->LineZ)>PInp->LineCnt)
+ BEGIN
+ PInp->LineZ=1; PInp->ParZ++;
+ z=EvalIntExpression(PInp->SpecName,Int32,&OK);
+ OK=(OK AND (z!=0));
+ Result=OK;
+ END
+ else Result=True;
+
+ return Result;
+END
+
+ static void WHILE_OutProcessor(void)
+BEGIN
+ POutputTag Tmp;
+ Boolean OK;
+ LongInt Erg;
+
+ /* Schachtelungen mitzaehlen */
+
+ if (MacroStart()) FirstOutputTag->NestLevel++;
+ else if (MacroEnd()) FirstOutputTag->NestLevel--;
+
+ /* falls noch nicht zuende, weiterzaehlen */
+
+ if (FirstOutputTag->NestLevel>-1)
+ BEGIN
+ AddStringListLast(&(FirstOutputTag->Tag->Lines),OneLine);
+ FirstOutputTag->Tag->LineCnt++;
+ END
+
+ /* alles zusammen? Dann umhaengen */
+
+ if (FirstOutputTag->NestLevel==-1)
+ BEGIN
+ Tmp=FirstOutputTag; FirstOutputTag=FirstOutputTag->Next;
+ Tmp->Tag->IsEmpty=(Tmp->Tag->Lines==Nil);
+ FirstPassUnknown=False;
+ Erg=EvalIntExpression(Tmp->Tag->SpecName,Int32,&OK);
+ if (FirstPassUnknown) WrError(1820);
+ OK=(OK AND (NOT FirstPassUnknown) AND (Erg!=0));
+ if ((IfAsm) AND (OK))
+ BEGIN
+ NextDoLst=(DoLst AND LstMacroEx);
+ Tmp->Tag->Next=FirstInputTag; FirstInputTag=Tmp->Tag;
+ END
+ else
+ BEGIN
+ ClearStringList(&(Tmp->Tag->Lines));
+ free(Tmp->Tag);
+ END
+ free(Tmp);
+ END
+END
+
+ static void ExpandWHILE(void)
+BEGIN
+ PInputTag Tag;
+ POutputTag Neu;
+ Boolean ErrFlag;
+
+ /* 1.Bedingung ermitteln */
+
+ if (ArgCnt!=1)
+ BEGIN
+ WrError(1110); ErrFlag=True;
+ END
+ else ErrFlag=False;
+ if (ErrFlag)
+ BEGIN
+ AddWaitENDM_Processor();
+ return;
+ END
+
+ /* 2. Tag erzeugen */
+
+ GenerateProcessor(&Tag);
+ Tag->Processor=WHILE_Processor;
+ Tag->Restorer =MACRO_Restorer;
+ Tag->Cleanup =WHILE_Cleanup;
+ Tag->GetPos =WHILE_GetPos;
+ Tag->IsMacro =True;
+ Tag->ParZ=1;
+ strmaxcpy(Tag->SpecName,ArgStr[1],255);
+
+ /* 3. einbetten */
+
+ Neu=(POutputTag) malloc(sizeof(TOutputTag));
+ Neu->Processor=WHILE_OutProcessor;
+ Neu->NestLevel=0;
+ Neu->Next=FirstOutputTag;
+ Neu->Tag=Tag;
+ FirstOutputTag=Neu;
+END
+
+/*--------------------------------------------------------------------------*/
+/* Einziehen von Include-Files */
+
+ static void INCLUDE_Cleanup(PInputTag PInp)
+BEGIN
+ String Tmp;
+
+ fclose(PInp->Datei);
+ free(PInp->Buffer);
+ LineSum+=MomLineCounter;
+ if ((*LstName!='\0') AND (NOT QuietMode))
+ BEGIN
+ sprintf(Tmp,LongIntFormat,CurrLine);
+ printf("%s(%s)",NamePart(CurrFileName),Tmp);
+ printf("%s\n",ClrEol); fflush(stdout);
+ END
+ if (MakeIncludeList) PopInclude();
+END
+
+ static Boolean INCLUDE_GetPos(PInputTag PInp, char *dest)
+BEGIN
+ String Tmp;
+
+ sprintf(Tmp,LongIntFormat,CurrLine);
+ sprintf(dest,"%s(%s) ",NamePart(CurrFileName),Tmp);
+ return True;
+END
+
+ Boolean INCLUDE_Processor(PInputTag PInp, char *Erg)
+BEGIN
+ Boolean Result;
+
+ Result=True;
+
+ if (feof(PInp->Datei)) *Erg='\0';
+ else
+ BEGIN
+ ReadLn(PInp->Datei,Erg);
+ /**ChkIO(10003);**/
+ END
+ CurrLine=(++MomLineCounter);
+ if (feof(PInp->Datei)) Result=False;
+
+ return Result;
+END
+
+ static void INCLUDE_Restorer(PInputTag PInp)
+BEGIN
+ MomLineCounter=PInp->StartLine;
+ strmaxcpy(CurrFileName,PInp->SpecName,255);
+ IncDepth--;
+END
+
+ static void ExpandINCLUDE(Boolean SearchPath)
+BEGIN
+ PInputTag Tag;
+
+ if (NOT IfAsm) return;
+
+ if (ArgCnt!=1)
+ BEGIN
+ WrError(1110); return;
+ END
+
+ 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(ArgStr[1],ArgPart,255);
+ if (SearchPath)
+ BEGIN
+ strmaxcpy(ArgPart,FExpand(FSearch(ArgPart,IncludeList)),255);
+ if (ArgPart[strlen(ArgPart)-1]=='/') strmaxcat(ArgPart,ArgStr[1],255);
+ END
+
+ /* Tag erzeugen */
+
+ GenerateProcessor(&Tag);
+ Tag->Processor=INCLUDE_Processor;
+ Tag->Restorer =INCLUDE_Restorer;
+ Tag->Cleanup =INCLUDE_Cleanup;
+ Tag->GetPos =INCLUDE_GetPos;
+ Tag->Buffer =(void *) malloc(BufferArraySize);
+
+ /* Sicherung alter Daten */
+
+ Tag->StartLine=MomLineCounter;
+ strmaxcpy(Tag->SpecName,CurrFileName,255);
+
+ /* Datei oeffnen */
+
+ Tag->Datei=fopen(ArgPart,"r");
+ if (Tag->Datei==Nil) ChkIO(10001);
+ setvbuf(Tag->Datei,Tag->Buffer,_IOFBF,BufferArraySize);
+
+ /* neu besetzen */
+
+ strmaxcpy(CurrFileName,ArgPart,255); MomLineCounter=0;
+ NextIncDepth++; AddFile(ArgPart);
+ PushInclude(ArgPart);
+
+ /* einhaengen */
+
+ Tag->Next=FirstInputTag; FirstInputTag=Tag;
+END
+
+/*=========================================================================*/
+/* Einlieferung von Zeilen */
+
+ static void GetNextLine(char *Line)
+BEGIN
+ PInputTag HTag;
+
+ InMacroFlag=False;
+
+ while ((FirstInputTag!=Nil) AND (FirstInputTag->IsEmpty))
+ BEGIN
+ FirstInputTag->Restorer(FirstInputTag);
+ HTag=FirstInputTag; FirstInputTag=HTag->Next;
+ free(HTag);
+ END
+
+ if (FirstInputTag==Nil)
+ BEGIN
+ *Line='\0'; return;
+ END
+
+ if (NOT FirstInputTag->Processor(FirstInputTag,Line))
+ BEGIN
+ FirstInputTag->Cleanup(FirstInputTag);
+ FirstInputTag->IsEmpty=True;
+ END
+
+ MacLineSum++;
+END
+
+ char *GetErrorPos(void)
+BEGIN
+ String ActPos;
+ PInputTag RunTag;
+ char *ErgPos=strdup(""),*tmppos;
+ Boolean Last;
+
+ for (RunTag=FirstInputTag; RunTag!=Nil; RunTag=RunTag->Next)
+ BEGIN
+ Last=RunTag->GetPos(RunTag,ActPos);
+ tmppos=(char *) malloc(strlen(ErgPos)+strlen(ActPos)+1);
+ strcpy(tmppos,ActPos); strcat(tmppos,ErgPos);
+ free(ErgPos); ErgPos=tmppos;
+ if (Last) break;
+ END
+
+ return ErgPos;
+END
+
+ static Boolean InputEnd(void)
+BEGIN
+ PInputTag Lauf;
+
+ Lauf=FirstInputTag;
+ while (Lauf!=Nil)
+ BEGIN
+ if (NOT Lauf->IsEmpty) return False;
+ Lauf=Lauf->Next;
+ END
+
+ return True;
+END
+
+
+/*=== Eine Quelldatei ( Haupt-oder Includedatei ) bearbeiten ===============*/
+
+/*--- aus der zerlegten Zeile Code erzeugen --------------------------------*/
+
+ Boolean HasLabel(void)
+BEGIN
+ if (*LabPart=='\0') return False;
+ if (IsDef()) return False;
+
+ switch (*OpPart)
+ BEGIN
+ case '=':
+ return (NOT Memo("="));
+ case ':':
+ return (NOT Memo(":"));
+ case 'M':
+ return (NOT Memo("MACRO"));
+ case 'F':
+ return (NOT Memo("FUNCTION"));
+ case 'L':
+ return (NOT Memo("LABEL"));
+ case 'S':
+ return ((NOT Memo("SET")) OR (SetIsOccupied)) AND (NOT Memo("STRUCT"));
+ case 'E':
+ return ((NOT Memo("EVAL")) OR (NOT SetIsOccupied)) AND (NOT Memo("EQU")) AND (NOT Memo("ENDSTRUCT"));
+ default:
+ return True;
+ END
+END
+
+ static void Produce_Code(void)
+BEGIN
+ Byte z;
+ PMacroRec OneMacro;
+ Boolean SearchMacros,Found;
+ String tmp,tmp2;
+ PStructure ZStruct;
+
+ ActListGran=ListGran();
+
+ /* Makrosuche unterdruecken ? */
+
+ if (*OpPart=='!')
+ BEGIN
+ SearchMacros=False; strcpy(OpPart,OpPart+1);
+ END
+ else
+ BEGIN
+ SearchMacros=True; ExpandSymbol(OpPart);
+ END
+ strcpy(LOpPart,OpPart); NLS_UpString(OpPart);
+
+ /* Prozessor eingehaengt ? */
+
+ if (FirstOutputTag!=Nil)
+ BEGIN
+ FirstOutputTag->Processor(); return;
+ END
+
+ /* ansonsten Code erzeugen */
+
+ /* evtl. voranstehendes Label ablegen */
+
+ if (IfAsm)
+ BEGIN
+ if (HasLabel())
+ if (StructureStack!=Nil)
+ BEGIN
+ strmaxcpy(tmp,LabPart,255);
+ for (ZStruct=StructureStack; ZStruct!=Nil; ZStruct=ZStruct->Next)
+ if (ZStruct->DoExt)
+ BEGIN
+ sprintf(tmp2,"%s_",ZStruct->Name);
+ strmaxprep(tmp,tmp2,255);
+ END
+ EnterIntSymbol(tmp,EProgCounter(),SegNone,False);
+ END
+ else EnterIntSymbol(LabPart,EProgCounter(),ActPC,False);
+ END
+
+ Found=False;
+ switch (*OpPart)
+ BEGIN
+ case 'I':
+ /* Makroliste ? */
+ if ((Found=Memo("IRP"))) ExpandIRP();
+ else if ((Found=Memo("IRPC"))) ExpandIRPC();
+ break;
+ case 'R':
+ /* Repetition ? */
+ if ((Found=Memo("REPT"))) ExpandREPT(); break;
+ case 'W':
+ /* bedingte Repetition ? */
+ if ((Found=Memo("WHILE"))) ExpandWHILE(); break;
+ END
+
+ /* bedingte Assemblierung ? */
+
+ if (NOT Found) Found=CodeIFs();
+
+ if (NOT Found)
+ switch (*OpPart)
+ BEGIN
+ case 'M':
+ /* Makrodefinition ? */
+ if ((Found=Memo(("MACRO")))) ReadMacro(); break;
+ case 'E':
+ /* Abbruch Makroexpansion ? */
+ if ((Found=Memo(("EXITM")))) ExpandEXITM(); break;
+ case 'I':
+ /* Includefile? */
+ if ((Found=Memo(("INCLUDE"))))
+ BEGIN
+ ExpandINCLUDE(True);
+ MasterFile=False;
+ END
+ break;
+ END
+
+ if (Found);
+
+ /* Makroaufruf ? */
+
+ else if ((SearchMacros) AND (FoundMacro(&OneMacro)))
+ BEGIN
+ if (IfAsm) ExpandMacro(OneMacro);
+ if (IfAsm) strmaxcpy(ListLine,"(MACRO)",255);
+ END
+
+ else
+ BEGIN
+ StopfZahl=0; CodeLen=0; DontPrint=False;
+
+ if (IfAsm)
+ BEGIN
+ if (NOT CodeGlobalPseudo()) MakeCode();
+ if ((MacProOutput) AND ((*OpPart!='\0') OR (*LabPart!='\0') OR (*CommPart!='\0')))
+ BEGIN
+ errno=0; fprintf(MacProFile,"%s\n",OneLine); ChkIO(10002);
+ END
+ END
+
+ for (z=0; z<StopfZahl; z++)
+ BEGIN
+ switch (ActListGran)
+ BEGIN
+ case 4:DAsmCode[CodeLen>>2]=NOPCode; break;
+ case 2:WAsmCode[CodeLen>>1]=NOPCode; break;
+ case 1:BAsmCode[CodeLen ]=NOPCode; break;
+ END
+ CodeLen+=ActListGran/Granularity();
+ END
+
+ if ((ActPC!=StructSeg) AND (NOT ChkPC(PCs[ActPC]+CodeLen-1)) AND (CodeLen!=0))
+ WrError(1925);
+ else
+ BEGIN
+ if ((NOT DontPrint) AND (ActPC!=StructSeg) AND (CodeLen>0)) BookKeeping();
+ if (ActPC==StructSeg)
+ BEGIN
+ if ((CodeLen!=0) AND (NOT DontPrint)) WrError(1940);
+ END
+ else if (CodeOutput)
+ BEGIN
+ if (DontPrint) NewRecord(PCs[ActPC]+CodeLen);
+ else WriteBytes();
+ END
+ PCs[ActPC]+=CodeLen;
+ END
+ END
+
+ /* dies ueberprueft implizit, ob von der letzten Eval...-Operation noch
+ externe Referenzen liegengeblieben sind. */
+
+ SetRelocs(Nil);
+END
+
+/*--- Zeile in Listing zerteilen -------------------------------------------*/
+
+ static void SplitLine(void)
+BEGIN
+ jmp_buf Retry;
+ String h;
+ char *i,*k,*p,*div,*run;
+ int l;
+ Boolean lpos;
+
+ Retracted=False;
+
+ /* Kommentar loeschen */
+
+ strmaxcpy(h,OneLine,255); i=QuotPos(h,';');
+ if (i!=Nil)
+ BEGIN
+ strcpy(CommPart,i+1);
+ *i='\0';
+ END
+ else *CommPart='\0';
+
+ /* alles in Grossbuchstaben wandeln, Praeprozessor laufen lassen */
+
+ ExpandDefines(h);
+
+ /* Label abspalten */
+
+ if ((*h!='\0') AND (NOT isspace((unsigned char)*h)))
+ BEGIN
+ for (i=h; *i!='\0'; i++)
+ if ((isspace(((unsigned char)*i)&0xff)) OR (*i==':')) break;
+ if (*i=='\0')
+ BEGIN
+ strcpy(LabPart,h); *h='\0';
+ END
+ else
+ BEGIN
+ *i='\0'; strcpy(LabPart,h); strcpy(h,i+1);
+ END
+ if (LabPart[l=(strlen(LabPart)-1)]==':') LabPart[l]='\0';
+ END
+ else *LabPart='\0';
+
+ /* Opcode & Argument trennen */
+ setjmp(Retry);
+ KillPrefBlanks(h);
+ i=FirstBlank(h);
+ SplitString(h,OpPart,ArgPart,i);
+
+ /* Falls noch kein Label da war, kann es auch ein Label sein */
+
+ i=strchr(OpPart,':');
+ if ((*LabPart=='\0') AND (i!=Nil) AND (i[1]=='\0'))
+ BEGIN
+ *i='\0'; strcpy(LabPart,OpPart); strcpy(OpPart,i+1);
+ if (*OpPart=='\0')
+ BEGIN
+ strcpy(h,ArgPart);
+ longjmp(Retry,1);
+ END
+ END
+
+ /* Attribut abspalten */
+
+ if (HasAttrs)
+ BEGIN
+ k=Nil; AttrSplit=' ';
+ for (run=AttrChars; *run!='\0'; run++)
+ BEGIN
+ p=strchr(OpPart,*run);
+ if (p!=Nil) if ((k==Nil) OR (p<k)) k=p;
+ END
+ if (k!=Nil)
+ BEGIN
+ AttrSplit=(*k);
+ strmaxcpy(AttrPart,k+1,255); *k='\0';
+ if ((*OpPart=='\0') AND (*AttrPart!='\0'))
+ BEGIN
+ strmaxcpy(OpPart,AttrPart,255); *AttrPart='\0';
+ END
+ END
+ else *AttrPart='\0';
+ END
+ else *AttrPart='\0';
+
+ KillPostBlanks(ArgPart);
+
+ /* Argumente zerteilen: Da alles aus einem String kommt und die Teile alle auch
+ so lang sind, koennen wir uns Laengenabfragen sparen */
+ ArgCnt=0; strcpy(h,ArgPart); run=h;
+ if (*run!='\0')
+ do
+ BEGIN
+ while ((*run!='\0') AND (isspace((unsigned char)*run))) run++;
+ i=Nil;
+ for (div=DivideChars; *div!='\0'; div++)
+ BEGIN
+ p=QuotPos(run,*div);
+ if (p!=Nil) if ((i==Nil) OR (p<i)) i=p;
+ END
+ lpos=((i!=Nil) AND (i[1]=='\0'));
+ if (i!=Nil) *i='\0';
+ strcpy(ArgStr[++ArgCnt],run);
+ if ((lpos) AND (ArgCnt!=ParMax)) *ArgStr[++ArgCnt]='\0';
+ KillPostBlanks(ArgStr[ArgCnt]);
+ run=(i==Nil) ? i : i+1;
+ END
+ while ((run!=Nil) AND (ArgCnt!=ParMax) AND (NOT lpos));
+
+ if ((run!=Nil) AND (*run!='\0')) WrError(1140);
+
+ Produce_Code();
+END
+
+/**
+CONST
+ LineBuffer:String='';
+ InComment:Boolean=FALSE;
+
+ static void C_SplitLine(void)
+BEGIN
+ p,p2:int;
+ SaveLine,h:String;
+
+ { alten Inhalt sichern }
+
+ SaveLine:=OneLine; h:=OneLine;
+
+ { Falls in Kommentar, nach schliessender Klammer suchen und den Teil bis
+ dahin verwerfen; falls keine Klammer drin ist, die ganze Zeile weg-
+ schmeissen; da wir dann OneLine bisher noch nicht veraendert hatten,
+ stoert der Abbruch ohne Wiederherstellung von Oneline nicht. }
+
+ IF InComment THEN
+ BEGIN
+ p:=Pos('}',h);
+ IF p>Length(h) THEN Exit
+ ELSE
+ BEGIN
+ Delete(h,1,p); InComment:=False;
+ END;
+ END;
+
+ { in der Zeile befindliche Teile loeschen; falls am Ende keine
+ schliessende Klammer kommt, muessen wir das Kommentarflag setzen. }
+
+ REPEAT
+ p:=QuotPos(h,'{');
+ IF p>Length(h) THEN p:=0
+ ELSE
+ BEGIN
+ p2:=QuotPos(h,'}');
+ IF (p2>p) AND (Length(h)>=p2) THEN Delete(h,p,p2-p+1)
+ ELSE
+ BEGIN
+ Byte(h[0]):=Pred(p);
+ InComment:=True;
+ p:=0;
+ END;
+ END;
+ UNTIL p=0;
+
+ { alten Inhalt zurueckkopieren }
+
+ OneLine:=SaveLine;
+END;**/
+
+/*------------------------------------------------------------------------*/
+
+ static void ProcessFile(String FileName)
+BEGIN
+ long NxtTime,ListTime;
+ String Num;
+ char *Name, *Run;
+
+ dbgentry("ProcessFile");
+
+ sprintf(OneLine," INCLUDE \"%s\"",FileName); MasterFile=False;
+ NextIncDepth=IncDepth;
+ SplitLine();
+ IncDepth=NextIncDepth;
+
+ ListTime=GTime();
+
+ while ((NOT InputEnd()) AND (NOT ENDOccured))
+ BEGIN
+ /* Zeile lesen */
+
+ GetNextLine(OneLine);
+
+ /* Ergebnisfelder vorinitialisieren */
+
+ DontPrint=False; CodeLen=0; *ListLine='\0';
+
+ NextDoLst=DoLst;
+ NextIncDepth=IncDepth;
+
+ for (Run=OneLine; *Run!='\0'; Run++)
+ if (NOT isspace(((unsigned int)*Run)&0xff)) break;
+ if (*Run=='#') Preprocess();
+ else SplitLine();
+
+ MakeList();
+ DoLst=NextDoLst;
+ IncDepth=NextIncDepth;
+
+ /* Zeilenzaehler */
+
+ if (NOT QuietMode)
+ BEGIN
+ NxtTime=GTime();
+ if (((NOT ListToStdout) OR ((ListMask&1)==0)) AND (DTime(ListTime,NxtTime)>50))
+ BEGIN
+ sprintf(Num,LongIntFormat,MomLineCounter); Name=NamePart(CurrFileName);
+ printf("%s(%s)%s",Name,Num,ClrEol);
+ /*for (z=0; z<strlen(Name)+strlen(Num)+2; z++) putchar('\b');*/
+ putchar('\r'); fflush(stdout);
+ ListTime=NxtTime;
+ END
+ END
+
+ /* bei Ende Makroprozessor ausraeumen
+ OK - das ist eine Hauruckmethode... */
+
+ if (ENDOccured)
+ while (FirstInputTag!=Nil) GetNextLine(OneLine);
+ END
+
+ while (FirstInputTag!=Nil) GetNextLine(OneLine);
+
+ /* irgendeine Makrodefinition nicht abgeschlossen ? */
+
+ if (FirstOutputTag!=Nil) WrError(1800);
+
+ dbgexit("ProcessFile");
+END
+
+/****************************************************************************/
+
+ static char *TWrite_Plur(int n)
+BEGIN
+ return (n!=1) ? getmessage(Num_ListPlurName) : "";
+END
+
+ static void TWrite_RWrite(char *dest, Double r, Byte Stellen)
+BEGIN
+ String s;
+
+ sprintf(s,"%20.*f",Stellen,r);
+ while (*s==' ') strcpy(s,s+1); strcat(dest,s);
+END
+
+ static void TWrite(Double DTime, char *dest)
+BEGIN
+ int h;
+ String s;
+
+ *dest='\0';
+ h=(int) floor(DTime/3600.0);
+ if (h>0)
+ BEGIN
+ sprintf(s,"%d",h);
+ strcat(dest,s);
+ strcat(dest,getmessage(Num_ListHourName));
+ strcat(dest,TWrite_Plur(h));
+ strcat(dest,", ");
+ DTime-=3600.0*h;
+ END
+ h=(int) floor(DTime/60.0);
+ if (h>0)
+ BEGIN
+ sprintf(s,"%d",h);
+ strcat(dest,s);
+ strcat(dest,getmessage(Num_ListMinuName));
+ strcat(dest,TWrite_Plur(h));
+ strcat(dest,", ");
+ DTime-=60.0*h;
+ END
+ TWrite_RWrite(dest,DTime,2); strcat(dest,getmessage(Num_ListSecoName));
+ if (DTime!=1) strcat(dest,getmessage(Num_ListPlurName));
+END
+
+/*--------------------------------------------------------------------------*/
+
+ static void AssembleFile_InitPass(void)
+BEGIN
+ static char DateS[31],TimeS[31];
+ int z;
+ String ArchVal;
+
+ dbgentry("AssembleFile_InitPass");
+
+ FirstInputTag=Nil; FirstOutputTag=Nil;
+
+ MomLineCounter=0; MomLocHandle=(-1); LocHandleCnt=0;
+
+ SectionStack=Nil;
+ FirstIfSave=Nil;
+ FirstSaveState=Nil;
+ StructureStack=Nil;
+
+ InitPassProc();
+
+ ActPC=SegCode; PCs[ActPC]=0; ENDOccured=False;
+ ErrorCount=0; WarnCount=0; LineSum=0; MacLineSum=0;
+ for (z=1; z<=StructSeg; z++)
+ BEGIN
+ PCsUsed[z]=(z==SegCode);
+ Phases[z]=0;
+ InitChunk(&SegChunks[z]);
+ END
+
+ TransTables=CurrTransTable=(PTransTable) malloc(sizeof(TTransTable));
+ CurrTransTable->Next=Nil;
+ CurrTransTable->Name=strdup("STANDARD");
+ CurrTransTable->Table=(unsigned char *) malloc(256*sizeof(char));
+ for (z=0; z<256; z++) CurrTransTable->Table[z]=z;
+
+ strmaxcpy(CurrFileName,"INTERNAL",255);
+ AddFile(CurrFileName); CurrLine=0;
+
+ IncDepth=(-1);
+ DoLst=True;
+
+ /* Pseudovariablen initialisieren */
+
+ ResetSymbolDefines(); ResetMacroDefines();
+ EnterIntSymbol(FlagTrueName,1,0,True);
+ EnterIntSymbol(FlagFalseName,0,0,True);
+ EnterFloatSymbol(PiName,4.0*atan(1.0),True);
+ EnterIntSymbol(VerName,VerNo,0,True);
+ sprintf(ArchVal,"%s-%s",ARCHPRNAME,ARCHSYSNAME);
+ EnterStringSymbol(ArchName,ArchVal,True);
+#ifdef HAS64
+ EnterIntSymbol(Has64Name,1,0,True);
+#else
+ EnterIntSymbol(Has64Name,0,0,True);
+#endif
+ EnterIntSymbol(CaseSensName,Ord(CaseSensitive),0,True);
+ if (PassNo==0)
+ BEGIN
+ NLS_CurrDateString(DateS);
+ NLS_CurrTimeString(False,TimeS);
+ END
+ EnterStringSymbol(DateName,DateS,True);
+ EnterStringSymbol(TimeName,TimeS,True);
+
+ if (*DefCPU == '\0')
+ SetCPU(0, True);
+ else
+ if (NOT SetNCPU(DefCPU, True)) SetCPU(0, True);
+
+ SetFlag(&SupAllowed,SupAllowedName,False);
+ SetFlag(&FPUAvail,FPUAvailName,False);
+ SetFlag(&DoPadding,DoPaddingName,True);
+ SetFlag(&Maximum,MaximumName,False);
+ SetFlag(&DoBranchExt,BranchExtName,False);
+ EnterIntSymbol(ListOnName,ListOn=1,0,True);
+ SetFlag(&LstMacroEx,LstMacroExName,True);
+ SetFlag(&RelaxedMode,RelaxedName,False);
+ CopyDefSymbols();
+
+ ResetPageCounter();
+
+ StartAdrPresent=False;
+
+ Repass=False; PassNo++;
+
+ dbgexit("AssembleFile_InitPass");
+END
+
+ static void AssembleFile_ExitPass(void)
+BEGIN
+ SwitchFrom();
+ ClearLocStack();
+ ClearStacks();
+ TossRegDefs(-1);
+ if (FirstIfSave!=Nil) WrError(1470);
+ if (FirstSaveState!=Nil) WrError(1460);
+ if (SectionStack!=Nil) WrError(1485);
+ if (StructureStack!=Nil) WrXError(1551,StructureStack->Name);
+END
+
+ static void AssembleFile(char *Name)
+BEGIN
+ String s,Tmp;
+
+ dbgentry("AssembleFile");
+
+ strmaxcpy(SourceFile,Name,255);
+ if (MakeDebug) fprintf(Debug,"File %s\n",SourceFile);
+
+ /* Untermodule initialisieren */
+
+ AsmDefInit(); AsmParsInit(); AsmIFInit(); InitFileList(); ResetStack();
+
+ /* Kommandozeilenoptionen verarbeiten */
+
+ strmaxcpy(OutName,GetFromOutList(),255);
+ if (OutName[0]=='\0')
+ BEGIN
+ strmaxcpy(OutName,SourceFile,255); KillSuffix(OutName);
+ AddSuffix(OutName,PrgSuffix);
+ END
+
+ if (*ErrorPath=='\0')
+ BEGIN
+ strmaxcpy(ErrorName,SourceFile,255);
+ KillSuffix(ErrorName);
+ AddSuffix(ErrorName,LogSuffix);
+ unlink(ErrorName);
+ END
+
+ switch (ListMode)
+ BEGIN
+ case 0: strmaxcpy(LstName,NULLDEV,255); break;
+ case 1: strmaxcpy(LstName,"!1",255); break;
+ case 2:
+ strmaxcpy(LstName,SourceFile,255);
+ KillSuffix(LstName);
+ AddSuffix(LstName,LstSuffix);
+ break;
+ END
+ ListToStdout=(strcmp(LstName,"!1")==0);
+ ListToNull=(strcmp(LstName,NULLDEV)==0);
+
+ if (ShareMode!=0)
+ BEGIN
+ strmaxcpy(ShareName,GetFromShareOutList(),255);
+ if (*ShareName == '\0')
+ BEGIN
+ strmaxcpy(ShareName,SourceFile,255);
+ KillSuffix(ShareName);
+ switch (ShareMode)
+ BEGIN
+ case 1: AddSuffix(ShareName,".inc"); break;
+ case 2: AddSuffix(ShareName,".h"); break;
+ case 3: AddSuffix(ShareName,IncSuffix); break;
+ END
+ END
+ END
+
+ if (MacProOutput)
+ BEGIN
+ strmaxcpy(MacProName,SourceFile,255); KillSuffix(MacProName);
+ AddSuffix(MacProName,PreSuffix);
+ END
+
+ if (MacroOutput)
+ BEGIN
+ strmaxcpy(MacroName,SourceFile,255); KillSuffix(MacroName);
+ AddSuffix(MacroName,MacSuffix);
+ END
+
+ ClearIncludeList();
+
+ if (DebugMode!=DebugNone) InitLineInfo();
+
+ /* Variablen initialisieren */
+
+ StartTime=GTime();
+
+ PassNo=0; MomLineCounter=0;
+
+ /* Listdatei eroeffnen */
+
+ if (NOT QuietMode) printf("%s%s\n",getmessage(Num_InfoMessAssembling),SourceFile);
+
+ do
+ BEGIN
+ /* Durchlauf initialisieren */
+
+ AssembleFile_InitPass(); AsmSubInit();
+ if (NOT QuietMode)
+ BEGIN
+ sprintf(Tmp,IntegerFormat,PassNo);
+ printf("%s%s%s\n",getmessage(Num_InfoMessPass),Tmp,ClrEol);
+ END
+
+ /* Dateien oeffnen */
+
+ if (CodeOutput) OpenFile();
+
+ if (ShareMode!=0)
+ BEGIN
+ ShareFile=fopen(ShareName,"w");
+ if (ShareFile==Nil) ChkIO(10001);
+ errno=0;
+ switch (ShareMode)
+ BEGIN
+ case 1:fprintf(ShareFile,"(* %s-Includefile f%sr CONST-Sektion *)\n",SourceFile,CH_ue); break;
+ case 2:fprintf(ShareFile,"/* %s-Includefile f%sr C-Programm */\n",SourceFile,CH_ue); break;
+ case 3:fprintf(ShareFile,"; %s-Includefile f%sr Assembler-Programm\n",SourceFile,CH_ue); break;
+ END
+ ChkIO(10002);
+ END
+
+ if (MacProOutput)
+ BEGIN
+ MacProFile=fopen(MacProName,"w");
+ if (MacProFile==Nil) ChkIO(10001);
+ END
+
+ if ((MacroOutput) AND (PassNo==1))
+ BEGIN
+ MacroFile=fopen(MacroName,"w");
+ if (MacroFile==Nil) ChkIO(10001);
+ END
+
+ /* Listdatei oeffnen */
+
+ RewriteStandard(&LstFile,LstName);
+ if (LstFile==Nil) ChkIO(10001);
+ errno=0; fprintf(LstFile,"%s",PrtInitString); ChkIO(10002);
+ if ((ListMask&1)!=0) NewPage(0,False);
+
+ /* assemblieren */
+
+ ProcessFile(SourceFile);
+ AssembleFile_ExitPass();
+
+ /* Dateien schliessen */
+
+ if (CodeOutput) CloseFile();
+
+ if (ShareMode!=0)
+ BEGIN
+ errno=0;
+ switch (ShareMode)
+ BEGIN
+ case 1: fprintf(ShareFile,"(* Ende Includefile f%sr CONST-Sektion *)\n",CH_ue); break;
+ case 2: fprintf(ShareFile,"/* Ende Includefile f%sr C-Programm */\n",CH_ue); break;
+ case 3: fprintf(ShareFile,"; Ende Includefile f%sr Assembler-Programm\n",CH_ue); break;
+ END
+ ChkIO(10002);
+ fclose(ShareFile);
+ END
+
+ if (MacProOutput) fclose(MacProFile);
+ if ((MacroOutput) AND (PassNo==1)) fclose(MacroFile);
+
+ /* evtl. fuer naechsten Durchlauf aufraeumen */
+
+ if ((ErrorCount==0) AND (Repass))
+ BEGIN
+ fclose(LstFile);
+ if (CodeOutput) unlink(OutName);
+ CleanupRegDefs();
+ ClearCodepages();
+ if (MakeUseList) ClearUseList();
+ if (MakeCrossList) ClearCrossList();
+ ClearDefineList();
+ if (DebugMode!=DebugNone) ClearLineInfo();
+ ClearIncludeList();
+ if (DebugMode!=DebugNone) ResetAddressRanges();
+ END
+ END
+ while ((ErrorCount==0) AND (Repass));
+
+ /* bei Fehlern loeschen */
+
+ if (ErrorCount!=0)
+ BEGIN
+ if (CodeOutput) unlink(OutName);
+ if (MacProOutput) unlink(MacProName);
+ if ((MacroOutput) AND (PassNo==1)) unlink(MacroName);
+ if (ShareMode!=0) unlink(ShareName);
+ GlobErrFlag=True;
+ END
+
+ /* Debug-Ausgabe muss VOR die Symbollistenausgabe, weil letztere die
+ Symbolliste loescht */
+
+ if (DebugMode!=DebugNone)
+ BEGIN
+ if (ErrorCount==0) DumpDebugInfo();
+ ClearLineInfo();
+ END
+
+ /* Listdatei abschliessen */
+
+ if (strcmp(LstName,NULLDEV)!=0)
+ BEGIN
+ if ((ListMask&2)!=0) PrintSymbolList();
+
+ if ((ListMask&64)!=0) PrintRegDefs();
+
+ if ((ListMask&4)!=0) PrintMacroList();
+
+ if ((ListMask&8)!=0) PrintFunctionList();
+
+ if ((ListMask&32)!=0) PrintDefineList();
+
+ if ((ListMask&128)!=0) PrintCodepages();
+
+ if (MakeUseList)
+ BEGIN
+ NewPage(ChapDepth,True);
+ PrintUseList();
+ END
+
+ if (MakeCrossList)
+ BEGIN
+ NewPage(ChapDepth,True);
+ PrintCrossList();
+ END
+
+ if (MakeSectionList) PrintSectionList();
+
+ if (MakeIncludeList) PrintIncludeList();
+
+ errno=0; fprintf(LstFile,"%s",PrtExitString); ChkIO(10002);
+ END
+
+ if (MakeUseList) ClearUseList();
+
+ if (MakeCrossList) ClearCrossList();
+
+ ClearSectionList();
+
+ ClearIncludeList();
+
+ if ((*ErrorPath=='\0') AND (IsErrorOpen))
+ BEGIN
+ fclose(ErrorFile); IsErrorOpen=False;
+ END
+
+ ClearUpProc();
+
+ /* Statistik ausgeben */
+
+ StopTime=GTime();
+ TWrite(DTime(StartTime,StopTime)/100.0,s);
+ if (NOT QuietMode) printf("\n%s%s%s\n\n",s,getmessage(Num_InfoMessAssTime),ClrEol);
+ if (ListMode==2)
+ BEGIN
+ WrLstLine("");
+ strmaxcat(s,getmessage(Num_InfoMessAssTime),255); WrLstLine(s);
+ WrLstLine("");
+ END
+
+ strcpy(s,Dec32BlankString(LineSum,7));
+ strmaxcat(s,getmessage((LineSum==1)?Num_InfoMessAssLine:Num_InfoMessAssLines),255);
+ if (NOT QuietMode) printf("%s%s\n",s,ClrEol);
+ if (ListMode==2) WrLstLine(s);
+
+ if (LineSum!=MacLineSum)
+ BEGIN
+ strcpy(s,Dec32BlankString(MacLineSum,7));
+ strmaxcat(s,getmessage((MacLineSum==1)?Num_InfoMessMacAssLine:Num_InfoMessMacAssLines),255);
+ if (NOT QuietMode) printf("%s%s\n",s,ClrEol);
+ if (ListMode==2) WrLstLine(s);
+ END
+
+ strcpy(s,Dec32BlankString(PassNo,7));
+ strmaxcat(s,getmessage((PassNo==1)?Num_InfoMessPassCnt:Num_InfoMessPPassCnt),255);
+ if (NOT QuietMode) printf("%s%s\n",s,ClrEol);
+ if (ListMode==2) WrLstLine(s);
+
+ if ((ErrorCount>0) AND (Repass) AND (ListMode!=0))
+ WrLstLine(getmessage(Num_InfoMessNoPass));
+
+#ifdef __TURBOC__
+ sprintf(s,"%s%s",Dec32BlankString(coreleft()>>10,7),getmessage(Num_InfoMessRemainMem));
+ if (NOT QuietMode) printf("%s%s\n",s,ClrEol);
+ if (ListMode==2) WrLstLine(s);
+
+ sprintf(s,"%s%s",Dec32BlankString(StackRes(),7),getmessage(Num_InfoMessRemainStack));
+ if (NOT QuietMode) printf("%s%s\n",s,ClrEol);
+ if (ListMode==2) WrLstLine(s);
+#endif
+
+ sprintf(s,"%s%s",Dec32BlankString(ErrorCount,7),getmessage(Num_InfoMessErrCnt));
+ if (ErrorCount!=1) strmaxcat(s,getmessage(Num_InfoMessErrPCnt),255);
+ if (NOT QuietMode) printf("%s%s\n",s,ClrEol);
+ if (ListMode==2) WrLstLine(s);
+
+ sprintf(s,"%s%s",Dec32BlankString(WarnCount,7),getmessage(Num_InfoMessWarnCnt));
+ if (WarnCount!=1) strmaxcat(s,getmessage(Num_InfoMessWarnPCnt),255);
+ if (NOT QuietMode) printf("%s%s\n",s,ClrEol);
+ if (ListMode==2) WrLstLine(s);
+
+ fclose(LstFile);
+
+ /* verstecktes */
+
+ if (MakeDebug) PrintSymbolDepth();
+
+ /* Speicher freigeben */
+
+ ClearSymbolList();
+ ClearRegDefs();
+ ClearCodepages();
+ ClearMacroList();
+ ClearFunctionList();
+ ClearDefineList();
+ ClearFileList();
+
+ dbgentry("AssembleFile");
+END
+
+ static void AssembleGroup(void)
+BEGIN
+ AddSuffix(FileMask,SrcSuffix);
+ if (NOT DirScan(FileMask,AssembleFile))
+ fprintf(stderr,"%s%s\n",FileMask,getmessage(Num_InfoMessNFilesFound));
+END
+
+/*-------------------------------------------------------------------------*/
+
+ static CMDResult CMD_SharePascal(Boolean Negate, char *Arg)
+BEGIN
+ if (NOT Negate) ShareMode=1;
+ else if (ShareMode==1) ShareMode=0;
+ return CMDOK;
+END
+
+ static CMDResult CMD_ShareC(Boolean Negate, char *Arg)
+BEGIN
+ if (NOT Negate) ShareMode=2;
+ else if (ShareMode==2) ShareMode=0;
+ return CMDOK;
+END
+
+ static CMDResult CMD_ShareAssembler(Boolean Negate, char *Arg)
+BEGIN
+ if (NOT Negate) ShareMode=3;
+ else if (ShareMode==3) ShareMode=0;
+ return CMDOK;
+END
+
+ static CMDResult CMD_DebugMode(Boolean Negate, char *Arg)
+BEGIN
+ UpString(Arg);
+
+ if (Negate)
+ if (Arg[0]!='\0') return CMDErr;
+ else
+ BEGIN
+ DebugMode=DebugNone; return CMDOK;
+ END
+ else if (strcmp(Arg,"")==0)
+ BEGIN
+ DebugMode=DebugMAP; return CMDOK;
+ END
+ else if (strcmp(Arg,"ATMEL")==0)
+ BEGIN
+ DebugMode=DebugAtmel; return CMDArg;
+ END
+ else if (strcmp(Arg,"MAP")==0)
+ BEGIN
+ DebugMode=DebugMAP; return CMDArg;
+ END
+ else if (strcmp(Arg,"NOICE")==0)
+ BEGIN
+ DebugMode=DebugNoICE; return CMDArg;
+ END
+ /*else if (strcmp(Arg,"A.OUT")==0)
+ BEGIN
+ DebugMode=DebugAOUT; return CMDArg;
+ END
+ else if (strcmp(Arg,"COFF")==0)
+ BEGIN
+ DebugMode=DebugCOFF; return CMDArg;
+ END
+ else if (strcmp(Arg,"ELF")==0)
+ BEGIN
+ DebugMode=DebugELF; return CMDArg;
+ END*/
+ else return CMDErr;
+
+/* if (Negate) DebugMode=DebugNone;
+ else DebugMode=DebugMAP;
+ return CMDOK;*/
+END
+
+ static CMDResult CMD_ListConsole(Boolean Negate, char *Arg)
+BEGIN
+ if (NOT Negate) ListMode=1;
+ else if (ListMode==1) ListMode=0;
+ return CMDOK;
+END
+
+ static CMDResult CMD_ListFile(Boolean Negate, char *Arg)
+BEGIN
+ if (NOT Negate) ListMode=2;
+ else if (ListMode==2) ListMode=0;
+ return CMDOK;
+END
+
+ static CMDResult CMD_SuppWarns(Boolean Negate, char *Arg)
+BEGIN
+ SuppWarns=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_UseList(Boolean Negate, char *Arg)
+BEGIN
+ MakeUseList=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_CrossList(Boolean Negate, char *Arg)
+BEGIN
+ MakeCrossList=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_SectionList(Boolean Negate, char *Arg)
+BEGIN
+ MakeSectionList=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_BalanceTree(Boolean Negate, char *Arg)
+BEGIN
+ BalanceTree=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_MakeDebug(Boolean Negate, char *Arg)
+BEGIN
+ if (NOT Negate)
+ BEGIN
+ MakeDebug=True;
+ errno=0; Debug=fopen("as.deb","w");
+ if (Debug==Nil) ChkIO(10002);
+ END
+ else if (MakeDebug)
+ BEGIN
+ MakeDebug=False;
+ fclose(Debug);
+ END
+ return CMDOK;
+END
+
+ static CMDResult CMD_MacProOutput(Boolean Negate, char *Arg)
+BEGIN
+ MacProOutput=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_MacroOutput(Boolean Negate, char *Arg)
+BEGIN
+ MacroOutput=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_MakeIncludeList(Boolean Negate, char *Arg)
+BEGIN
+ MakeIncludeList=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_CodeOutput(Boolean Negate, char *Arg)
+BEGIN
+ CodeOutput=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_MsgIfRepass(Boolean Negate, String Arg)
+BEGIN
+ Boolean OK;
+
+ MsgIfRepass=NOT Negate;
+ if (MsgIfRepass)
+ if (Arg[0]=='\0')
+ BEGIN
+ PassNoForMessage=1; return CMDOK;
+ END
+ else
+ BEGIN
+ PassNoForMessage=ConstLongInt(Arg,&OK);
+ if (NOT OK)
+ BEGIN
+ PassNoForMessage=1; return CMDOK;
+ END
+ else if (PassNoForMessage<1) return CMDErr;
+ else return CMDArg;
+ END
+ else return CMDOK;
+END
+
+ static CMDResult CMD_ExtendErrors(Boolean Negate, char *Arg)
+BEGIN
+ if ((Negate) AND (ExtendErrors > 0))
+ ExtendErrors--;
+ else if ((NOT Negate) AND (ExtendErrors < 2))
+ ExtendErrors++;
+
+ return CMDOK;
+END
+
+ static CMDResult CMD_NumericErrors(Boolean Negate, char *Arg)
+BEGIN
+ NumericErrors=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_HexLowerCase(Boolean Negate, char *Arg)
+BEGIN
+ HexLowerCase=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_QuietMode(Boolean Negate, char *Arg)
+BEGIN
+ QuietMode=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_ThrowErrors(Boolean Negate, char *Arg)
+BEGIN
+ ThrowErrors=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_CaseSensitive(Boolean Negate, char *Arg)
+BEGIN
+ CaseSensitive=NOT Negate;
+ return CMDOK;
+END
+
+ static CMDResult CMD_IncludeList(Boolean Negate, char *Arg)
+BEGIN
+ char *p;
+ String Copy,part;
+
+ if (*Arg=='\0') return CMDErr;
+ else
+ BEGIN
+ strncpy(Copy,Arg,255);
+ do
+ BEGIN
+ p=strrchr(Copy,DIRSEP);
+ if (p==Nil)
+ BEGIN
+ strmaxcpy(part,Copy,255);
+ *Copy='\0';
+ END
+ else
+ BEGIN
+ *p='\0'; strmaxcpy(part,p+1,255);
+ END
+ if (Negate) RemoveIncludeList(part); else AddIncludeList(part);
+ END
+ while (Copy[0]!='\0');
+ return CMDArg;
+ END
+END
+
+ static CMDResult CMD_ListMask(Boolean Negate, char *Arg)
+BEGIN
+ Byte erg;
+ Boolean OK;
+
+ if (Arg[0]=='\0') return CMDErr;
+ else
+ BEGIN
+ erg=ConstLongInt(Arg,&OK);
+ if ((NOT OK) OR (erg>31)) return CMDErr;
+ else
+ BEGIN
+ if (Negate) ListMask&=(~erg);
+ else ListMask|=erg;
+ return CMDArg;
+ END
+ END
+END
+
+ static CMDResult CMD_DefSymbol(Boolean Negate, char *Arg)
+BEGIN
+ String Copy,Part,Name;
+ char *p;
+ TempResult t;
+
+ if (Arg[0]=='\0') return CMDErr;
+
+ strmaxcpy(Copy,Arg,255);
+ do
+ BEGIN
+ p=QuotPos(Copy,',');
+ if (p==Nil)
+ BEGIN
+ strmaxcpy(Part,Copy,255); Copy[0]='\0';
+ END
+ else
+ BEGIN
+ *p='\0'; strmaxcpy(Part,Copy,255); strcpy(Copy,p+1);
+ END
+ UpString(Part);
+ p=QuotPos(Part,'=');
+ if (p==Nil)
+ BEGIN
+ strmaxcpy(Name,Part,255); Part[0]='\0';
+ END
+ else
+ BEGIN
+ *p='\0'; strmaxcpy(Name,Part,255); strcpy(Part,p+1);
+ END
+ if (NOT ChkSymbName(Name)) return CMDErr;
+ if (Negate) RemoveDefSymbol(Name);
+ else
+ BEGIN
+ AsmParsInit();
+ if (Part[0]!='\0')
+ BEGIN
+ FirstPassUnknown=False;
+ EvalExpression(Part,&t);
+ if ((t.Typ==TempNone) OR (FirstPassUnknown)) return CMDErr;
+ END
+ else
+ BEGIN
+ t.Typ=TempInt; t.Contents.Int=1;
+ END
+ AddDefSymbol(Name,&t);
+ END
+ END
+ while (Copy[0]!='\0');
+
+ return CMDArg;
+END
+
+ static CMDResult CMD_ErrorPath(Boolean Negate, String Arg)
+BEGIN
+ if (Negate) return CMDErr;
+ else if (Arg[0]=='\0')
+ BEGIN
+ ErrorPath[0]='\0'; return CMDOK;
+ END
+ else
+ BEGIN
+ strncpy(ErrorPath,Arg,255); return CMDArg;
+ END
+END
+
+ static CMDResult CMD_HardRanges(Boolean Negate, char *Arg)
+BEGIN
+ HardRanges=Negate; return CMDOK;
+END
+
+ static CMDResult CMD_OutFile(Boolean Negate, char *Arg)
+BEGIN
+ if (Arg[0]=='\0')
+ if (Negate)
+ BEGIN
+ ClearOutList(); return CMDOK;
+ END
+ else return CMDErr;
+ else
+ BEGIN
+ if (Negate) RemoveFromOutList(Arg);
+ else AddToOutList(Arg);
+ return CMDArg;
+ END
+END
+
+ static CMDResult CMD_ShareOutFile(Boolean Negate, char *Arg)
+BEGIN
+ if (Arg[0]=='\0')
+ if (Negate)
+ BEGIN
+ ClearShareOutList(); return CMDOK;
+ END
+ else return CMDErr;
+ else
+ BEGIN
+ if (Negate) RemoveFromShareOutList(Arg);
+ else AddToShareOutList(Arg);
+ return CMDArg;
+ END
+END
+
+
+ static Boolean CMD_CPUAlias_ChkCPUName(char *s)
+BEGIN
+ int z;
+
+ for(z=0; z<strlen(s); z++)
+ if (NOT isalnum((unsigned int) s[z])) return False;
+ return True;
+END
+
+ static CMDResult CMD_CPUAlias(Boolean Negate, char *Arg)
+BEGIN
+ char *p;
+ String s1,s2;
+
+ if (Negate) return CMDErr;
+ else if (Arg[0]=='\0') return CMDErr;
+ else
+ BEGIN
+ p=strchr(Arg,'=');
+ if (p==Nil) return CMDErr;
+ else
+ BEGIN
+ *p='\0';
+ strmaxcpy(s1,Arg,255); UpString(s1);
+ strmaxcpy(s2,p+1,255); UpString(s2);
+ *p='=';
+ if (NOT (CMD_CPUAlias_ChkCPUName(s1) AND CMD_CPUAlias_ChkCPUName(s2)))
+ return CMDErr;
+ else if (NOT AddCPUAlias(s2,s1)) return CMDErr;
+ else return CMDArg;
+ END
+ END
+END
+
+ static CMDResult CMD_SetCPU(Boolean Negate, char *Arg)
+BEGIN
+ if (Negate)
+ BEGIN
+ *DefCPU = '\0';
+ return CMDOK;
+ END
+ else
+ BEGIN
+ if (*Arg == '\0') return CMDErr;
+ strmaxcpy(DefCPU, Arg, sizeof(DefCPU) - 1);
+ NLS_UpString(DefCPU);
+ return CMDArg;
+ END
+END
+
+ static void ParamError(Boolean InEnv, char *Arg)
+BEGIN
+ printf("%s%s\n",getmessage((InEnv) ? Num_ErrMsgInvEnvParam : Num_ErrMsgInvParam),Arg);
+ exit(4);
+END
+
+#define ASParamCnt 33
+static CMDRec ASParams[ASParamCnt]=
+ {{"A" , CMD_BalanceTree},
+ {"ALIAS", CMD_CPUAlias},
+ {"a" , CMD_ShareAssembler},
+ {"C" , CMD_CrossList},
+ {"c" , CMD_ShareC},
+ {"CPU" , CMD_SetCPU},
+ {"D" , CMD_DefSymbol},
+ {"E" , CMD_ErrorPath},
+ {"g" , CMD_DebugMode},
+ {"G" , CMD_CodeOutput},
+ {"h" , CMD_HexLowerCase},
+ {"i" , CMD_IncludeList},
+ {"I" , CMD_MakeIncludeList},
+ {"L" , CMD_ListFile},
+ {"l" , CMD_ListConsole},
+ {"M" , CMD_MacroOutput},
+ {"n" , CMD_NumericErrors},
+ {"o" , CMD_OutFile},
+ {"P" , CMD_MacProOutput},
+ {"p" , CMD_SharePascal},
+ {"q" , CMD_QuietMode},
+ {"QUIET", CMD_QuietMode},
+ {"r" , CMD_MsgIfRepass},
+ {"s" , CMD_SectionList},
+ {"SHAREOUT", CMD_ShareOutFile},
+ {"t" , CMD_ListMask},
+ {"u" , CMD_UseList},
+ {"U" , CMD_CaseSensitive},
+ {"w" , CMD_SuppWarns},
+ {"WARNRANGES", CMD_HardRanges},
+ {"x" , CMD_ExtendErrors},
+ {"X" , CMD_MakeDebug},
+ {"Y" , CMD_ThrowErrors}};
+
+/*--------------------------------------------------------------------------*/
+
+
+
+#ifdef __sunos__
+
+ extern void on_exit(void (*procp)(int status, caddr_t arg),caddr_t arg);
+
+ static void GlobExitProc(int status, caddr_t arg)
+BEGIN
+ if (MakeDebug) fclose(Debug);
+END
+
+#else
+
+ static void GlobExitProc(void)
+BEGIN
+ if (MakeDebug) fclose(Debug);
+END
+
+#endif
+
+static int LineZ;
+
+ static void NxtLine(void)
+BEGIN
+ if (++LineZ==23)
+ BEGIN
+ LineZ=0;
+ if (Redirected!=NoRedir) return;
+ printf("%s",getmessage(Num_KeyWaitMsg)); fflush(stdout);
+ while (getchar()!='\n');
+ printf("%s%s",CursUp,ClrEol);
+ END
+END
+
+ static void WrHead(void)
+BEGIN
+ if (!QuietMode)
+ BEGIN
+ printf("%s%s\n",getmessage(Num_InfoMessMacroAss),Version); NxtLine();
+ printf("(%s-%s)\n",ARCHPRNAME,ARCHSYSNAME); NxtLine();
+ printf("%s\n",InfoMessCopyright); NxtLine();
+ WriteCopyrights(NxtLine);
+ printf("\n"); NxtLine();
+ END
+END
+
+ int main(int argc, char **argv)
+BEGIN
+ char *Env,*ph1,*ph2;
+ String Dummy;
+ int i;
+ static Boolean First=TRUE;
+ CMDProcessed ParUnprocessed; /* bearbeitete Kommandozeilenparameter */
+
+ ParamCount=argc-1; ParamStr=argv;
+
+ if (First)
+ BEGIN
+ endian_init(); nls_init(); bpemu_init(); stdhandl_init();
+ strutil_init(); stringlists_init(); chunks_init();
+
+ NLS_Initialize();
+
+ nlmessages_init("as.msg",*argv,MsgId1,MsgId2); ioerrs_init(*argv);
+ cmdarg_init(*argv);
+
+ asmfnums_init(); asminclist_init(); asmitree_init();
+
+ asmdef_init(); asmsub_init(); asmpars_init();
+
+ asmmac_init(); asmif_init(); asmcode_init(); asmdebug_init();
+
+ codeallg_init(); codepseudo_init();
+
+ code68k_init();
+ code56k_init();
+ code601_init();
+ codemcore_init();
+ code68_init(); code6805_init(); code6809_init(); code6812_init(); code6816_init();
+ codeh8_3_init(); codeh8_5_init(); code7000_init();
+ code65_init(); code7700_init(); code4500_init(); codem16_init(); codem16c_init();
+ code4004_init(); code8008_init(); code48_init(); code51_init(); code96_init(); code85_init(); code86_init(); code960_init();
+ code8x30x_init(); codexa_init();
+ codeavr_init();
+ code29k_init();
+ code166_init();
+ codez80_init(); codez8_init();
+ code96c141_init(); code90c141_init(); code87c800_init(); code47c00_init(); code97c241_init();
+ code16c5x_init(); code16c8x_init(); code17c4x_init();
+ codest6_init(); codest7_init(); codest9_init(); code6804_init();
+ code3201x_init(); code3202x_init(); code3203x_init(); code3205x_init(); code3206x_init();
+ code9900_init(); codetms7_init(); code370_init(); codemsp_init();
+ code78c10_init(); code75k0_init(); code78k0_init(); code7720_init(); code77230_init();
+ codescmp_init(); codecop8_init(); codesc14xxx_init();
+ codeace_init();
+ code53c8xx_init();
+ codef2mc8_init();
+ /*as1750_init();*/
+ First=FALSE;
+ END
+
+#ifdef __sunos__
+ on_exit(GlobExitProc,(caddr_t) Nil);
+#else
+#ifndef __MUNIX__
+ atexit(GlobExitProc);
+#endif
+#endif
+
+ *CursUp='\0'; *ClrEol='\0';
+ switch (Redirected)
+ BEGIN
+ case NoRedir:
+ Env=getenv("USEANSI"); strncpy(Dummy,(Env!=Nil)?Env:"Y",255);
+ if (toupper(Dummy[0])=='N')
+ BEGIN
+ END
+ else
+ BEGIN
+ strcpy(ClrEol," [K"); ClrEol[0]=Char_ESC; /* ANSI-Sequenzen */
+ strcpy(CursUp," [A"); CursUp[0]=Char_ESC;
+ END
+ break;
+ case RedirToDevice:
+ /* Basissteuerzeichen fuer Geraete */
+ for (i=1; i<=20; i++) strcat(ClrEol," ");
+ for (i=1; i<=20; i++) strcat(ClrEol,"\b");
+ break;
+ case RedirToFile:
+ strcpy(ClrEol,"\n"); /* CRLF auf Datei */
+ END
+
+ ShareMode=0; ListMode=0; IncludeList[0]='\0'; SuppWarns=False;
+ MakeUseList=False; MakeCrossList=False; MakeSectionList=False;
+ MakeIncludeList=False; ListMask=0xff;
+ MakeDebug=False; ExtendErrors=0;
+ MacroOutput=False; MacProOutput=False; CodeOutput=True;
+ strcpy(ErrorPath,"!2"); MsgIfRepass=False; QuietMode=False;
+ NumericErrors=False; DebugMode=DebugNone; CaseSensitive=False;
+ ThrowErrors=False; HardRanges=True;
+
+ LineZ=0;
+
+ if (ParamCount==0)
+ BEGIN
+ WrHead();
+ printf("%s%s%s\n",getmessage(Num_InfoMessHead1),GetEXEName(),getmessage(Num_InfoMessHead2)); NxtLine();
+ for (ph1=getmessage(Num_InfoMessHelp),ph2=strchr(ph1,'\n'); ph2!=Nil; ph1=ph2+1,ph2=strchr(ph1,'\n'))
+ BEGIN
+ *ph2='\0';
+ printf("%s\n",ph1); NxtLine();
+ *ph2='\n';
+ END
+ PrintCPUList(NxtLine);
+ ClearCPUList();
+ exit(1);
+ END
+
+#if defined(STDINCLUDES)
+ CMD_IncludeList(False,STDINCLUDES);
+#endif
+ ProcessCMD(ASParams,ASParamCnt,ParUnprocessed,EnvName,ParamError);
+
+ /* wegen QuietMode dahinter */
+
+ WrHead();
+
+ GlobErrFlag=False;
+ if (ErrorPath[0]!='\0')
+ BEGIN
+ strcpy(ErrorName,ErrorPath);
+ unlink(ErrorName);
+ END
+ IsErrorOpen=False;
+
+ for (i=1; i<=ParamCount; i++)
+ if (ParUnprocessed[i]) break;
+ if (i>ParamCount)
+ BEGIN
+ printf("%s [%s] ",getmessage(Num_InvMsgSource),SrcSuffix); fflush(stdout);
+ fgets(FileMask,255,stdin);
+ if (FileMask[strlen(FileMask)-1]=='\n') FileMask[strlen(FileMask)-1]='\0';
+ AssembleGroup();
+ END
+ else
+ for (i=1; i<=ParamCount; i++)
+ if (ParUnprocessed[i])
+ BEGIN
+ strmaxcpy(FileMask,ParamStr[i],255);
+ AssembleGroup();
+ END
+
+ if ((ErrorPath[0]!='\0') AND (IsErrorOpen))
+ BEGIN
+ fclose(ErrorFile); IsErrorOpen=False;
+ END
+
+ ClearCPUList();
+
+ if (GlobErrFlag) return (2); else return (0);
+END
diff --git a/as.h b/as.h
new file mode 100644
index 0000000..c0e9c93
--- /dev/null
+++ b/as.h
@@ -0,0 +1,11 @@
+/* as.h */
+/*****************************************************************************/
+/* AS-Portierung */
+/* */
+/* Hauptmodul */
+/* */
+/* Historie: 4. 5.1996 Grundsteinlegung */
+/* */
+/*****************************************************************************/
+
+extern char *GetErrorPos(void);
diff --git a/as.res b/as.res
new file mode 100644
index 0000000..4c5f01d
--- /dev/null
+++ b/as.res
@@ -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"
diff --git a/as1750.c b/as1750.c
new file mode 100644
index 0000000..13301b4
--- /dev/null
+++ b/as1750.c
@@ -0,0 +1,1295 @@
+/***************************************************************************/
+/* */
+/* Project : as1750 -- Mil-Std-1750 Assembler and Linker */
+/* */
+/* Component : as1750.c -- 1750 instruction assembly */
+/* */
+/* Copyright : (C) Daimler-Benz Aerospace AG, 1994-1997 */
+/* */
+/* Author : Oliver M. Kellogg, Dornier Satellite Systems, */
+/* Dept. RST13, D-81663 Munich, Germany. */
+/* Contact : oliver.kellogg@space.otn.dasa.de */
+/* */
+/* Disclaimer: */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License as published by */
+/* the Free Software Foundation; either version 2 of the License, or */
+/* (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/***************************************************************************/
+
+#ifdef AS1750
+#include "common.h"
+#include "utils.h"
+#else /* ASL */
+#include <stdio.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <string.h>
+#include "datatypes.h"
+#include "strutil.h"
+#include "asmdef.h"
+#include "asmsub.h"
+#include "asmpars.h"
+#include "as1750.h"
+#define bool char
+#define ushort unsigned short
+#define ulong unsigned long
+#define status unsigned
+#define dtoi(ascii_char) (ascii_char - '0')
+#endif
+
+
+#ifndef AS1750
+static
+#endif
+ status /* Output an error text (printf style). */
+error (char *layout,...) /* Return the ERROR status code. */
+{
+ va_list vargu;
+ char output_line[132];
+
+ va_start (vargu, layout);
+ vsprintf (output_line, layout, vargu);
+#ifdef AS1750
+ fprintf (stderr, "%s line%5d: %s\n", nopath (file[curr_file].name),
+ file[curr_file].line_number, output_line);
+#else /* ASL */
+ WrErrorString (output_line, "\0", 0, 0);
+#endif
+ va_end (vargu);
+ return ERROR;
+}
+
+
+/* Get a number. Return pointer to first position in s after the end of
+ * the number, or NULL for error.
+ * Will also read character constants of the form: 'x', and two-character
+ * packed strings of the form "xy" (where x=>highbyte,y=>lowbyte.)
+ */
+
+#ifdef AS1750
+
+char *
+get_num (char *s, int *outnum)
+{
+ bool is_neg = FALSE, intel = FALSE, c_lang = FALSE, tld = FALSE;
+ char *start;
+
+ *outnum = 0;
+ if (*s == '-')
+ {
+ is_neg = TRUE;
+ ++s;
+ }
+ else if (*s == '+')
+ ++s;
+ /* determine if Intel format */
+ if (isdigit (*s))
+ {
+ char *p = s;
+ while (isxdigit (*++p))
+ ;
+ if (upcase (*p) == 'H')
+ intel = TRUE;
+ }
+ if (intel
+ || (c_lang = (*s == '0' && upcase (*(s + 1)) == 'X'))
+ || (tld = strncmp (s, "16#", 3) == 0))
+ {
+ s += c_lang ? 2 : tld ? 3 : 0;
+ start = s;
+ while (isxdigit (*s))
+ {
+ *outnum = (*outnum << 4) | xtoi (*s);
+ ++s;
+ }
+ if (s - start > 4)
+ {
+ error ("get_num -- number at '%s' too large", start);
+ return NULL;
+ }
+ if (intel)
+ s++;
+ else if (tld)
+ {
+ if (*s != '#')
+ {
+ error ("get_num -- expecting '#' at end of number");
+ return NULL;
+ }
+ s++;
+ }
+ }
+ else if (*s == '0' || (tld = (*s == '8' && *(s + 1) == '#')))
+ {
+ s += tld ? 2 : 1;
+ start = s;
+ while (*s >= '0' && *s <= '7')
+ {
+ *outnum = (*outnum << 3) | (*s - '0');
+ ++s;
+ }
+ if (s - start > 6)
+ {
+ error ("get_num -- number at '%s' too large", start);
+ return NULL;
+ }
+ if (tld)
+ {
+ if (*s != '#')
+ {
+ error ("get_num -- expecting '#' at end of number");
+ return NULL;
+ }
+ ++s;
+ }
+ }
+ else if (*s == '@' || (tld = (*s == '2' && *(s + 1) == '#')))
+ {
+ s += (tld ? 2 : 1);
+ start = s;
+ while (*s == '0' || *s == '1')
+ {
+ *outnum = (*outnum << 1) | (*s - '0');
+ ++s;
+ }
+ if (s - start > 16)
+ {
+ error ("get_num -- number at '%s' too large", start);
+ return NULL;
+ }
+ if (tld)
+ {
+ if (*s != '#')
+ {
+ error ("get_num -- expecting '#' at end of number");
+ return NULL;
+ }
+ ++s;
+ }
+ }
+ else if (isdigit (*s))
+ {
+ start = s;
+ while (isdigit (*s))
+ {
+ *outnum = (*outnum * 10) + dtoi (*s);
+ ++s;
+ }
+ if (s - start > 5)
+ {
+ error ("get_num -- number at '%s' too large", start);
+ return NULL;
+ }
+ }
+ else if (*s == '\'')
+ {
+ start = s;
+ if (*++s == '\\')
+ {
+ switch (*++s)
+ {
+ case 't':
+ *outnum = 9;
+ break;
+ case 'n':
+ *outnum = 10;
+ break;
+ case 'r':
+ *outnum = 13;
+ break;
+ default:
+ error ("get_num -- unknown escape '\\%c'", *s);
+ return NULL;
+ }
+ }
+ else
+ *outnum = (int) *s & 0xFF;
+ if (*++s != '\'')
+ {
+ error ("get_num -- character constant incorrectly terminated", start);
+ return NULL;
+ }
+ ++s;
+ }
+ else if (*s == '"')
+ {
+ start = s;
+ *outnum = ((int) *++s & 0xFF) << 8;
+ *outnum |= (int) *++s & 0xFF;
+ if (*++s != '"')
+ {
+ error ("get_num -- character tuple incorrectly terminated", start);
+ return NULL;
+ }
+ ++s;
+ }
+ else
+ return NULL;
+ if (is_neg)
+ *outnum = -*outnum;
+ return s;
+}
+
+/* Get a constant symbol (previously defined by EQU) or a number.
+ * Return pointer to first character after the symbol or number consumed,
+ * or NULL if reading the symbol or number was unsuccessful.
+ */
+char *
+get_sym_num (char *s, int *outnum)
+{
+ char *p, c;
+ symbol_t sym;
+
+ if ((p = get_num (s, outnum)) != NULL)
+ return p;
+
+ /* Didn't find a raw number; try symbol. */
+ if (!issymstart (*s))
+ {
+ error ("expecting symbol at '%s'", s);
+ return NULL;
+ }
+ p = s;
+ while (issymchar (*p))
+ p++;
+ c = *p;
+ *p = '\0';
+ if ((sym = find_symbol (s)) == SNULL)
+ {
+ error ("unidentified symbol at '%s'", s);
+ return NULL;
+ }
+ *p = c;
+ if (!sym->is_constant)
+ {
+ error ("symbol must be constant in this context");
+ return NULL;
+ }
+ *outnum = (int) sym->value;
+ return p;
+}
+
+
+extern int curr_frag; /* imported from main.c */
+
+/* Enter a 16-bit word into the object space */
+void
+add_word (ushort word)
+{
+ struct objblock *obj = &objblk[curr_frag];
+
+ if (obj->data == (ushort *) 0)
+ {
+ obj->n_allocated = 256;
+ obj->data = (ushort *) malloc (obj->n_allocated * sizeof (ushort));
+ obj->line = (struct linelist **) malloc
+ (obj->n_allocated * sizeof (struct linelist *));
+ }
+ else if (obj->n_used == obj->n_allocated)
+ {
+ obj->n_allocated *= 2;
+ obj->data = (ushort *) realloc (obj->data,
+ obj->n_allocated * sizeof (ushort));
+ obj->line = (struct linelist **) realloc (obj->line,
+ obj->n_allocated * sizeof (struct linelist *));
+ }
+ if (obj->data == (ushort *) 0 || obj->line == (struct linelist **) 0)
+ problem ("request for object space refused by OS");
+ obj->data[obj->n_used] = word;
+ obj->line[obj->n_used] = line;
+ obj->n_used++;
+}
+
+void
+add_reloc (symbol_t sym) /* auxiliary to parse_addr() */
+{
+ struct reloc *rel;
+
+ if (relblk.data == (struct reloc *) 0)
+ {
+ relblk.n_allocated = 256;
+ relblk.data = (struct reloc *) malloc
+ (relblk.n_allocated * sizeof (struct reloc));
+ }
+ else if (relblk.n_used == relblk.n_allocated)
+ {
+ relblk.n_allocated *= 2;
+ relblk.data = (struct reloc *) realloc (relblk.data,
+ relblk.n_allocated * sizeof (struct reloc));
+ }
+ if (relblk.data == (struct reloc *) 0)
+ problem ("request for relocation space refused by OS");
+ rel = &relblk.data[relblk.n_used];
+ rel->done = FALSE; /* default initializations */
+ rel->reltype = Word_Reloc;
+ rel->frag_index = curr_frag;
+ rel->obj_index = objblk[curr_frag].n_used;
+ rel->sym = sym;
+ relblk.n_used++;
+}
+
+
+/* Parse the address expression at s into object space.
+ Returns OKAY or ERROR. */
+status
+parse_addr (char *s)
+{
+ int num;
+ char *p, c, c1;
+ symbol_t sym, sym1;
+
+ if (issymstart (*s))
+ {
+ p = skip_symbol (s);
+ c = *p; /* prepare for symbol lookup */
+ *p = '\0';
+ if ((sym = find_or_enter (s)) == SNULL)
+ return ERROR;
+ sym->is_referenced = TRUE;
+ *p = c;
+ s = p++;
+ if (c == '\0')
+ {
+ if (sym->is_constant)
+ add_word ((ushort) sym->value);
+ else
+ {
+ add_reloc (sym);
+ add_word (0);
+ }
+ }
+ else if (c != '+' && c != '-')
+ return error ("error after symbolname at: %s", s);
+ else if (issymstart (*p))
+ {
+ s = skip_symbol (p);
+ if (*s != '\0' && *s != ',')
+ return error ("address expression too complex");
+ c1 = *s; /* prepare for symbol lookup */
+ *s = '\0';
+ if ((sym1 = find_or_enter (p)) == SNULL)
+ return ERROR;
+ sym1->is_referenced = TRUE;
+ *s = c1;
+ if (c == '+')
+ {
+ if (sym->is_constant)
+ {
+ if (sym1->is_constant)
+ {
+ long sum = sym->value + sym1->value;
+ if (sum < -0x8000L)
+ return error ("negative overflow in symbol addition");
+ else if (sum > 0xFFFFL)
+ return error ("positive overflow in symbol addition");
+ add_word ((ushort) sum);
+ }
+ else
+ {
+ add_reloc (sym1);
+ add_word ((ushort) sym->value);
+ }
+ }
+ else
+ {
+ if (sym1->is_constant)
+ {
+ add_reloc (sym);
+ add_word ((ushort) sym1->value);
+ }
+ else
+ return error ("cannot add relocatable symbols");
+ }
+ }
+ else
+ /* subtraction */
+ {
+ if (sym->is_constant)
+ {
+ if (sym1->is_constant)
+ {
+ long dif = sym->value - sym1->value;
+ if (dif < -0x8000L)
+ return error ("negative overflow in symbol subtraction");
+ else if (dif > 0xFFFFL)
+ return error ("positive overflow symbol subtraction");
+ add_word ((ushort) dif);
+ }
+ else
+ error ("cannot subtract relocatable symbol from constant symbol");
+ }
+ else
+ {
+ if (sym1->is_constant)
+ {
+ add_reloc (sym);
+ add_word ((ushort) - sym1->value);
+ }
+ else
+ {
+ if (objblk[sym->frag_index].section !=
+ objblk[sym1->frag_index].section)
+ return error
+ ("cannot subtract relocatable symbols from different fragments");
+ if (sym->value < sym1->value)
+ error ("warning: strange subtraction of relocatable symbols");
+ add_word ((ushort) (sym->value - sym1->value));
+ }
+ }
+ }
+ }
+ else
+ {
+ if (get_num (s, &num) == NULL)
+ return ERROR;
+ if (sym->is_constant)
+ {
+ long sum = sym->value + (long) num;
+ if (sum < -32768L)
+ return error ("neg. overflow in symbolic expression");
+ else if (sum > 65535L)
+ return error ("overflow in symbolic expression");
+ add_word ((ushort) sum);
+ }
+ else
+ {
+ add_reloc (sym);
+ add_word ((ushort) num);
+ }
+ }
+ }
+ else if ((s = get_num (s, &num)) == NULL)
+ return ERROR;
+ else
+ {
+ if (*s == '\0')
+ add_word ((ushort) num);
+ else if (*s != '+')
+ return error ("expected '+' in address expression at: %s", s);
+ else
+ {
+ ++s;
+ if (!issymstart (*s))
+ return error ("expected symbolname in address expression at: %s", s);
+ p = skip_symbol (s);
+ if (*p != '\0' && *p != ',')
+ return error ("illegal characters after symbolname at: %s", s);
+ c = *p; /* prepare for symbol lookup */
+ *p = '\0';
+ if ((sym = find_or_enter (s)) == SNULL)
+ return ERROR;
+ sym->is_referenced = TRUE;
+ *p = c;
+ s = p;
+ if (sym->is_constant)
+ add_word ((ushort) (sym->value + (long) num));
+ else
+ {
+ add_reloc (sym);
+ add_word ((ushort) num);
+ }
+ }
+ }
+ return OKAY;
+}
+
+#else /* ASL */
+
+static char *
+get_sym_num (char *s, int *outnum)
+{
+ Boolean okay;
+ *outnum = (int) EvalIntExpression (s, Int16, &okay);
+ if (!okay)
+ return NULL;
+ return (s + strlen (s)); /* Any non-NULL value will do here. */
+}
+
+
+#define add_word(word) WAsmCode[CodeLen++]=word
+
+static status
+parse_addr (char *s)
+{
+ int value;
+ Boolean okay;
+ value = (int) EvalIntExpression (s, Int16, &okay);
+ if (!okay)
+ return ERROR;
+ add_word ((ushort) value);
+ return OKAY;
+}
+
+#endif /* from #else of #ifdef AS1750 */
+
+/* From here on, everything is identical between as1750 and ASL. */
+
+static ushort
+get_num_bounded (char *s, int lowlim, int highlim)
+{
+ int num;
+ if (get_sym_num (s, &num) == NULL)
+ return ERROR;
+ if (num < lowlim || num > highlim)
+ return error ("number not in range %d..%d", lowlim, highlim);
+ return (ushort) num;
+}
+
+static ushort
+get_regnum (char *s)
+{
+ ushort regnum;
+ *s = toupper (*s);
+ if (*s != 'R')
+ return error ("expecting register at '%s'", s);
+ ++s;
+ if (!isdigit (*s))
+ return error ("expecting register at '%s'", s);
+ regnum = dtoi (*s);
+ ++s;
+ if (isdigit (*s))
+ {
+ regnum = regnum * 10 + dtoi (*s);
+ if (regnum > 15)
+ return error ("register number out of range");
+ ++s;
+ }
+ return regnum;
+}
+
+
+/**********************************************************************/
+/* Functions to process opcode arguments according to addressing mode */
+
+static int n_args;
+static char *arg[4];
+
+static status
+check_indexreg (void)
+{
+ if (n_args > 2)
+ {
+ ushort rx;
+
+ if ((rx = get_regnum (arg[2])) == ERROR)
+ return ERROR;
+ if (rx == 0)
+ return error ("R0 not an index register");
+#ifdef AS1750
+ objblk[curr_frag].data[objblk[curr_frag].n_used - 2] |= rx;
+#else /* ASL */
+ WAsmCode[0] |= rx;
+#endif
+ }
+ return OKAY;
+}
+
+
+static ushort
+as_r (ushort oc)
+{
+ ushort ra, rb;
+ if (n_args != 2)
+ return error ("incorrect number of operands");
+ if ((ra = get_regnum (arg[0])) == ERROR)
+ return ERROR;
+ if ((rb = get_regnum (arg[1])) == ERROR)
+ return ERROR;
+
+ add_word (oc | (ra << 4) | rb);
+ return 1;
+}
+
+static ushort
+as_mem (ushort oc)
+{
+ ushort ra;
+ if (n_args < 2)
+ return error ("insufficient number of operands");
+ if ((ra = get_regnum (arg[0])) == ERROR)
+ return ERROR;
+ add_word (oc | (ra << 4));
+ if (parse_addr (arg[1]))
+ return ERROR;
+ if (check_indexreg ())
+ return ERROR;
+ return 2;
+}
+
+static ushort
+as_addr (ushort oc) /* LST and LSTI */
+{
+ if (n_args < 1)
+ return error ("insufficient number of operands");
+ add_word (oc);
+ if (parse_addr (arg[0]))
+ return ERROR;
+ n_args++; /* cheat check_indexreg() */
+ arg[2] = arg[1];
+ if (check_indexreg ())
+ return ERROR;
+ return 2;
+}
+
+static ushort
+as_xmem (ushort oc) /* MIL-STD-1750B extended mem. addr. */
+{
+ ushort ra;
+
+ if (n_args < 2)
+ return error ("insufficient number of operands");
+ if ((ra = get_regnum (arg[0])) == ERROR)
+ return ERROR;
+ add_word (oc | (ra << 4));
+ if (parse_addr (arg[1]))
+ return ERROR;
+ if (n_args > 2)
+ {
+ ushort rx;
+ if ((rx = get_regnum (arg[2])) == ERROR)
+ return ERROR;
+#ifdef AS1750
+ objblk[curr_frag].data[objblk[curr_frag].n_used - 2] |= rx;
+#else /* ASL */
+ WAsmCode[0] |= rx;
+#endif
+ }
+ return 2;
+}
+
+static ushort
+as_im_0_15 (ushort oc) /* for STC, LM, TB,SB,RB,TSB */
+{
+ ushort ra;
+ if (n_args < 2)
+ return error ("insufficient number of operands");
+ if ((ra = get_num_bounded (arg[0], 0, 15)) == ERROR)
+ return ERROR;
+ add_word (oc | (ra << 4));
+ if (parse_addr (arg[1]))
+ return ERROR;
+ if (check_indexreg ())
+ return ERROR;
+ return 2;
+}
+
+static ushort
+as_im_1_16 (ushort oc)
+{
+ ushort ra;
+ if (n_args < 2)
+ return error ("insufficient number of operands");
+ if ((ra = get_num_bounded (arg[0], 1, 16)) == ERROR)
+ return ERROR;
+ add_word (oc | ((ra - 1) << 4));
+ if (parse_addr (arg[1]))
+ return ERROR;
+ if (check_indexreg ())
+ return ERROR;
+ return 2;
+}
+
+static ushort
+as_im_ocx (ushort oc)
+{
+ ushort ra;
+ if (n_args != 2)
+ return error ("incorrect number of operands");
+ if ((ra = get_regnum (arg[0])) == ERROR)
+ return ERROR;
+ add_word (oc | (ra << 4)); /* oc has OCX in LSnibble */
+ if (parse_addr (arg[1]))
+ return ERROR;
+ return 2;
+}
+
+static ushort
+as_is (ushort oc)
+{
+ ushort ra, i;
+ if (n_args != 2)
+ return error ("incorrect number of operands");
+ if ((ra = get_regnum (arg[0])) == ERROR)
+ return ERROR;
+ if ((i = get_num_bounded (arg[1], 1, 16)) == ERROR)
+ return ERROR;
+ add_word (oc | (ra << 4) | (i - 1));
+ return 1;
+}
+
+static ushort
+as_icr (ushort oc)
+{
+#ifdef AS1750
+ struct objblock *obj = &objblk[curr_frag];
+ int last = obj->n_used;
+#endif
+ if (n_args != 1)
+ return error ("incorrect number of operands");
+ if (parse_addr (arg[0]))
+ return ERROR;
+#ifdef AS1750
+ /* If symbol relocation, then set the relocation type to Byte_Reloc */
+ if (relblk.n_used > 0)
+ {
+ struct reloc *rel = &relblk.data[relblk.n_used - 1];
+ if (rel->frag_index == curr_frag && rel->obj_index == last)
+ rel->reltype = Byte_Reloc;
+ }
+ obj->data[last] &= 0x00FF;
+ obj->data[last] |= oc;
+#else /* ASL */
+ {
+ const short target = (short) WAsmCode[0];
+ const long curr_pc = (long) EProgCounter () & 0xFFFFL;
+ const long diff = (long) target - curr_pc;
+ if (diff < -128L || diff > 127L)
+ return error
+ ("address distance too large in Instruction Counter Relative operation");
+ WAsmCode[0] = oc | (ushort) (diff & 0xFFL);
+ }
+#endif
+ return 1;
+}
+
+static ushort
+as_b (ushort oc)
+{
+ char r;
+ ushort br, lobyte;
+ if (n_args != 2)
+ return error ("incorrect number of operands");
+ r = toupper (*arg[0]);
+ if (r != 'B' && r != 'R')
+ return error ("expecting base register");
+ if ((br = get_num_bounded (arg[0] + 1, 12, 15)) == ERROR)
+ return ERROR;
+ if ((lobyte = get_num_bounded (arg[1], 0, 255)) == ERROR)
+ return ERROR;
+ add_word (oc | ((br - 12) << 8) | lobyte);
+ return 1;
+}
+
+static ushort
+as_bx (ushort oc)
+{
+ char r;
+ ushort br, rx = 0;
+ if (n_args != 2)
+ return error ("incorrect number of operands");
+ r = toupper (*arg[0]);
+ if ((r != 'B' && r != 'R')
+ || (br = get_num_bounded (arg[0] + 1, 12, 15)) == ERROR)
+ return error ("expecting base register");
+ if ((rx = get_regnum (arg[1])) == ERROR)
+ return ERROR;
+ if (rx == 0)
+ return error ("R0 not an index register");
+ add_word (oc | ((br - 12) << 8) | rx);
+ return 1;
+}
+
+static ushort
+as_r_imm (ushort oc) /* for shifts with immediate shiftcount */
+{
+ ushort rb, n;
+ if (n_args != 2)
+ return error ("incorrect number of operands");
+ if ((rb = get_regnum (arg[0])) == ERROR)
+ return ERROR;
+ if ((n = get_num_bounded (arg[1], 1, 16)) == ERROR)
+ return ERROR;
+ add_word (oc | ((n - 1) << 4) | rb);
+ return 1;
+}
+
+static ushort
+as_imm_r (ushort oc) /* for test/set/reset-bit in reg. */
+{
+ ushort n, rb;
+ if (n_args != 2)
+ return error ("incorrect number of operands");
+ if ((n = get_num_bounded (arg[0], 0, 15)) == ERROR)
+ return ERROR;
+ if ((rb = get_regnum (arg[1])) == ERROR)
+ return ERROR;
+ add_word (oc | (n << 4) | rb);
+ return 1;
+}
+
+static ushort
+as_jump (ushort oc)
+{
+ ushort condcode = 0xFFFF;
+ static const struct
+ {
+ char *name;
+ ushort value;
+ }
+ cond[] =
+ { /* CPZN */
+ { "LT", 0x1 }, /* 0001 */
+ { "LZ", 0x1 }, /* 0001 */
+ { "EQ", 0x2 }, /* 0010 */
+ { "EZ", 0x2 }, /* 0010 */
+ { "LE", 0x3 }, /* 0011 */
+ { "LEZ", 0x3 }, /* 0011 */
+ { "GT", 0x4 }, /* 0100 */
+ { "GTZ", 0x4 }, /* 0100 */
+ { "NE", 0x5 }, /* 0101 */
+ { "NZ", 0x5 }, /* 0101 */
+ { "GE", 0x6 }, /* 0110 */
+ { "GEZ", 0x6 }, /* 0110 */
+ { "ALL", 0x7 }, /* 0111 */
+ { "CY", 0x8 }, /* 1000 */
+ { "CLT", 0x9 }, /* 1001 */
+ { "CEQ", 0xA }, /* 1010 */
+ { "CEZ", 0xA }, /* 1010 */
+ { "CLE", 0xB }, /* 1011 */
+ { "CGT", 0xC }, /* 1100 */
+ { "CNZ", 0xD }, /* 1101 */
+ { "CGE", 0xE }, /* 1110 */
+ { "UC", 0xF } /* 1111 */
+ };
+ if (n_args < 2)
+ return error ("insufficient number of operands");
+ if (isalpha (*arg[0]))
+ {
+ int i;
+ for (i = 0; i < 22; i++)
+ if (!strcasecmp (arg[0], cond[i].name))
+ {
+ condcode = cond[i].value;
+ break;
+ }
+ }
+ if (condcode == 0xFFFF)
+ if ((condcode = get_num_bounded (arg[0], 0, 15)) == ERROR)
+ return ERROR;
+ add_word (oc | (condcode << 4));
+ if (parse_addr (arg[1]))
+ return ERROR;
+ if (check_indexreg ())
+ return ERROR;
+ return 2;
+}
+
+static ushort
+as_s (ushort oc) /* For the moment, BEX only. */
+{
+ ushort lsnibble;
+ if (n_args != 1)
+ return error ("incorrect number of operands");
+ if ((lsnibble = get_num_bounded (arg[0], 0, 15)) == ERROR)
+ return ERROR;
+ add_word (oc | lsnibble);
+ return 1;
+}
+
+static ushort
+as_sr (ushort oc) /* XBR and URS. */
+{
+ ushort hlp;
+ if (n_args != 1)
+ return error ("incorrect number of operands");
+ if ((hlp = get_regnum (arg[0])) == ERROR)
+ return ERROR;
+ add_word (oc | (hlp << 4));
+ return 1;
+}
+
+static ushort
+as_xio (ushort oc)
+{
+ ushort ra;
+ int cmdfld = -1;
+ static const struct
+ {
+ char *mnem;
+ ushort cmd;
+ }
+ xio[] =
+ {
+ { "SMK", 0x2000 },
+ { "CLIR", 0x2001 },
+ { "ENBL", 0x2002 },
+ { "DSBL", 0x2003 },
+ { "RPI", 0x2004 },
+ { "SPI", 0x2005 },
+ { "OD", 0x2008 },
+ { "RNS", 0x200A },
+ { "WSW", 0x200E },
+ { "CO", 0x4000 },
+ { "CLC", 0x4001 },
+ { "MPEN", 0x4003 },
+ { "ESUR", 0x4004 },
+ { "DSUR", 0x4005 },
+ { "DMAE", 0x4006 },
+ { "DMAD", 0x4007 },
+ { "TAS", 0x4008 },
+ { "TAH", 0x4009 },
+ { "OTA", 0x400A },
+ { "GO", 0x400B },
+ { "TBS", 0x400C },
+ { "TBH", 0x400D },
+ { "OTB", 0x400E },
+ { "LMP", 0x5000 },
+ { "WIPR", 0x5100 },
+ { "WOPR", 0x5200 },
+ { "RMP", 0xD000 },
+ { "RIPR", 0xD100 },
+ { "ROPR", 0xD200 },
+ { "RMK", 0xA000 },
+ { "RIC1", 0xA001 },
+ { "RIC2", 0xA002 },
+ { "RPIR", 0xA004 },
+ { "RDOR", 0xA008 },
+ { "RDI", 0xA009 },
+ { "TPIO", 0xA00B },
+ { "RMFS", 0xA00D },
+ { "RSW", 0xA00E },
+ { "RCFR", 0xA00F },
+ { "CI", 0xC000 },
+ { "RCS", 0xC001 },
+ { "ITA", 0xC00A },
+ { "ITB", 0xC00E },
+ { "", 0xFFFF }
+ };
+
+ if (n_args < 2)
+ return error ("incorrect number of operands");
+ if ((ra = get_regnum (arg[0])) == ERROR)
+ return ERROR;
+ add_word (oc | (ra << 4));
+ /* Get the XIO command field. */
+ if (isalpha (*arg[1]))
+ {
+ int i;
+ for (i = 0; xio[i].cmd != 0xFFFF; i++)
+ if (!strcasecmp (arg[1], xio[i].mnem))
+ break;
+ if (xio[i].cmd != 0xFFFF)
+ cmdfld = xio[i].cmd;
+ }
+ if (cmdfld == -1)
+ if (get_sym_num (arg[1], &cmdfld) == NULL)
+ return ERROR;
+ add_word ((ushort) cmdfld);
+ if (check_indexreg ())
+ return ERROR;
+ return 2;
+}
+
+static ushort
+as_none (ushort oc)
+{
+ add_word (oc);
+ return 1;
+}
+
+/* end of argument assembly functions */
+
+/***********************************************************************/
+
+static struct
+ {
+ char *mnemon;
+ ushort opcode;
+ ushort (*as_args) (ushort);
+ } optab[] =
+ {
+ { "AISP", 0xA200, as_is }, /* Sorted by beginning letter. */
+ { "AIM", 0x4A01, as_im_ocx }, /* Within each beginning letter, */
+ { "AR", 0xA100, as_r }, /* sorted by approximate */
+ { "A", 0xA000, as_mem }, /* instruction frequency. */
+ { "ANDM", 0x4A07, as_im_ocx },
+ { "ANDR", 0xE300, as_r },
+ { "AND", 0xE200, as_mem },
+ { "ABS", 0xA400, as_r },
+ { "AB", 0x1000, as_b },
+ { "ANDB", 0x3400, as_b },
+ { "ABX", 0x4040, as_bx },
+ { "ANDX", 0x40E0, as_bx },
+ { "BEZ", 0x7500, as_icr },
+ { "BNZ", 0x7A00, as_icr },
+ { "BGT", 0x7900, as_icr },
+ { "BLE", 0x7800, as_icr },
+ { "BGE", 0x7B00, as_icr },
+ { "BLT", 0x7600, as_icr },
+ { "BR", 0x7400, as_icr },
+ { "BEX", 0x7700, as_s },
+ { "BPT", 0xFFFF, as_none },
+ { "BIF", 0x4F00, as_s },
+ { "CISP", 0xF200, as_is },
+ { "CIM", 0x4A0A, as_im_ocx },
+ { "CR", 0xF100, as_r },
+ { "C", 0xF000, as_mem },
+ { "CISN", 0xF300, as_is },
+ { "CB", 0x3800, as_b },
+ { "CBL", 0xF400, as_mem },
+ { "CBX", 0x40C0, as_bx },
+ { "DLR", 0x8700, as_r },
+ { "DL", 0x8600, as_mem },
+ { "DST", 0x9600, as_mem },
+ { "DSLL", 0x6500, as_r_imm },
+ { "DSRL", 0x6600, as_r_imm },
+ { "DSRA", 0x6700, as_r_imm },
+ { "DSLC", 0x6800, as_r_imm },
+ { "DSLR", 0x6D00, as_r },
+ { "DSAR", 0x6E00, as_r },
+ { "DSCR", 0x6F00, as_r },
+ { "DECM", 0xB300, as_im_1_16 },
+ { "DAR", 0xA700, as_r },
+ { "DA", 0xA600, as_mem },
+ { "DSR", 0xB700, as_r },
+ { "DS", 0xB600, as_mem },
+ { "DMR", 0xC700, as_r },
+ { "DM", 0xC600, as_mem },
+ { "DDR", 0xD700, as_r },
+ { "DD", 0xD600, as_mem },
+ { "DCR", 0xF700, as_r },
+ { "DC", 0xF600, as_mem },
+ { "DLB", 0x0400, as_b },
+ { "DSTB", 0x0C00, as_b },
+ { "DNEG", 0xB500, as_r },
+ { "DABS", 0xA500, as_r },
+ { "DR", 0xD500, as_r },
+ { "D", 0xD400, as_mem },
+ { "DISP", 0xD200, as_is },
+ { "DIM", 0x4A05, as_im_ocx },
+ { "DISN", 0xD300, as_is },
+ { "DVIM", 0x4A06, as_im_ocx },
+ { "DVR", 0xD100, as_r },
+ { "DV", 0xD000, as_mem },
+ { "DLI", 0x8800, as_mem },
+ { "DSTI", 0x9800, as_mem },
+ { "DB", 0x1C00, as_b },
+ { "DBX", 0x4070, as_bx },
+ { "DLBX", 0x4010, as_bx },
+ { "DSTX", 0x4030, as_bx },
+ { "DLE", 0xDF00, as_xmem },
+ { "DSTE", 0xDD00, as_xmem },
+ { "EFL", 0x8A00, as_mem },
+ { "EFST", 0x9A00, as_mem },
+ { "EFCR", 0xFB00, as_r },
+ { "EFC", 0xFA00, as_mem },
+ { "EFAR", 0xAB00, as_r },
+ { "EFA", 0xAA00, as_mem },
+ { "EFSR", 0xBB00, as_r },
+ { "EFS", 0xBA00, as_mem },
+ { "EFMR", 0xCB00, as_r },
+ { "EFM", 0xCA00, as_mem },
+ { "EFDR", 0xDB00, as_r },
+ { "EFD", 0xDA00, as_mem },
+ { "EFLT", 0xEB00, as_r },
+ { "EFIX", 0xEA00, as_r },
+ { "FAR", 0xA900, as_r },
+ { "FA", 0xA800, as_mem },
+ { "FSR", 0xB900, as_r },
+ { "FS", 0xB800, as_mem },
+ { "FMR", 0xC900, as_r },
+ { "FM", 0xC800, as_mem },
+ { "FDR", 0xD900, as_r },
+ { "FD", 0xD800, as_mem },
+ { "FCR", 0xF900, as_r },
+ { "FC", 0xF800, as_mem },
+ { "FABS", 0xAC00, as_r },
+ { "FIX", 0xE800, as_r },
+ { "FLT", 0xE900, as_r },
+ { "FNEG", 0xBC00, as_r },
+ { "FAB", 0x2000, as_b },
+ { "FABX", 0x4080, as_bx },
+ { "FSB", 0x2400, as_b },
+ { "FSBX", 0x4090, as_bx },
+ { "FMB", 0x2800, as_b },
+ { "FMBX", 0x40A0, as_bx },
+ { "FDB", 0x2C00, as_b },
+ { "FDBX", 0x40B0, as_bx },
+ { "FCB", 0x3C00, as_b },
+ { "FCBX", 0x40D0, as_bx },
+ { "INCM", 0xA300, as_im_1_16 },
+ { "JC", 0x7000, as_jump },
+ { "J", 0x7400, as_icr }, /* TBD (GAS) */
+ { "JEZ", 0x7500, as_icr }, /* TBD (GAS) */
+ { "JLE", 0x7800, as_icr }, /* TBD (GAS) */
+ { "JGT", 0x7900, as_icr }, /* TBD (GAS) */
+ { "JNZ", 0x7A00, as_icr }, /* TBD (GAS) */
+ { "JGE", 0x7B00, as_icr }, /* TBD (GAS) */
+ { "JLT", 0x7600, as_icr }, /* TBD (GAS) */
+ { "JCI", 0x7100, as_jump },
+ { "JS", 0x7200, as_mem },
+ { "LISP", 0x8200, as_is },
+ { "LIM", 0x8500, as_mem },
+ { "LR", 0x8100, as_r },
+ { "L", 0x8000, as_mem },
+ { "LISN", 0x8300, as_is },
+ { "LB", 0x0000, as_b },
+ { "LBX", 0x4000, as_bx },
+ { "LSTI", 0x7C00, as_addr },
+ { "LST", 0x7D00, as_addr },
+ { "LI", 0x8400, as_mem },
+ { "LM", 0x8900, as_im_0_15 },
+ { "LUB", 0x8B00, as_mem },
+ { "LLB", 0x8C00, as_mem },
+ { "LUBI", 0x8D00, as_mem },
+ { "LLBI", 0x8E00, as_mem },
+ { "LE", 0xDE00, as_xmem },
+ { "MISP", 0xC200, as_is },
+ { "MSIM", 0x4A04, as_im_ocx },
+ { "MSR", 0xC100, as_r },
+ { "MS", 0xC000, as_mem },
+ { "MISN", 0xC300, as_is },
+ { "MIM", 0x4A03, as_im_ocx },
+ { "MR", 0xC500, as_r },
+ { "M", 0xC400, as_mem },
+ { "MOV", 0x9300, as_r },
+ { "MB", 0x1800, as_b },
+ { "MBX", 0x4060, as_bx },
+ { "NEG", 0xB400, as_r },
+ { "NOP", 0xFF00, as_none },
+ { "NIM", 0x4A0B, as_im_ocx },
+ { "NR", 0xE700, as_r },
+ { "N", 0xE600, as_mem },
+ { "ORIM", 0x4A08, as_im_ocx },
+ { "ORR", 0xE100, as_r },
+ { "OR", 0xE000, as_mem },
+ { "ORB", 0x3000, as_b },
+ { "ORBX", 0x40F0, as_bx },
+ { "PSHM", 0x9F00, as_r },
+ { "POPM", 0x8F00, as_r },
+ { "RBR", 0x5400, as_imm_r },
+ { "RVBR", 0x5C00, as_r },
+ { "RB", 0x5300, as_im_0_15 },
+ { "RBI", 0x5500, as_im_0_15 },
+ { "ST", 0x9000, as_mem },
+ { "STC", 0x9100, as_im_0_15 },
+ { "SISP", 0xB200, as_is },
+ { "SIM", 0x4A02, as_im_ocx },
+ { "SR", 0xB100, as_r },
+ { "S", 0xB000, as_mem },
+ { "SLL", 0x6000, as_r_imm },
+ { "SRL", 0x6100, as_r_imm },
+ { "SRA", 0x6200, as_r_imm },
+ { "SLC", 0x6300, as_r_imm },
+ { "SLR", 0x6A00, as_r },
+ { "SAR", 0x6B00, as_r },
+ { "SCR", 0x6C00, as_r },
+ { "SJS", 0x7E00, as_mem },
+ { "STB", 0x0800, as_b },
+ { "SBR", 0x5100, as_imm_r },
+ { "SB", 0x5000, as_im_0_15 },
+ { "SVBR", 0x5A00, as_r },
+ { "SOJ", 0x7300, as_mem },
+ { "SBB", 0x1400, as_b },
+ { "STBX", 0x4020, as_bx },
+ { "SBBX", 0x4050, as_bx },
+ { "SBI", 0x5200, as_im_0_15 },
+ { "STZ", 0x9100, as_addr },
+ { "STCI", 0x9200, as_im_0_15 },
+ { "STI", 0x9400, as_mem },
+ { "SFBS", 0x9500, as_r },
+ { "SRM", 0x9700, as_mem },
+ { "STM", 0x9900, as_im_0_15 },
+ { "STUB", 0x9B00, as_mem },
+ { "STLB", 0x9C00, as_mem },
+ { "SUBI", 0x9D00, as_mem },
+ { "SLBI", 0x9E00, as_mem },
+ { "STE", 0xDC00, as_xmem },
+ { "TBR", 0x5700, as_imm_r },
+ { "TB", 0x5600, as_im_0_15 },
+ { "TBI", 0x5800, as_im_0_15 },
+ { "TSB", 0x5900, as_im_0_15 },
+ { "TVBR", 0x5E00, as_r },
+ { "URS", 0x7F00, as_sr },
+ { "UAR", 0xAD00, as_r },
+ { "UA", 0xAE00, as_mem },
+ { "USR", 0xBD00, as_r },
+ { "US", 0xBE00, as_mem },
+ { "UCIM", 0xF500, as_im_ocx },
+ { "UCR", 0xFC00, as_r },
+ { "UC", 0xFD00, as_mem },
+ { "VIO", 0x4900, as_mem },
+ { "XORR", 0xE500, as_r },
+ { "XORM", 0x4A09, as_im_ocx },
+ { "XOR", 0xE400, as_mem },
+ { "XWR", 0xED00, as_r },
+ { "XBR", 0xEC00, as_sr },
+ { "XIO", 0x4800, as_xio },
+ { "", 0, as_none } /* end-of-array marker */
+};
+
+/* Offset table with indexes into optab: indexed by starting letter
+ (A => 0, B => 1, ..., Z => 25), returns the starting index
+ and number of entries for that letter in optab[].
+ start_index is -1 if no entries for that starting letter in optab[]. */
+
+static struct
+ {
+ int start_index;
+ int n_entries;
+ }
+ofstab[26];
+
+/* Initialize ofstab[]. This must be called before as1750() can be used. */
+void
+init_as1750 ()
+{
+ int optab_ndx, ofstab_ndx = 1;
+ char c;
+
+ ofstab[0].start_index = 0;
+ ofstab[0].n_entries = 1;
+ for (optab_ndx = 1; (c = *optab[optab_ndx].mnemon) != '\0'; optab_ndx++)
+ {
+ if (c != *optab[optab_ndx - 1].mnemon)
+ {
+ while (ofstab_ndx != c - 'A')
+ ofstab[ofstab_ndx++].start_index = -1;
+ ofstab[ofstab_ndx].start_index = optab_ndx;
+ ofstab[ofstab_ndx++].n_entries = 1;
+ }
+ else
+ ofstab[ofstab_ndx - 1].n_entries++;
+ }
+}
+
+
+/************************** HERE'S THE BEEF: ****************************/
+
+ushort
+as1750 (char *operation, int n_operands, char *operand[])
+{
+ int i, optab_ndx, firstletter;
+ bool found = FALSE;
+
+ if (n_operands < 0 || n_operands > 3 || *operation < 'A' || *operation > 'X')
+ return NO_OPCODE;
+ n_args = n_operands;
+ for (i = 0; i < n_args; i++)
+ arg[i] = operand[i];
+ firstletter = (int) (*operation - 'A');
+ if ((optab_ndx = ofstab[firstletter].start_index) < 0)
+ return NO_OPCODE;
+ for (i = 0; i < ofstab[firstletter].n_entries; i++, optab_ndx++)
+ if (!strcmp (operation + 1, optab[optab_ndx].mnemon + 1))
+ {
+ found = TRUE;
+ break;
+ }
+ if (!found)
+ return NO_OPCODE;
+ return (*optab[optab_ndx].as_args) (optab[optab_ndx].opcode);
+}
+
diff --git a/as1750.h b/as1750.h
new file mode 100644
index 0000000..2f9adf3
--- /dev/null
+++ b/as1750.h
@@ -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
diff --git a/asl.1 b/asl.1
new file mode 100644
index 0000000..557312a
--- /dev/null
+++ b/asl.1
@@ -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...
diff --git a/asl.def b/asl.def
new file mode 100644
index 0000000..827702b
--- /dev/null
+++ b/asl.def
@@ -0,0 +1,2 @@
+STACKSIZE 40960
+
diff --git a/asmallg.c b/asmallg.c
new file mode 100644
index 0000000..abe52a1
--- /dev/null
+++ b/asmallg.c
@@ -0,0 +1,1341 @@
+/* codeallg.c */
+/*****************************************************************************/
+/* AS-Portierung */
+/* */
+/* von allen Codegeneratoren benutzte Pseudobefehle */
+/* */
+/* Historie: 10. 5.1996 Grundsteinlegung */
+/* 24. 6.1998 CODEPAGE-Kommando */
+/* 17. 7.1998 CHARSET ohne Argumente */
+/* 17. 8.1998 BookKeeping-Aufruf bei ALIGN */
+/* 18. 8.1998 RADIX-Kommando */
+/* 2. 1.1999 Standard-ChkPC-Routine */
+/* 9. 1.1999 BINCLUDE gefixt... */
+/* 30. 5.1999 OUTRADIX-Kommando */
+/* 12. 7.1999 EXTERN-Kommando */
+/* */
+/*****************************************************************************/
+
+#include "stdinc.h"
+#include <string.h>
+
+
+#include "nls.h"
+#include "strutil.h"
+#include "stringlists.h"
+#include "bpemu.h"
+#include "cmdarg.h"
+#include "chunks.h"
+#include "asmdef.h"
+#include "asmsub.h"
+#include "asmpars.h"
+#include "asmmac.h"
+#include "asmcode.h"
+#include "asmitree.h"
+#include "codepseudo.h"
+
+/*--------------------------------------------------------------------------*/
+
+static char *PseudoStrs[3]={Nil,Nil,Nil};
+
+static PInstTable PseudoTable=Nil,ONOFFTable;
+
+/*--------------------------------------------------------------------------*/
+
+ static Boolean DefChkPC(LargeWord Addr)
+BEGIN
+ if (((1 << ActPC) & ValidSegs) == 0) return 0;
+ else return (Addr <= SegLimits[ActPC]);
+END
+
+ void SetCPU(CPUVar NewCPU, Boolean NotPrev)
+BEGIN
+ LongInt HCPU;
+ char *z,*dest;
+ Boolean ECPU;
+ char s[11];
+ PCPUDef Lauf;
+
+ Lauf=FirstCPUDef;
+ while ((Lauf!=Nil) AND (Lauf->Number!=NewCPU)) Lauf=Lauf->Next;
+ if (Lauf==Nil) return;
+
+ strmaxcpy(MomCPUIdent,Lauf->Name,11);
+ MomCPU=Lauf->Orig;
+ MomVirtCPU=Lauf->Number;
+ strmaxcpy(s,MomCPUIdent,11);
+ for (z=dest=s; *z!='\0'; z++)
+ if (((*z>='0') AND (*z<='9')) OR ((*z>='A') AND (*z<='F')))
+ *(dest++)=(*z);
+ *dest='\0';
+ for (z=s; *z!='\0'; z++)
+ if ((*z>='0') AND (*z<='9')) break;
+ if (*z!='\0') strcpy(s,z);
+ strprep(s,"$");
+ HCPU=ConstLongInt(s,&ECPU);
+ if (ParamCount!=0)
+ BEGIN
+ EnterIntSymbol(MomCPUName,HCPU,SegNone,True);
+ EnterStringSymbol(MomCPUIdentName,MomCPUIdent,True);
+ END
+
+ InternSymbol=Default_InternSymbol;
+ ChkPC = DefChkPC;
+ if (NOT NotPrev) SwitchFrom();
+ Lauf->SwitchProc();
+
+ DontPrint=True;
+END
+
+ Boolean SetNCPU(char *Name, Boolean NoPrev)
+BEGIN
+ PCPUDef Lauf;
+
+ Lauf = FirstCPUDef;
+ while ((Lauf != Nil) AND (strcmp(Name, Lauf->Name) != 0))
+ Lauf = Lauf->Next;
+ if (Lauf == Nil) WrXError(1430, Name);
+ else SetCPU(Lauf->Number, NoPrev);
+ return (Lauf != Nil);
+END
+
+ char *IntLine(LongInt Inp)
+BEGIN
+ static String s;
+
+ switch (ConstMode)
+ BEGIN
+ case ConstModeIntel:
+ sprintf(s,"%sH",HexString(Inp,0));
+ if (*s>'9') strmaxprep(s,"0",255);
+ break;
+ case ConstModeMoto:
+ sprintf(s,"$%s",HexString(Inp,0));
+ break;
+ case ConstModeC:
+ sprintf(s,"0x%s",HexString(Inp,0));
+ break;
+ END
+
+ return s;
+END
+
+
+ static void CodeSECTION(Word Index)
+BEGIN
+ PSaveSection Neu;
+
+ if (ArgCnt!=1) WrError(1110);
+ else if (ExpandSymbol(ArgStr[1]))
+ if (NOT ChkSymbName(ArgStr[1])) WrXError(1020,ArgStr[1]);
+ else if ((PassNo==1) AND (GetSectionHandle(ArgStr[1],False,MomSectionHandle)!=-2)) WrError(1483);
+ else
+ BEGIN
+ Neu=(PSaveSection) malloc(sizeof(TSaveSection));
+ Neu->Next=SectionStack;
+ Neu->Handle=MomSectionHandle;
+ Neu->LocSyms=Nil; Neu->GlobSyms=Nil; Neu->ExportSyms=Nil;
+ SetMomSection(GetSectionHandle(ArgStr[1],True,MomSectionHandle));
+ SectionStack=Neu;
+ END
+END
+
+
+ static void CodeENDSECTION_ChkEmptList(PForwardSymbol *Root)
+BEGIN
+ PForwardSymbol Tmp;
+
+ while (*Root!=Nil)
+ BEGIN
+ WrXError(1488,(*Root)->Name);
+ free((*Root)->Name);
+ Tmp=(*Root); *Root=Tmp->Next; free(Tmp);
+ END
+END
+
+ static void CodeENDSECTION(Word Index)
+BEGIN
+ PSaveSection Tmp;
+
+ if (ArgCnt>1) WrError(1110);
+ else if (SectionStack==Nil) WrError(1487);
+ else if ((ArgCnt==0) OR (ExpandSymbol(ArgStr[1])))
+ if ((ArgCnt==1) AND (GetSectionHandle(ArgStr[1],False,SectionStack->Handle)!=MomSectionHandle)) WrError(1486);
+ else
+ BEGIN
+ Tmp=SectionStack; SectionStack=Tmp->Next;
+ CodeENDSECTION_ChkEmptList(&(Tmp->LocSyms));
+ CodeENDSECTION_ChkEmptList(&(Tmp->GlobSyms));
+ CodeENDSECTION_ChkEmptList(&(Tmp->ExportSyms));
+ TossRegDefs(MomSectionHandle);
+ if (ArgCnt==0)
+ sprintf(ListLine,"[%s]",GetSectionName(MomSectionHandle));
+ SetMomSection(Tmp->Handle);
+ free(Tmp);
+ END
+END
+
+
+ static void CodeCPU(Word Index)
+BEGIN
+ if (ArgCnt!=1) WrError(1110);
+ else if (*AttrPart!='\0') WrError(1100);
+ else
+ BEGIN
+ NLS_UpString(ArgStr[1]);
+ if (SetNCPU(ArgStr[1], False)) ActPC = SegCode;
+ END
+END
+
+
+ static void CodeSETEQU(Word Index)
+BEGIN
+ TempResult t;
+ Boolean MayChange;
+ Integer DestSeg;
+
+ FirstPassUnknown=False;
+ MayChange=((NOT Memo("EQU")) AND (NOT Memo("=")));
+ if (*AttrPart!='\0') WrError(1100);
+ else if ((ArgCnt<1) OR (ArgCnt>2)) WrError(1110);
+ else
+ BEGIN
+ EvalExpression(ArgStr[1],&t);
+ if (NOT FirstPassUnknown)
+ BEGIN
+ if (ArgCnt==1) DestSeg=SegNone;
+ else
+ BEGIN
+ NLS_UpString(ArgStr[2]);
+ if (strcmp(ArgStr[2],"MOMSEGMENT")==0) DestSeg=ActPC;
+ else if (*ArgStr[2]=='\0') DestSeg=SegNone;
+ else
+ BEGIN
+ DestSeg=0;
+ while ((DestSeg<=PCMax) AND
+ (strcmp(ArgStr[2],SegNames[DestSeg])!=0))
+ DestSeg++;
+ END
+ END
+ if (DestSeg>PCMax) WrXError(1961,ArgStr[2]);
+ else
+ BEGIN
+ SetListLineVal(&t);
+ PushLocHandle(-1);
+ switch (t.Typ)
+ BEGIN
+ case TempInt : EnterIntSymbol (LabPart,t.Contents.Int,DestSeg,MayChange); break;
+ case TempFloat : EnterFloatSymbol (LabPart,t.Contents.Float,MayChange); break;
+ case TempString: EnterStringSymbol(LabPart,t.Contents.Ascii,MayChange); break;
+ case TempNone : break;
+ END
+ PopLocHandle();
+ END
+ END
+ END
+END
+
+
+ static void CodeORG(Word Index)
+BEGIN
+ LargeInt HVal;
+ Boolean ValOK;
+
+ FirstPassUnknown=False;
+ if (*AttrPart!='\0') WrError(1100);
+ else if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+#ifndef HAS64
+ HVal=EvalIntExpression(ArgStr[1],UInt32,&ValOK);
+#else
+ HVal=EvalIntExpression(ArgStr[1],Int64,&ValOK);
+#endif
+ if (FirstPassUnknown) WrError(1820);
+ if ((ValOK) AND (NOT FirstPassUnknown))
+ BEGIN
+ PCs[ActPC]=HVal; DontPrint=True;
+ END
+ END
+END
+
+
+ static void CodeSHARED_BuildComment(char *c)
+BEGIN
+ switch (ShareMode)
+ BEGIN
+ case 1: sprintf(c,"(* %s *)",CommPart); break;
+ case 2: sprintf(c,"/* %s */",CommPart); break;
+ case 3: sprintf(c,"; %s",CommPart); break;
+ END
+END
+
+ static void CodeSHARED(Word Index)
+BEGIN
+ int z;
+ Boolean ValOK;
+ LargeInt HVal;
+ Double FVal;
+ String s,c;
+
+ if (ShareMode==0) WrError(30);
+ else if ((ArgCnt==0) AND (*CommPart!='\0'))
+ BEGIN
+ CodeSHARED_BuildComment(c);
+ errno=0; fprintf(ShareFile,"%s\n",c); ChkIO(10004);
+ END
+ else
+ for (z=1; z<=ArgCnt; z++)
+ BEGIN
+ if (IsSymbolString(ArgStr[z]))
+ BEGIN
+ ValOK=GetStringSymbol(ArgStr[z],s);
+ if (ShareMode==1)
+ BEGIN
+ strmaxprep(s,"\'",255); strmaxcat(s,"\'",255);
+ END
+ else
+ BEGIN
+ strmaxprep(s,"\"",255); strmaxcat(s,"\"",255);
+ END
+ END
+ else if (IsSymbolFloat(ArgStr[z]))
+ BEGIN
+ ValOK=GetFloatSymbol(ArgStr[z],&FVal);
+ sprintf(s,"%0.17g",FVal);
+ END
+ else
+ BEGIN
+ ValOK=GetIntSymbol(ArgStr[z],&HVal);
+ switch (ShareMode)
+ BEGIN
+ case 1: sprintf(s,"$%s",HexString(HVal,0)); break;
+ case 2: sprintf(s,"0x%s",HexString(HVal,0)); break;
+ case 3: strmaxcpy(s,IntLine(HVal),255); break;
+ END
+ END
+ if (ValOK)
+ BEGIN
+ if ((z==1) AND (*CommPart!='\0'))
+ BEGIN
+ CodeSHARED_BuildComment(c); strmaxprep(c," ",255);
+ END
+ else *c='\0';
+ errno=0;
+ switch (ShareMode)
+ BEGIN
+ case 1:
+ fprintf(ShareFile,"%s = %s;%s\n",ArgStr[z],s,c); break;
+ case 2:
+ fprintf(ShareFile,"#define %s %s%s\n",ArgStr[z],s,c); break;
+ case 3:
+ strmaxprep(s,IsSymbolChangeable(ArgStr[z])?"set ":"equ ",255);
+ fprintf(ShareFile,"%s %s%s\n",ArgStr[z],s,c); break;
+ END
+ ChkIO(10004);
+ END
+ else if (PassNo==1)
+ BEGIN
+ Repass=True;
+ if ((MsgIfRepass) AND (PassNo>=PassNoForMessage)) WrXError(170,ArgStr[z]);
+ END
+ END
+END
+
+
+ static void CodePAGE(Word Index)
+BEGIN
+ Integer LVal,WVal;
+ Boolean ValOK;
+
+ if ((ArgCnt!=1) AND (ArgCnt!=2)) WrError(1110);
+ else if (*AttrPart!='\0') WrError(1100);
+ else
+ BEGIN
+ LVal=EvalIntExpression(ArgStr[1],UInt8,&ValOK);
+ if (ValOK)
+ BEGIN
+ if ((LVal<5) AND (LVal!=0)) LVal=5;
+ if (ArgCnt==1)
+ BEGIN
+ WVal=0; ValOK=True;
+ END
+ else WVal=EvalIntExpression(ArgStr[2],UInt8,&ValOK);
+ if (ValOK)
+ BEGIN
+ if ((WVal<5) AND (WVal!=0)) WVal=5;
+ PageLength=LVal; PageWidth=WVal;
+ END
+ END
+ END
+END
+
+
+ static void CodeNEWPAGE(Word Index)
+BEGIN
+ ShortInt HVal8;
+ Boolean ValOK;
+
+ if (ArgCnt>1) WrError(1110);
+ else if (*AttrPart!='\0') WrError(1100);
+ else
+ BEGIN
+ if (ArgCnt==0)
+ BEGIN
+ HVal8=0; ValOK=True;
+ END
+ else HVal8=EvalIntExpression(ArgStr[1],Int8,&ValOK);
+ if ((ValOK) OR (ArgCnt==0))
+ BEGIN
+ if (HVal8>ChapMax) HVal8=ChapMax;
+ else if (HVal8<0) HVal8=0;
+ NewPage(HVal8,True);
+ END
+ END
+END
+
+
+ static void CodeString(Word Index)
+BEGIN
+ String tmp;
+ Boolean OK;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ EvalStringExpression(ArgStr[1],&OK,tmp);
+ if (NOT OK) WrError(1970); else strmaxcpy(PseudoStrs[Index],tmp,255);
+ END
+END
+
+
+ static void CodePHASE(Word Index)
+BEGIN
+ Boolean OK;
+ LongInt HVal;
+
+ if (ArgCnt!=1) WrError(1110);
+ else if (ActPC==StructSeg) WrError(1553);
+ else
+ BEGIN
+ HVal=EvalIntExpression(ArgStr[1],Int32,&OK);
+ if (OK) Phases[ActPC]=HVal-ProgCounter();
+ END
+END
+
+
+ static void CodeDEPHASE(Word Index)
+BEGIN
+ if (ArgCnt!=0) WrError(1110);
+ else if (ActPC==StructSeg) WrError(1553);
+ else Phases[ActPC]=0;
+END
+
+
+ static void CodeWARNING(Word Index)
+BEGIN
+ String mess;
+ Boolean OK;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ EvalStringExpression(ArgStr[1],&OK,mess);
+ if (NOT OK) WrError(1970);
+ else WrErrorString(mess,"",True,False);
+ END
+END
+
+
+ static void CodeMESSAGE(Word Index)
+BEGIN
+ String mess;
+ Boolean OK;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ EvalStringExpression(ArgStr[1],&OK,mess);
+ if (NOT OK) WrError(1970);
+ printf("%s%s\n",mess,ClrEol);
+ if (strcmp(LstName,"/dev/null")!=0) WrLstLine(mess);
+ END
+END
+
+
+ static void CodeERROR(Word Index)
+BEGIN
+ String mess;
+ Boolean OK;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ EvalStringExpression(ArgStr[1],&OK,mess);
+ if (NOT OK) WrError(1970);
+ else WrErrorString(mess,"",False,False);
+ END
+END
+
+
+ static void CodeFATAL(Word Index)
+BEGIN
+ String mess;
+ Boolean OK;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ EvalStringExpression(ArgStr[1],&OK,mess);
+ if (NOT OK) WrError(1970);
+ else WrErrorString(mess,"",False,True);
+ END
+END
+
+ static void CodeCHARSET(Word Index)
+BEGIN
+ TempResult t;
+ FILE *f;
+ unsigned char tfield[256];
+ LongWord Start,l,TStart,Stop,z;
+ Boolean OK;
+
+ if (ArgCnt>3) WrError(1110);
+ else if (ArgCnt==0)
+ BEGIN
+ for (z=0; z<256; z++) CharTransTable[z]=z;
+ END
+ else
+ BEGIN
+ FirstPassUnknown=False; EvalExpression(ArgStr[1],&t);
+ switch (t.Typ)
+ BEGIN
+ case TempInt:
+ if (FirstPassUnknown) t.Contents.Int&=255;
+ if (ChkRange(t.Contents.Int,0,255))
+ if (ArgCnt<2) WrError(1110);
+ else
+ BEGIN
+ Start=t.Contents.Int;
+ FirstPassUnknown=False; EvalExpression(ArgStr[2],&t);
+ switch (t.Typ)
+ BEGIN
+ case TempInt: /* Übersetzungsbereich als Character-Angabe */
+ if (FirstPassUnknown) t.Contents.Int&=255;
+ if (ArgCnt==2)
+ BEGIN
+ Stop=Start; TStart=t.Contents.Int;
+ OK=ChkRange(TStart,0,255);
+ END
+ else
+ BEGIN
+ Stop=t.Contents.Int; OK=ChkRange(Stop,Start,255);
+ if (OK) TStart=EvalIntExpression(ArgStr[3],UInt8,&OK);
+ else TStart=0;
+ END
+ if (OK)
+ for (z=Start; z<=Stop; z++) CharTransTable[z]=TStart+(z-Start);
+ break;
+ case TempString:
+ l=strlen(t.Contents.Ascii); /* Übersetzungsstring ab Start */
+ if (Start+l>256) WrError(1320);
+ else
+ for (z=0; z<l; z++)
+ CharTransTable[Start+z]=t.Contents.Ascii[z];
+ break;
+ case TempFloat:
+ WrError(1135);
+ break;
+ default:
+ break;
+ END
+ END
+ break;
+ case TempString:
+ if (ArgCnt!=1) WrError(1110); /* Tabelle von Datei lesen */
+ else
+ BEGIN
+ f=fopen(t.Contents.Ascii,OPENRDMODE);
+ if (f==Nil) ChkIO(10001);
+ if (fread(tfield,sizeof(char),256,f)!=256) ChkIO(10003);
+ fclose(f); memcpy(CharTransTable,tfield,sizeof(char)*256);
+ END
+ break;
+ case TempFloat:
+ WrError(1135);
+ break;
+ default:
+ break;
+ END
+ END
+END
+
+ static void CodePRSET(Word Index)
+BEGIN
+ int z,z2;
+
+ for (z=0; z<16; z++)
+ BEGIN
+ for (z2=0; z2<16; z2++) printf(" %02x",CharTransTable[z*16+z2]);
+ printf(" ");
+ for (z2=0; z2<16; z2++) printf("%c",CharTransTable[z*16+z2]>' ' ? CharTransTable[z*16+z2] : '.');
+ putchar('\n');
+ END
+END
+
+ static void CodeCODEPAGE(Word Index)
+BEGIN
+ PTransTable Prev,Run,New,Source;
+ int erg=0;
+
+ if ((ArgCnt!=1) AND (ArgCnt!=2)) WrError(1110);
+ else if (NOT ChkSymbName(ArgStr[1])) WrXError(1020,ArgStr[1]);
+ else
+ BEGIN
+ if (NOT CaseSensitive)
+ BEGIN
+ UpString(ArgStr[1]);
+ if (ArgCnt==2) UpString(ArgStr[2]);
+ END
+
+ if (ArgCnt==1) Source=CurrTransTable;
+ else
+ for (Source=TransTables; Source!=Nil; Source=Source->Next)
+ if (strcmp(Source->Name,ArgStr[2])==0) break;
+
+ if (Source==Nil) WrXError(1610,ArgStr[2]);
+ else
+ BEGIN
+ for (Prev=Nil,Run=TransTables; Run!=Nil; Prev=Run,Run=Run->Next)
+ if ((erg=strcmp(ArgStr[1],Run->Name))<=0) break;
+
+ if ((Run==Nil) OR (erg<0))
+ BEGIN
+ New=(PTransTable) malloc(sizeof(TTransTable));
+ New->Next=Run;
+ New->Name=strdup(ArgStr[1]);
+ New->Table=(unsigned char *) malloc(256*sizeof(char));
+ memcpy(New->Table,Source->Table,256*sizeof(char));
+ if (Prev==Nil) TransTables=New; else Prev->Next=New;
+ CurrTransTable=New;
+ END
+ else CurrTransTable=Run;
+ END
+ END
+END
+
+
+ static void CodeFUNCTION(Word Index)
+BEGIN
+ String FName;
+ Boolean OK;
+ int z;
+
+ if (ArgCnt<2) WrError(1110);
+ else
+ BEGIN
+ OK=True; z=1;
+ do
+ BEGIN
+ OK=(OK AND ChkMacSymbName(ArgStr[z]));
+ if (NOT OK) WrXError(1020,ArgStr[z]);
+ z++;
+ END
+ while ((z<ArgCnt) AND (OK));
+ if (OK)
+ BEGIN
+ strmaxcpy(FName,ArgStr[ArgCnt],255);
+ for (z=1; z<ArgCnt; z++)
+ CompressLine(ArgStr[z],z,FName);
+ EnterFunction(LabPart,FName,ArgCnt-1);
+ END
+ END
+END
+
+
+ static void CodeSAVE(Word Index)
+BEGIN
+ PSaveState Neu;
+
+ if (ArgCnt!=0) WrError(1110);
+ else
+ BEGIN
+ Neu=(PSaveState) malloc(sizeof(TSaveState));
+ Neu->Next=FirstSaveState;
+ Neu->SaveCPU=MomCPU;
+ Neu->SavePC=ActPC;
+ Neu->SaveListOn=ListOn;
+ Neu->SaveLstMacroEx=LstMacroEx;
+ Neu->SaveTransTable=CurrTransTable;
+ FirstSaveState=Neu;
+ END
+END
+
+
+ static void CodeRESTORE(Word Index)
+BEGIN
+ PSaveState Old;
+
+ if (ArgCnt!=0) WrError(1110);
+ else if (FirstSaveState==Nil) WrError(1450);
+ else
+ BEGIN
+ Old=FirstSaveState; FirstSaveState=Old->Next;
+ if (Old->SavePC!=ActPC)
+ BEGIN
+ ActPC=Old->SavePC; DontPrint=True;
+ END
+ if (Old->SaveCPU!=MomCPU) SetCPU(Old->SaveCPU,False);
+ EnterIntSymbol(ListOnName,ListOn=Old->SaveListOn,0,True);
+ SetFlag(&LstMacroEx,LstMacroExName,Old->SaveLstMacroEx);
+ CurrTransTable=Old->SaveTransTable;
+ free(Old);
+ END
+END
+
+
+ static void CodeSEGMENT(Word Index)
+BEGIN
+ Byte SegZ;
+ Word Mask;
+ Boolean Found;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ Found=False; NLS_UpString(ArgStr[1]);
+ for (SegZ=1,Mask=2; SegZ<=PCMax; SegZ++,Mask<<=1)
+ if (((ValidSegs&Mask)!=0) AND (strcmp(ArgStr[1],SegNames[SegZ])==0))
+ BEGIN
+ Found=True;
+ if (ActPC!=SegZ)
+ BEGIN
+ ActPC=SegZ;
+ if (NOT PCsUsed[ActPC]) PCs[ActPC]=SegInits[ActPC];
+ PCsUsed[ActPC]=True;
+ DontPrint=True;
+ END
+ END
+ if (NOT Found) WrXError(1961,ArgStr[1]);
+ END
+END
+
+
+ static void CodeLABEL(Word Index)
+BEGIN
+ LongInt Erg;
+ Boolean OK;
+
+ FirstPassUnknown=False;
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ Erg=EvalIntExpression(ArgStr[1],Int32,&OK);
+ if ((OK) AND (NOT FirstPassUnknown))
+ BEGIN
+ PushLocHandle(-1);
+ EnterIntSymbol(LabPart,Erg,SegCode,False);
+ sprintf(ListLine,"=%s",IntLine(Erg));
+ PopLocHandle();
+ END
+ END
+END
+
+
+ static void CodeREAD(Word Index)
+BEGIN
+ String Exp;
+ TempResult Erg;
+ Boolean OK;
+ LongInt SaveLocHandle;
+
+ if ((ArgCnt!=1) AND (ArgCnt!=2)) WrError(1110);
+ else
+ BEGIN
+ if (ArgCnt==2) EvalStringExpression(ArgStr[1],&OK,Exp);
+ else
+ BEGIN
+ sprintf(Exp,"Read %s ? ",ArgStr[1]); OK=True;
+ END
+ if (OK)
+ BEGIN
+ setbuf(stdout,Nil); printf("%s",Exp);
+ fgets(Exp,255,stdin); UpString(Exp);
+ FirstPassUnknown=False;
+ EvalExpression(Exp,&Erg);
+ if (OK)
+ BEGIN
+ SetListLineVal(&Erg);
+ SaveLocHandle=MomLocHandle; MomLocHandle=(-1);
+ if (FirstPassUnknown) WrError(1820);
+ else switch (Erg.Typ)
+ BEGIN
+ case TempInt : EnterIntSymbol(ArgStr[ArgCnt],Erg.Contents.Int,SegNone,True); break;
+ case TempFloat : EnterFloatSymbol(ArgStr[ArgCnt],Erg.Contents.Float,True); break;
+ case TempString: EnterStringSymbol(ArgStr[ArgCnt],Erg.Contents.Ascii,True); break;
+ case TempNone : break;
+ END
+ MomLocHandle=SaveLocHandle;
+ END
+ END
+ END
+END
+
+ static void CodeRADIX(Word Index)
+BEGIN
+ Boolean OK;
+ LargeWord tmp;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ tmp=ConstLongInt(ArgStr[1],&OK);
+ if (NOT OK) WrError(1135);
+ else if (ChkRange(tmp,2,36))
+ BEGIN
+ if (Index == 1) OutRadixBase = tmp;
+ else RadixBase = tmp;
+ END
+ END
+END
+
+ static void CodeALIGN(Word Index)
+BEGIN
+ Word Dummy;
+ Boolean OK;
+ LongInt NewPC;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ FirstPassUnknown=False;
+ Dummy=EvalIntExpression(ArgStr[1],Int16,&OK);
+ if (OK)
+ if (FirstPassUnknown) WrError(1820);
+ else
+ BEGIN
+ NewPC=ProgCounter()+Dummy-1;
+ NewPC-=NewPC%Dummy;
+ CodeLen=NewPC-ProgCounter();
+ DontPrint=(CodeLen!=0);
+ if (DontPrint) BookKeeping();
+ END
+ END
+END
+
+
+ static void CodeENUM(Word Index)
+BEGIN
+ int z;
+ char *p=Nil;
+ Boolean OK;
+ LongInt Counter,First=0,Last=0;
+ String SymPart;
+
+ Counter=0;
+ if (ArgCnt==0) WrError(1110);
+ else
+ for (z=1; z<=ArgCnt; z++)
+ BEGIN
+ p=QuotPos(ArgStr[z],'=');
+ if (p!=Nil)
+ BEGIN
+ strmaxcpy(SymPart,p+1,255);
+ FirstPassUnknown=False;
+ Counter=EvalIntExpression(SymPart,Int32,&OK);
+ if (NOT OK) return;
+ if (FirstPassUnknown)
+ BEGIN
+ WrXError(1820,SymPart); return;
+ END
+ *p='\0';
+ END
+ EnterIntSymbol(ArgStr[z],Counter,SegNone,False);
+ if (z==1) First=Counter;
+ else if (z==ArgCnt) Last=Counter;
+ Counter++;
+ END
+ sprintf(ListLine,"=%s",IntLine(First));
+ if (ArgCnt!=1)
+ BEGIN
+ strmaxcat(ListLine,"..",255);
+ strmaxcat(ListLine,IntLine(Last),255);
+ END
+END
+
+
+ static void CodeEND(Word Index)
+BEGIN
+ LongInt HVal;
+ Boolean OK;
+
+ if (ArgCnt>1) WrError(1110);
+ else
+ BEGIN
+ if (ArgCnt==1)
+ BEGIN
+ FirstPassUnknown=False;
+ HVal=EvalIntExpression(ArgStr[1],Int32,&OK);
+ if ((OK) AND (NOT FirstPassUnknown))
+ BEGIN
+ ChkSpace(SegCode);
+ StartAdr=HVal;
+ StartAdrPresent=True;
+ END
+ END
+ ENDOccured=True;
+ END
+END
+
+
+ static void CodeLISTING(Word Index)
+BEGIN
+ Byte Value=0xff;
+ Boolean OK;
+
+ if (ArgCnt!=1) WrError(1110);
+ else if (*AttrPart!='\0') WrError(1100);
+ else
+ BEGIN
+ OK=True; NLS_UpString(ArgStr[1]);
+ if (strcmp(ArgStr[1],"OFF")==0) Value=0;
+ else if (strcmp(ArgStr[1],"ON")==0) Value=1;
+ else if (strcmp(ArgStr[1],"NOSKIPPED")==0) Value=2;
+ else if (strcmp(ArgStr[1],"PURECODE")==0) Value=3;
+ else OK=False;
+ if (NOT OK) WrError(1520);
+ else EnterIntSymbol(ListOnName,ListOn=Value,0,True);
+ END
+END
+
+ static void CodeBINCLUDE(Word Index)
+BEGIN
+ FILE *F;
+ LongInt Len=(-1);
+ LongWord Ofs=0,Curr,Rest,FSize;
+ Word RLen;
+ Boolean OK,SaveTurnWords;
+ LargeWord OldPC;
+ String Name;
+
+ if ((ArgCnt<1) OR (ArgCnt>3)) WrError(1110);
+ else if (ActPC==StructSeg) WrError(1940);
+ else
+ BEGIN
+ if (ArgCnt==1) OK=True;
+ else
+ BEGIN
+ FirstPassUnknown=False;
+ Ofs=EvalIntExpression(ArgStr[2],Int32,&OK);
+ if (FirstPassUnknown)
+ BEGIN
+ WrError(1820); OK=False;
+ END
+ if (OK)
+ if (ArgCnt==2) Len=(-1);
+ else
+ BEGIN
+ Len=EvalIntExpression(ArgStr[3],Int32,&OK);
+ if (FirstPassUnknown)
+ BEGIN
+ WrError(1820); OK=False;
+ END
+ END
+ END
+ if (OK)
+ BEGIN
+ strmaxcpy(Name,ArgStr[1],255);
+ if (*Name=='"') strcpy(Name,Name+1);
+ if (Name[strlen(Name)-1]=='"') Name[strlen(Name)-1]='\0';
+ strmaxcpy(ArgStr[1],Name,255);
+ strmaxcpy(Name,FExpand(FSearch(Name,IncludeList)),255);
+ if (Name[strlen(Name)-1]=='/') strmaxcat(Name,ArgStr[1],255);
+ F=fopen(Name,OPENRDMODE); ChkIO(10001);
+ FSize=FileSize(F); ChkIO(10003);
+ if (Len==-1)
+ if ((Len=FSize-Ofs)<0)
+ BEGIN
+ fclose(F); WrError(1600); return;
+ END
+ if (NOT ChkPC(PCs[ActPC]+Len-1)) WrError(1925);
+ else
+ BEGIN
+ fseek(F,Ofs,SEEK_SET); ChkIO(10003);
+ Rest=Len; SaveTurnWords=TurnWords; TurnWords=False;
+ OldPC = ProgCounter();
+ do
+ BEGIN
+ if (Rest<MaxCodeLen) Curr=Rest; else Curr=MaxCodeLen;
+ RLen=fread(BAsmCode,1,Curr,F); ChkIO(10003);
+ CodeLen=RLen;
+ WriteBytes();
+ PCs[ActPC]+=CodeLen;
+ Rest-=RLen;
+ END
+ while ((Rest!=0) AND (RLen==Curr));
+ if (Rest!=0) WrError(1600);
+ TurnWords=SaveTurnWords;
+ DontPrint=True; CodeLen=ProgCounter()-OldPC;
+ PCs[ActPC]=OldPC;
+ END
+ fclose(F);
+ END
+ END
+END
+
+ static void CodePUSHV(Word Index)
+BEGIN
+ int z;
+
+ if (ArgCnt<2) WrError(1110);
+ else
+ BEGIN
+ if (NOT CaseSensitive) NLS_UpString(ArgStr[1]);
+ for (z=2; z<=ArgCnt; z++)
+ PushSymbol(ArgStr[z],ArgStr[1]);
+ END
+END
+
+ static void CodePOPV(Word Index)
+BEGIN
+ int z;
+
+ if (ArgCnt<2) WrError(1110);
+ else
+ BEGIN
+ if (NOT CaseSensitive) NLS_UpString(ArgStr[1]);
+ for (z=2; z<=ArgCnt; z++)
+ PopSymbol(ArgStr[z],ArgStr[1]);
+ END
+END
+
+ static PForwardSymbol CodePPSyms_SearchSym(PForwardSymbol Root, char *Comp)
+BEGIN
+ PForwardSymbol Lauf=Root;
+
+ while ((Lauf!=Nil) AND (strcmp(Lauf->Name,Comp)!=0)) Lauf=Lauf->Next;
+ return Lauf;
+END
+
+
+ static void CodeSTRUCT(Word Index)
+BEGIN
+ PStructure NStruct;
+ int z;
+ Boolean OK;
+
+ if (ArgCnt>1) WrError(1110);
+ else if (NOT ChkSymbName(LabPart)) WrXError(1020,LabPart);
+ else
+ BEGIN
+ if (NOT CaseSensitive) NLS_UpString(LabPart);
+ if (StructureStack!=Nil) StructureStack->CurrPC=ProgCounter();
+ NStruct=(PStructure) malloc(sizeof(TStructure));
+ NStruct->Name=strdup(LabPart);
+ NStruct->CurrPC=0; NStruct->DoExt=True;
+ NStruct->Next=StructureStack;
+ OK=True;
+ for (z=1; z<=ArgCnt; z++)
+ if (OK)
+ if (strcasecmp(ArgStr[z],"EXTNAMES")==0) NStruct->DoExt=True;
+ else if (strcasecmp(ArgStr[z],"NOEXTNAMES")==0) NStruct->DoExt=False;
+ else
+ BEGIN
+ WrXError(1554,ArgStr[z]); OK=False;
+ END
+ if (OK)
+ BEGIN
+ StructureStack=NStruct;
+ if (ActPC!=StructSeg) StructSaveSeg=ActPC; ActPC=StructSeg;
+ PCs[ActPC]=0;
+ Phases[ActPC]=0;
+ Grans[ActPC]=Grans[SegCode]; ListGrans[ActPC]=ListGrans[SegCode];
+ ClearChunk(SegChunks+StructSeg);
+ CodeLen=0; DontPrint=True;
+ END
+ else
+ BEGIN
+ free(NStruct->Name); free(NStruct);
+ END
+ END
+END
+
+ static void CodeENDSTRUCT(Word Index)
+BEGIN
+ Boolean OK;
+ PStructure OStruct;
+ TempResult t;
+ String tmp;
+
+ if (ArgCnt>1) WrError(1110);
+ else if (StructureStack==Nil) WrError(1550);
+ else
+ BEGIN
+ if (*LabPart=='\0') OK=True;
+ else
+ BEGIN
+ if (NOT CaseSensitive) NLS_UpString(LabPart);
+ OK=(strcmp(LabPart,StructureStack->Name)==0);
+ if (NOT OK) WrError(1552);
+ END
+ if (OK)
+ BEGIN
+ OStruct=StructureStack; StructureStack=OStruct->Next;
+ if (ArgCnt==0) sprintf(tmp,"%s_len",OStruct->Name);
+ else strmaxcpy(tmp,ArgStr[1],255);
+ EnterIntSymbol(tmp,ProgCounter(),SegNone,False);
+ t.Typ=TempInt; t.Contents.Int=ProgCounter(); SetListLineVal(&t);
+ free(OStruct->Name);
+ free(OStruct);
+ if (StructureStack==Nil) ActPC=StructSaveSeg;
+ else PCs[ActPC]+=StructureStack->CurrPC;
+ ClearChunk(SegChunks+StructSeg);
+ CodeLen=0; DontPrint=True;
+ END
+ END
+END
+
+ static void CodeEXTERN(Word Index)
+BEGIN
+ char *Split;
+ int i;
+ Boolean OK;
+ Byte Type;
+
+ if (ArgCnt < 1) WrError(1110);
+ else
+ BEGIN
+ i = 1; OK = True;
+ while ((OK) && (i <= ArgCnt))
+ BEGIN
+ Split = strrchr(ArgStr[i], ':');
+ if (Split == NULL)
+ Type = SegNone;
+ else
+ BEGIN
+ for (Type = SegNone + 1; Type <= PCMax; Type++)
+ if (strcasecmp(Split + 1, SegNames[Type]) == 0)
+ break;
+ if (Type > PCMax) WrXError(1961, Split + 1);
+ else
+ BEGIN
+ *Split = '\0';
+ EnterExtSymbol(ArgStr[i], 0, Type, FALSE);
+ END
+ END
+ i++;
+ END
+ END
+END
+
+ static void CodePPSyms(PForwardSymbol *Orig,
+ PForwardSymbol *Alt1,
+ PForwardSymbol *Alt2)
+BEGIN
+ PForwardSymbol Lauf;
+ int z;
+ String Sym,Section;
+
+ if (ArgCnt==0) WrError(1110);
+ else
+ for (z=1; z<=ArgCnt; z++)
+ BEGIN
+ SplitString(ArgStr[z],Sym,Section,QuotPos(ArgStr[z],':'));
+ if (NOT ExpandSymbol(Sym)) return;
+ if (NOT ExpandSymbol(Section)) return;
+ if (NOT CaseSensitive) NLS_UpString(Sym);
+ Lauf=CodePPSyms_SearchSym(*Alt1,Sym);
+ if (Lauf!=Nil) WrXError(1489,ArgStr[z]);
+ else
+ BEGIN
+ Lauf=CodePPSyms_SearchSym(*Alt2,Sym);
+ if (Lauf!=Nil) WrXError(1489,ArgStr[z]);
+ else
+ BEGIN
+ Lauf=CodePPSyms_SearchSym(*Orig,Sym);
+ if (Lauf==Nil)
+ BEGIN
+ Lauf=(PForwardSymbol) malloc(sizeof(TForwardSymbol));
+ Lauf->Next=(*Orig); *Orig=Lauf;
+ Lauf->Name=strdup(Sym);
+ END
+ IdentifySection(Section,&(Lauf->DestSection));
+ END
+ END
+ END
+END
+
+/*------------------------------------------------------------------------*/
+
+#define ONOFFMax 32
+static int ONOFFCnt=0;
+typedef struct
+ {
+ Boolean Persist,*FlagAddr;
+ char *FlagName,*InstName;
+ } ONOFFTab;
+static ONOFFTab ONOFFList[ONOFFMax];
+
+ static void DecodeONOFF(Word Index)
+BEGIN
+ ONOFFTab *Tab=ONOFFList+Index;
+ Boolean OK;
+
+ if (ArgCnt!=1) WrError(1110);
+ else
+ BEGIN
+ NLS_UpString(ArgStr[1]);
+ if (*AttrPart!='\0') WrError(1100);
+ else if ((strcasecmp(ArgStr[1],"ON")!=0) AND (strcasecmp(ArgStr[1],"OFF")!=0)) WrError(1520);
+ else
+ BEGIN
+ OK=(strcasecmp(ArgStr[1],"ON")==0);
+ SetFlag(Tab->FlagAddr,Tab->FlagName,OK);
+ END
+ END
+END
+
+ void AddONOFF(char *InstName, Boolean *Flag, char *FlagName, Boolean Persist)
+BEGIN
+ if (ONOFFCnt==ONOFFMax) exit(255);
+ ONOFFList[ONOFFCnt].Persist=Persist;
+ ONOFFList[ONOFFCnt].FlagAddr=Flag;
+ ONOFFList[ONOFFCnt].FlagName=FlagName;
+ ONOFFList[ONOFFCnt].InstName=InstName;
+ AddInstTable(ONOFFTable,InstName,ONOFFCnt++,DecodeONOFF);
+END
+
+ void ClearONOFF(void)
+BEGIN
+ int z,z2;
+
+ for (z=0; z<ONOFFCnt; z++)
+ if (NOT ONOFFList[z].Persist) break;
+
+ for (z2=ONOFFCnt-1; z2>=z; z2--)
+ RemoveInstTable(ONOFFTable,ONOFFList[z2].InstName);
+
+ ONOFFCnt=z;
+END
+
+/*------------------------------------------------------------------------*/
+
+typedef struct
+ {
+ char *Name;
+ void (*Proc)(
+#ifdef __PROTOS__
+ Word Index
+#endif
+ );
+ } PseudoOrder;
+static PseudoOrder Pseudos[]=
+ {{"ALIGN", CodeALIGN },
+ {"BINCLUDE", CodeBINCLUDE },
+ {"CHARSET", CodeCHARSET },
+ {"CODEPAGE", CodeCODEPAGE },
+ {"CPU", CodeCPU },
+ {"DEPHASE", CodeDEPHASE },
+ {"END", CodeEND },
+ {"ENDSECTION", CodeENDSECTION},
+ {"ENDSTRUCT", CodeENDSTRUCT },
+ {"ENUM", CodeENUM },
+ {"ERROR", CodeERROR },
+ {"EXTERN", CodeEXTERN },
+ {"FATAL", CodeFATAL },
+ {"FUNCTION", CodeFUNCTION },
+ {"LABEL", CodeLABEL },
+ {"LISTING", CodeLISTING },
+ {"MESSAGE", CodeMESSAGE },
+ {"NEWPAGE", CodeNEWPAGE },
+ {"ORG", CodeORG },
+ {"PAGE", CodePAGE },
+ {"PHASE", CodePHASE },
+ {"POPV", CodePOPV },
+ {"PRSET", CodePRSET },
+ {"PUSHV", CodePUSHV },
+ {"RADIX", CodeRADIX },
+ {"READ", CodeREAD },
+ {"RESTORE", CodeRESTORE },
+ {"SAVE", CodeSAVE },
+ {"SECTION", CodeSECTION },
+ {"SEGMENT", CodeSEGMENT },
+ {"SHARED", CodeSHARED },
+ {"STRUCT", CodeSTRUCT },
+ {"WARNING", CodeWARNING },
+ {"" , Nil }};
+
+ Boolean CodeGlobalPseudo(void)
+BEGIN
+ switch (*OpPart)
+ BEGIN
+ case 'S':
+ if ((NOT SetIsOccupied) AND (Memo("SET")))
+ BEGIN
+ CodeSETEQU(0); return True;
+ END
+ break;
+ case 'E':
+ if ((SetIsOccupied) AND (Memo("EVAL")))
+ BEGIN
+ CodeSETEQU(0); return True;
+ END
+ break;
+ END
+
+ if (LookupInstTable(ONOFFTable,OpPart)) return True;
+
+ if (LookupInstTable(PseudoTable,OpPart)) return True;
+
+ if (SectionStack!=Nil)
+ BEGIN
+ if (Memo("FORWARD"))
+ BEGIN
+ if (PassNo<=MaxSymPass)
+ CodePPSyms(&(SectionStack->LocSyms),
+ &(SectionStack->GlobSyms),
+ &(SectionStack->ExportSyms));
+ return True;
+ END
+ if (Memo("PUBLIC"))
+ BEGIN
+ CodePPSyms(&(SectionStack->GlobSyms),
+ &(SectionStack->LocSyms),
+ &(SectionStack->ExportSyms));
+ return True;
+ END
+ if (Memo("GLOBAL"))
+ BEGIN
+ CodePPSyms(&(SectionStack->ExportSyms),
+ &(SectionStack->LocSyms),
+ &(SectionStack->GlobSyms));
+ return True;
+ END
+ END
+
+ return False;
+END
+
+
+ void codeallg_init(void)
+BEGIN
+ PseudoOrder *POrder;
+
+ PseudoStrs[0]=PrtInitString;
+ PseudoStrs[1]=PrtExitString;
+ PseudoStrs[2]=PrtTitleString;
+
+ PseudoTable=CreateInstTable(201);
+ for (POrder=Pseudos; POrder->Proc!=Nil; POrder++)
+ AddInstTable(PseudoTable,POrder->Name,0,POrder->Proc);
+ AddInstTable(PseudoTable,"OUTRADIX", 1, CodeRADIX);
+ AddInstTable(PseudoTable,"EQU",0,CodeSETEQU);
+ AddInstTable(PseudoTable,"=",0,CodeSETEQU);
+ AddInstTable(PseudoTable,":=",0,CodeSETEQU);
+ AddInstTable(PseudoTable,"PRTINIT",0,CodeString);
+ AddInstTable(PseudoTable,"PRTEXIT",1,CodeString);
+ AddInstTable(PseudoTable,"TITLE",2,CodeString);
+ ONOFFTable=CreateInstTable(47);
+ AddONOFF("MACEXP",&LstMacroEx,LstMacroExName,True);
+ AddONOFF("RELAXED",&RelaxedMode,RelaxedName,True);
+END
diff --git a/asmallg.h b/asmallg.h
new file mode 100644
index 0000000..1035b0f
--- /dev/null
+++ b/asmallg.h
@@ -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);
diff --git a/asmcode.c b/asmcode.c
new file mode 100644
index 0000000..46e8283
--- /dev/null
+++ b/asmcode.c
@@ -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
diff --git a/asmcode.h b/asmcode.h
new file mode 100644
index 0000000..661940e
--- /dev/null
+++ b/asmcode.h
@@ -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);
diff --git a/asmdebug.c b/asmdebug.c
new file mode 100644
index 0000000..f94cf09
--- /dev/null
+++ b/asmdebug.c
@@ -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
diff --git a/asmdebug.h b/asmdebug.h
new file mode 100644
index 0000000..435deb4
--- /dev/null
+++ b/asmdebug.h
@@ -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);
diff --git a/asmdef.c b/asmdef.c
new file mode 100644
index 0000000..ac3a1fc
--- /dev/null
+++ b/asmdef.c
@@ -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
diff --git a/asmdef.h b/asmdef.h
new file mode 100644
index 0000000..94fb312
--- /dev/null
+++ b/asmdef.h
@@ -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);
diff --git a/asmfnums.c b/asmfnums.c
new file mode 100644
index 0000000..7352ff2
--- /dev/null
+++ b/asmfnums.c
@@ -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
+
diff --git a/asmfnums.h b/asmfnums.h
new file mode 100644
index 0000000..74bec99
--- /dev/null
+++ b/asmfnums.h
@@ -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);
diff --git a/asmif.c b/asmif.c
new file mode 100644
index 0000000..18a616e
--- /dev/null
+++ b/asmif.c
@@ -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
diff --git a/asmif.h b/asmif.h
new file mode 100644
index 0000000..a3253ec
--- /dev/null
+++ b/asmif.h
@@ -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);
diff --git a/asminclist.c b/asminclist.c
new file mode 100644
index 0000000..9645e85
--- /dev/null
+++ b/asminclist.c
@@ -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
diff --git a/asminclist.h b/asminclist.h
new file mode 100644
index 0000000..0c15e75
--- /dev/null
+++ b/asminclist.h
@@ -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);
diff --git a/asmitree.c b/asmitree.c
new file mode 100644
index 0000000..12ef168
--- /dev/null
+++ b/asmitree.c
@@ -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
diff --git a/asmitree.h b/asmitree.h
new file mode 100644
index 0000000..511447b
--- /dev/null
+++ b/asmitree.h
@@ -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);
diff --git a/asmmac.c b/asmmac.c
new file mode 100644
index 0000000..8a694e4
--- /dev/null
+++ b/asmmac.c
@@ -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
diff --git a/asmmac.h b/asmmac.h
new file mode 100644
index 0000000..7320058
--- /dev/null
+++ b/asmmac.h
@@ -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);
diff --git a/asmpars.c b/asmpars.c
new file mode 100644
index 0000000..34b2b9b
--- /dev/null
+++ b/asmpars.c
@@ -0,0 +1,3822 @@
+/* asmpars.c */
+/*****************************************************************************/
+/* AS-Portierung */
+/* */
+/* Verwaltung von Symbolen und das ganze Drumherum... */
+/* */
+/* Historie: 5. 5.1996 Grundsteinlegung */
+/* 4. 1.1997 Umstellung wg. case-sensitiv */
+/* 24. 9.1997 Registersymbole */
+/* 26. 6.1998 Codepages */
+/* 7. 7.1998 Fix Zugriffe auf CharTransTable wg. signed chars */
+/* 17. 7.1998 Korrektur Maskentabellen */
+/* 16. 8.1998 NoICE-Symbolausgabe */
+/* 18. 8.1998 Benutzung RadixBase */
+/* 19. 8.1998 == als Alias fuer = - Operator */
+/* 1. 9.1998 RefList nicht initialisiert bei Symbolen */
+/* ACOT korrigiert */
+/* 6.12.1998 UInt14 */
+/* 30. 1.1999 Formate maschinenunabhaengig gemacht */
+/* 12. 2.1999 Compilerwarnungen beseitigt */
+/* 17. 4.1999 Abfrage auf PCSymbol gegen Nullzeigerzugriff ge- */
+/* schuetzt. */
+/* 30. 5.1999 OutRadixBase beruecksichtigt */
+/* 12. 7.1999 angefangen mit externen Symbolen */
+/* 14. 7.1999 Relocs im Parser beruecksichtigt */
+/* 1. 8.1999 Relocs im Formelparser durch */
+/* 8. 8.1999 Relocs in EvalIntExpression beruecksichtigt */
+/* */
+/*****************************************************************************/
+
+#include "stdinc.h"
+#include <string.h>
+#include <ctype.h>
+
+#include "endian.h"
+#include "bpemu.h"
+#include "nls.h"
+#include "nlmessages.h"
+#include "as.rsc"
+#include "strutil.h"
+
+#include "asmdef.h"
+#include "asmsub.h"
+#include "asmfnums.h"
+#include "asmrelocs.h"
+#include "chunks.h"
+
+#include "asmpars.h"
+
+LargeWord IntMasks[IntTypeCnt]=
+ {0x00000001l, /* UInt1 */
+ 0x00000003l, /* UInt2 */
+ 0x00000007l, /* UInt3 */
+ 0x00000007l,0x0000000fl,0x0000000fl, /* SInt4 UInt4 Int4 */
+ 0x0000000fl,0x0000001fl,0x0000001fl, /* SInt5 UInt5 Int5 */
+ 0x0000003fl, /* UInt6 */
+ 0x0000003fl,0x0000007fl, /* SInt7 UInt7 */
+ 0x0000007fl,0x000000ffl,0x000000ffl, /* SInt8 UInt8 Int8 */
+ 0x000001ffl, /* UInt9 */
+ 0x000003ffl,0x000003ffl, /* UInt10 Int10 */
+ 0x000007ffl, /* UInt11 */
+ 0x00000fffl,0x00000fffl, /* UInt12 Int12 */
+ 0x00001fffl, /* UInt13 */
+ 0x00003fffl, /* UInt14 */
+ 0x00007fffl, /* UInt15 */
+ 0x00007fffl,0x0000ffffl,0x0000ffffl, /* SInt16 UInt16 Int16 */
+ 0x0003ffffl, /* UInt18 */
+ 0x0007ffffl,0x000fffffl,0x000fffffl, /* SInt20 UInt20 Int20 */
+ 0x003fffffl, /* UInt22 */
+ 0x007fffffl,0x00ffffffl,0x00ffffffl, /* SInt24 UInt24 Int24 */
+ 0xffffffffl,0xffffffffl,0xffffffffl /* SInt32 UInt32 Int32 */
+#ifdef HAS64
+ ,0xffffffffffffffffllu /* Int64 */
+#endif
+ };
+
+LargeInt IntMins[IntTypeCnt]=
+ { 0l, /* UInt1 */
+ 0l, /* UInt2 */
+ 0l, /* UInt3 */
+ -8l, 0l, -8l, /* SInt4 UInt4 Int4 */
+ -16l, 0l, -16l, /* SInt5 UInt5 Int5 */
+ 0l, /* UInt6 */
+ -64, 0l, /* SInt7 UInt7 */
+ -128l, 0l, -128l, /* SInt8 UInt8 Int8 */
+ 0l, /* UInt9 */
+ 0l, -512l, /* UInt10 Int10 */
+ 0l, /* UInt11 */
+ 0l, -2047l, /* UInt12 Int12 */
+ 0l, /* UInt13 */
+ 0l, /* UInt14 */
+ 0l, /* UInt15 */
+ -32768l, 0l, -32768l, /* SInt16 UInt16 Int16 */
+ 0l, /* UInt18 */
+ -524288l, 0l, -524288l, /* SInt20 UInt20 Int20 */
+ 0l, /* UInt22 */
+ -8388608l, 0l, -8388608l, /* SInt24 UInt24 Int24 */
+ -2147483647l, 0l,-2147483647l /* SInt32 UInt32 Int32 */
+#ifdef HAS64
+ ,-9223372036854775807ll /* Int64 */
+#endif
+ };
+
+LargeInt IntMaxs[IntTypeCnt]=
+ { 1l, /* UInt1 */
+ 3l, /* UInt2 */
+ 7l, /* UInt3 */
+ 7l, 15l, 15l, /* SInt4 UInt4 Int4 */
+ 15l, 31l, 31l, /* SInt5 UInt5 Int5 */
+ 63l, /* UInt6 */
+ 63l, 127l, /* SInt7 UInt7 */
+ 127l, 255l, 255l, /* SInt8 UInt8 Int8 */
+ 511l, /* UInt9 */
+ 1023l, 1023l, /* UInt10 Int10 */
+ 2047l, /* UInt11 */
+ 4095l, 4095l, /* UInt12 Int12 */
+ 8191l, /* UInt13 */
+ 16383l, /* UInt14 */
+ 32767l, /* UInt15 */
+ 32767l, 65535l, 65535l, /* SInt16 UInt16 Int16 */
+ 262143l, /* UInt18 */
+ 524287l, /* SInt20 */
+ 1048575l, 1048575l, /* UInt20 Int20 */
+ 4194303l, /* UInt22 */
+#ifdef __STDC__
+ 8388607l, 16777215l, 16777215l, /* SInt24 UInt24 Int24 */
+ 2147483647l, 4294967295ul,4294967295ul /* SInt32 UInt32 Int32 */
+#else
+ 8388607l, 16777215l, 16777215l, /* SInt24 UInt24 Int24 */
+ 2147483647l, 4294967295l, 4294967295l /* SInt32 UInt32 Int32 */
+#endif
+#ifdef HAS64
+ , 9223372036854775807ll /* Int64 */
+#endif
+ };
+
+
+Boolean FirstPassUnknown; /* Hinweisflag: evtl. im ersten Pass unbe-
+ kanntes Symbol, Ausdruck nicht ausgewertet */
+Boolean SymbolQuestionable; /* Hinweisflag: Dadurch, dass Phasenfehler
+ aufgetreten sind, ist dieser Symbolwert evtl.
+ nicht mehr aktuell */
+Boolean UsesForwards; /* Hinweisflag: benutzt Vorwaertsdefinitionen */
+LongInt MomLocHandle; /* Merker, den lokale Symbole erhalten */
+
+LongInt LocHandleCnt; /* mom. verwendeter lokaler Handle */
+
+Boolean BalanceTree; /* Symbolbaum ausbalancieren */
+
+
+static char BaseIds[3]={'%','@','$'};
+static char BaseLetters[3]={'B','O','H'};
+static Byte BaseVals[3]={2,8,16};
+
+typedef struct _TSymbolStackEntry
+ {
+ struct _TSymbolStackEntry *Next;
+ SymbolVal Contents;
+ } TSymbolStackEntry,*PSymbolStackEntry;
+
+typedef struct _TSymbolStack
+ {
+ struct _TSymbolStack *Next;
+ char *Name;
+ PSymbolStackEntry Contents;
+ } TSymbolStack,*PSymbolStack;
+
+typedef struct _TDefSymbol
+ {
+ struct _TDefSymbol *Next;
+ char *SymName;
+ TempResult Wert;
+ } TDefSymbol,*PDefSymbol;
+
+typedef struct _TCToken
+ {
+ struct _TCToken *Next;
+ char *Name;
+ LongInt Parent;
+ ChunkList Usage;
+ } TCToken,*PCToken;
+
+typedef struct Operator
+ {
+ char *Id;
+ int IdLen;
+ Boolean Dyadic;
+ Byte Priority;
+ Boolean MayInt;
+ Boolean MayFloat;
+ Boolean MayString;
+ Boolean Present;
+ } Operator;
+
+typedef struct _TLocHeap
+ {
+ struct _TLocHeap *Next;
+ LongInt Cont;
+ } TLocHeap,*PLocHandle;
+
+typedef struct _TRegDefList
+ {
+ struct _TRegDefList *Next;
+ LongInt Section;
+ char *Value;
+ Boolean Used;
+ } TRegDefList,*PRegDefList;
+
+typedef struct _TRegDef
+ {
+ struct _TRegDef *Left,*Right;
+ char *Orig;
+ PRegDefList Defs,DoneDefs;
+ } TRegDef,*PRegDef;
+
+static SymbolPtr FirstSymbol,FirstLocSymbol;
+static PDefSymbol FirstDefSymbol;
+/*static*/ PCToken FirstSection;
+static PRegDef FirstRegDef;
+static Boolean DoRefs; /* Querverweise protokollieren */
+static PLocHandle FirstLocHandle;
+static PSymbolStack FirstStack;
+static PCToken MomSection;
+
+ void AsmParsInit(void)
+BEGIN
+ FirstSymbol=Nil;
+
+ FirstLocSymbol = Nil; MomLocHandle = (-1); SetMomSection(-1);
+ FirstSection = Nil;
+ FirstLocHandle = Nil;
+ FirstStack = Nil;
+ FirstRegDef = Nil;
+ DoRefs = True;
+ RadixBase = 10;
+ OutRadixBase = 16;
+END
+
+
+ Boolean RangeCheck(LargeInt Wert, IntType Typ)
+BEGIN
+#ifndef HAS64
+ if (((int)Typ)>=((int)SInt32)) return True;
+#else
+ if (((int)Typ)>=((int)Int64)) return True;
+#endif
+ else return ((Wert>=IntMins[(int)Typ]) AND (Wert<=IntMaxs[(int)Typ]));
+END
+
+ Boolean FloatRangeCheck(Double Wert, FloatType Typ)
+BEGIN
+ switch (Typ)
+ BEGIN
+ case Float32 : return (fabs(Wert)<=3.4e38);
+ case Float64 : return (fabs(Wert)<=1.7e308);
+/** case FloatCo : FloatRangeCheck:=Abs(Wert)<=9.22e18;
+ case Float80 : FloatRangeCheck:=True;
+ case FloatDec : FloatRangeCheck:=True;**/
+ default: return False;
+ END
+/** IF (Typ=FloatDec) AND (Abs(Wert)>1e1000) THEN WrError(40);**/
+END
+
+
+ Boolean SingleBit(LargeInt Inp, LargeInt *Erg)
+BEGIN
+ *Erg=0;
+ do
+ BEGIN
+ if (NOT Odd(Inp)) (*Erg)++;
+ if (NOT Odd(Inp)) Inp=Inp>>1;
+ END
+ while ((*Erg!=LARGEBITS) AND (NOT Odd(Inp)));
+ return (*Erg!=LARGEBITS) AND (Inp==1);
+END
+
+
+ static Boolean ProcessBk(char **Start, char *Erg)
+BEGIN
+ LongInt System=0,Acc=0,Digit=0;
+ char ch;
+ int cnt;
+ Boolean Finish;
+
+ switch (toupper(**Start))
+ BEGIN
+ case '\'': case '\\': case '"':
+ *Erg=**Start; (*Start)++; return True;
+ case 'H':
+ *Erg='\''; (*Start)++; return True;
+ case 'I':
+ *Erg='"'; (*Start)++; return True;
+ case 'B':
+ *Erg=Char_BS; (*Start)++; return True;
+ case 'A':
+ *Erg=Char_BEL; (*Start)++; return True;
+ case 'E':
+ *Erg=Char_ESC; (*Start)++; return True;
+ case 'T':
+ *Erg=Char_HT; (*Start)++; return True;
+ case 'N':
+ *Erg=Char_LF; (*Start)++; return True;
+ case 'R':
+ *Erg=Char_CR; (*Start)++; return True;
+ case 'X':
+ System=16; (*Start)++;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ if (System==0) System=(**Start=='0')?8:10;
+ cnt=(System==16) ? 1 : ((System==10) ? 0 : -1);
+ do
+ BEGIN
+ ch=toupper(**Start); Finish=False;
+ if ((ch>='0') AND (ch<='9')) Digit=ch-'0';
+ else if ((System==16) AND (ch>='A') AND (ch<='F')) Digit=(ch-'A')+10;
+ else Finish=True;
+ if (NOT Finish)
+ BEGIN
+ (*Start)++; cnt++;
+ if (Digit>=System)
+ BEGIN
+ WrError(1320); return False;
+ END
+ Acc=(Acc*System)+Digit;
+ END
+ END
+ while ((NOT Finish) AND (cnt<3));
+ if (NOT ChkRange(Acc,0,255)) return False;
+ *Erg=Acc; return True;
+ default:
+ WrError(1135); return False;
+ END
+END
+
+ static void ReplaceBkSlashes(char *s)
+BEGIN
+ char *p,*n;
+ char ErgChar;
+
+ p=strchr(s,'\\');
+ while (p!=Nil)
+ BEGIN
+ n=p+1; if (ProcessBk(&n,&ErgChar)) *p=ErgChar;
+ strcpy(p+1,n);
+ p=strchr(p+1,'\\');
+ END
+END
+
+
+ Boolean ExpandSymbol(char *Name)
+BEGIN
+ char *p1,*p2;
+ String h;
+ Boolean OK;
+
+ do
+ BEGIN
+ if ((p1=strchr(Name,'{'))==Nil) return True;
+ strmaxcpy(h,p1+1,255);
+ if ((p2=QuotPos(h,'}'))==Nil)
+ BEGIN
+ WrXError(1020,Name);
+ return False;
+ END
+ strcpy(p1,p2+1); *p2='\0';
+ FirstPassUnknown=False;
+ EvalStringExpression(h,&OK,h);
+ if (FirstPassUnknown)
+ BEGIN
+ WrError(1820); return False;
+ END
+ if (NOT CaseSensitive) UpString(h);
+ strmaxins(Name,h,p1-Name,255);
+ END
+ while (p1!=Nil);
+ return True;
+END
+
+ Boolean IdentifySection(char *Name, LongInt *Erg)
+BEGIN
+ PSaveSection SLauf;
+ sint Depth;
+
+ if (NOT ExpandSymbol(Name)) return False;
+ if (NOT CaseSensitive) NLS_UpString(Name);
+
+ if (*Name=='\0')
+ BEGIN
+ *Erg=(-1); return True;
+ END
+ else if (((strlen(Name)==6) OR (strlen(Name)==7))
+ AND (strncasecmp(Name,"PARENT",6)==0)
+ AND ((strlen(Name)==6) OR ((Name[6]>='0') AND (Name[6]<='9'))))
+ BEGIN
+ if (strlen(Name)==6) Depth=1; else Depth=Name[6]-AscOfs;
+ SLauf=SectionStack; *Erg=MomSectionHandle;
+ while ((Depth>0) AND (*Erg!=(-2)))
+ BEGIN
+ if (SLauf==Nil) *Erg=(-2);
+ else
+ BEGIN
+ *Erg=SLauf->Handle;
+ SLauf=SLauf->Next;
+ END
+ Depth--;
+ END
+ if (*Erg==(-2))
+ BEGIN
+ WrError(1484); return False;
+ END
+ else return True;
+ END
+ else if (strcmp(Name,GetSectionName(MomSectionHandle))==0)
+ BEGIN
+ *Erg=MomSectionHandle; return True;
+ END
+ else
+ BEGIN
+ SLauf=SectionStack;
+ while ((SLauf!=Nil) AND (strcmp(GetSectionName(SLauf->Handle),Name)!=0))
+ SLauf=SLauf->Next;
+ if (SLauf==Nil)
+ BEGIN
+ WrError(1484); return False;
+ END
+ else
+ BEGIN
+ *Erg=SLauf->Handle; return True;
+ END
+ END
+END
+
+ static Boolean GetSymSection(char *Name, LongInt *Erg)
+BEGIN
+ String Part;
+ char *q;
+ int l=strlen(Name);
+
+ if (Name[l-1]!=']')
+ BEGIN
+ *Erg=(-2); return True;
+ END
+
+ Name[l-1]='\0';
+ q=RQuotPos(Name,'[');
+ Name[l-1]=']';
+ if (Name+strlen(Name)-q<=2)
+ BEGIN
+ WrXError(1020,Name); return False;
+ END
+
+ Name[strlen(Name)-1]='\0';
+ strmaxcpy(Part,q+1,255);
+ *q='\0';
+
+ return IdentifySection(Part,Erg);
+END
+
+ int DigitVal(char ch, int Base)
+BEGIN
+ static char *DigitVals="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ char *pos=strchr(DigitVals,ch);
+ int erg;
+
+ if (pos==Nil) return -1;
+ else if ((erg=pos-DigitVals)>=Base) return -1;
+ return erg;
+END
+
+ LargeInt ConstIntVal(char *Asc_O, IntType Typ, Boolean *Ok)
+BEGIN
+ String Asc;
+ int Search;
+ Byte Base,Digit;
+ LargeInt Wert;
+ Boolean NegFlag;
+ TConstMode ActMode=ConstModeC;
+ Boolean Found;
+ char *z,ch;
+ int l;
+
+ *Ok=False; Wert=0; strmaxcpy(Asc,Asc_O,255);
+ if (Asc[0]=='\0')
+ BEGIN
+ *Ok=True; return 0;
+ END
+
+ /* ASCII herausfiltern */
+
+ else if (*Asc=='\'')
+ BEGIN
+ if (Asc[strlen(Asc)-1]!='\'') return -1;
+ strcpy(Asc,Asc+1); Asc[strlen(Asc)-1]='\0'; ReplaceBkSlashes(Asc);
+ for (Search=0; Search<strlen(Asc); Search++)
+ BEGIN
+ Digit=(usint) Asc[Search];
+ Wert=(Wert<<8)+CharTransTable[Digit&0xff];
+ END
+ NegFlag=False;
+ END
+
+ /* Zahlenkonstante */
+
+ else
+ BEGIN
+ /* Vorzeichen */
+
+ if (*Asc=='+') strcpy(Asc,Asc+1);
+ NegFlag=(*Asc=='-');
+ if (NegFlag) strcpy(Asc,Asc+1);
+
+ /* automatische Syntaxermittlung */
+
+ if (RelaxedMode)
+ BEGIN
+ Found=False;
+ if ((strlen(Asc)>=2) AND (*Asc=='0') AND (toupper(Asc[1])=='X'))
+ BEGIN
+ ActMode=ConstModeC; Found=True;
+ END
+ if ((NOT Found) AND (strlen(Asc)>=2))
+ BEGIN
+ for (Search=0; Search<3; Search++)
+ if (Asc[0]==BaseIds[Search])
+ BEGIN
+ ActMode=ConstModeMoto; Found=True; break;
+ END
+ END
+ if ((NOT Found) AND (strlen(Asc)>=2) AND (*Asc>='0') AND (*Asc<='9'))
+ BEGIN
+ ch=toupper(Asc[strlen(Asc)-1]);
+ if (DigitVal(ch,RadixBase)==-1)
+ for (Search=0; Search<3; Search++)
+ if (ch==BaseLetters[Search])
+ BEGIN
+ ActMode=ConstModeIntel; Found=True; break;
+ END
+ END
+ if (NOT Found) ActMode=ConstModeC;
+ END
+ else ActMode=ConstMode;
+
+ /* Zahlensystem ermitteln/pruefen */
+
+ Base=RadixBase;
+ switch (ActMode)
+ BEGIN
+ case ConstModeIntel:
+ l=strlen(Asc); ch=toupper(Asc[l-1]);
+ if (DigitVal(ch,RadixBase)==-1)
+ for (Search=0; Search<3; Search++)
+ if (ch==BaseLetters[Search])
+ BEGIN
+ Base=BaseVals[Search]; Asc[l-1]='\0'; break;
+ END
+ break;
+ case ConstModeMoto:
+ for (Search=0; Search<3; Search++)
+ if (Asc[0]==BaseIds[Search])
+ BEGIN
+ Base=BaseVals[Search]; strcpy(Asc,Asc+1); break;
+ END
+ break;
+ case ConstModeC:
+ if (strcmp(Asc,"0")==0)
+ BEGIN
+ *Ok=True; return 0;
+ END
+ else if (*Asc!='0') Base=RadixBase;
+ else if (strlen(Asc)<2) return -1;
+ else
+ BEGIN
+ strcpy(Asc,Asc+1);
+ ch=toupper(*Asc);
+ if ((RadixBase!=10) && (DigitVal(ch,RadixBase)!=-1)) Base=RadixBase;
+ else switch (toupper(*Asc))
+ BEGIN
+ case 'X': strcpy(Asc,Asc+1); Base=16; break;
+ case 'B': strcpy(Asc,Asc+1); Base=2; break;
+ default: Base=8; break;
+ END
+ if (Asc[0]=='\0') return -1;
+ END
+ END
+
+ if (Asc[0]=='\0') return -1;
+
+ if (ActMode==ConstModeIntel)
+ if ((Asc[0]<'0') OR (Asc[0]>'9')) return -1;
+
+ for (z=Asc; *z!='\0'; z++)
+ BEGIN
+ Search=DigitVal(toupper(*z),Base); if (Search==-1) return -1;
+ Wert=Wert*Base+Search;
+ END
+ END
+
+ if (NegFlag) Wert=(-Wert);
+
+ *Ok=RangeCheck(Wert,Typ);
+ if (Ok) return Wert;
+ else if (HardRanges)
+ BEGIN
+ WrError(1320);
+ return -1;
+ END
+ else
+ BEGIN
+ *Ok=True; WrError(260); return Wert&IntMasks[(int)Typ];
+ END
+END
+
+ Double ConstFloatVal(char *Asc_O, FloatType Typ, Boolean *Ok)
+BEGIN
+ Double Erg;
+ char *end;
+
+ if (*Asc_O)
+ BEGIN
+ Erg=strtod(Asc_O,&end);
+ *Ok=(*end=='\0');
+ END
+ else
+ BEGIN
+ Erg=0.0;
+ *Ok=True;
+ END
+ return Erg;
+END
+
+ void ConstStringVal(char *Asc_O, char *Erg, Boolean *OK)
+BEGIN
+ String Asc,tmp,Part;
+ char *z,Save;
+ int l;
+ Boolean OK2;
+ TempResult t;
+
+ *OK=False;
+
+ if ((strlen(Asc_O)<2) OR (*Asc_O!='"') OR (Asc_O[strlen(Asc_O)-1]!='"')) return;
+
+ strmaxcpy(Asc,Asc_O+1,255); Asc[strlen(Asc)-1]='\0'; *tmp='\0';
+
+ while (*Asc!='\0')
+ BEGIN
+ z=strchr(Asc,'\\'); if (z==Nil) z=Asc+strlen(Asc);
+ Save=(*z); *z='\0'; if (strchr(Asc,'"')!=Nil) return;
+ strmaxcat(tmp,Asc,255); *z=Save; strcpy(Asc,z);
+ if (*Asc=='\\')
+ BEGIN
+ if (Asc[1]=='{')
+ BEGIN
+ z=QuotPos(Asc,'}'); if (z==Nil) return;
+ FirstPassUnknown=False;
+ *(z++)='\0'; strmaxcpy(Part,Asc+2,255); KillBlanks(Part);
+ EvalExpression(Part,&t);
+ if (FirstPassUnknown)
+ BEGIN
+ WrXError(1820,Part); return;
+ END
+ else if (t.Relocs != Nil)
+ BEGIN
+ WrError(1150); FreeRelocs(&t.Relocs); return;
+ END
+ else switch(t.Typ)
+ BEGIN
+ case TempInt: strmaxcat(tmp,SysString(t.Contents.Int,OutRadixBase,0),255); break;
+ case TempFloat: strmaxcat(tmp,FloatString(t.Contents.Float),255); break;
+ case TempString: strmaxcat(tmp,t.Contents.Ascii,255); break;
+ default: return;
+ END
+ END
+ else
+ BEGIN
+ z=Asc+1; OK2=ProcessBk(&z,&Save);
+ if (NOT OK2) return;
+ l=strlen(tmp); tmp[l++]=Save; tmp[l++]='\0';
+ END
+ strcpy(Asc,z);
+ END
+ END
+
+ *OK=True; strmaxcpy(Erg,tmp,255);
+END
+
+
+ static SymbolPtr FindLocNode(
+#ifdef __PROTOS__
+char *Name, TempType SearchType
+#endif
+);
+
+ static SymbolPtr FindNode(
+#ifdef __PROTOS__
+char *Name, TempType SearchType
+#endif
+);
+
+
+ static void EvalExpression_ChgFloat(TempResult *T)
+BEGIN
+ if (T->Typ!=TempInt) return;
+ T->Typ=TempFloat; T->Contents.Float=T->Contents.Int;
+END
+
+#define LEAVE goto func_exit
+
+ void EvalExpression(char *Asc_O, TempResult *Erg)
+BEGIN
+#define OpCnt 24
+static Operator Operators[OpCnt+1]=
+ /* Dummynulloperator */
+ {{" " ,1 , False, 0, False, False, False, False},
+ /* Einerkomplement */
+ {"~" ,1 , False, 1, True , False, False, False},
+ /* Linksschieben */
+ {"<<",2 , True , 3, True , False, False, False},
+ /* Rechtsschieben */
+ {">>",2 , True , 3, True , False, False, False},
+ /* Bitspiegelung */
+ {"><",2 , True , 4, True , False, False, False},
+ /* binaeres AND */
+ {"&" ,1 , True , 5, True , False, False, False},
+ /* binaeres OR */
+ {"|" ,1 , True , 6, True , False, False, False},
+ /* binaeres EXOR */
+ {"!" ,1 , True , 7, True , False, False, False},
+ /* allg. Potenz */
+ {"^" ,1 , True , 8, True , True , False, False},
+ /* Produkt */
+ {"*" ,1 , True , 11, True , True , False, False},
+ /* Quotient */
+ {"/" ,1 , True , 11, True , True , False, False},
+ /* Modulodivision */
+ {"#" ,1 , True , 11, True , False, False, False},
+ /* Summe */
+ {"+" ,1 , True , 13, True , True , True , False},
+ /* Differenz */
+ {"-" ,1 , True , 13, True , True , False, False},
+ /* logisches NOT */
+ {"~~",2 , False, 2, True , False, False, False},
+ /* logisches AND */
+ {"&&",2 , True , 15, True , False, False, False},
+ /* logisches OR */
+ {"||",2 , True , 16, True , False, False, False},
+ /* logisches EXOR */
+ {"!!",2 , True , 17, True , False, False, False},
+ /* Gleichheit */
+ {"=" ,1 , True , 23, True , True , True , False},
+ {"==",2 , True , 23, True , True , True , False},
+ /* Groesser als */
+ {">" ,1 , True , 23, True , True , True , False},
+ /* Kleiner als */
+ {"<" ,1 , True , 23, True , True , True , False},
+ /* Kleiner oder gleich */
+ {"<=",2 , True , 23, True , True , True , False},
+ /* Groesser oder gleich */
+ {">=",2 , True , 23, True , True , True , False},
+ /* Ungleichheit */
+ {"<>",2 , True , 23, True , True , True , False}};
+ static Operator *OpEnd=Operators+OpCnt;
+ Operator *FOps[OpCnt+1];
+ LongInt FOpCnt=0;
+
+ Boolean OK,FFound;
+ TempResult LVal,RVal,MVal;
+ int z1,cnt;
+ Operator *Op;
+ char Save='\0';
+ sint LKlamm,RKlamm,WKlamm,zop;
+ sint OpMax,LocOpMax,OpPos=(-1),OpLen;
+ Boolean OpFnd,InHyp,InQuot;
+ LargeInt HVal;
+ Double FVal;
+ SymbolPtr Ptr;
+ PFunction ValFunc;
+ String Asc,stemp,ftemp;
+ char *KlPos,*zp,*DummyPtr;
+ PRelocEntry TReloc;
+
+ memset(&LVal, 0, sizeof(LVal));
+ memset(&RVal, 0, sizeof(RVal));
+
+ ChkStack();
+
+ strmaxcpy(Asc, Asc_O, 255);
+ strmaxcpy(stemp, Asc, 255); KillBlanks(Asc);
+ if (MakeDebug) fprintf(Debug, "Parse %s", Asc);
+
+ /* Annahme Fehler */
+
+ Erg->Typ = TempNone;
+ Erg->Relocs = Nil;
+
+ /* Programmzaehler ? */
+
+ if ((PCSymbol != NULL) AND (strcasecmp(Asc,PCSymbol) == 0))
+ BEGIN
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = EProgCounter();
+ Erg->Relocs = Nil;
+ LEAVE;
+ END
+
+ /* Konstanten ? */
+
+ Erg->Contents.Int = ConstIntVal(Asc, (IntType) (IntTypeCnt-1), &OK);
+ if (OK)
+ BEGIN
+ Erg->Typ = TempInt;
+ Erg->Relocs = Nil;
+ LEAVE;
+ END
+
+ Erg->Contents.Float = ConstFloatVal(Asc, Float80, &OK);
+ if (OK)
+ BEGIN
+ Erg->Typ = TempFloat;
+ Erg->Relocs = Nil;
+ LEAVE;
+ END
+
+ ConstStringVal(Asc,Erg->Contents.Ascii,&OK);
+ if (OK)
+ BEGIN
+ Erg->Typ = TempString;
+ Erg->Relocs = Nil;
+ LEAVE;
+ END
+
+ /* durch Codegenerator gegebene Konstanten ? */
+
+ Erg->Relocs = Nil;
+ InternSymbol(Asc, Erg);
+ if (Erg->Typ != TempNone) LEAVE;
+
+ /* Zaehler initialisieren */
+
+ LocOpMax = 0; OpMax = 0; LKlamm = 0; RKlamm = 0; WKlamm = 0;
+ InHyp = False; InQuot = False;
+ for (Op=Operators+1; Op<=OpEnd; Op++)
+ if (((Op->IdLen==1)?(strchr(Asc,*Op->Id)):(strstr(Asc,Op->Id)))!=Nil) FOps[FOpCnt++]=Op;
+/* if (strstr(Asc,Op->Id)!=Nil) FOps[FOpCnt++]=Op;*/
+
+ /* nach Operator hoechster Rangstufe ausserhalb Klammern suchen */
+
+ for (zp=Asc; *zp!='\0'; zp++)
+ BEGIN
+ switch (*zp)
+ BEGIN
+ case '(': if (NOT (InHyp OR InQuot)) LKlamm++; break;
+ case ')': if (NOT (InHyp OR InQuot)) RKlamm++; break;
+ case '{': if (NOT (InHyp OR InQuot)) WKlamm++; break;
+ case '}': if (NOT (InHyp OR InQuot)) WKlamm--; break;
+ case '"': if (NOT InHyp) InQuot=NOT InQuot; break;
+ case '\'':if (NOT InQuot) InHyp=NOT InHyp; break;
+ default:
+ if ((LKlamm==RKlamm) AND (WKlamm==0) AND (NOT InHyp) AND (NOT InQuot))
+ BEGIN
+ OpFnd=False; OpLen=0; LocOpMax=0;
+ for (zop=0; zop<FOpCnt; zop++)
+ if (strncmp(zp,FOps[zop]->Id,FOps[zop]->IdLen)==0)
+ if (FOps[zop]->IdLen>=OpLen)
+ BEGIN
+ OpFnd=True; OpLen=FOps[zop]->IdLen; LocOpMax=FOps[zop]-Operators;
+ if (Operators[LocOpMax].Priority>=Operators[OpMax].Priority)
+ BEGIN
+ OpMax=LocOpMax; OpPos=zp-Asc;
+ END
+ END
+ if (OpFnd) zp+=strlen(Operators[LocOpMax].Id)-1;
+ END
+ END
+ END
+
+ /* Klammerfehler ? */
+
+ if (LKlamm != RKlamm)
+ BEGIN
+ WrXError(1300, Asc); LEAVE;
+ END
+
+ /* Operator gefunden ? */
+
+ if (OpMax!=0)
+ BEGIN
+ Op=Operators + OpMax;
+
+ /* Minuszeichen sowohl mit einem als auch 2 Operanden */
+
+ if (strcmp(Op->Id, "-") == 0) Op->Dyadic = (OpPos>0);
+
+ /* Operandenzahl pruefen */
+
+ if (((Op->Dyadic) AND (OpPos == 0)) OR ((NOT Op->Dyadic) AND (OpPos != 0)) OR (OpPos == strlen(Asc)-1))
+ BEGIN
+ WrError(1110); LEAVE;
+ END
+
+ /* Teilausdruecke rekursiv auswerten */
+
+ Save = Asc[OpPos]; Asc[OpPos] = '\0';
+ if (Op->Dyadic) EvalExpression(Asc, &LVal);
+ else
+ BEGIN
+ LVal.Typ = TempInt; LVal.Contents.Int = 0; LVal.Relocs = Nil;
+ END
+ EvalExpression(Asc + OpPos + strlen(Op->Id), &RVal);
+ Asc[OpPos] = Save;
+
+ /* Abbruch, falls dabei Fehler */
+
+ if ((LVal.Typ == TempNone) OR (RVal.Typ == TempNone)) LEAVE;
+
+ /* relokatible Symbole nur fuer + und - erlaubt */
+
+ if ((OpMax != 12) AND (OpMax != 13) AND ((LVal.Relocs != Nil) OR (RVal.Relocs != Nil)))
+ BEGIN
+ WrError(1150);
+ LEAVE;
+ END
+
+ /* Typueberpruefung */
+
+ if ((Op->Dyadic) AND (LVal.Typ != RVal.Typ))
+ BEGIN
+ if ((LVal.Typ == TempString) OR (RVal.Typ == TempString))
+ BEGIN
+ WrError(1135); LEAVE;
+ END
+ if (LVal.Typ == TempInt) EvalExpression_ChgFloat(&LVal);
+ if (RVal.Typ == TempInt) EvalExpression_ChgFloat(&RVal);
+ END
+
+ switch (RVal.Typ)
+ BEGIN
+ case TempInt:
+ if (NOT Op->MayInt)
+ BEGIN
+ if (NOT Op->MayFloat)
+ BEGIN
+ WrError(1135); LEAVE;
+ END
+ else
+ BEGIN
+ EvalExpression_ChgFloat(&RVal);
+ if (Op->Dyadic) EvalExpression_ChgFloat(&LVal);
+ END
+ END
+ break;
+ case TempFloat:
+ if (NOT Op->MayFloat)
+ BEGIN
+ WrError(1135); LEAVE;
+ END
+ break;
+ case TempString:
+ if (NOT Op->MayString)
+ BEGIN
+ WrError(1135); LEAVE;
+ END;
+ break;
+ default:
+ break;
+ END
+
+ /* Operanden abarbeiten */
+
+ switch (OpMax)
+ BEGIN
+ case 1: /* ~ */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = ~RVal.Contents.Int;
+ break;
+ case 2: /* << */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = LVal.Contents.Int << RVal.Contents.Int;
+ break;
+ case 3: /* >> */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = LVal.Contents.Int >> RVal.Contents.Int;
+ break;
+ case 4: /* >< */
+ Erg->Typ = TempInt;
+ if ((RVal.Contents.Int < 1) OR (RVal.Contents.Int > 32)) WrError(1320);
+ else
+ BEGIN
+ Erg->Contents.Int = (LVal.Contents.Int >> RVal.Contents.Int) << RVal.Contents.Int;
+ RVal.Contents.Int--;
+ for (z1 = 0; z1 <= RVal.Contents.Int; z1++)
+ BEGIN
+ if ((LVal.Contents.Int & (1 << (RVal.Contents.Int - z1))) != 0)
+ Erg->Contents.Int += (1 << z1);
+ END
+ END
+ break;
+ case 5: /* & */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = LVal.Contents.Int & RVal.Contents.Int;
+ break;
+ case 6: /* | */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = LVal.Contents.Int | RVal.Contents.Int;
+ break;
+ case 7: /* ! */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = LVal.Contents.Int ^ RVal.Contents.Int;
+ break;
+ case 8: /* ^ */
+ switch (Erg->Typ = LVal.Typ)
+ BEGIN
+ case TempInt:
+ if (RVal.Contents.Int < 0) Erg->Contents.Int = 0;
+ else
+ BEGIN
+ Erg->Contents.Int = 1;
+ while (RVal.Contents.Int > 0)
+ BEGIN
+ if ((RVal.Contents.Int&1) == 1) Erg->Contents.Int *= LVal.Contents.Int;
+ RVal.Contents.Int >>= 1;
+ if (RVal.Contents.Int != 0) LVal.Contents.Int *= LVal.Contents.Int;
+ END
+ END
+ break;
+ case TempFloat:
+ if (RVal.Contents.Float == 0.0) Erg->Contents.Float = 1.0;
+ else if (LVal.Contents.Float == 0.0) Erg->Contents.Float = 0.0;
+ else if (LVal.Contents.Float > 0) Erg->Contents.Float = pow(LVal.Contents.Float, RVal.Contents.Float);
+ else if ((abs(RVal.Contents.Float) <= ((double)MaxLongInt)) AND (floor(RVal.Contents.Float) == RVal.Contents.Float))
+ BEGIN
+ HVal = (LongInt) floor(RVal.Contents.Float+0.5);
+ if (HVal < 0)
+ BEGIN
+ LVal.Contents.Float = 1 / LVal.Contents.Float; HVal = (-HVal);
+ END
+ Erg->Contents.Float = 1.0;
+ while (HVal > 0)
+ BEGIN
+ if ((HVal & 1) == 1) Erg->Contents.Float *= LVal.Contents.Float;
+ LVal.Contents.Float *= LVal.Contents.Float; HVal >>= 1;
+ END
+ END
+ else
+ BEGIN
+ WrError(1890); Erg->Typ = TempNone;
+ END
+ break;
+ default:
+ break;
+ END
+ break;
+ case 9: /* * */
+ switch (Erg->Typ = LVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int = LVal.Contents.Int * RVal.Contents.Int; break;
+ case TempFloat:
+ Erg->Contents.Float = LVal.Contents.Float * RVal.Contents.Float; break;
+ default:
+ break;
+ END
+ break;
+ case 10: /* / */
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ if (RVal.Contents.Int == 0) WrError(1310);
+ else
+ BEGIN
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = LVal.Contents.Int / RVal.Contents.Int;
+ END
+ break;
+ case TempFloat:
+ if (RVal.Contents.Float == 0.0) WrError(1310);
+ else
+ BEGIN
+ Erg->Typ = TempFloat;
+ Erg->Contents.Float = LVal.Contents.Float / RVal.Contents.Float;
+ END
+ default:
+ break;
+ END
+ break;
+ case 11: /* # */
+ if (RVal.Contents.Int == 0) WrError(1310);
+ else
+ BEGIN
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = LVal.Contents.Int % RVal.Contents.Int;
+ END
+ break;
+ case 12: /* + */
+ switch (Erg->Typ = LVal.Typ)
+ BEGIN
+ case TempInt :
+ Erg->Contents.Int = LVal.Contents.Int + RVal.Contents.Int;
+ Erg->Relocs = MergeRelocs(&(LVal.Relocs), &(RVal.Relocs), TRUE);
+ break;
+ case TempFloat :
+ Erg->Contents.Float = LVal.Contents.Float + RVal.Contents.Float;
+ break;
+ case TempString:
+ strmaxcpy(Erg->Contents.Ascii, LVal.Contents.Ascii, 255);
+ strmaxcat(Erg->Contents.Ascii, RVal.Contents.Ascii, 255);
+ break;
+ default:
+ break;
+ END
+ break;
+ case 13: /* - */
+ if (Op->Dyadic)
+ switch (Erg->Typ = LVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int = LVal.Contents.Int-RVal.Contents.Int;
+ Erg->Relocs = MergeRelocs(&(LVal.Relocs), &(RVal.Relocs), FALSE);
+ break;
+ case TempFloat:
+ Erg->Contents.Float = LVal.Contents.Float - RVal.Contents.Float;
+ break;
+ default:
+ break;
+ END
+ else
+ switch (Erg->Typ = RVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int = (-RVal.Contents.Int);
+ InvertRelocs(&(Erg->Relocs), &(RVal.Relocs));
+ break;
+ case TempFloat:
+ Erg->Contents.Float = (-RVal.Contents.Float);
+ break;
+ default:
+ break;
+ END
+ break;
+ case 14: /* ~~ */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = (RVal.Contents.Int == 0) ? 1 : 0;
+ break;
+ case 15: /* && */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = ((LVal.Contents.Int != 0) AND (RVal.Contents.Int != 0)) ? 1 : 0;
+ break;
+ case 16: /* || */
+ Erg->Typ = TempInt;
+ Erg->Contents.Int = ((LVal.Contents.Int != 0) OR (RVal.Contents.Int != 0)) ? 1 : 0;
+ break;
+ case 17: /* !! */
+ Erg->Typ = TempInt;
+ if ((LVal.Contents.Int != 0) AND (RVal.Contents.Int == 0))
+ Erg->Contents.Int = 1;
+ else if ((LVal.Contents.Int == 0) AND (RVal.Contents.Int != 0))
+ Erg->Contents.Int = 1;
+ else Erg->Contents.Int = 0;
+ break;
+ case 18: /* = */
+ case 19: /* == */
+ Erg->Typ = TempInt;
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int = (LVal.Contents.Int == RVal.Contents.Int) ? 1 : 0;
+ break;
+ case TempFloat:
+ Erg->Contents.Int = (LVal.Contents.Float == RVal.Contents.Float) ? 1 : 0;
+ break;
+ case TempString:
+ Erg->Contents.Int = (strcmp(LVal.Contents.Ascii, RVal.Contents.Ascii) == 0) ? 1 : 0;
+ break;
+ default:
+ break;
+ END
+ break;
+ case 20: /* > */
+ Erg->Typ = TempInt;
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int = (LVal.Contents.Int > RVal.Contents.Int) ? 1 : 0;
+ break;
+ case TempFloat:
+ Erg->Contents.Int = (LVal.Contents.Float > RVal.Contents.Float) ? 1 : 0;
+ break;
+ case TempString:
+ Erg->Contents.Int = (strcmp(LVal.Contents.Ascii, RVal.Contents.Ascii) > 0) ? 1 : 0;
+ break;
+ default:
+ break;
+ END
+ break;
+ case 21: /* < */
+ Erg->Typ = TempInt;
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int = (LVal.Contents.Int < RVal.Contents.Int) ? 1 : 0;
+ break;
+ case TempFloat:
+ Erg->Contents.Int = (LVal.Contents.Float < RVal.Contents.Float) ? 1 : 0;
+ break;
+ case TempString:
+ Erg->Contents.Int = (strcmp(LVal.Contents.Ascii, RVal.Contents.Ascii) < 0) ? 1 : 0;
+ break;
+ default:
+ break;
+ END
+ break;
+ case 22: /* <= */
+ Erg->Typ = TempInt;
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int = (LVal.Contents.Int <= RVal.Contents.Int) ? 1 : 0;
+ break;
+ case TempFloat:
+ Erg->Contents.Int = (LVal.Contents.Float <= RVal.Contents.Float) ? 1 : 0;
+ break;
+ case TempString:
+ Erg->Contents.Int = (strcmp(LVal.Contents.Ascii, RVal.Contents.Ascii) <= 0) ? 1 : 0; break;
+ default:
+ break;
+ END
+ break;
+ case 23: /* >= */
+ Erg->Typ=TempInt;
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int=(LVal.Contents.Int>=RVal.Contents.Int)?1:0; break;
+ case TempFloat:
+ Erg->Contents.Int=(LVal.Contents.Float>=RVal.Contents.Float)?1:0; break;
+ case TempString:
+ Erg->Contents.Int=(strcmp(LVal.Contents.Ascii,RVal.Contents.Ascii)>=0)?1:0; break;
+ default:
+ break;
+ END
+ break;
+ case 24: /* <> */
+ Erg->Typ=TempInt;
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ Erg->Contents.Int=(LVal.Contents.Int!=RVal.Contents.Int)?1:0; break;
+ case TempFloat:
+ Erg->Contents.Int=(LVal.Contents.Float!=RVal.Contents.Float)?1:0; break;
+ case TempString:
+ Erg->Contents.Int=(strcmp(LVal.Contents.Ascii,RVal.Contents.Ascii)!=0)?1:0; break;
+ default:
+ break;
+ END
+ break;
+ END
+ LEAVE;
+ END
+
+ /* kein Operator gefunden: Klammerausdruck ? */
+
+ if (LKlamm!=0)
+ BEGIN
+
+ /* erste Klammer suchen, Funktionsnamen abtrennen */
+
+ KlPos=strchr(Asc,'(');
+
+ /* Funktionsnamen abschneiden */
+
+ *KlPos='\0'; strmaxcpy(ftemp,Asc,255);
+ strcpy(Asc,KlPos+1); Asc[strlen(Asc)-1]='\0';
+
+ /* Nullfunktion: nur Argument */
+
+ if (ftemp[0]=='\0')
+ BEGIN
+ EvalExpression(Asc,&LVal);
+ *Erg=LVal; LEAVE;
+ END
+
+ /* selbstdefinierte Funktion ? */
+
+ if ((ValFunc=FindFunction(ftemp))!=Nil)
+ BEGIN
+ strmaxcpy(ftemp,ValFunc->Definition,255);
+ for (z1=1; z1<=ValFunc->ArguCnt; z1++)
+ BEGIN
+ if (Asc[0]=='\0')
+ BEGIN
+ WrError(1490); LEAVE;
+ END;
+ KlPos=QuotPos(Asc,','); if (KlPos!=Nil) *KlPos='\0';
+ EvalExpression(Asc,&LVal);
+ if (LVal.Relocs != Nil)
+ BEGIN
+ WrError(1150); FreeRelocs(&LVal.Relocs); return;
+ END
+ if (KlPos==Nil) Asc[0]='\0'; else strcpy(Asc,KlPos+1);
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ sprintf(stemp,"%s",LargeString(LVal.Contents.Int));
+ break;
+ case TempFloat:
+ sprintf(stemp,"%0.16e",LVal.Contents.Float);
+ KillBlanks(stemp);
+ break;
+ case TempString:
+ strcpy(stemp,"\"");
+ strmaxcat(stemp,LVal.Contents.Ascii,255);
+ strmaxcat(stemp,"\"",255);
+ break;
+ default:
+ LEAVE;
+ END
+ memmove(stemp+1,stemp,strlen(stemp)+1);
+ stemp[0]='('; strmaxcat(stemp,")",255);
+ ExpandLine(stemp,z1,ftemp);
+ END
+ if (Asc[0]!='\0')
+ BEGIN
+ WrError(1490); LEAVE;
+ END
+ EvalExpression(ftemp,Erg);
+ LEAVE;
+ END
+
+ /* hier einmal umwandeln ist effizienter */
+
+ NLS_UpString(ftemp);
+
+ /* symbolbezogene Funktionen */
+
+ if (strcmp(ftemp,"SYMTYPE")==0)
+ BEGIN
+ Erg->Typ=TempInt;
+ if (FindRegDef(Asc,&DummyPtr)) Erg->Contents.Int=0x80;
+ else Erg->Contents.Int=GetSymbolType(Asc);
+ LEAVE;
+ END
+
+ /* Unterausdruck auswerten (interne Funktionen maxmimal mit drei Argumenten) */
+
+ z1 = 0; KlPos = Asc;
+ do
+ BEGIN
+ zp = QuotPos(KlPos, ',');
+ if (zp != Nil) *zp = '\0';
+ switch (z1)
+ BEGIN
+ case 0:
+ EvalExpression(KlPos, &LVal);
+ if (LVal.Typ == TempNone) LEAVE;
+ TReloc = LVal.Relocs;
+ break;
+ case 1:
+ EvalExpression(KlPos, &MVal);
+ if (MVal.Typ == TempNone) LEAVE;
+ TReloc = MVal.Relocs;
+ break;
+ case 2:
+ EvalExpression(KlPos, &RVal);
+ if (RVal.Typ == TempNone) LEAVE;
+ TReloc = RVal.Relocs;
+ break;
+ default:
+ WrError(1490); LEAVE;
+ END
+ if (TReloc != Nil)
+ BEGIN
+ WrError(1150); FreeRelocs(&TReloc); LEAVE;
+ END
+ if (zp != Nil) KlPos = zp + 1;
+ z1++;
+ END
+ while (zp!=Nil);
+
+ /* ein paar Funktionen mit zwei,drei Argumenten */
+
+ if (z1==3)
+ BEGIN
+ if (strcmp(ftemp,"SUBSTR")==0)
+ BEGIN
+ if ((LVal.Typ!=TempString) OR (MVal.Typ!=TempInt) OR (RVal.Typ!=TempInt)) WrError(1135);
+ else
+ BEGIN
+ cnt=strlen(LVal.Contents.Ascii)-MVal.Contents.Int;
+ if ((RVal.Contents.Int!=0) AND (RVal.Contents.Int<cnt)) cnt=RVal.Contents.Int;
+ if (cnt<0) cnt=0;
+ memcpy(Erg->Contents.Ascii,LVal.Contents.Ascii+MVal.Contents.Int,cnt);
+ Erg->Contents.Ascii[cnt]='\0';
+ Erg->Typ=TempString;
+ END
+ END
+ else WrXError(1860,ftemp);
+ LEAVE;
+ END
+ else if (z1==2)
+ BEGIN
+ if (strcmp(ftemp,"STRSTR")==0)
+ BEGIN
+ if ((LVal.Typ!=TempString) OR (MVal.Typ!=TempString)) WrError(1135);
+ else
+ BEGIN
+ zp=strstr(LVal.Contents.Ascii,MVal.Contents.Ascii);
+ Erg->Typ=TempInt;
+ Erg->Contents.Int=(zp==Nil) ? -1 : (zp-LVal.Contents.Ascii);
+ END
+ END
+ else WrXError(1860,ftemp);
+ LEAVE;
+ END
+
+ /* Funktionen fuer Stringargumente */
+
+ if (LVal.Typ==TempString)
+ BEGIN
+ /* in Grossbuchstaben wandeln ? */
+
+ if (strcmp(ftemp,"UPSTRING")==0)
+ BEGIN
+ Erg->Typ=TempString; strmaxcpy(Erg->Contents.Ascii,LVal.Contents.Ascii,255);
+ for (KlPos=Erg->Contents.Ascii; *KlPos!='\0'; KlPos++)
+ *KlPos=toupper(*KlPos);
+ END
+
+ /* in Kleinbuchstaben wandeln ? */
+
+ else if (strcmp(ftemp,"LOWSTRING")==0)
+ BEGIN
+ Erg->Typ=TempString; strmaxcpy(Erg->Contents.Ascii,LVal.Contents.Ascii,255);
+ for (KlPos=Erg->Contents.Ascii; *KlPos!='\0'; KlPos++)
+ *KlPos=tolower(*KlPos);
+ END
+
+ /* Laenge ermitteln ? */
+
+ else if (strcmp(ftemp,"STRLEN")==0)
+ BEGIN
+ Erg->Typ=TempInt; Erg->Contents.Int=strlen(LVal.Contents.Ascii);
+ END
+
+ /* Parser aufrufen ? */
+
+ else if (strcmp(ftemp,"VAL")==0)
+ BEGIN
+ EvalExpression(LVal.Contents.Ascii,Erg);
+ END
+
+ /* nix gefunden ? */
+
+ else
+ BEGIN
+ WrXError(1860,ftemp); Erg->Typ=TempNone;
+ END
+ END
+
+ /* Funktionen fuer Zahlenargumente */
+
+ else
+ BEGIN
+ FFound=False; Erg->Typ=TempNone;
+
+ /* reine Integerfunktionen */
+
+ if (strcmp(ftemp,"TOUPPER")==0)
+ BEGIN
+ if (LVal.Typ!=TempInt) WrError(1135);
+ else if ((LVal.Contents.Int<0) OR (LVal.Contents.Int>255)) WrError(1320);
+ else
+ BEGIN
+ Erg->Typ=TempInt;
+ Erg->Contents.Int=toupper(LVal.Contents.Int);
+ END
+ FFound=True;
+ END
+
+ else if (strcmp(ftemp,"TOLOWER")==0)
+ BEGIN
+ if (LVal.Typ!=TempInt) WrError(1135);
+ else if ((LVal.Contents.Int<0) OR (LVal.Contents.Int>255)) WrError(1320);
+ else
+ BEGIN
+ Erg->Typ=TempInt;
+ Erg->Contents.Int=tolower(LVal.Contents.Int);
+ END
+ FFound=True;
+ END
+
+ else if (strcmp(ftemp,"BITCNT")==0)
+ BEGIN
+ if (LVal.Typ!=TempInt) WrError(1135);
+ else
+ BEGIN
+ Erg->Typ=TempInt;
+ Erg->Contents.Int=0;
+ for (z1=0; z1<LARGEBITS; z1++)
+ BEGIN
+ Erg->Contents.Int+=(LVal.Contents.Int & 1);
+ LVal.Contents.Int=LVal.Contents.Int >> 1;
+ END
+ END
+ FFound=True;
+ END
+
+ else if (strcmp(ftemp,"FIRSTBIT")==0)
+ BEGIN
+ if (LVal.Typ!=TempInt) WrError(1135);
+ else
+ BEGIN
+ Erg->Typ=TempInt;
+ Erg->Contents.Int=0;
+ do
+ BEGIN
+ if (NOT Odd(LVal.Contents.Int)) Erg->Contents.Int++;
+ LVal.Contents.Int=LVal.Contents.Int >> 1;
+ END
+ while ((Erg->Contents.Int<LARGEBITS) AND (NOT Odd(LVal.Contents.Int)));
+ if (Erg->Contents.Int>=LARGEBITS) Erg->Contents.Int=(-1);
+ END
+ FFound=True;
+ END
+
+ else if (strcmp(ftemp,"LASTBIT")==0)
+ BEGIN
+ if (LVal.Typ!=TempInt) WrError(1135);
+ else
+ BEGIN
+ Erg->Typ=TempInt;
+ Erg->Contents.Int=(-1);
+ for (z1=0; z1<LARGEBITS; z1++)
+ BEGIN
+ if (Odd(LVal.Contents.Int)) Erg->Contents.Int=z1;
+ LVal.Contents.Int=LVal.Contents.Int >> 1;
+ END
+ END
+ FFound=True;
+ END
+
+ else if (strcmp(ftemp,"BITPOS")==0)
+ BEGIN
+ if (LVal.Typ!=TempInt) WrError(1135);
+ else
+ BEGIN
+ Erg->Typ=TempInt;
+ if (NOT SingleBit(LVal.Contents.Int,&Erg->Contents.Int))
+ BEGIN
+ Erg->Contents.Int=(-1); WrError(1540);
+ END
+ END
+ FFound=True;
+ END
+
+ /* variable Integer/Float-Funktionen */
+
+ else if (strcmp(ftemp,"ABS")==0)
+ BEGIN
+ switch (Erg->Typ=LVal.Typ)
+ BEGIN
+ case TempInt: Erg->Contents.Int=abs(LVal.Contents.Int); break;
+ case TempFloat: Erg->Contents.Float=fabs(LVal.Contents.Float);break;
+ default: break;
+ END
+ FFound=True;
+ END
+
+ else if (strcmp(ftemp,"SGN")==0)
+ BEGIN
+ Erg->Typ=TempInt;
+ switch (LVal.Typ)
+ BEGIN
+ case TempInt:
+ if (LVal.Contents.Int<0) Erg->Contents.Int=(-1);
+ else if (LVal.Contents.Int>0) Erg->Contents.Int=1;
+ else Erg->Contents.Int=0;
+ break;
+ case TempFloat:
+ if (LVal.Contents.Float<0) Erg->Contents.Int=(-1);
+ else if (LVal.Contents.Float>0) Erg->Contents.Int=1;
+ else Erg->Contents.Int=0;
+ break;
+ default:
+ break;
+ END
+ FFound=True;
+ END
+
+ /* Funktionen Float und damit auch Int */
+
+ if (NOT FFound)
+ BEGIN
+ /* Typkonvertierung */
+
+ EvalExpression_ChgFloat(&LVal);
+ Erg->Typ=TempFloat;
+
+ /* Integerwandlung */
+
+ if (strcmp(ftemp,"INT")==0)
+ BEGIN
+ if (fabs(LVal.Contents.Float)>MaxLargeInt)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1320);
+ END
+ else
+ BEGIN
+ Erg->Typ=TempInt; Erg->Contents.Int=(LargeInt) floor(LVal.Contents.Float);
+ END
+ END
+
+ /* Quadratwurzel */
+
+ else if (strcmp(ftemp,"SQRT")==0)
+ BEGIN
+ if (LVal.Contents.Float<0)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=sqrt(LVal.Contents.Float);
+ END
+
+ /* trigonometrische Funktionen */
+
+ else if (strcmp(ftemp,"SIN")==0) Erg->Contents.Float=sin(LVal.Contents.Float);
+ else if (strcmp(ftemp,"COS")==0) Erg->Contents.Float=cos(LVal.Contents.Float);
+ else if (strcmp(ftemp,"TAN")==0)
+ BEGIN
+ if (cos(LVal.Contents.Float)==0.0)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=tan(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"COT")==0)
+ BEGIN
+ if ((FVal=sin(LVal.Contents.Float))==0.0)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=cos(LVal.Contents.Float)/FVal;
+ END
+
+ /* inverse trigonometrische Funktionen */
+
+ else if (strcmp(ftemp,"ASIN")==0)
+ BEGIN
+ if (fabs(LVal.Contents.Float)>1)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=asin(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"ACOS")==0)
+ BEGIN
+ if (fabs(LVal.Contents.Float)>1)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=acos(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"ATAN")==0) Erg->Contents.Float=atan(LVal.Contents.Float);
+ else if (strcmp(ftemp,"ACOT")==0) Erg->Contents.Float=M_PI/2-atan(LVal.Contents.Float);
+
+ /* exponentielle & hyperbolische Funktionen */
+
+ else if (strcmp(ftemp,"EXP")==0)
+ BEGIN
+ if (LVal.Contents.Float>709)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=exp(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"ALOG")==0)
+ BEGIN
+ if (LVal.Contents.Float>308)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=exp(LVal.Contents.Float*log(10.0));
+ END
+ else if (strcmp(ftemp,"ALD")==0)
+ BEGIN
+ if (LVal.Contents.Float>1022)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=exp(LVal.Contents.Float*log(2.0));
+ END
+ else if (strcmp(ftemp,"SINH")==0)
+ BEGIN
+ if (LVal.Contents.Float>709)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=sinh(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"COSH")==0)
+ BEGIN
+ if (LVal.Contents.Float>709)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=cosh(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"TANH")==0)
+ BEGIN
+ if (LVal.Contents.Float>709)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=tanh(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"COTH")==0)
+ BEGIN
+ if (LVal.Contents.Float>709)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else if ((FVal=tanh(LVal.Contents.Float))==0.0)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=1.0/FVal;
+ END
+
+ /* logarithmische & inverse hyperbolische Funktionen */
+
+ else if (strcmp(ftemp,"LN")==0)
+ BEGIN
+ if (LVal.Contents.Float<=0)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=log(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"LOG")==0)
+ BEGIN
+ if (LVal.Contents.Float<=0)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=log10(LVal.Contents.Float);
+ END
+ else if (strcmp(ftemp,"LD")==0)
+ BEGIN
+ if (LVal.Contents.Float<=0)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1870);
+ END
+ else Erg->Contents.Float=log(LVal.Contents.Float)/log(2.0);
+ END
+ else if (strcmp(ftemp,"ASINH")==0)
+ Erg->Contents.Float=log(LVal.Contents.Float+sqrt(LVal.Contents.Float*LVal.Contents.Float+1));
+ else if (strcmp(ftemp,"ACOSH")==0)
+ BEGIN
+ if (LVal.Contents.Float<1)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=log(LVal.Contents.Float+sqrt(LVal.Contents.Float*LVal.Contents.Float-1));
+ END
+ else if (strcmp(ftemp,"ATANH")==0)
+ BEGIN
+ if (fabs(LVal.Contents.Float)>=1)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=0.5*log((1+LVal.Contents.Float)/(1-LVal.Contents.Float));
+ END
+ else if (strcmp(ftemp,"ACOTH")==0)
+ BEGIN
+ if (fabs(LVal.Contents.Float)<=1)
+ BEGIN
+ Erg->Typ=TempNone; WrError(1880);
+ END
+ else Erg->Contents.Float=0.5*log((LVal.Contents.Float+1)/(LVal.Contents.Float-1));
+ END
+
+ /* nix gefunden ? */
+
+ else
+ BEGIN
+ WrXError(1860,ftemp); Erg->Typ=TempNone;
+ END
+ END
+ END
+ LEAVE;
+ END
+
+ /* nichts dergleichen, dann einfaches Symbol: */
+
+ /* interne Symbole ? */
+
+ strmaxcpy(Asc,stemp,255); KillPrefBlanks(Asc); KillPostBlanks(Asc);
+
+ if (strcasecmp(Asc,"MOMFILE")==0)
+ BEGIN
+ Erg->Typ=TempString;
+ strmaxcpy(Erg->Contents.Ascii,CurrFileName,255);
+ LEAVE;
+ END;
+
+ if (strcasecmp(Asc,"MOMLINE")==0)
+ BEGIN
+ Erg->Typ=TempInt;
+ Erg->Contents.Int=CurrLine;
+ LEAVE;
+ END
+
+ if (strcasecmp(Asc,"MOMPASS")==0)
+ BEGIN
+ Erg->Typ=TempInt;
+ Erg->Contents.Int=PassNo;
+ LEAVE;
+ END
+
+ if (strcasecmp(Asc,"MOMSECTION")==0)
+ BEGIN
+ Erg->Typ=TempString;
+ strmaxcpy(Erg->Contents.Ascii,GetSectionName(MomSectionHandle),255);
+ LEAVE;
+ END
+
+ if (strcasecmp(Asc,"MOMSEGMENT")==0)
+ BEGIN
+ Erg->Typ=TempString;
+ strmaxcpy(Erg->Contents.Ascii,SegNames[ActPC],255);
+ LEAVE;
+ END
+
+ if (NOT ExpandSymbol(Asc)) LEAVE;
+
+ KlPos=strchr(Asc,'[');
+ if (KlPos!=Nil)
+ BEGIN
+ Save=(*KlPos); *KlPos='\0';
+ END
+ OK=ChkSymbName(Asc);
+ if (KlPos!=Nil) *KlPos=Save;
+ if (NOT OK)
+ BEGIN
+ WrXError(1020,Asc); LEAVE;
+ END;
+
+ Ptr = FindLocNode(Asc, TempNone);
+ if (Ptr == Nil) Ptr=FindNode(Asc, TempNone);
+ if (Ptr != Nil)
+ BEGIN
+ switch (Erg->Typ = Ptr->SymWert.Typ)
+ BEGIN
+ case TempInt: Erg->Contents.Int=Ptr->SymWert.Contents.IWert; break;
+ case TempFloat: Erg->Contents.Float=Ptr->SymWert.Contents.FWert; break;
+ case TempString: strmaxcpy(Erg->Contents.Ascii,Ptr->SymWert.Contents.SWert,255);
+ default: break;
+ END
+ if (Erg->Typ != TempNone) Erg->Relocs = DupRelocs(Ptr->Relocs);
+ if (Ptr->SymType != 0) TypeFlag |= (1 << Ptr->SymType);
+ if ((Ptr->SymSize != (-1)) AND (SizeFlag == (-1))) SizeFlag = Ptr->SymSize;
+ if (NOT Ptr->Defined)
+ BEGIN
+ if (Repass) SymbolQuestionable = True;
+ UsesForwards = True;
+ END
+ Ptr->Used = True;
+ LEAVE;
+ END
+
+ /* Symbol evtl. im ersten Pass unbekannt */
+
+ if (PassNo<=MaxSymPass)
+ BEGIN
+ Erg->Typ=TempInt; Erg->Contents.Int=EProgCounter();
+ Repass=True;
+ if ((MsgIfRepass) AND (PassNo>=PassNoForMessage)) WrXError(170,Asc);
+ FirstPassUnknown=True;
+ END
+
+ /* alles war nix, Fehler */
+
+ else WrXError(1010,Asc);
+
+func_exit:
+ if (LVal.Relocs != NULL) FreeRelocs(&LVal.Relocs);
+ if (RVal.Relocs != NULL) FreeRelocs(&RVal.Relocs);
+END
+
+
+ LargeInt EvalIntExpression(char *Asc, IntType Typ, Boolean *OK)
+BEGIN
+ TempResult t;
+
+ *OK = False;
+ TypeFlag = 0; SizeFlag = (-1);
+ UsesForwards = False;
+ SymbolQuestionable = False;
+ FirstPassUnknown = False;
+
+ EvalExpression(Asc, &t);
+ SetRelocs(t.Relocs);
+ if (t.Typ != TempInt)
+ BEGIN
+ if (t.Typ != TempNone) WrError(1135);
+ FreeRelocs(&LastRelocs);
+ return -1;
+ END
+
+ if (FirstPassUnknown) t.Contents.Int &= IntMasks[(int)Typ];
+
+ if (NOT RangeCheck(t.Contents.Int,Typ))
+ if (HardRanges)
+ BEGIN
+ FreeRelocs(&LastRelocs);
+ WrError(1320); return -1;
+ END
+ else
+ BEGIN
+ WrError(260); *OK = True; return t.Contents.Int&IntMasks[(int)Typ];
+ END
+ else
+ BEGIN
+ *OK = True; return t.Contents.Int;
+ END
+END
+
+ Double EvalFloatExpression(char *Asc, FloatType Typ, Boolean *OK)
+BEGIN
+ TempResult t;
+
+ *OK=False;
+ TypeFlag=0; SizeFlag=(-1);
+ UsesForwards=False;
+ SymbolQuestionable=False;
+ FirstPassUnknown=False;
+
+ EvalExpression(Asc,&t);
+ switch (t.Typ)
+ BEGIN
+ case TempNone:
+ return -1;
+ case TempInt:
+ t.Contents.Float=t.Contents.Int;
+ break;
+ case TempString:
+ WrError(1135); return -1;
+ default:
+ break;
+ END
+
+ if (NOT FloatRangeCheck(t.Contents.Float,Typ))
+ BEGIN
+ WrError(1320); return -1;
+ END
+
+ *OK=True; return t.Contents.Float;
+END
+
+ void EvalStringExpression(char *Asc, Boolean *OK, char *Result)
+BEGIN
+ TempResult t;
+
+ *OK=False;
+ TypeFlag=0; SizeFlag=(-1);
+ UsesForwards=False;
+ SymbolQuestionable=False;
+ FirstPassUnknown=False;
+
+ EvalExpression(Asc,&t);
+ if (t.Typ!=TempString)
+ BEGIN
+ *Result='\0';
+ if (t.Typ!=TempNone) WrError(1135);
+ return;
+ END
+
+ strmaxcpy(Result,t.Contents.Ascii,255); *OK=True;
+END
+
+
+ static void FreeSymbol(SymbolPtr *Node)
+BEGIN
+ PCrossRef Lauf;
+
+ free((*Node)->SymName);
+
+ if ((*Node)->SymWert.Typ == TempString)
+ free((*Node)->SymWert.Contents.SWert);
+
+ while ((*Node)->RefList != Nil)
+ BEGIN
+ Lauf = (*Node)->RefList->Next;
+ free((*Node)->RefList);
+ (*Node)->RefList = Lauf;
+ END
+
+ FreeRelocs(&((*Node)->Relocs));
+
+ free(*Node); *Node = Nil;
+END
+
+static String serr,snum;
+
+ Boolean EnterTreeNode(SymbolPtr *Node, SymbolPtr Neu, Boolean MayChange, Boolean DoCross)
+BEGIN
+ SymbolPtr Hilf,p1,p2;
+ Boolean Grown,Result;
+ ShortInt CompErg;
+
+ /* Stapelueberlauf pruefen, noch nichts eingefuegt */
+
+ ChkStack(); Result = False;
+
+ /* an einem Blatt angelangt--> einfach anfuegen */
+
+ if (*Node == Nil)
+ BEGIN
+ (*Node) = Neu;
+ (*Node)->Balance = 0; (*Node)->Left = Nil; (*Node)->Right = Nil;
+ (*Node)->Defined = True; (*Node)->Used = False;
+ (*Node)->Changeable = MayChange; (*Node)->RefList = Nil;
+ if (DoCross)
+ BEGIN
+ (*Node)->FileNum = GetFileNum(CurrFileName);
+ (*Node)->LineNum = CurrLine;
+ END
+ return True;
+ END
+
+ CompErg = StrCmp(Neu->SymName, (*Node)->SymName, Neu->Attribute,
+ (*Node)->Attribute);
+
+ if (CompErg > 0)
+ BEGIN
+ Grown = EnterTreeNode(&((*Node)->Right), Neu, MayChange, DoCross);
+ 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 (CompErg < 0)
+ BEGIN
+ Grown = EnterTreeNode(&((*Node)->Left), Neu, MayChange, DoCross);
+ 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) AND (NOT MayChange))
+ BEGIN
+ strmaxcpy(serr, (*Node)->SymName, 255);
+ if (DoCross)
+ BEGIN
+ sprintf(snum, ",%s %s:%ld", getmessage(Num_PrevDefMsg),
+ GetFileName((*Node)->FileNum), (long)((*Node)->LineNum));
+ strmaxcat(serr, snum, 255);
+ END
+ WrXError(1000, serr);
+ FreeSymbol(&Neu);
+ END
+ else
+ BEGIN
+ if (NOT MayChange)
+ BEGIN
+ if ((Neu->SymWert.Typ != (*Node)->SymWert.Typ)
+ OR ((Neu->SymWert.Typ == TempString) AND (strcmp(Neu->SymWert.Contents.SWert, (*Node)->SymWert.Contents.SWert) != 0))
+ OR ((Neu->SymWert.Typ == TempFloat ) AND (Neu->SymWert.Contents.FWert != (*Node)->SymWert.Contents.FWert))
+ OR ((Neu->SymWert.Typ == TempInt ) AND (Neu->SymWert.Contents.IWert != (*Node)->SymWert.Contents.IWert)))
+ BEGIN
+ if ((NOT Repass) AND (JmpErrors>0))
+ BEGIN
+ if (ThrowErrors) ErrorCount -= JmpErrors;
+ JmpErrors = 0;
+ END
+ Repass = True;
+ if ((MsgIfRepass) AND (PassNo >= PassNoForMessage))
+ BEGIN
+ strmaxcpy(serr, Neu->SymName, 255);
+ if (Neu->Attribute != (-1))
+ BEGIN
+ strmaxcat(serr, "[", 255);
+ strmaxcat(serr, GetSectionName(Neu->Attribute), 255);
+ strmaxcat(serr, "]", 255);
+ END
+ WrXError(80, serr);
+ END
+ END
+ END
+ Neu->Left = (*Node)->Left; Neu->Right = (*Node)->Right;
+ Neu->Balance = (*Node)->Balance;
+ if (DoCross)
+ BEGIN
+ Neu->LineNum = (*Node)->LineNum; Neu->FileNum = (*Node)->FileNum;
+ END
+ Neu->RefList = (*Node)->RefList; (*Node)->RefList = Nil;