.title rsxdat date/time conversion .ident /4.0.01/ .psect .enabl gbl ; Copyright (C) 1979, 1980, 1981, 1982, 1983 Brian Nelson ; ; This software is furnished in an as-is ; condition, with no committments of sup- ; port or updates. This software may NOT ; be sold for profit nor can it be includ- ; ed in any package to be sold for profit ; without the written consent of the au- ; thor. This software may be used only ; within the above conditions of use. ; ; The information in contained herein is ; subject to change or revision at any ; time without notice. ; ; .sbttl get date and time section $code .enabl lc .mcall gtim$s dattim::save mov @r5 ,r0 ; r0 := caller result addr sub #16. ,sp ; make room for result mov sp ,r1 ; result addr for gtim$ gtim$s r1 ; get time and date mov g.tida(r1),r2 ; r2 := day jsr pc ,cnvert ; convert and store day movb #'- ,(r0)+ ; insert dash mov g.timo(r1),r2 ; r2 := month asl r2 add g.timo(r1),r2 ; r2 := 3*month add #mnthtab-3,r2 ; r2 := mnthtab[3*month]@ movb (r2)+ ,(r0)+ movb (r2)+ ,(r0)+ ; store month name movb (r2)+ ,(r0)+ movb #'- ,(r0)+ ; insert dash mov @r1 ,r2 ; r2 := year jsr pc ,cnvert ; convert and store year movb #40 ,(r0)+ ; final space movb #40 ,(r0)+ ; final space mov #3,r3 ; loop count := 3 add #g.tihr,r1 ; start with hours 1$: mov (r1)+,r2 ; begin loop jsr pc,cnvert ; convert to ascii and store dec r3 ; if done beq 2$ ; then exit loop movb #':,(r0)+ ; else insert colon br 1$ ; end loop 2$: add #16.,sp unsave return ; ; cnvert: internal procedure to convert ; integer in r2 to ascii. cnvert: add #366,r2 ;begin loop tstb r2 bpl cnvert ;end loop add #"00-366,r2 ;convert to ascii swab r2 ;reorder bytes movb r2,(r0)+ ;store digit swab r2 movb r2,(r0)+ ;store digit rts pc ; mnthtab:.ascii /JanFebMarAprMayJunJulAugSepOctNovDec/ .even .end