We need this for load average computation
.globl _euclid
.globl _udivhi3
.globl _umodhi3
+ .globl _mulhi3
; debugging aids
.globl outcharhex
bne mod1
leas 3,s
rts
+
+_mulhi3:
+ pshs x
+ lda 5,s ; left msb * right lsb * 256
+ ldb ,s
+ mul
+ tfr b,a
+ clrb
+ tfr d,x
+ ldb 1,s ; left lsb * right msb * 256
+ lda 4,s
+ mul
+ tfr b,a
+ clrb
+ leax d,x
+ ldb 1,s ; left lsb * right lsb
+ lda 5,s
+ mul
+ leax d,x
+ puls d,pc ; kill D to remove initial push