Penguin
Annotated edit history of as86(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 as86
2 !!!as86
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 OPTIONS
7 AS86 SOURCE
8 Using GASP
9 SEE ALSO
10 BUGS
11 ----
12 !!NAME
13
14
15 as86 - Assembler for 8086..80386 processors
16 !!SYNOPSIS
17
18
19 __as86__ [[__-0123agjuw__] [[__-lm__[[__list__]]
20 [[__-n name__] [[__-o obj__] [[__-b__[[__bin__]]
21 [[__-s sym__] [[__-t textseg__] __src__
22
23
24 __as86_encap prog.s prog.v__ [[__prefix___] [[__as86
25 options__]
26 !!DESCRIPTION
27
28
29 __as86__ is an assembler for the 8086..80386 processors,
30 it's syntax is closer to the intel/microsoft form rather
31 than the more normal generic form of the unix system
32 assembler.
33
34
35 The __src__ file can be '-' to assemble the standard
36 input.
37
38
39 This assembler can be compiled to support the 6809 cpu and
40 may even work.
41
42
43 __as86_encap__ is a shell script to call as86 and convert
44 the created binary into a C file __prog.v__ to be
45 included in or linked with programs like boot block
46 installers. The __prefix___ argument is a prefix to be
47 added to all variables defined by the source, it defaults to
48 the name of the source file. The variables defined include
49 __prefix_start prefix_size__ and __prefix_data__ to
50 define and contain the code, plus integers containing the
51 values of all exported labels. Either or both the
52 __prog.s__ and __prog.v__ arguments can be '-' for
53 standard in/out.
54 !!OPTIONS
55
56
57 __-0__
58
59
60 start with 16-bit code segment, warn for all instructions
61
62
63 __-1__
64
65
66 start with 16-bit code segment, warn for all instructions
67
68
69 __-2__
70
71
72 start with 16-bit code segment, warn for all instructions
73
74
75 __-3__
76
77
78 start with 32-bit code segment, don't warn for any
79 instructions. (not even 486 or 586)
80
81
82 __-a__
83
84
85 enable partial compatibility with Minix asld. This swaps the
86 interpretation of round brackets and square brackets as well
87 as making alterations to the code generation and syntax for
88 16bit jumps and calls. (
89
90
91 __-g__
92
93
94 only put global symbols in object or symbol
95 file
96
97
98 __-j__
99
100
101 replace all short jumps with similar 16 or 32 bit jumps, the
102 16 bit conditional branches are encoded as a short
103 conditional and a long unconditional branch.
104
105
106 __-O__
107
108
109 this causes the assembler to add extra passes to try to use
110 forward references to reduce the bytes needed for some
111 instructions. If the labels move on the last pass the
112 assembler will keep adding passes until the labels all
113 stabilise (to a maximum of 30 passes) It's probably not a
114 good idea to use this with hand written assembler use the
115 explicit __br bmi bcc__ style opcodes for 8086 code or
116 the __jmp near__ style for conditional i386 instructions
117 and make sure all variables are defined before they are
118 used.
119
120
121 __-l__
122
123
124 produce list file, filename may follow
125
126
127 __-m__
128
129
130 print macro expansions in listing
131
132
133 __-n__
134
135
136 name of module follows (goes in object instead of source
137 name)
138
139
140 __-o__
141
142
143 produce object file, filename follows
144
145
146 __-b__
147
148
149 produce a raw binary file, filename may follow. This is a
150 'raw' binary file with no header, if there's no __-s__
151 option the file starts at location 0.
152
153
154 __-s__
155
156
157 produce an ASCII symbol file, filename follows. The format
158 of this table is designed to be easy to parse for
159 encapsulation and related activities in relation to binary
160 files created with the __-b__ option. If a binary file
161 doesn't start at location zero the first two items in the
162 table are the start and end addresses of the binary
163 file.
164
165
166 __-u__
167
168
169 assume undefined symbols are imported-with-unspecified
170 segment.
171
172
173 __-w-__
174
175
176 allow the assembler to print warning messages.
177
178
179 __-t n__
180
181
182 move all text segment data in segment n+3.
183 !!AS86 SOURCE
184
185
186 Special characters
187
188
189 __*__
190
191
192 Address of the start of the current line.
193
194
195 __; !__
196
197
198 Either of these marks the start of a comment. In addition
199 any 'unexpected' character at the start of a line is assumed
200 to be a comment (but it's also displayed to the
201 terminal).
202
203
204 __$__
205
206
207 Prefix for hexadecimal numbers, the 'C' syntax, eg 0x1234,
208 is also accepted.
209
210
211 __%__
212
213
214 Prefix for binary numbers.
215
216
217 __#__
218
219
220 Prefix for immediate operands.
221
222
223 __[[ ]__
224
225
226 Specifies an indirect operand.
227 Unlike MASM the assembler has no type information on labels
228 just a segment and offset. This means that the way this
229 operator and the immediate prefix work are like traditional
230 assemblers.
231
232
233 Examples:
234 mov ax,bx
235 jmp bx
236 Direct register addressing, the jump copies BX into
237 PC.
238
239
240 mov ax,[[bx]
241 jmp [[bx]
242 Simple indirect register addressing, the jump moves the contents of the location specified by BX into the PC.
243
244
245 mov ax,#1234
246 Immediate value, ax becomes 1234.
247
248
249 mov ax,1234
250 mov ax,_hello
251 mov ax,[[_hello]
252 Absolute addressing, ax is set to contents of location 1234. Note the third option is not strictly consistant but is in place mainly for asld compatibility.
253
254
255 mov ax,_table[[bx]
256 mov ax,_table[[bx+si]
257 mov eax,_table[[ebx*4]
258 mov ax,[[bx+_table]
259 mov ax,[[bx+si+_table]
260 mov eax,[[ebx*4+_table]
261 Indexed addressing, both formats are ok, I think the first is more correct but I tend to used the second. :-)
262
263
264 Conditionals
265
266
267 __IF, ELSE, ELSEIF, ENDIF__
268
269
270 Numeric condition
271
272
273 __IFC, ELSEIFC__
274
275
276 String compare (str1,str2)
277
278
279 __FAIL .FAIL__
280
281
282 Generate user error.
283
284
285 Segment related
286
287
288 __.TEXT .ROM .DATA .BSS__
289
290
291 Set current segment. These can be preceded by the keyword
292 __.SECT__
293
294
295 __LOC__
296
297
298 Set numeric segment 0=TEXT, 3=DATA,ROM,BSS, 14=MAX. The
299 segment order set by the linker is now
300 0,4,5,6,7,8,9,A,B,C,D,E,1,2,3. Segment 0 and all segments
301 above 3 are assumed to be text segment. Note the 64k size
302 restrictions are not imposed for segments 3-14.
303
304
305 Label type definition
306
307
308 __EXPORT PUBLIC .DEFINE__
309
310
311 Export label defined in this object
312
313
314 __ENTRY__
315
316
317 Force linker to include the specified label in
318 a.out
319
320
321 __.GLOBL .GLOBAL__
322
323
324 Define label as external and force import even if it isn't
325 used.
326
327
328 __EXTRN EXTERN IMPORT .EXTERN__
329
330
331 Import list of externally defined labels
332 NB: It doesn't make sense to use imports for raw binary
333 files.
334
335
336 __.ENTER__
337
338
339 Mark entry for old binary file (obs)
340
341
342 Data definition
343
344
345 __DB .DATA1 .BYTE FCB__
346
347
348 List of 1 byte objects.
349
350
351 __DW .DATA2 .SHORT FDB .WORD__
352
353
354 List of 2 byte objects.
355
356
357 __DD .DATA4 .LONG__
358
359
360 List of 4 byte objects.
361
362
363 __.ASCII FCC__
364
365
366 Ascii string copied to output.
367
368
369 __.ASCIZ__
370
371
372 Ascii string copied to output with trailing __nul__
373 byte.
374
375
376 Space definition
377
378
379 __.BLKB RMB .SPACE__
380
381
382 Space is counted in bytes.
383
384
385 __.BLKW .ZEROW__
386
387
388 Space is counted in words. (2 bytes each)
389
390
391 __COMM .COMM LCOMM .LCOMM__
392
393
394 Common area data definition
395
396
397 Other useful pseudo operations.
398
399
400 __.ALIGN .EVEN__
401
402
403 Alignment
404
405
406 __EQU__
407
408
409 Define label
410
411
412 __SET__
413
414
415 Define re-definable label
416
417
418 __ORG .ORG__
419
420
421 Set assemble location
422
423
424 __BLOCK__
425
426
427 Set assemble location and stack old one
428
429
430 __ENDB__
431
432
433 Return to stacked assemble location
434
435
436 __GET INCLUDE__
437
438
439 Insert new file (no quotes on name)
440
441
442 __USE16__ [[__cpu__]
443
444
445 Define default operand size as 16 bit, argument is cpu type
446 the code is expected to run on (86, 186, 286, 386, 486, 586)
447 instructions for cpus later than specified give a
448 warning.
449
450
451 __USE32__ [[__cpu__]
452
453
454 Define default operand size as 32 bit, argument is cpu type
455 the code is expected to run on (86, 186, 286, 386, 486, 586)
456 instructions for cpus later than specified give a warning.
457 If the cpu is not mentioned the assembler ensures it is
458
459
460 __END__
461
462
463 End of compilation for this file.
464
465
466 __.WARN__
467
468
469 Switch warnings
470
471
472 __.LIST__
473
474
475 Listings on/off (1,-1)
476
477
478 __.MACLIST__
479
480
481 Macro listings on/off (1,-1)
482
483
484 Macros, now working, the general form is like
485 this.
486
487
488 MACRO sax mov ax,#?1 MEND sax(1)
489
490
491 Unimplemented/unused.
492
493
494 IDENT
495
496
497 Define object identity string.
498
499
500 SETDP
501
502
503 Set DP value on 6809
504
505
506 MAP
507
508
509 Set binary symbol table map number.
510
511
512 Registers
513
514
515 BP BX DI SI
516 EAX EBP EBX ECX EDI EDX ESI ESP
517 AX CX DX SP
518 AH AL BH BL CH CL DH DL
519 CS DS ES FS GS SS
520 CR0 CR2 CR3 DR0 DR1 DR2 DR3 DR6 DR7
521 TR3 TR4 TR5 TR6 TR7 ST
522
523
524 Operand type specifiers
525
526
527 BYTE DWORD FWORD FAR PTR PWORD QWORD TBYTE WORD
528 NEAR
529
530
531 The 'near and 'far' do not allow multi-segment programming,
532 all 'far' operations are specified explicitly through the
533 use of the instructions: jmpi, jmpf, callf, retf, etc. The
534 'Near' operator can be used to force the use of 80386 16bit
535 conditional branches. The 'Dword' and 'word' operators can
536 control the size of operands on far jumps and
537 calls.
538
539
540 General instructions.
541
542
543 These are in general the same as the instructions found in
544 any 8086 assembler, the main exceptions being a few 'Bcc'
545 (BCC, BNE, BGE, etc) instructions which are shorthands for a
546 short branch plus a long jump and 'BR' which is the longest
547 unconditional jump (16 or 32 bit).
548
549
550 Long branches
551
552
553 BCC BCS BEQ BGE BGT BHI BHIS BLE BLO BLOS BLT BMI BNE BPC
554 BPL BPS BVC BVS BR
555
556
557 Intersegment
558
559
560 CALLI CALLF JMPI JMPF
561
562
563 Segment modifier instructions
564
565
566 ESEG FSEG GSEG SSEG
567
568
569 Byte operation instructions
570
571
572 ADCB ADDB ANDB CMPB DECB DIVB IDIVB IMULB INB INCB MOVB MULB
573 NEGB NOTB ORB OUTB RCLB RCRB ROLB RORB SALB SARB SHLB SHRB
574 SBBB SUBB TESTB XCHGB XORB
575
576
577 Standard instructions
578
579
580 AAA AAD AAM AAS ADC ADD AND ARPL BOUND BSF BSR BSWAP BT BTC
581 BTR BTS CALL CBW CDQ CLC CLD CLI CLTS CMC CMP CMPS CMPSB
582 CMPSD CMPSW CMPW CMPXCHG CSEG CWD CWDE DAA DAS DEC DIV DSEG
583 ENTER HLT IDIV IMUL IN INC INS INSB INSD INSW INT INTO INVD
584 INVLPG INW IRET IRETD J JA JAE JB JBE JC JCXE JCXZ JE JECXE
585 JECXZ JG JGE JL JLE JMP JNA JNAE JNB JNBE JNC JNE JNG JNGE
586 JNL JNLE JNO JNP JNS JNZ JO JP JPE JPO JS JZ LAHF LAR LDS
587 LEA LEAVE LES LFS LGDT LGS LIDT LLDT LMSW LOCK LODB LODS
588 LODSB LODSD LODSW LODW LOOP LOOPE LOOPNE LOOPNZ LOOPZ LSL
589 LSS LTR MOV MOVS MOVSB MOVSD MOVSW MOVSX MOVW MOVZX MUL NEG
590 NOP NOT OR OUT OUTS OUTSB OUTSD OUTSW OUTW POP POPA POPAD
591 POPF POPFD PUSH PUSHA PUSHAD PUSHF PUSHFD RCL RCR REP REPE
592 REPNE REPNZ REPZ RET RETF RETI ROL ROR SAHF SAL SAR SBB SCAB
593 SCAS SCASB SCASD SCASW SCAW SEG SETA SETAE SETB SETBE SETC
594 SETE SETG SETGE SETL SETLE SETNA SETNAE SETNB SETNBE SETNC
595 SETNE SETNG SETNGE SETNL SETNLE SETNO SETNP SETNS SETNZ SETO
596 SETP SETPE SETPO SETS SETZ SGDT SHL SHLD SHR SHRD SIDT SLDT
597 SMSW STC STD STI STOB STOS STOSB STOSD STOSW STOW STR SUB
598 TEST VERR VERW WAIT WBINVD XADD XCHG XLAT XLATB
599 XOR
600
601
602 Floating point
603
604
605 F2XM1 FABS FADD FADDP FBLD FBSTP FCHS FCLEX FCOM FCOMP
606 FCOMPP FCOS FDECSTP FDISI FDIV FDIVP FDIVR FDIVRP FENI FFREE
607 FIADD FICOM FICOMP FIDIV FIDIVR FILD FIMUL FINCSTP FINIT
608 FIST FISTP FISUB FISUBR FLD FLD1 FLDL2E FLDL2T FLDCW FLDENV
609 FLDLG2 FLDLN2 FLDPI FLDZ FMUL FMULP FNCLEX FNDISI FNENI
610 FNINIT FNOP FNSAVE FNSTCW FNSTENV FNSTSW FPATAN FPREM FPREM1
611 FPTAN FRNDINT FRSTOR FSAVE FSCALE FSETPM FSIN FSINCOS FSQRT
612 FST FSTCW FSTENV FSTP FSTSW FSUB FSUBP FSUBR FSUBRP FTST
613 FUCOM FUCOMP FUCOMPP FWAIT FXAM FXCH FXTRACT FYL2X
614 FYL2XP1
615 !!Using GASP
616
617
618 The Gnu assembler preprocessor provides some reasonable
619 implementations of user biased pseudo opcodes.
620
621
622 It can be invoked in a form similar to:
623
624
625 __gasp__
626
627
628 [[__-a...__] __file.s__ [[__file2.s__] __|
629 as86__ [[__...__] __-__ [[__-o obj__] [[__-b
630 bin__]
631
632
633 Be aware though that Gasp generates an error for __.org__
634 commands, if you're not using alternate syntax you can use
635 __org__ instead, otherwise use __block__ and
636 __endb__. The directive __export__ is translated into
637 __.global__, which forces an import, if you are making a
638 file using __-b__ use __public__ or __.define__
639 instead.
640
641
642 The GASP list options have no support in as86.
643 !!SEE ALSO
644
645
646 as(1), ld86(1), bcc(1)
647 !!BUGS
648
649
650 The 6809 version does not support -0, -3, -a or
651 -j.
652
653
654 If this assembler is compiled with BCC this is classed as a
655 'small' compiler, so there is a maximum input line length of
656 256 characters and the instruction to cpu checking is not
657 included.
658
659
660 The checking for instructions that work on specific cpus is
661 probably not complete, the distinction between 80186 and
662 80286 is especially problematic.
663
664
665 The __.text__ and __.data__ pseudo operators are not
666 useful for raw binary files.
667
668
669 When using the __org__ directive the assembler can
670 generate object files that may break ld86(1).
671 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.