We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
Ei] 00SBox 0.74-3, Cpu speed: max 100% cyc! - x
File Edit Search Run Compile Debuy Project Options Window Help
_—_—— _———————1.
RESTOR™1.C
fHinclude ]
Wtinclude
itdef ine BITS 4|
7 Convert decimal number to binary array
void decToBinCint num, imt binl1) {
ae
for (i = BITS - 13 i ones
Tree Remo ad
nun nl eee rd
rameskip 0, Program: TC
Zeer Ste Ur Comic
int binToDectint binL]) ¢
an
Fy Ci ee Ure IES
Penner sCie8
aa
— 144:13 ne be be be fies a
Fi Help Alt-F8 Next Msg Alt-F? Prey Msg Alt-F9 Compile FS Make F10 MenuBB] DOSBox 0.74-3, Cpu speed: max 100% cycles, Frameskip 0, Program: TC - x
File Edit Search Run Compile Debug Project Options Window Help
—S— SL
i
QAR s ss Cee CL rr ee ee
oid subtractCint ALI, int ML1) ¢
int BEBITS]
peor
Pa ea
for Ci = 0: i < BITS: ite) ¢
BLi ee Ot1:6:
+
eee Coe
roa
oanel H H
Rae ee eee reste
fae eet eae
carry = sum 7 Z.
7 ed
Alt-F8 Next Msg Alt-F? Prey Msg Alt-F9 Compile F9 Make F10 Menu
Fi HelpWindow
BITS - 1: i >= 6.
int sum = ALi] + BLil + carry:
a Oe er eT
void addCint ALI, int MEI) ¢
FUraeert set eC!
for (i = BITS - 1; i >= @: i+) £
int sum = ALG] + MLi] + carry:
a Ere e
sees wards
ty
v/ Left shift A and Q combined by 1 bit
Naam CERO UP ee
ct
63:13 be be he ia oe 2
Fi Help Alt-F8 Next Msg Alt-F/? Prev Msg ALt-F9 Compile FS Make F109 Men]Fl DOSBox 0.74-3, Cpu speed: max 100% cycles, Frameskip 0, Program: TC - x
File Edit Search Run Compile Debug Project Options Window
a Po ee
for (i = 0; i < BITS — 13 it*) {
ALi] = ALi + 11:
a
Ci) i es eee
for (i = @: i < BITS —
rice ie Smee
QUBITS - 1]
Cee ee
void printBinCint binL]) ¢
pra
for (i = 0; i < BITS; ite) ¢
Prete eae Tu Leb yy
}
b
a ere mn
int MCBITS], QUBITS1, ALBITS:
ieee ey lu:
i
Fi Help Alt-F8 Next “‘Alt-F? compile F9 Make F10Fj DOSBox 0.74-3, Cpu speed: max 100% cycles, Frameskip 0, Program: = TC = x
File Edit) Search Run Compile Debug Project Options Window Help
en ee F
int divisor, dividend
chr aey
clrscrQs
sua
scant, ÷nd):
a
scant, &divisor):
if (divisor
Pra ua
getchO)
pacts
a
if (dividend >= (1 << BITS) Hi divisor >= (1 << BITS)) €
his teas Pas Roa 03rd
Pee
Pec
105313Ed DosBox Cpu speed: max cycles, Frameskip 0, Program: TC -
File Edit Search Run Compile Debug Project Options Window
ann cok Le wc
Cos U Ue ere a)
decToBin(dividend, Q);
for (i = OG; i < BITS: i++)
Cisse)
au
ene
poet SUG
aus
peu DE
ana Fy
poe ae SUG
ue) OP a) ee
printf ( Par ae er
7a eee |
Tera Cee
Neues
Pe TuLGe
—— 128:13cles, Frameskip 0, Program: TC _
Compile Debug Project Options Window Help
RT Cea
sorta
port TUL
Pe Ce CS es ee ea)
se mean eOs
QUBITS - 1] = 6:
adda, M3 7 Restore A
Sa
Pate aa
Ae ee Ce
QUBITS - 1] = 4;
eta
Tsu Re
Psu ULC
rime
Py
Petr
per
Ma D
3| EH] DOSBox 0:74-3, Cpu speed: max 100% cycles, Frameskip 0, Program: TC -
File Edit Search Run Conpile Debug Project Options Window
ca ae a
QUBITS - 1]
Pau
}
eure
printBintg);
ea
PSUR
Seu TCO
PSUR Peano
Seta
printBin(a):
portiead Pe Sy
eH
Peet mdBl DOSBox 0.74-3, Cpu speed: max 100% cycles, Frameskip 0,Pregram: TC
nter Dividend (Q
nter Divisor (M)Program: = TC
8
is negative, restoring A and setting QO = 0.
Final Quotient (Q): 6010
PUM tM aPC oD