; ; Divides 'HL' by value in 'DE' - upon exit: BC=quotient, HL=remainder ; a,f,b,c,h,l dvhlde: push d; divisor mov a,e cma; Negate divisor mov e,a mov a,d cma mov d,a inx d; de := - de lxi b,0; Init quotient divl1: dad d; Subtract divisor from divident inx b; Bump quotient jc divl1; Loop until sign changes dcx b; Adjust quotient pop d; restore divisor dad d; adjust remainder ret ; ; Multiply the value in 'HL' by the value in 'A', ; return with answer in 'HL'. ; a,f,d,e,h,l mulhla: xchg; Multiplicand to 'DE' lxi h,0; Init product inr a mullp: dcr a rz dad d jmp mullp ; ; Logical shift hl 4 bits to the right ; a,f,h,l dv16hl: call dv2hl ; " " ; Logical shift hl 3 bits to the right ; a,f,h,l dv8hl: call dv2hl ; " " ; Logical shift hl 2 bits to the right ; a,f,h,l dv4hl: call dv2hl ; " " ; Logical shift 'HL' register pair right one bit, rh bit to carry ; a,f,h,l dv2hl: ora a; Clear the carry bit mov a,h rar mov h,a mov a,l rar mov l,a ret ; ; end of open file, set time routine ; ------------------------------------------------------------------- ; ; Closes the received file ; closfil: mvi a,close call fileop inr a rnz; Close ok call erxit; bad close, abort db '++ Can''t close file ++','$' ; ; print hl/8, rounded up (i.e. convert recds to k) ; a,f,h,l decoutk: mvi a,7 call indexb; round up call dv8hl; and divide by 8 jmp decout ; ; Decimal output from (a) ; a,f,h,l decouta: mov l,a mvi h,0 ; " " ; Decimal output routine - call with decimal value in 'HL' ; a,f decout: push b push d push h lxi b,-10 lxi d,-1 decou2: dad b inx d jc decou2 lxi b,10 dad b xchg mov a,h ora l cnz decout mov a,e adi '0' call ctype pop h pop d pop b ret ; ; Print hex value from (hl) on CRT ; a,f t4hex: mov a,h call hexo mov a,l ; " " ; Prints a hex value in 'A' on the CRT ; a,f hexo: push psw rar rar rar rar call t1hex pop psw ; " " t1hex: ani 0fh adi 090h; convert hex to ascii daa aci 040h daa jmp ctype ; ; Move hl^ to de^ for 12 bytes. Advance hl & de by b ; a,f,b,d,e,h,l move12: mvi b,12 ; " " ; Move hl^ to de^, length in (b) (0 for 256). Adv. hl & de by b ; a,f,b,d,e,h,l move: mov a,m stax d inx d inx h dcr b jnz move ret ;