; From David Adamson - echoing the command line to STDOUT.

seg000          segment byte public 'CODE'
                assume cs:seg000
                org    100h

;---------------------------------------------------------
                assume es:seg000, ss:nothing, ds:seg000

start:
                mov     si, 80h         ; get number of bytes in string
                mov     cx, [si]
                xor     ch, ch          ; Logical Exclusive OR
                jcxz    Finish          ; Jump if CX is 0,ie no cmd line string
                mov     dx, 81h         ; Start of string
                call    Write           ; Call Procedure
CRLF:                                   ; cr & lf ie 13,10
                mov     ah, 2
                mov     dl, 0Dh
                int     21h             ; DOS - DISPLAY OUTPUT
                                        ; DL = character to send to standard
output:
                mov     dl, 0Ah
                int     21h             ; DOS - DISPLAY OUTPUT
                                        ; DL = character to send to standard 

Finish:
                int     20h             ; DOS - PROGRAM TERMINATION

;---------------------------------------------------------

Write:
                mov     bx, 1           ; handle 1 is console out(screen)
                mov     ah, 40h         ; Int service number
                int     21h             ; DOS - 2+ - WRITE TO CON WITH HANDLE
                                        ; BX = file handle, CX = number of      
                                        ; bytes to write, DS:DX -> buffer
                ret                     ; Return Near from Procedure
;---------------------------------------------------------

seg000          ends


                end    start

