; SYSLIB Module Name: SPHL5DC ; Author: Richard Conn ; SYSLIB Version Number: 3.6 ; Module Version Number: 1.3 ; ; Modified by Carson Wilson 3/1/88 ; Entry points for 2 and 4 decimal character output added. ; Code compressed. PUBLIC PHL2DC,PHL4DC ; PUBLIC PHL5DC,PHLDC EXT COUT PUTRG MACRO push bc ; SAVE BC, DE, HL push de push hl ENDM GETRG MACRO pop hl ; RESTORE HL, DE, BC pop de pop bc ENDM ; ; PHL2DC -- ; Print HL as 2 decimal characters ; PHL2DC: push af ; SAVE ALL REGS PUTRG ld b,0 ; B=0 FOR NO LEADING jr PHDC6 ; ; ; PHL4DC -- ; Print HL as 4 decimal characters ; PHL4DC: push af ; SAVE ALL REGS PUTRG ld b,0 ; B=0 FOR NO LEADING jr PHDC5 ; ; ; PHL5DC -- ; PRINT HL AS 5 DECIMAL CHARACTERS ; PHL5DC: push af ; SAVE ALL REGS PUTRG ld b,0 ; B=0 FOR NO LEADING jr PHDC ; ; PHLDC -- ; Print HL as decimal characters w/leading spaces in 5-char field ; PHLDC: push af ; SAVE ALL REGS PUTRG ld b,1 ; B=1 for leading ; ; Print HL using leading flag in B ; PHDC: ld de,10000 ; PRINT 10000'S call PHDC1 PHDC5: ld de,1000 ; PRINT 1000'S call PHDC1 ld de,100 ; PRINT 100'S call PHDC1 PHDC6: ld de,10 ; PRINT 10'S call PHDC1 ld a,l ; PRINT 1'S add '0' ; CONVERT TO ASCII call COUT GETRG ; RESTORE ALL REGS pop af ret ; ; Divide HL by DE and print quotient with leading s ; PHDC1: xor a ; Set count PHDC2: or a ; Clear carry sbc hl,de jr c,PHDC3 ; DONE IF CARRY SET (FURTHER BORROW) inc a ; Incr count jr PHDC2 PHDC3: add hl,de and a ; Check for zero jr nz,PHDC4 or b ; 0 = NO LEADING (A=0, A OR B = 0 IF B=0) jr z,PHDC4 ld a,' ' ; PRINT jp COUT PHDC4: ld b,0 ; Turn off leading for rest of output PHDC7: add '0' ; Convert to ASCII jp COUT end