home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
A
/
ARC20.ARC
/
ARCMACS.ARC
/
DATESTR.MAC
< prev
next >
Wrap
Text File
|
1989-11-03
|
1KB
|
57 lines
; DATESTR for Turbo-ARC, TR 031189
.z80
extrn eingabe,output,default
xor a
ld de,eingabe
inc de
ld hl,(eingabe)
ld h,a
add hl,de ; Point behind last Char of String
ld (hl),a ; NUL Char identifies End of String
ld ix,(output) ; Point to Output Array
ld (ix),a
ld (ix+1),a
ld (ix+2),a ; Clear Output Array
ex de,hl
ld e,3 ; max. 3 Codes
loop: ld c,0 ; Output Code
inloop: ld a,(hl)
inc hl
or a
jr z,final ; NUL Char: all done!
sub '0'
cp 10
jr nc,ready ; Delimiter: Value ready
ld b,a
ld a,c
add a,a
add a,a
add a,c
add a,a ; last value *10
add a,b ; + new digit
ld c,a
jr inloop
ready: ld (ix),c
inc ix ; store Output Code
dec e
jr nz,loop ; get next Code
ret ; after 3 Codes: Exit
final: ld (ix),c ; store last value
ld hl,(output)
ld a,(hl)
or a
ret z ; first value zero: ok (date=0)
ld bc,(default) ; default value in C
ld b,3
floop: ld a,(hl)
or a ; value of zero ?
jr nz,floop1
ld (hl),c ; set to default
floop1: inc hl
djnz floop ; all checked: exit
end