lua-users home
lua-l archive

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


On Thu, 16 Feb 2023 at 21:56, Sean Conner <sean@conman.org> wrote:
> > [...]
> > it's useful, specially in slow processors, how many have used the
> > classic Z80 sequence
> >
> > add ax,0x40
> > daa
> > adc ax,0x90
> > daa
> 
>   Um, aside from using AX (which is from the 8086), what's so special about
> this sequence?  Aside from doing a bit of BCD arithmetic?
> 
>  -spc

Briefly, should be register "AL" for the Z80... 16-bit version is
presented as "AF".

Hadn't seen this code, but the Internet shows it is a neat and tidy way
to convert 1 nybble (low 4 bits, with high 4 bits 0) of AL to ASCII
hex ('0'..'9', 'A'..'F').  Need to save/shift x 4/convert/restore/mask
to process the high nybble before the low nybble.

Having started the half-byte circus, hopefully this completes some sort
of conceptual circle, and focus can return to Lua.

sur-behoffski (Brenton Hoff)
programmer, Grouse Software