collapseos/blk/320
Virgil Dupras bf4ab0f1b4 z80: protect or avoid BC wherever it's used
For the IY->BC move, of course.
2020-07-05 23:12:17 -04:00

16 lines
404 B
Plaintext

( Borrowed from http://wikiti.brandonw.net/ )
( Divides AC by DE and places the quotient in AC and the
remainder in HL )
CODE /MOD EXX, ( protect BC )
DE POP, BC POP, chkPS,
A B LDrr, B 16 LDri,
HL 0 LDdn,
BEGIN,
SCF, C RL, RLA,
HL ADCHLd, DE SBCHLd,
IFC, DE ADDHLd, C DECr, THEN,
DJNZ, AGAIN,
B A LDrr,
HL PUSH, BC PUSH,
EXX, ( unprotect BC ) ;CODE