Adding modding folder with a hacked build.

This commit is contained in:
ml
2026-09-26 08:53:08 +02:00
parent cdb960dc71
commit c91080aba7
755 changed files with 50424 additions and 0 deletions
@@ -0,0 +1,26 @@
package numbers
// ToBinaryCodedDecimal converts given integer value to a 4-digit BCD value.
func ToBinaryCodedDecimal(value uint16) (bcd uint16) {
factors := []uint16{1000, 100, 10, 1}
value %= 10000
for _, factor := range factors {
bcd = (bcd << 4) | (value / factor)
value %= factor
}
return
}
// FromBinaryCodedDecimal converts given 4-digit BCD value into an integer.
func FromBinaryCodedDecimal(bcd uint16) (value uint16) {
factors := []uint16{1, 10, 100, 1000}
for _, factor := range factors {
value += (bcd & 0xF) * factor
bcd >>= 4
}
return
}