NASM version 2.09 available | A86 (Announce)
> Still just for fun I thought I would do a quick compare using your
> example:
Okay, but, uhm, you do know it was supposed to be a NASM-only example?
> LABEL is reserved word in MASM, A86, TASM? So A86 will only compiles your
> program if LABEL is fixed, e.g. LABEL1.
NASM allows access to reserved words by prefixing them with '$'. That can be done automatically using macros (so that you can actually use the unprefixed word as label).
> and is 52 bytes [...]
Yup, you could write smaller code! Try this:
mov ah, 02h
mov dl, '!'
int 21h
retn
Note how this is both less source code and a smaller binary (7 byte). The source code was freed from all the unnecessary red tape. It also makes our user interface less obstructive than ever.
> mov ah, 9h
Why not "mov ah, 9" then? This is worse than both alternatives!
> db "Now tell me this isn't more readable!",13,10,"$"
It's not. Why is there a dollar sign behind all your messages? What's that do? I don't get it. /BLAHMODE
> > I don't doubt that you can write simple programs in A86 easily,
> > but so can I in NASM.
>
> I think it is important to remember you can write complex programs in
> pretty much anything.
How does this program look in A86? Note that here, you can add code to the installation or TSR section as necessary and all the segment arithmetic is automatically fixed up. The vstart option makes the TSR section work as a separate segment, that is, the labels there are addressed as if the section's beginning was at address 0. Besides that, note the relevant size calculations and how actually NASM isn't trying to do the segment setup here; I am doing it. Of course I usually write macros to make such complicated segment setup and access easier, this is the "unrolled" form.
cpu 8086
org 100h
section TRANSIENT
transient:
mov ah, 52h
int 21h
mov ax, word [ es:bx-2 ]
push cs
pop es
.loop:
mov ds, ax
inc ax
cmp word [ 1 ], ax
jne .next
cmp word [ 3 ], resident_size_p
jne .next
mov si, 8
mov di, residentmcb+8
mov cx, si
rep cmpsb
jne .next
push ax
mov ax, 3521h
int 21h
pop ax
cmp bx, handler
jne .error
mov bx, es
cmp ax, bx
jne .error
push ds
lds dx, [ 10h + handler.next ]
mov ax, 2521h
int 21h
pop ds
mov word [ 1 ], 0
mov dx, 'U'
jmp short .exit
.error:
mov dx, (0FFh<<8)+'!'
.exit:
mov ah, 02h
int 21h
mov ah, 4Ch
mov al, dh
int 21h
.next:
add ax, word [ 3 ]
cmp byte [ 0 ], 'M'
je .loop
mov ax, cs
add ax, 10h+transient_size_p
mov ds, ax
mov ax, 3521h
int 21h
mov word [ handler.next +2 ], es
mov word [ handler.next ], bx
mov ah, 25h
mov dx, handler
int 21h
mov ax, cs
mov ds, ax
add word [ residentmcb + 1 ], ax
dec ax
mov es, ax
mov bl, byte [ es:0 ]
mov ax, word [ es:3 ]
sub ax, 10h+transient_size_p+resident_size_p+1
mov word [ newmcb + 3 ], ax
mov byte [ newmcb + 0 ], bl
mov sp, $-$$+100h&~1
mov word [ es:3 ], 10h+transient_size_p-1
mov byte [ es:0 ], 'M'
mov dx, 'I'
jmp short .exit
align 16
residentmcb:
db 'M'
dw 10h+transient_size_p
dw resident_size_p
db 0,0,0
db "I21HOOK",0
; I'd usually do these equates in a macro
transient_size equ $-transient
transient_size_p equ transient_size+15>>4
section RESIDENT vstart=0 align=16
resident:
handler:
; Do Int21 hook functionality here.
jmp 0:0
.next: equ $-4
resident_size equ $-resident
resident_size_p equ resident_size+15>>4
section NEWMCB align=16
newmcb:
db 0
dw 0
dw 0
times 3+8 db 0
> Obviously most of the time it makes sense to do
> things the easy way if easier tools exist.
The easiest way (speaking of simple syntax) would be using nothing but db. That doesn't require a complex assembler either. This is an extreme comparison, but my point here is that doing things the easy way isn't what you should prefer most of the time - I usually prefer higher readability of the source code. (This doesn't mean using HLL macros to write your code for you. It means writing real code in a way so it's readable.)
> I can't compare NASM in that regards as to be honest I've not used it for
> Win32.
I've used neither for any real Win32 effort but then again it just doesn't interest me. I don't see why it would be necessary to write for a Win32 platform, DOS programs done right are complex enough.
> > Int21.09 but I don't like it that much.)
>
> Any particular reason?
It uses a dollar sign as string terminator. That is silly. (It also doesn't allow displaying device names, as they'll often contain dollar signs.)
> Obviously not easy to use ;)
Yeah.. I would assume D86 doesn't work there
> Still for those of us with A86 and A86 formatted
> code/libraries be aware we may occasionally still use it.
I never said anything against that
---
l
Complete thread:
- NASM version 2.09 available - rr, 25.08.2010, 13:27 (Announce)
- NASM version 2.09 available - DOS386, 26.08.2010, 09:10
- NASM version 2.09 available - ecm, 26.08.2010, 20:10
- NASM version 2.09 available - DOS386, 27.08.2010, 03:16
- NASM version 2.09 available - marcov, 27.08.2010, 17:10
- NASM version 2.09 available - Rugxulo, 28.08.2010, 04:53
- NASM version 2.09 available - ecm, 30.08.2010, 21:40
- NASM version 2.09 available - Rugxulo, 03.09.2010, 05:51
- NASM version 2.09 available - Arjay, 03.09.2010, 13:14
- NASM version 2.09 available - ecm, 03.09.2010, 14:40
- NASM version 2.09 available | 8086 is COOOOL - DOS386, 06.09.2010, 20:06
- NASM version 2.09 available | 8086 is COOOOL - Rugxulo, 06.09.2010, 22:27
- NASM version 2.09 available | 8086 is COOOOL - DOS386, 06.09.2010, 22:37
- NASM version 2.09 available | 8086 is COOOOL - Arjay, 07.09.2010, 18:19
- NASM version 2.09 available | 8086 is COOOOL - ecm, 07.09.2010, 18:53
- NASM version 2.09 available | 8086 is COOOOL - Arjay, 07.09.2010, 18:19
- NASM version 2.09 available | 8086 is COOOOL - Arjay, 07.09.2010, 07:33
- NASM version 2.09 available | 8086 is COOOOL - ecm, 07.09.2010, 16:22
- NASM version 2.09 available | 8086 is COOOOL - Rugxulo, 07.09.2010, 16:59
- NASM version 2.09 available | 8086 is COOOOL - Arjay, 07.09.2010, 18:04
- NASM version 2.09 available | A86 - ecm, 07.09.2010, 19:15
- NASM version 2.09 available | A86 - Arjay, 07.09.2010, 19:58
- NASM version 2.09 available | A86 - ecm, 07.09.2010, 22:42
- NASM 2.09 available | A86 | FASM | Arjay's 8086+80386 PC's - DOS386, 08.09.2010, 01:05
- FASM and OMF - Japheth, 08.09.2010, 09:26
- 16-bit DOS COBOL, 16-bit DOS PASCAL, 16-bit DOS C, 16-bit - DOS386, 08.09.2010, 19:40
- 16-bit DOS COBOL, 16-bit DOS PASCAL, 16-bit DOS C, 16-bit - ecm, 08.09.2010, 19:45
- 16-bit DOS COBOL, 16-bit DOS PASCAL, 16-bit DOS C, 16-bit - DOS386, 08.09.2010, 19:53
- FASM is copylefted - ecm, 08.09.2010, 20:02
- 16-bit DOS COBOL, 16-bit DOS PASCAL, 16-bit DOS C, 16-bit - DOS386, 08.09.2010, 19:53
- 16-bit DOS COBOL, 16-bit DOS PASCAL, 16-bit DOS C, 16-bit - ecm, 08.09.2010, 19:45
- 16-bit DOS COBOL, 16-bit DOS PASCAL, 16-bit DOS C, 16-bit - DOS386, 08.09.2010, 19:40
- NASM - FASM - ecm, 08.09.2010, 15:09
- NASM 2.09 available | A86 | FASM | Arjay's 8086+80386 PC's - Arjay, 08.09.2010, 22:12
- NASM 2.09 available | A86 | FASM | Arjay's 8086+80386 PC's - DOS386, 11.09.2010, 01:23
- NASM - FASM license - ecm, 11.09.2010, 01:53
- NASM 2.09 available | A86 | FASM | Arjay's 8086+80386 PC's - Arjay, 13.09.2010, 13:31
- NASM 2.09 available | A86 | FASM | Arjay's 8086+80386 PC's - DOS386, 11.09.2010, 01:23
- FASM and OMF - Japheth, 08.09.2010, 09:26
- NASM 2.09 available | A86 | FASM | Arjay's 8086+80386 PC's - DOS386, 08.09.2010, 01:05
- NASM version 2.09 available | A86 - ecm, 07.09.2010, 22:42
- NASM version 2.09 available | A86 - Rugxulo, 08.09.2010, 06:56
- NASM version 2.09 available | A86 - Arjay, 07.09.2010, 19:58
- NASM version 2.09 available | 8086 is COOOOL - Rugxulo, 08.09.2010, 06:28
- NASM version 2.09 available | A86 - ecm, 07.09.2010, 19:15
- NASM version 2.09 available | A86 and kernels - ecm, 07.09.2010, 18:42
- NASM version 2.09 available | A86 and kernels - Rugxulo, 08.09.2010, 06:49
- NASM version 2.09 available | A86 and kernels - ecm, 08.09.2010, 20:30
- NASM version 2.09 available | A86 and kernels - ecm, 11.09.2010, 12:27
- Debian/OW ... FASM - Rugxulo, 11.09.2010, 23:44
- Debian/OW ... FASM - ecm, 12.09.2010, 02:40
- Debian/OW ... FASM - Rugxulo, 12.09.2010, 04:18
- Debian/OW ... FASM - ecm, 12.09.2010, 14:29
- FASM's license - Rugxulo, 12.09.2010, 22:18
- FASM's license - ecm, 12.09.2010, 23:12
- FASM's license - Rugxulo, 13.09.2010, 01:49
- FASM's license - ecm, 13.09.2010, 14:13
- FASM's license - Rugxulo, 13.09.2010, 22:27
- FASM's license - ecm, 14.09.2010, 15:50
- FASM's license - Rugxulo, 15.09.2010, 23:29
- FASM's license - ecm, 16.09.2010, 00:03
- code density - Rugxulo, 16.09.2010, 21:10
- code density - ecm, 17.09.2010, 14:15
- code density - Rugxulo, 17.09.2010, 23:06
- code density - ecm, 18.09.2010, 02:18
- code density - Rugxulo, 19.09.2010, 20:23
- code density - ecm, 19.09.2010, 20:27
- this messy thread - DOS386, 13.10.2010, 04:17
- this messy thread - Rugxulo, 13.10.2010, 04:50
- this messy thread - ecm, 14.10.2010, 13:01
- this messy thread - Rugxulo, 13.10.2010, 04:50
- this messy thread - DOS386, 13.10.2010, 04:17
- code density - ecm, 19.09.2010, 20:27
- code density - Rugxulo, 19.09.2010, 20:23
- code density - ecm, 18.09.2010, 02:18
- code density - Rugxulo, 17.09.2010, 23:06
- code density - ecm, 17.09.2010, 14:15
- code density - Rugxulo, 16.09.2010, 21:10
- FASM's license - ecm, 16.09.2010, 00:03
- FASM's license - Rugxulo, 15.09.2010, 23:29
- FASM's license - ecm, 14.09.2010, 15:50
- FASM's license - Rugxulo, 13.09.2010, 22:27
- FASM's license - ecm, 13.09.2010, 14:13
- FASM's license - Rugxulo, 13.09.2010, 01:49
- FASM's license - ecm, 12.09.2010, 23:12
- FASM's license - Rugxulo, 12.09.2010, 22:18
- Debian/OW ... FASM - ecm, 12.09.2010, 14:29
- Debian/OW ... FASM - Rugxulo, 12.09.2010, 04:18
- Debian/OW ... FASM - ecm, 12.09.2010, 02:40
- Debian/OW ... FASM - Rugxulo, 11.09.2010, 23:44
- NASM version 2.09 available | A86 and kernels - Rugxulo, 08.09.2010, 06:49
- NASM version 2.09 available | 8086 is COOOOL - tom, 07.09.2010, 19:58
- NASM version 2.09 available | 8086 is COOOOL - Rugxulo, 08.09.2010, 06:58
- NASM version 2.09 available | 8086 is COOOOL - Arjay, 07.09.2010, 18:04
- 8086 is fairly useless - tom, 07.09.2010, 19:47
- 8086 is fairly useless - ecm, 07.09.2010, 19:55
- NASM version 2.09 available | 8086 is COOOOL - Rugxulo, 07.09.2010, 16:59
- NASM version 2.09 available | 8086 is COOOOL - DOS386, 06.09.2010, 22:37
- NASM version 2.09 available | 8086 is COOOOL - Arjay, 07.09.2010, 07:26
- NASM version 2.09 available | NASM manual - ecm, 07.09.2010, 16:30
- NASM version 2.09 available | 8086 is COOOOL - Rugxulo, 06.09.2010, 22:27
- NASM version 2.09 available - Rugxulo, 13.10.2010, 06:15
- NASM version 2.09 available | 8086 is COOOOL - DOS386, 06.09.2010, 20:06
- NASM version 2.09 available - Rugxulo, 03.09.2010, 05:51
- NASM version 2.09 available - ecm, 30.08.2010, 21:40
- NASM version 2.09 available - Rugxulo, 28.08.2010, 04:53
- 8086-NASM - Japheth, 14.09.2010, 15:04
- 8086-JWASM - ecm, 14.09.2010, 15:33
- NASM version 2.09 available - ecm, 26.08.2010, 20:10
- NASM version 2.09 available - DOS386, 26.08.2010, 09:10