.title idadal ; ; call idadal( idate, byte(30) ) ; ; Internal DAte => Date ASCII Long ; .psect user$i idadal:: tst (r5)+ mov @(r5)+,idate ; date mov (r5)+,r0 ; r0 => o/p area mov #r5dow,r5 mov r0,-(sp) ; save it call idadow mov (sp)+,r0 ; restore it mov #buf,r1 ; r1 => i/p 5$: movb (r1)+,(r0)+ ; copy day of week to o/p bne 5$ dec r0 movb #' ,(r0)+ ; put space in, over null mov r0,-(sp) mov #r5dmy,r5 ; get day month year call idadmy mov (sp)+,r0 mov id,r1 ; get day clr r2 ; leading zero suppresion call $cbdmg ; convert to ascii mov #"th,ext ; load default ; 1st, 2nd or 3rd ? cmpb -1(r0),#'1 ; 1 digit ? beq 10$ ; br, if true cmpb -1(r0),#'2 ; 2 digit ? beq 20$ ; br, if true cmpb -1(r0),#'3 ; 3 digit ? beq 30$ ; br, if true br 40$ 10$: cmp id,#11. ; not beq 40$ mov #"st,ext br 40$ 20$: cmp id,#12. beq 40$ mov #"nd,ext br 40$ 30$: cmp id,#13. beq 40$ mov #"rd,ext 40$: movb ext,(r0)+ movb ext+1,(r0)+ mov im,r1 ; get month no dec r1 asl r1 mov montab(r1),r1 ; get address of month string 50$: movb (r1)+,(r0)+ bne 50$ dec r0 ; point at null movb #'1,(r0)+ movb #'9,(r0)+ mov iy,r1 clr r2 call $cbdmg clrb (r0)+ return .psect user$d,d r5dow: .word 2,idate,buf idate: .word buf: .blkb 10. .even r5dmy: .word 4,idate,id,im,iy id: .word im: .word iy: .word ext: .word montab: .word jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec jan: .asciz / January / feb: .asciz / February / mar: .asciz / March / apr: .asciz / April / may: .asciz / May / jun: .asciz / June / jul: .asciz / July / aug: .asciz / August / sep: .asciz / September / oct: .asciz / October / nov: .asciz / November / dec: .asciz / December / .even .end