Category : Batch File Utilities - mostly for DOS
Archive   : YYMMDD.ZIP
Filename : YYMMDD.ASM

 
Output of file : YYMMDD.ASM contained in archive : YYMMDD.ZIP
PAGE 60,132
name NEED
; [ - condensed Toshiba P351
TITLE YYMMDD 1.0 1991/12/20

Comment û
Please report bugs and problems to:
Roedy Green
Canadian Mind Products
#168 - 1020 Mainland Street
Vancouver BC Canada
V6B 2T4
(604) 684-6529
BIX id ROEDY

YYMMDD.com Displays date in form YY/MM/DD without a CrLf

Version 1.0 1991 Dec 20
- released on BIX

;==============================================================

; R E G I S T E R C O N V E N T I O N S

Subroutines may trash any registers they please except CS: DS:
ES: SS: and of course the outputs.

û ; end of comment

;==============================================================

stack segment stack ; keep MS link happy by providing null stack
stack ends

;==============================================================

CODE SEGMENT PARA ; start off in code.

;==============================================================

data segment word ; provide a separate DATA segment
; Even though it appears in the source
; before the code, it the COM file it
; will appear at the end. This is as dodge
; to avoid forward references that confuse
; MASM.

Slash DB '/','$' ; separator we use on date

; embedded but not displayed

CopyrightMsg label byte
DB '°±²Û SDATE 1.0 Û²±°',13,10
db 13,10
DB 'Copyright (c) 1991 Roedy Green Canadian Mind Products',13,10
DB '#168 - 1020 Mainland, Vancouver BC Canada V6B 2T4 (604) 684-6529',13,10
DB 'May be freely distributed and used for any purpose except military.',13,10
db '$'

Data EndS

;==============================================================

com group code,data ; force data segment to go at the end

ASSUME CS:com,DS:com,ES:com,SS:com
; seg regs cover everything
ORG 100H ; in Code segment



;==============================================================

; P R O C E D U R E S

Main Proc near


; see page 384 Ray Duncan's Advanced MS DOS

mov ah,02ah ; get date DOS function
int 21h
; year is returned in CX
; month is returned in DH
; Day is returned in DL

mov ax,cx ; display year
mov cx,2 ; only 2 low order digits
call SayNDigits

Call SaySlash ; separate YY/MM

sub ax,ax ; display month, 2 digits
mov al,dh
mov cx,2
call SayNDigits

Call SaySlash ; separate MM/DD

sub ax,ax
mov al,dl ; display day of month, 2 digits
mov cx,2
call SayNDigits

mov ax, 4c00h ; ERRORLEVEL = 0
int 21h ; normal exit to dos

Main EndP

;==============================================================


SaySlash Proc Near

; displays / on screen using BIOS
push dx
lea dx,Slash
mov AH,09h
int 21h
pop dx
ret

SaySlash EndP

;==============================================================

SayNDigits PROC NEAR

; call with unsigned number in AX, CX counts how many digits you want
; converts it to ASCII and displays it on the screen
; leading 0's are NOT suppressed.
; Field is exactly wide enough to hold the number.
; No leading or trailing spaces. DISPLAYED IN DECIMAL
;
; Method is to repeatedly divide by 10. The remainder at
; each stage is one digit of the result, working right to left.
; Preserves all registers

Data Segment

PAD DB 15 dup (0) ; where build the output string
PADend db '$' ; terminator for Say

Data EndS

push ax
push bx
push cx
push dx
push di ; preserve di
mov bx,10d
lea di,padEnd ; point at $ trailing the PAD
; work right to left building digits at PAD
; CX counts number of digits
NumLoop: ; loop once for each digit
; number so far is in dx:ax
mov bx,10
sub dx,dx ; clear out high order part of DX:AX
div bx ; dx=remdr ax=quot

add dl,'0' ; convert digit to ASCII

dec di ; work right to left
mov [di],dl ; save digit

loop NumLoop

mov dx,di ; start of ascii string, terminated by $
mov AH,09h ; BIOS put string terminated by $
int 21h
pop di ; restore caller's registers
pop dx
pop cx
pop bx
pop ax
ret

SayNDigits endp


;============================================

CODE ends ; end of code segment

end Main


  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : YYMMDD.ZIP
Filename : YYMMDD.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/