Z80 Routines:Other:DispHL
From WikiTI
Unsigned Version
;DispHL, especially adapted to some kind of games (RPG's actually) ;input: hl=num, d=row,e=col, bc=number of algarisms to skip ;number of numbers' characters to display: 5 ; example: 65000 ;output: hl displayed DispHL: push bc ld (CurRow),de ld de,OP1 push de push de ;save twice... call Num2Dec ex de,hl ld (hl),0 pop hl jr firsttime nozerodisp: ld (hl),' ' ;suppress starting zeros, but you can delete this code if you don't want it inc hl firsttime: ld a,(hl) cp '0' jr z,nozerodisp pop hl pop bc add hl,bc b_call(_PutS) ret ;also adaptable for a DispA routine! DispA: ld h,0 ld l,a ld bc,2 jr DispHL
Signed Version
; DispHLsign: