Task

Create a program that, when run, would display all integers from   1   to      ∞      (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time.



An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integers are represented as a 32-bit unsigned value with 0 as the smallest representable value, the largest representable value would be 4,294,967,295.   Some languages support arbitrarily-large numbers as a built-in feature, while others make use of a module or library.

If appropriate, provide an example which reflect the language implementation's common built-in limits as well as an example which supports arbitrarily large numbers, and describe the nature of such limitations—or lack thereof.




org &1000
PrintChar equ &BB5A
ld hl,1 ;START AT ONE
main:
push hl
;PRINT HIGH BYTE
ld a,h
call ShowHex
;THEN PRINT LOW BYTE
ld a,l
call ShowHex
 
;NEW LINE
ld a,13
call PrintChar
ld a,10
call PrintChar
 
pop hl
;NEXT HL
inc hl
;COMPARE HL TO ZERO
ld a,h
or l
jr nz,main     ;IF NOT ZERO, REPEAT
ret	       ;RETURN TO BASIC
 
 
ShowHex:	
	push af
		and %11110000
		rrca
		rrca
		rrca
		rrca
		call PrintHexChar
	pop af
	and %00001111
	;call PrintHexChar
	;execution flows into it naturally.
PrintHexChar:
        ;this converts hexadecimal to ascii.
	or a	;Clear Carry Flag
	daa
	add a,&F0
	adc a,&40
	jp PrintChar
	;ret