-
Notifications
You must be signed in to change notification settings - Fork 3
/
pasmodoc.html
1885 lines (1530 loc) · 51.1 KB
/
pasmodoc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" >
<title>Pasmo documentation.</title>
</head>
<body>
<h1>Pasmo documentation.</h1>
<p>
(C) 2004-2006 Julián Albo.
</p>
<p>
Use and distribution allowed under the terms of the GPL license.
</p>
<p>
Last revision date: 28-may-2006
</p>
<p>
Current Pasmo version: 0.6.0 (in progress)
</p>
<h2>Short index.</h2>
<ul>
<li>
<a href="#longindex">Long index.</a>
</li>
<li>
<a href="#intro">Introduction.</a>
</li>
<li>
<a href="#install">Installation.</a>
</li>
<li>
<a href="#command">Command line use.</a>
</li>
<li>
<a href="#codegen">Code generation modes.</a>
</li>
<li>
<a href="#source">Source code format.</a>
</li>
<li>
<a href="#directives">Directives.</a>
</li>
<li>
<a href="#operators">Operators.</a>
</li>
<li>
<a href="#macros">Macros.</a>
</li>
<li>
<a href="#discussion">About suggestions and possible improvements.</a>
</li>
<li>
<a href="#tricks">Tricks.</a>
</li>
<li>
<a href="#bugs">Bugs.</a>
</li>
<li>
<a href="#epilogue">Epilogue.</a>
</li>
</ul>
<h2><a name="longindex">Long index.</a></h2>
<ul>
<li>
<a href="#intro">Introduction.</a>
</li>
<li>
<a href="#install">Installation.</a>
</li>
<li>
<a href="#command">Command line use.</a>
</li>
<li>
<a href="#codegen">Code generation modes.</a>
<ul>
<li><a href="#codegendefault">Default mode.</a></li>
<li><a href="#codegenbin">--bin mode.</a></li>
<li><a href="#codegencom">--com mode.</a></li>
<li><a href="#codegendump">--dump mode.</a></li>
<li><a href="#codegenhex">--hex mode.</a></li>
<li><a href="#codegenprl">--prl mode.</a></li>
<li><a href="#codegenrel">--rel mode.</a></li>
<li><a href="#codegencmd">--cmd mode.</a></li>
<li><a href="#codegentap">--tap mode.</a></li>
<li><a href="#codegentzx">--tzx mode.</a></li>
<li><a href="#codegencdt">--cdt mode.</a></li>
<li><a href="#codegentapbas">--tapbas mode.</a></li>
<li><a href="#codegentzxbas">--tzxbas mode.</a></li>
<li><a href="#codegencdtbas">--cdtbas mode.</a></li>
<li><a href="#codegenplus3dos">--plus3dos mode.</a></li>
<li><a href="#codegenamsdos">--amsdos mode.</a></li>
<li><a href="#codegenmsx">--msx mode.</a></li>
<li><a href="#codegensymbol">Symbol table.</a></li>
</ul>
</li>
<li>
<a href="#source">Source code format.</a>
<ul>
<li><a href="#sourcegeneral">Generalities.</a>
<li><a href="#sourcelit">Literals.</a>
<ul>
<li><a href="#sourcelitnum">Numeric literals.</a></li>
<li><a href="#sourcelitstr">String literals.</a></li>
</ul>
</li>
<li><a href="#sourceident">Identifiers.</a>
<li><a href="#sourcefilename">File names.</a>
<li><a href="#sourcelabel">Labels.</a>
</ul>
</li>
<li>
<a href="#directives">Directives.</a>
<ul>
<li><a href="#dir8080">.8080</a></li>
<li><a href="#dir8086">.8086</a></li>
<li><a href="#dirdephase">.DEPHASE</a></li>
<li><a href="#direrror">.ERROR</a></li>
<li><a href="#dirphase">.PHASE</a></li>
<li><a href="#dirshift">.SHIFT</a></li>
<li><a href="#dirwarning">.WARNING</a></li>
<li><a href="#dirz80">.Z80</a></li>
<li><a href="#diraseg">ASEG</a></li>
<li><a href="#dircseg">CSEG</a></li>
<li><a href="#dirdefb">DEFB</a></li>
<li><a href="#dirdefl">DEFL</a></li>
<li><a href="#dirdefm">DEFM</a></li>
<li><a href="#dirdefs">DEFS</a></li>
<li><a href="#dirdefw">DEFW</a></li>
<li><a href="#dirds">DS</a></li>
<li><a href="#dirdseg">DSEG</a></li>
<li><a href="#dirdw">DW</a></li>
<li><a href="#direlse">ELSE</a></li>
<li><a href="#dirend">END</a></li>
<li><a href="#direndif">ENDIF</a></li>
<li><a href="#direndm">ENDM</a></li>
<li><a href="#direndp">ENDP</a></li>
<li><a href="#direqu">EQU</a></li>
<li><a href="#direxitm">EXITM</a></li>
<li><a href="#dirif">IF</a></li>
<li><a href="#dirif1">IF1</a></li>
<li><a href="#dirif2">IF2</a></li>
<li><a href="#dirifdef">IFDEF</a></li>
<li><a href="#dirifndef">IFNDEF</a></li>
<li><a href="#dirinclude">INCLUDE</a></li>
<li><a href="#dirincbin">INCBIN</a></li>
<li><a href="#dirirp">IRP</a></li>
<li><a href="#dirirp">IRPC</a></li>
<li><a href="#dirlocal">LOCAL</a></li>
<li><a href="#dirmacro">MACRO</a></li>
<li><a href="#dirorg">ORG</a></li>
<li><a href="#dirproc">PROC</a></li>
<li><a href="#dirpublic">PUBLIC</a></li>
<li><a href="#dirrept">REPT</a></li>
<li><a href="#dirset">SET</a></li>
</ul>
</li>
<li>
<a href="#operators">Operators.</a>
<ul>
<li><a href="#opergeneral">Generalities.</a></li>
<li><a href="#opertable">Table of precedence.</a></li>
<li><a href="#operlist">List of operators.</a></li>
</ul>
</li>
<li>
<a href="#macros">Macros.</a>
<ul>
<li><a href="#macrogeneral">Generalities.</a></li>
<li><a href="#macrodirectives">Directives.</a>
<ul>
<li><a href="#macroshift">.SHIFT</a></li>
<li><a href="#macroendm">ENDM</a></li>
<li><a href="#macroexitm">EXITM</a></li>
<li><a href="#macroirp">IRP</a></li>
<li><a href="#macroirpc">IRPC</a></li>
<li><a href="#macromacro">MACRO</a></li>
<li><a href="#macrorept">REPT</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#discussion">About suggestions and possible improvements.</a>
</li>
<li>
<a href="#tricks">Tricks.</a>
</li>
<li>
<a href="#bugs">Bugs.</a>
</li>
<li>
<a href="#epilogue">Epilogue.</a>
</li>
</ul>
<h2><a name="intro">Introduction.</a></h2>
<p>
Pasmo is a multiplatform Z80 and 8080 cross-assembler, easy to compile
and easy to use.
It can generate object code in several formats suitable for many Z80
machines and emulators.<br>
Pasmo generates fixed position code, can not be used to create relocatable
object files for use with linkers.
</p>
<p>
Pasmo is compatible with the syntax used in several old assemblers, by
supporting several styles of numeric and string literals and by
providing several names of the most used directives.<br>
However, in Pasmo the Z80 mnemonics, register and flags names and
directives are reserved words, this may require changes of symbol
names conflicting in some programs.
</p>
<p>
Pasmo can also generate the 8086 equivalent to the z80 assembly code.
It can create COM files for ms-dos, by using the binary generation mode,
or CMD files for CP/M 86, by using
<a href="#codegencmd">the --cmd generation mode</a>.
This feature is experimental, use with care.
</p>
<h2><a name="install">Installation.</a></h2>
<p>
Download Pasmo from
<a href="http://www.arrakis.es/~ninsesabe/pasmo/"
>http://www.arrakis.es/~ninsesabe/pasmo/</a>.<br>
Several binary executable are provided in the web, if your platform
is not between these, or wants a more recent version, you must
download the source package and compile it. If you want to compile it
in windows you can use cygwin or mingw with the Makefile provided, with
other compilers you may need to create a project, workspace or whatever
your compiler or IDE uses.<br>
To compile you need gcc version 2.95 or later, with the c++ language
included (usually a package called g++-something).<br>
Others compilers may also be used, any reasonable standard complaint
c++ compiler must compile it with few or none corrections.<br>
From version 0.5.2 a configure script is provided. You can use the
usual './configure ; make ; make install' procedure.<br>
You have also an official Debian package.
</p>
<h2><a name="command">Command line use.</a></h2>
<p>
Pasmo is invoked from command line as:
</p>
<pre>
pasmo [options] [file.asm] [file.bin] [file.symbol [file.publics] ]
</pre>
<p>
Where file.asm is the source file, file.bin is the object file to be
created and optionally file.symbol is the file where the symbol table
will be written and file.publics is the file for the public symbols
table.
Both symbol file names can be an empty string for no generation or - to
write in the standard output.
When the --public option is used this is handled in another way, see
below.
The source and object file can also be specified
with the options --input and --output.
If the --link option is used the source file must be omitted.
</p>
<p>
Options can be zero or more of the following:
</p>
<dl>
<dt>-1 (digit 'one')</dt>
<dd>Same as --debinfo1</dd>
<dt>-8</dt>
<dd>Same as --w8080</dd>
<dt>-B</dt>
<dd>Same as --bracket</dd>
<dt>-E</dt>
<dd>Same as --equ</dd>
<dt>-I (upper case i)</dt>
<dd>Same as --include-dir</dd>
<dt>-S</dt>
<dd>Same as --skiplines</dd>
<dt>-d</dt>
<dd>Same as --debinfo</dd>
<dt>-h</dt>
<dd>Same as --help</dd>
<dt>-m</dt>
<dd>Same as --module</dd>
<dt>-o</dt>
<dd>Same as --output</dd>
<dt>-v</dt>
<dd>Same as --verbose</dd>
<dt>--86</dt>
<dd>
Generate 8086 code instead of Z80. This feature is experimental.
</dd>
<dt>--after</dt>
<dd>
Place common segments after absolute segment when linking.
</dd>
<dt>--alocal</dt>
<dd>
Use autolocal mode. In this mode all labels that begins with '_'
are locals. See <a href="#sourcelabel">the chapter about labels</a> for
details.
</dd>
<dt>--amsdos</dt>
<dd>
Generate the object file in Amsdos format.
</dd>
<dt>--asm</dt>
<dd>
Sets the assembly language used at start (can be overriden in the source
with the .8080 and .Z80 directives). Possible values are Z80 and 8080.
If not specified, Z80 mode is assumed.
</dd>
<dt>--bin</dt>
<dd>
Generate the object file in raw binary format without headers.
</dd>
<dt>--bracket</dt>
<dd>
Use bracket only mode. In this mode the parenthesis are valid only in
expressions, for indirections brackets must be used.
</dd>
<dt>--cdt</dt>
<dd>
Generate the object file in .cdt format.
</dd>
<dt>--cdtbas</dt>
<dd>
Same as --cdt but adding a Basic loader before the code.
</dd>
<dt>--cmd</dt>
<dd>
Generate the object file in CP/M 86 CMD format.
</dd>
<dt>--com</dt>
<dd>
Generate the objet file in COM format.
</dd>
<dt>--debinfo</dt>
<dd>
Show debug info during second pass of assembly.
</dd>
<dt>--debinfo1</dt>
<dd>
Show debug info during both passes of assembly.
</dd>
<dt>--dump</dt>
<dd>
Generate the object file in readable hex dump format.
</dd>
<dt>--equ</dt>
<dd>
Predefine a symbol. Predefined symbol are treated in a similar way as
defineds with EQU. Some possible uses are exemplified in the black.asm
example file. The syntax is: '--equ label=value' where label must be
a valid label name and value a numeric constant in a format valid in
pasmo syntax. The part =value is optional, if not specified the value
asigned is FFFF hex.
</dd>
<dt>--err</dt>
<dd>
Direct error messages to standard output instead of error output
(except for errors in options).
</dd>
<dt>--help</dt>
<dd>
Show short information about options in standard error and exit.
</dd>
<dt>--hex</dt>
<dd>
Generate the object file in Intel HEX format.
</dd>
<dt>--include-dir</dt>
<dd>
Add directory to the list for searching files in INCLUDE and INCBIN.
</dd>
<dt>--input</dt>
<dd>
Specify the file name to assembly. If this option is specified, the
argument file.asm must be omitted.
</dd>
<dt>--link</dt>
<dd>
Link only. Do not assembly any source, just link relocatable modules.
</dd>
<dt>--listing</dt>
<dd>
Specify a file name to generate an assembly listing.
</dd>
<dt>--module</dt>
<dd>
Specify a REL module to link.
</dd>
<dt>--msx</dt>
<dd>
Generate the object file in MSX format.
</dd>
<dt>--name</dt>
<dd>
Name to put in the header in the formats that use it. If unspecified
the object file name will be used.
</dd>
<dt>--nocase</dt>
<dd>
Make identifiers case insensitive.
</dd>
<dt>--numerr</dt>
<dd>
Set the numbers of non fatal errors that can be reported before stop
the assembly. If not specified a value of 1 is assumed. A value of 0
means to never stop (almost, but Pasmo will probably run out of memory
before reaching the limit).
</dd>
<dt>--output</dt>
<dd>
Specify the file name wher to put the object code generated. If this option
is specified, the argument file.bin must be omitted.
</dd>
<dt>--plus3dos</dt>
<dd>
Generate the object file in PLUS3DOS format.
</dd>
<dt>--prl</dt>
<dd>
Generate the object file in CP/M PRL format.
</dd>
<dt>--public</dt>
<dd>
Only the public symbols table is generated, using the file.symbol name,
file.symbol must not be specified when using this option.
</dd>
<dt>--skiplines</dt>
<dd>
Skip the number of lines specified at the begin of the input file.
Useful for debugging during Pasmo developmente, don't know if it
can have other interesting uses.
</dd>
<dt>--tap</dt>
<dd>
Generate the object file in .tap format.
</dd>
<dt>--tapbas</dt>
<dd>
Same as --tap but adding a Basic loader before the code.
</dd>
<dt>--tzx</dt>
<dd>
Generate the object file in .tzx format.
</dd>
<dt>--tzxbas</dt>
<dd>
Same as --txz but adding a Basic loader before the code.
</dd>
<dt>--verbose</dt>
<dd>
Verbose mode. Show progress information about loading of files,
progress of assembly and maybe other things.
</dd>
<dt>--version</dt>
<dd>
Show Pasmo version infornation in standar output and exit.
</dd>
<dt>--w8080</dt>
<dd>
Show warnings when Z80 instructions that have no equivalent in 8080
are used. Makes easy to write programs for 8080 processor using Z80
assembler syntax.
</dd>
</dl>
<p>
When no option for code generation is specified, --bin is used by
default.
</p>
<p>
The -d option is intended to debug pasmo itself, but can also be useful
to find errors in asm code. When used the information is showed in the
standard output. Error messages goes to error ouptut unless the --err
option is used.
</p>
<h2><a name="codegen">Code generation modes.</a></h2>
<h3><a name="codegendefault">Default mode</a></h3>
<p>
If none of the code generation options is specified, then --bin mode is
used by default.
</p>
<h3><a name="codegenbin">--bin mode</a></h3>
<p>
The --bin mode just dumps the code generated from the first
position used without any header. This mode can be used for
direct generation of CP/M or MSX COM files, supposed that you
use a ORG 100H directive at the beginning of the code, or to
generate blocks of code to be INCBINed in other programs.
</p>
<h3><a name="codegencom">--com mode</a></h3>
<p>
The --com mode is similar to --bin, but code is assembled or linked
starting at 0100 hex without the need to ORG it. The reason for
the use of the two options is to make easier to assemble whithout
changes code written for DR ASM or similar assemblers and
code written for use with a relocatable asembler such as DR RMAC
and a linker.
</p>
<h3><a name="codegendump">--dump mode</a></h3>
<p>
The --dump mode generates a human readable uppercase hexadecimal dump,
consisting of lines of 16 hexadcimal two digit numbers separated by
spaces with the address of the code at the beginning of the line as a
four digit hexadecimal number followed by a collon and a space.
</p>
<h3><a name="codegenhex">--hex mode</a></h3>
<p>
The --hex mode generates code in Intel HEX format. This format can
be used with the LOAD or HEXCOM CP/M utilities, can be transmitted
more easily than a binary format, and is also used in some PROM
programming tools.
</p>
<h3><a name="codegenprl">--prl mode</a></h3>
<p>
The prl format is used in several variants of Digital Research CP/M
operating system. In pasmo is supported only to create RSX files for
use in CP/M Plus, use for PRL files in MP/M is not supported because
I don't have a MP/M system, real or emulated, where to test it.
</p>
<h3><a name="codegenrel">--rel mode</a></h3>
<p>
The REL relocatable format is used by Digital Research and Microsoft
assemblers and compilers, and many others.
This version of Pasmo has preliminar support for it, supporting only
program segment, PUBLIC symbols, and sources that not use ORG
directives.
Note that for compatibility you probably must use the --nocase mode,
or write all public symbols in upper case. Remeber also that in REL
files the identifiers are truncated to 6 characteres.
</p>
<h3><a name="codegencmd">--cmd mode</a></h3>
<p>
The --cmd option generates a CP/M 86 CMD mode, using the 8080 memory
model of CP/M 86. Used in conjuction with the --86 option can easily
generate CP/M 86 executables from CP/M 80 sources with minimal changes.
</p>
<h3><a name="codegentap">--tap mode</a></h3>
<p>
The --tap options generates a tap file with a code block, with the
loading position set to the beginnig of the code so you can load it
from Basic with a
<strong>LOAD "" CODE</strong>
instruction.
</p>
<h3><a name="codegentzx">--tzx mode</a></h3>
<p>
Same as <a href="#codegentap">--tap</a> but using tzx format instead of tap.
</p>
<h3><a name="codegencdt">--cdt mode</a></h3>
<p>
The --cdt options generates a cdt file with a code block, with the
loading position set to the beginning of the code and the start
address to the start point specified in the source, if any, so you
can use
<strong>RUN ""</strong>
to execute it or
<strong>LOAD ""</strong>
to load it.
</p>
<h3><a name="codegentapbas">--tapbas mode</a></h3>
<p>
With the --tapbas option a tap file is generated with two parts:
a Basic loader and a code block with the object code. The Basic
loader does a CLEAR before the initial address of the code, loads
the code, and executes it if a entry point is defined (see the
<a href="#dirend">END</a>
directive). That way you can directly launch the code in a emulator,
or transfer it to a tape for use in a real Spectrum.
</p>
<h3><a name="codegentzxbas">--tzxbas mode</a></h3>
<p>
Same as <a href="#codegentapbas">--tapbas</a> but using tzx format instead
of tap.
</p>
<h3><a name="codegencdtbas">--cdtbas mode</a></h3>
<p>
Same as <a href="#codegentapbas">--tapbas</a> but using cdt format instead
of tap and with a Locomotive Basic loader instead of Spectrum Basic.
</p>
<h3><a name="codegenplus3dos">--plus3dos mode</a></h3>
<p>
Generate the object file in plus3dos format, used by the Spectrum +3 disks.
The file can be loaded from Basic with a
<strong>LOAD "filename" CODE</strong>
instruction.
</p>
<h3><a name="codegenamsdos">--amsdos mode</a></h3>
<p>
Generate the object file with Amsdos header, used by the Amstrad CPC
on disk files. The file generated can be loaded from Basic with
<strong>LOAD "filename", address</strong>
or executed with
<strong>RUN "filename"</strong>
if an entry point has been specified in the source (see the
<a href="#dirend">END</a>
directive).
</p>
<h3><a name="codegenmsx">--msx mode</a></h3>
<p>
Generate the object file with header for use with BLOAD in MSX Basic.
</p>
<h3><a name="codegensymbol">Symbol table</a></h3>
<p>
The symbol table generated contains all identifiers used in the program,
with the locals represented as a 8 digit hexadecimal number in order of
use, unless the --public option is used. In that case only the symbols
specified in PUBLIC directives are listed.
</p>
<p>
The symbol table format is a list of EQU directives. That way you can
INCLUDE it in another source to create programs composed of several
blocks.
</p>
<h2><a name="source">Source code format.</a></h2>
<h3><a name="sourcegeneral">Generalities.</a></h3>
<p>
Source code files must be valid text files in the platform used. The use of,
for example, unix text files under pasmo in windows, is unsupported and the
result is undefined (may depend of the compiler used to build pasmo, for
example). The result of the use of a file that contains vertical tab or
form feed characters is also undefined.
</p>
<p>
Some symbols have several meanings depending of his use and the context,
this is caused by the intent to be source compatible with several old
assemblers and to allow the use of operators commonly used in another
languages.<br />
The recommended way to avoid mistakes is to always separate the operators
and his operands with white space, specially inside macros.
</p>
<p>
Everything after a ; in a line is a comment (unlees the ; is part of a
string literal, of course).
There are no multiline comments, you can use IF 0 .... ENDIF instead
(but see <a href="#dirinclude">INCLUDE</a>).<br>
If the comment begins with ;; instead of a single ; it will not be
included in macro expansion.
</p>
<p>
String literals are written to the object file without any character set
translation. Then the use of any character with a different meaning in
the platform were pasmo is running and the destination machine must be
avoided, and the code of the character may be used instead. That also
means that using Pasmo in any machine that uses a non ascii compatible
character set may be difficult, and that a source written in utf-8 may
give undesired results. This may be changed in future versions of Pasmo.
</p>
<p>
A line may begin with a decimal number followed by blanks. This number
is ignored by the assembler, is allowed for compatibility with old
assemblers. The line number reported in errors is the sequential number
of the line in the file, not this.
</p>
<p>
Blanks are significative only in string literals and when they separate
lexical elements. Any number of blanks has the same meaning as one.
A blank between operators and operands is allowed but no required except
when the same character has other meaning as prefix ('$' and '%', for
example).
</p>
<h3><a name="sourcelit">Literals.</a></h3>
<h4><a name="sourcelitnum">Numeric literals.</a></h4>
<p>
Numeric literals can be written in decimal, binary, octal and hexadecimal
formats. Several formats are accepted to obtain compatibility with the
source format of several assemblers.
</p>
<p>
A literal that begins with $ is a hexadecimal constant, except if the
literal is only the $ symbol, in that case is an operator, see below.
</p>
<p>
A literal that begins with # is a hexadecimal constant, except if there
are two consecitives #, see the ## operator.
</p>
<p>
A literal that begins with & can be hexadecimal, octal or binary
constant, depending of the character that follows the &: H means
hexadecimal, O octal and X hexadecimal, if none of this the caracter
must be a valid hexadecimal digit and the constant is hexadecimal.
See also the use of & in macros.
</p>
<p>
A literal that begins with % is a binary constant. See also the use of
% in macro arguments.
</p>
<p>
A literal that begins with a decimal digit can be a decimal, binary,
octal or hexadecimal.
If the digit is 0 and the following character is an X, the number is
hexadecimal.
If not, the suffix of the literal is examined: D means decimal, B binary,
H hexadcimal and O or Q octal, in any other case is taken as decimal.
Take care, FFFFh for example is not an hexadecimal constant, is an
identifier, to write it with the suffix notation you must do it as 0FFFFh.
</p>
<p>
All numeric formats can have $ signs between the digits to improve
readability. They are ignored.
</p>
<h4><a name="sourcelitstr">String literals.</a></h4>
<p>
There are two formats of string literals: single or double quote
delimited.
</p>
<p>
A string literal delimited with single quotes is the simpler format,
all characters are included in the string without any special
interpretation, with the only exception that two consecutive single
quotes are taken as one single quote character to be included in the
string. For example: the single quote delimited string
'That''s all folks' generates the same string as the double quote
delimited "That's all folks".
</p>
<p>
A string literal delimited with double quotes is interpreted in a
way similar to the C and C++ languages. The \ character is taken
as escape character, with the following interpretations: n is a
new line character (0A hex), r is a carriage return (0D hex), t is
a tabulator (09 hex), a is a bell (07 hex), x indicates that the
two next characters will be considered the hexadecimal code of
a char and a char with that code is inserted, an octal digit prefixes
and begins an octal number of up to three digits, and the corresponding
character is inserted into the string, the characters \ and "
means to insert itself in the string, and any other char is reserved
for future use.
</p>
<p>
A string literal of length 1 ot 2 can be used as a numeric constant with
the numeric value of the first character, and the second in his case as
the high order byte.
This allows expressions such as 'A' + 80h to be evaluated as expected.
</p>
<h3><a name="sourceident">Identifiers.</a></h3>
<p>
Identifiers are the names used for labels, EQU and DEFL symbols and
macro names and parameters. The names of the Z80 mnemonics, registers
and flag names, and of pasmo operands and assemble directives are
reserved and can not be used as names of identifiers, except in
macro parameters.
Reserved names are case insensitive, even if case sensitive mode is used.
</p>
<p>
In the following 'letter' means an english letter character in
upper or lower case. Characters that correspond to letters in
other languages are not allowed in identifiers.
</p>
<p>
Identifiers begins with a letter, '_', '?', '@' or '.', followed for
zero or more letter, decimal digit, '_', '?', '@', '.' or '$'.
The '$' are ignored, but a reserved word with a '$' embedded or appended
is not recognized as such.
</p>
<p>
Identifiers that begins with '_' are special when using autolocal mode,
see the --alocal option and
<a href="#sourcelabel">the chapter about labels</a>
for details.
The check for autolocal is done before stripping '$', then $_name is
not considered local.
</p>
<p>
Identifiers are case sensitive if the option --nocase is not used.
When using --nocase, they are always converted to upper case.
</p>
<h3><a name="sourcefilename">File names.</a></h3>
<p>
File names are used in the INCLUDE and INCBIN directives. They follow
special rules.
</p>
<p>
A file name that begins with a double quote character must end with
another double quote, and the file name contains all character between
them without any special interpretation.
</p>
<p>
A file name that begins with a single quote character must end with
another single quote, and the file name contains all character between
them without any special interpretation.
</p>
<p>
In any other case all characteres until the next blank or the end of line
are considered part of the file name. Blank characters are space and tab.
</p>
<h3><a name="sourcelabel">Labels.</a></h3>
<p>
A label can be placed at the beginning of any line, before any
assembler mnemonic or directive. Optionally can be followed by
a ':', but is not recommended to use it in directives, for
compatibility with other assemblers, however it may be needed if a
macro with the same name as the label is already defined.
</p>
<p>
A line that has a label with no mnemonic nor directive is also valid.
</p>
<p>
The label has special meaning in the MACRO, EQU and DEFL directives,
in any other case the value of the current code generation position is
assigned to the label.
</p>
<p>
Labels can be used before his definition, but the result of doing this
with labels assigned with DEFL is undefined.
</p>
<p>
The value of a label cannot be changed unless DEFL is used in all
assignments of that label. If the value assigned to a label is
different in the two passes of the assembly the program is illegal,
but is not guaranteed that an error is generated. However, is legal