Z80::MathInt
- integer math common routines.¶ ↑
in Z80::MathInt::Macros
require 'z80'
class Program
include Z80
include Z80::TAP
macro_import MathInt
ld hl, [dividend.words[0]]
exx
push hl
ld hl, [dividend.words[1]]
ld de, [divisor]
divmod32_16
ld [result.words[1]], hl
exx
ld [result.words[0]], hl
ld [remainder], de
utobcd bcdbufend, result, size: 4
exx
bcdtoa hl, c, skip_leading0: true do
add ?0.ord
rst 0x10
end
pop hl
exx
ret
dividend int 32, 0xdeadbaca
divisor int 16, 0xbaba
result int 32, 0
remainder int 16, 0
bytes 5
bcdbufend label
end