Changes

Programming:Display a 8-bit number in hex

599 bytes added, 15:24, 20 January 2015
From the '''The Unofficial Amstrad WWW Resource''':
 
This routine uses [[Firmware]]
 
<pre>
;; A procedure to display a 8-bit number in hex form
jp txt_output ;display digit
</pre>
 
The .print_byte_digit routine can be further optimised by devious use of DAA
 
<pre>
;;-------------------------------------------
;; display number in lower nibble (bits 3..0)
.print_byte_digit
and %00001111 ;isolate lower nibble. (This contains the digit value 0...15)
cp &a ;Less than 10? Set carry if so
sbc a,&69
daa ;Because previous instruction was a subtract operation this
;is known as 'das' in x86
jp txt_output ;display digit
</pre>
 
[[Category:Programming]]
3
edits