DataMuseum.dk

Presents historical artifacts from the history of:

Jet Computer Jet80

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Jet Computer Jet80

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦20c256533⟧ TextFile

    Length: 1280 (0x500)
    Types: TextFile
    Names: »BN2HEX.MAC«

Derivation

└─⟦01b5c9619⟧ Bits:30005906 Microsoft Multiplan v1.05 og HELP
    └─ ⟦this⟧ »BN2HEX.MAC« 

TextFile

;
;
;
;
;	Title		Binary to hex ASCII
;	Name:		BN2HEX
;
;
;	Purpose:	Convert one byte of binary data to
;			two ASCII characters
;
;	Entry:		Register A = Binary data
;
;	Exit:		Register H = ASCII more significant digit
;			Register L = ASCII less significant digit
;
;	Registers used:	AF,B,HL
;
;	Time:		Approximately 162 cycles
;
;	Size:		Program 28 bytes
;
;
;
BN2HEX:
	;Convert high nibble
	ld	b,a		;Save original binary value
	and	0f0h		;Get high nibble
	rrca			;Move high nibble to low nibble
	rrca
	rrca
	rrca
	call	NASCII		;Convert high nibble to ASCII
	ld	h,a		;Return high nibble in H

	;Convert low nibble
	ld	a,b
	and	0fh		;Get low nibble
	call	NASCII		;Convert low nibble to ASCII
	ld	l,a		;Return low nibble in L
	ret

	;--------------------------------------------------
	; Subroutine ASCII
	; Purpose:   Convert a hexadecimal digit to ASCII
	; Entry:     A = Binary data in lower nibble
	; Exit:      ASCII characters
	; Registers used: A,F
	;--------------------------------------------------

NASCII:
	cp	10
	jr	c,NAS1		;Jump if high nibble < 10
	add	a,7		;Else add 7 so after adding '0' the
				; character will be in 'A'..'F'

NAS1:
	add	a,'0'		;Add ASCII 0 to make a character
	ret
«eof»