15-byte Dump Meg to STDOUTAssembler/8086

A small program that dumps the first meg to STDOUT. You can redirect it using MS-DOS pipes. It makes certain assumptions:

This may not work on all DOS versions.

The source code and a compiled version is available for download (807 bytes).

; Dump first meg to stdout
; Writer: Jim Neil - jim-neil@digital.com

ASSUME  CS:CODE,SS:CODE,DS:CODE,ES:CODE
CODE    SEGMENT                 ; define code Segment.
ORG     100h                    ; all .COM programs start at 0100h.

dump:                           ; assumes on entry bx = 0 and ch = 0.
        xchg    si,ax
        inc     bx
        mov     cl,16           ; si = seg, bx = handle, cx = size.
mloop:                          ; do...
        mov     ah,40h
        mov     ds,si
        cwd                     ; ah = func, ds:dx = addr of next blk.
        int     21h
        inc     si              ; 16 bytes to stdout, si = next seg.
        jnz     mloop           ; while not zero...
        ret                     ; return to DOS.

CODE    ENDS                    ; close code Segment.
END     dump
Gem writer: Jim Niel
last updated: 1998-06-07