; SYSLIB Module Name: SMHL5DC ; Author: Richard Conn ; SYSLIB Version Number: 3.6 ; Module Version Number: 1.4 ; Debugged by Carson Wilson 2/2/90 ; ; Module Version Number: 1.3 ; ; Modified by Carson Wilson 1/6/90 ; Entry points for 2 and 4 decimal character output added. ; Code compressed. PUBLIC MHL2DC,MHL4DC PUBLIC MHL5DC,MHLDC EXT MOUT ; ZSLIB PUTRG MACRO push bc ; SAVE regs push hl push ix ENDM GETRG MACRO pop ix pop hl ; RESTORE regs pop bc ENDM ; ; MHL2DC -- ; Store HL as 2 decimal characters. On return DE points to byte ; following buffer. MHL2DC: push af ; SAVE REGS PUTRG push de ; FOR OUTPUT pop ix ld b,0 ; B=0 FOR NO LEADING jr MHDC6 ; ; MHL4DC -- ; Store HL as 4 decimal characters ; MHL4DC: push af ; SAVE REGS PUTRG push de ; FOR OUTPUT pop ix ld b,0 ; B=0 FOR NO LEADING jr MHDC5 ; ; MHL5DC -- ; STORE HL AS 5 DECIMAL CHARACTERS ; MHL5DC: push af ; SAVE REGS PUTRG push de ; FOR OUTPUT pop ix ld b,0 ; B=0 FOR NO LEADING jr MHDC ; ; MHLDC -- ; Store HL as decimal characters w/leading spaces in 5-char field ; MHLDC: push af ; SAVE REGS PUTRG push de ; FOR OUTPUT pop ix ld b,1 ; B=1 for leading ; ; Store HL using leading flag in B ; MHDC: ld de,10000 ; Store 10000'S call MHDC1 MHDC5: ld de,1000 ; Store 1000'S call MHDC1 ld de,100 ; Store 100'S call MHDC1 MHDC6: ld de,10 ; Store 10'S call MHDC1 ld a,l ; Store 1'S add '0' ; CONVERT TO ASCII call MHDC8 GETRG ; RESTORE REGS pop af ret ; ; Divide HL by DE and store quotient with leading s ; MHDC1: xor a ; Set count MHDC2: or a ; Clear carry sbc hl,de jr c,MHDC3 ; DONE IF CARRY SET (FURTHER BORROW) inc a ; Incr count jr MHDC2 MHDC3: add hl,de and a ; Check for zero jr nz,MHDC4 or b ; 0 = NO LEADING (A=0, A OR B = 0 IF B=0) jr z,MHDC4 ld a,' ' ; Store jr MHDC8 MHDC4: ld b,0 ; Turn off leading for rest of output MHDC7: add '0' ; Convert to ASCII MHDC8: push ix ; Get storage address pop de inc ix call MOUT ret end ; End SMHL5DC+.Z80