ret\r
\r
\r
- if 0\r
-\r
;-------------------------------------------------------------------------------\r
-; print 16 bit number from HL\r
+; print decimal 16 bit number from HL\r
;\r
+; HL: unsigned binary number to print\r
+; C: minimum print field width\r
+; number is prined right-aligned\r
+; B: pad character, typically ' ' or '0'\r
\r
pr.dec:\r
- ex de,hl\r
- ld hl,0\r
- ;fall thru\r
-\r
-pr.decl:\r
- push ix\r
- ld ix,1 ; count chars on stack\r
- push bc\r
- exx\r
- ex (sp),hl\r
-; push de\r
-; push bc\r
- exx\r
-\r
- xor a\r
- push af ; string terminator\r
- inc sp\r
-prd_divloop:\r
- ld bc,10\r
- call div32_16 ; get a digit\r
- ld a,c\r
- add a,'0' ; make it printable\r
- push af\r
- inc sp\r
- inc ix\r
-\r
- ld a,h\r
- or l\r
- or d\r
- or e\r
- jr nz,prd_divloop\r
- exx\r
- push hl\r
- exx\r
- pop bc ;b=filler, c=field width\r
- inc c\r
- push ix\r
+ push de\r
+ ld de,0\r
+ call pr.decl\r
pop de\r
-prd_filloop:\r
- ld a,e\r
- cp c\r
- jr nc,prd_out\r
- push bc\r
- inc sp\r
- inc de\r
- jr prd_filloop\r
-prd_out:\r
- ld hl,0\r
- add hl,sp ;ptr to beginning of number string (hl==0 here)\r
- call ?pmsg\r
- ex de,hl\r
- add hl,sp\r
- ld sp,hl\r
- exx\r
- pop hl\r
- exx\r
- pop ix\r
ret\r
\r
- endif\r
-\r
;-------------------------------------------------------------------------------\r
-; print 16 bit number from HL\r
+; print decimal 32 bit number from DEHL\r
;\r
-\r
-pr.dec:\r
- ex de,hl\r
- ld hl,0\r
- ;fall thru\r
+; DEHL: unsigned binary number to print\r
+; C: minimum print field width\r
+; number is prined right-aligned\r
+; B: pad character, typically ' ' or '0'\r
\r
pr.decl:\r
push bc ;save width and fillchar\r
push bc\r
- exx\r
+ exx ;(alt)\r
ex (sp),hl ;save hl', get width and fill\r
push de ;save de'\r
\r