The file was the library smoke test: it set up a few cells, called raw_add and
printed five values. It now also calls clb_mul and prints the two product bytes,
so one tape exercises both of the expensive paths and the self check runs a
result rather than only an assembly.
127 + 130 = 257 -> S = 1, Co = 1
200 * 200 = 40000 -> PL = 0x40 = 64, PH = 0x9C = 156
whole tape 5417 characters (was 1666)
Both interpreters agree on `out 127 130 0 1 1 64 156`: r8forge_derive from the
source and r8forge_tape_run from the assembled tape, 427343 steps.
The multiply half lives at cells 16 and up so it cannot disturb the add half, and
the file's existing cell layout is untouched.
54 lines
735 B
Plaintext
54 lines
735 B
Plaintext
%include "asm/raw_add.r8asm"
|
|
%include "asm/raw_and.r8asm"
|
|
%include "asm/raw_or.r8asm"
|
|
%include "asm/raw_xor.r8asm"
|
|
%include "asm/raw_inc.r8asm"
|
|
%include "asm/mul.r8asm"
|
|
|
|
|
|
.var A 0
|
|
.var B 2
|
|
.var Ci 4
|
|
.var S 6
|
|
.var Co 8
|
|
.var tmp 1
|
|
|
|
.tp A
|
|
.xor 127
|
|
.tp B
|
|
.xor (~126)+1
|
|
.tp Ci
|
|
.xor 0
|
|
|
|
raw_add A B Ci S Co tmp
|
|
|
|
output A
|
|
output B
|
|
output Ci
|
|
output S
|
|
output Co
|
|
|
|
|
|
; 再乘一次:200 * 200 = 40000 = 0x9C40,低字节 0x40 = 64,高字节 0x9C = 156。
|
|
; 这一块只碰 16 号往后的 cell,不打扰上面加法用的那一组。
|
|
.var MC 16
|
|
.var MUL 17
|
|
.var PL 18
|
|
.var PH 19
|
|
.var MCA 20
|
|
.var MS 21
|
|
.var MCi 22
|
|
.var MT 23
|
|
.var MF 24
|
|
.var MNR 25
|
|
|
|
.tp MC
|
|
.xor 200
|
|
.tp MUL
|
|
.xor 200
|
|
|
|
clb_mul MC MUL PL PH MCA MS MCi MT MF MNR
|
|
|
|
output PL
|
|
output PH
|