-
Notifications
You must be signed in to change notification settings - Fork 9
/
binary.mlc
49 lines (47 loc) · 1.48 KB
/
binary.mlc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
PRINT NOGEN
***************************************************************
* BINARY.MLC
* Playing with binary arithemetic as per Ch14
***************************************************************
START 0
YREGS
BINARY SUBENTRY
L R3,A Load register FW
L R4,B
CR R3,R4 Compare register
C R3,B Compare FW
ST R3,A Store R3 at A FW
LH R3,C Load register HW
LH R4,D
CR R3,R4 Compare register
CH R3,D Compare HW
STH R3,C Store R3 at C HW
* Move fullword to halfword A -> C
L R3,A Load A into R3
STH R3,C Store R3 in C
* A + C + D = B
L R3,A Load A into R3
AH R3,C Add C to R3
AH R3,D Add D to R3
ST R3,D Store R3 in D
* B = A - B - C
L R3,A Load A into R3
S R3,B Subtract B from R3
SH R3,C Subtract C from R3
ST R3,B Store R3 in B
* Print B
CVD R3,DBL Convert from bin to Packed dec
XDUMP DBL,L'DBL
MVC PRT(10),=X'40202020202020202020' BZZ,ZZ9.99
ED PRT(10),DBL+3
XPRNT PRT,L'PRT
RETURN
LTORG
DS 0F
A DC X'00000005'
B DC X'FFFFFFFB'
C DC X'0002'
D DC X'FFFE'
DBL DC D'0'
PRT DC CL80' '
END BINARY