[A83] Re: Weird commands


[Prev][Next][Index][Thread]

[A83] Re: Weird commands




> Van: Jimmy Pardey <j_pardey@hotmail.com>
> 
> HellO! Why does the z80 have commands to load registers into themselves? 
> Does it change the flags around or something?
> 
> examples:   ld a,a
>             ld b,b

There is no practical use on the "real Z80", but they are used on Z80
derevatives -like the eZ80- for special commands.

> P.S How does one use sythetic division to convert from hexadecimal to 
> binary?

Uh? ASCII hex -or- real hex? For "real hex" it's just simple, you do
bitshifting. Most Z80 shift commands shift the bit 'that drops out' into
the carry (or was it the zero?) flag.

I think ASCII hex should be converted to "real hex" first and then you can
do the bitshifting stuff.

Just handy to know:
'0' -> '9'  :  $30 -> $39
'A' -> 'F'  :  $41 -> $46

; input in A
; (almost) no error checking...
Conv_char_to_4bit_hex:
	sub	'0'
	cp	10
	ret	PE	; return is underflow occured (right?)
	sub	'A'
	cp	6
	ret	;PE
	; error if you come here...

Hope this helps...

	Henk Poley <><