Download manual tecnico

Transcript
c
c
c
Grquitectura y An6lir;is de Instrucciones
C o m p o n z n t e s de
la Rrquitectura
!
C
:o ta cI o Ir-1
-.- - ..
........
<:>
i
1
?.I!
!
................................................
'
..........................
"
- ....................
<:>
...
t...,
I
4
......
I
.....
'
I
.....
....
". .
---.
..................
- .. -- ......
i )
'
3
!
Símbolo :: DP
-
ARP -
INTFI NTM-
ov
CVM
,
1
Implernentacibn
; int.
I:'[-".,
Implementacibn :: int T
Implementacibn :int FiOt"l[1536]
Principales P r o c e s o s d e Operacibn
Multiplicador
Desplazadores
Desplazadar
de m A s d e un b i t (Barrel
Direccionamientos a la Memoria
- Direccianamientu I n d i r e c t a :
de Datos
Shifter)
i
-
Direccionamiento Inmediato :
i
,
- REGISTRO P.. T E INSTRL',rCION€S DE PIULTIFLICACI0h'
:
-INSTRUCCIONES DE ENTRADA Y SALIDA Y OPERACIONES CON L A
PIEMORICI DE DATOS
de
es
de
si
de
LT
2
C a r - g a el r-eg;i.c,Irro T
Cddiga = b4XX h.
m
Descripcidn
C a r g a al r e g i s t r o T c o n e l c o n t e n i d o
d e la d i r e c r c i t f j n d e memoria.
.
!
I
!
!
TMS3201.13
M A N U A L DE U S U A R I O
EL S IMLJLADOR D E L CO-FROCESADOR
TMS32C)l.C)
ESTA
COMPUESTO
POR
UN FKOGRAMF
L L A M A D O TMS32010.EXE E L C U A LE J E C U T A
O P O N E EN F U N C I O N A M I E N T O RL S I M U L A D O R ,
ES D E C I R , SE D E B ET E C L E A R
:
C:\>TMS32010 <ENTER>
UNA
VEZ
INVOCADO
EL S I S T E M AP E D I R A
BUE SE E S C R I B A EL NOMERE D E LA R C H I V C
D E DONDE
TOMARA
EL CODIGO
QUE
FROCESARG,
ES D E C I R
EL CONJUNTO
DE
I N S T R U C C I O N E S CXJE E S T A NE N
UN F O R M A T OI G U A LA LS I G U I E N T E
:
EO00ONO%IDT90000BF900~O.1304BOO90B00~6B6EO0~7F89E7E02E6700B4A~O7F~l6FNO~ID
3
B 7 E 0 3 B 6 7 0 0 B 4 9 0 0 B F 6 0 0 ~ 0 0 l 0 B F ~ 0 ~ B O ~ 0 ~ B 4 0 O 0 ~ 4 8 O 0 B F 9 O 0 B 0 ~ ~ C 7 F 3NOBIDT
E9F
2
: NOBIDT
02-10-93
17:36:41
ASM32010 PC2.1 84.107
NOBIDT t
D E S P U EDS
TEE C L E A R
c O t w o N E r 4 AL SIMULADOR
L I N E A COlylO :
EL NOMBRE D EALR C H I VAOP A R E C E R f iLNAVSE N T A N A S
Y EN LA FC'IRTE INFERIOR
DE LA PANTALLA
AFARECE
QUE
UNF
F3.Inst./(R)egs.Gen./F2-Regs.Edo./(M)em.Prog./(L)oc.Datos/(C)ont. PgUp P g D r
EL
LC
A U AILN D I C A
CJUE T E C L AESS T AANC T I V G D APSA R A
S I S T E M A Y L A SC U A L E S
SE D E S C R I B E N :
F3.Inst.-
E SOTPAC I O N
(F3j
I N S T R U C C I O NE SD E C I R
SIRVE
:
FARfi
FUNCIONEMIENTO
DEL
M O D I F I CAALRG UPNAARLDT
FEE
( D 1MA
- D I R E C C I O N DE L G MEMOR I A
( I ) I \ I S T - L AI N S T R U C C I O NE NE J E C U C I O N
DIRECCIONAMIENTO,
( M I C I D - MODO D E
(R)egs.Gen.-
ACC
ES D E C I R
S I ES ( D ) I R E C T O O
EST& O P C I O N ( R ) S I R V E FkKfi P O D E
MRO D I F I C f i R
R E G I S T R O S G E N E R A L E S UEL S IPlULfiDOR,
ES D E C I R .
R E G I S T R O S COMO SON :
- GCUMULADQR
ARO Y A R l - R E G I S T R O SD EF R O F O S I T OG E N E R A L
P
T
- R E GFIHSDO
TER
F OG
S IETNOE R A L
PC
-
-
y
R E GFI R
SDO
TER
FO
USITO
CONTGrjOKF R
DO
EG
L KfiMfi
GENERAL
(1)NDIRECTC
fiLGUP-IU
ALGLJNO
DE
DE
LEC
LEE
F2-Regs.Edo.-
OV
OVM
ARP
INTM
DP
E S T AO F C I O N
QUE
COMF'DNEN
-REGISTRO
-REGISTRO
-REGISTRO
-REGISTRO
"REGISTRO
(F2j
S I R V E PARA M O D I F I C A RL O SR E G I S T R O S
A L SIPlULADOFi :
DE ESTADC
QUE I N D I C A EL S O h R E F L U J O DEL ACUMULADOR ( 1 =NO o (3 = S I )
DE MODO DE S O B R E F L C I J O( O = D E S H A B I L I T A D O
6 l=HABILITADO)
P f i R A SABER Q U ER E G I S T R O
SE ESTAUSfiNDO
(ARC) 0 A R 1 )
DE INTERRUPCION(O=HABILITADA ó l = D E S H A B I L I T A D O )
AF'UNTADOR A L AP A G I N A
DE M E M O R I A DE D A T O S ( ( 2 6 1 )
(M)em.Prog.- E S T A
OPCION
( M ) SIRVE
PARA
POSE
PlODIFICAR
ALGUNA
CELDA
DE 1.F
M E M O RD
I AE L
FF:OGRGMA
SOLO CON I N D I C A R Lfi D I R E C C I O N DE ESF
C E L D A DE M E M O R I A Y L U E G O
PEDIRA
El- DFiTO GIUE SER6 I N T R O D U C I D C
EN ESA D I R E C C I O N
ES I M P O R T A N T ER E C f i L C A R
REGRESfiK'R A DONDEAFUhITA
(L)oc
.Datos-
CIUE U N A V E Z CAPTURADO EL DATO DESEADO L.4 F A N T A L L F
EL PC P A R AC O N T I N U A RE J E C U T A N D O
EL FROGRAMA.
E S T AO F C I O N
(L)S I R V E P A R A P O D E RM O D I F I C A RA L G U N AC E L . D A
DE 1-F
MEMORIG DE D A T O S Y A LI G U A LQ U E
EN L A M E M O R I A DE FROGRAMA
SOLC
SERA N E C E S A R I OI N D I C R RL AD I R E C C I O ND EL AM E M O R I AQ U E
SE DESEF
M O D I F I C A R Y LUEGO SE F E D I R A EL D A T O CIUE QUEDARA EN E S C
A ELDF
D EL AM E M O R I A
I
ES I M P O R T A NR
TE C R L C A R
ClUE
F f i N T AMLDEA
LEM
fi OR
GIFAE C T f iFDEOR M A N E C EAR
HHAA1S T A
M O D I F I C A RO T R AC E L D A .
UV
NIE
A
NZT R O D U C I D O
CDN L G
TE
SCLAS
DE PgUp, PgDn
F'ODREMUS MOVER L I B R E M E N T ED E N T R OD E
P A R A S A L I R DEL S I S T E M GS O L O
EL
DGTO
DESEADO
CIUE SE
LF
DESEE
Y CON L A S F L E C H A S A r r i b a , A b a j o NO5
Lfi PAI'JTALLG DE L A MEMOR IA DEL FROGRAMA
ES N E C E S A R I OF R E S I O N A RL AT E C L A
.
DE .::'.ESC:::.
Manual
T e c n i c o s o b r e el
Movimiento
e n Ventanas
La F u n c i b n
&ttprface c o n t r o l a
la-, m o v i m i e n tsoosb r e
las
v p n t a n a s a t r a v e s d e l a l e c t u r a d e l a t e c l a q u e s e p r e s i o n ee n
ese m o m e n t o . E s t o e5 p o s i b l ed e
realizar p om
r e d i . 0d e
la l e c t u r a
d e t e c l a s d e l a F u n c i ó n lee-tecla l a cual l e e la t e c l a q u e se
e n c u e n t r ae n
e l B u f f e r d e teclado.
U n a V E Z l e i d a l a t e c l a 5e p r a c e d e a d e s i f r a r s i e ?c o d i g od e
l a t e c l a e x i s t ee n t r e
1.0s y a d e f i n i d opsr e v i a m e n tdeme a n e r a
global.
S i el c t i d i g o d e l a t e c l a e s t a d e f i n i d ae ,n t o n c e s ,
a
t r a v e s d e u n Case r e a i i z a m o s l a a c c i 6 nc o r r e s p o n d i e n t e
al codigo
desifrado.
A n t e 5d e
que se l e a c ~ t a l q u i e r t e c l a e l sistema d e s p l i e g a l a s
v e n t a n a s que c o m p o n e n l a p r e s e n t a c i b n
de
Memoria d eFl r n g r a m a p
Memoria d e d a t o s , F i l a , R e g i s t r o s d e E s t a d o , R e g i s t r o sG e n e r a l e s
y C o m p o n e n t ed
se
l a I n s t r u c c i ó n a F r o c e s a r s ee n
ese m o m e n t o v e r
dibujo de pantalla.
L o s c B i f i g o sd e
#define
#define
#define
#define
#define
#define
#define
l a s teclas son :
UP-ARROW
DN-RRHOW
FG-UF
PG-DN
F1
F2
F3
0:.:4800
O:.:SOO(j
(3:.:49(3(3
Ct :.: 5 1 C!C)
0 :.: 3 b 0 B
6:.:3cC10
(:t:.:3dCiO
F l e c h ah a c i a r r i b a
F l e c h ah a c i aa b a j o
P a g i n a arriba
Fa i n a a b a j o
Modifica r e g i s t r o s d e E s t a d o
M o d i f i c a c o m p o n e n t e sd eI n s t r u c c i ó n
T e c l a s m y M p a r a m o d i f i c a r a l g u n al o c a l i d a d
d e la Memoria d e l Programa
T e c l a s 1 y L p a r am o d i f i c a ra l g u n al o c a l i d a d
d e l a memoria d e d a t o s
T e c l a s r y R p a r a m o d i f i c a r cztlqun R e g i s t r o
General
T e c l a s d e c y C p a r a c o n t i n L t . a re j e c u t a n d o
la
c , i g u i e n t ei n F ; t r u c c i 6 n
T e c l a d e ESC p a r a t e r m i n a r 21 proqrarna
Los c u a l e 5 s o nc l a s i f i c a d a se nu n
Case p a r ad e s p u e s
llamar a l a
f u n c i ó nc o r r e s p a n d i e n t e
y r e a l i z a r l a a c c i ó n que 5ea n e c e z a r i a .
E n el c a s o d e que 5 ~ -p r e s i o na el g u n a
.tecl;( q u e n o s e
este
d e f i n i d3ao n a r -uaBne e p
p r o v n c a d o PO!'
l a f u n c i o n con e l m i z m o
nombre.
I
E s t r u c t u r a q u e componen al Sistema
La P i l ad e
E a t o s e s t a c o m p u e s t a de u na r r e g l od e
4 pnsiciones
e n t e r a s y 2 e n t e r o( ts o p eb ?a s e )
los c u a l fecs; n c i o n a n
como
c o n t a d o r e sd e n t r o
d e a r r e g l o p a r a marcar l a b a s ed e
la P i l a y el
Top
de
l a P i lCa u. a n dud ona t o
es i n t r o d u c i d o a la P i l a
p r i m e r a m e n t e SE v e r i f i c a q u e l a F i l a n o
e s t e l l e n a ya q t l e d e l o
c o n t r a r i o se p e r d e r a e l d a t oq u e
se l o c a l i z a e n l a b a s ed e
la
P i . l a p a r a l u e g o r e c o r r e r l o s d a t o su n ap o s i c i b nh a c i a
l a base d e
l a P i l a e nu n ap o s i c i ó n
y a s i p o d e r i- n t r o d u c i re n
~l t o p ed e
la
P i l a el n u e v od a t o .
C opm
o do e m o s
o b s e r v a r me o? v i m i e ndteo
la
Fila
no
es
p r e s i s a m e n t e e l d eu n aP i l an o r m a sl i n o
p o r u 1c o n t r a r i o
actua
como una "cola c i r c u l a r "
es d e c i r y c u a n d o e l . f r e n t e e s i g u a l a l
p o s t e r i o r e l p o s t e r i o r se r e c o r r e a l . i g u a l que r l f r e n t e p a r a
meter e l n u e v od a t o .
T a n t o l a P l e m o r i a d e d a t o s como l a Memoria d eFl r o g r a m a
son
a r r e g l o s d e e n t e r o s D A T A MEM y MEM PROG l o s c u a l e ss o nm o s t r a d o s
e n p a n t a l la e n f o r m a t o H e x a d e c i m a l .
L a s 6 v e n t a n a s d e l S i m u l a d o r s odne f i n i d aeu-n,n
arreglo
H i d i m e n s i o n a ld e
7x4 l l a m a d a V e n y e l c u a lc o n t i e n ee nc a d au n o a
d e sus c e l d a s
l a s c o o r d e n a d adc sea du and ae
lar; v e n t a n a s
p r e s e n t a d a se n
e l s i m u l a d o r y que g r a c i a s a l a f u n c i ó n p a n t a l l a ,
marco y
se1 ventana I m p r i m i mm
eonso n i t o r
para a s i d a r
la
I r n p r e s i o nd ev e n t a n a si n d e p e n d i e n t e s .
Funcionemiento General d e las Ventanas
U n av e zp i n t a d o s
l o s recuadros dil. c a d av e n t a n a
tratamos a c a d a
V e n t a n pa osre p a r a d o
y a sea p a r a c o l o c a r l o s daters i n t e r n o s a
e l l a o p a zr ac t u a l i z a t a a l g u ndoe
e l l o s s o i a m ~ n t e hacemns
r e f e r e n c i da ea! r r e g l o
V e n . E s t a e rn e a l i d a d
se l o g r a p o r q u e
c a d a v e n t a n ae nr e a l i d a df u n c i o n a
d e m a n e r ian d e p e n d i e n t e
y con
solo
mencior;ar
que
n i t mvedereno t a n a
se d e s e a a f e c t a r y
m a n d a n d o l o como parametro d e l a f u n c i ósne l - v e n t a n a (
)
actuara
c u a l q u i e r e f e c t o d e p o s i c i ó n e i m p r e s i o ns o b r e
l a misma.
F a r ap o d e rm o d i f i c a r
o mo%verses o b r e a l g u n a d e l a s 2 Memoria
q u e e x i s t e n b a s t a c o ni n d i c a r
L ó M y l u e g oi n d i c a r
que l n c a l i d a d
d e memoria s e desea m o d i f i c a r p a r a q u e l a r u t i n a d ed e s p l i e g a < )
c o n coloque d e n t r o d e la::; 1 3 p o s i c i o n e s q u e SE a ! . c a n z a n a v e r e n
el m o n i t oFr '. a r a
e l caso d e l a Memoria d e l F r o g r a muanvae z
m o d i f i c a d a l a d i r e c c i ó n d e s e a d a se r e g r e s a r a a u t o m a t i c a m e n t e a l a
p o s i c i o n que l e i n d i q u e e l F C y a que l a i n s t r u c c i o n que s e
e n c u e n t r a en ia p a r t e s u p e r i o r d e l a v e n t a n a d e l a Memoria d e
Programa es l a i n s t r u c c i b n a e j e c u t a r s e y p a r a e l c a s o d e l a
Memoria d e Datos u n a .vez q u e se m o d i f i c aa l g u n al o c a l i d a d
d e la
i
rn3.
adff
235f
8716
&?2c
12
afae
1212
23dd
3pI
m
Me
a
1
2
3
21ad
add3
1214
0
4
5
o
b
23ff
8
7
1
a
a
"
- h
F3. Inst./(Rjegs. Gen.jF2-Regs. Edo./(Mjem. Frog./(Ljoc. Datos/lC)ont.
Comando :
Regs. Edo.
1
PgUp PSDIl
t 4
.urce P r i n t - File: C:\TMj~2010\TRS320!0.C
"
"
"
"
"
"
"
"
"
"
"
"
"
Pale: 1
...................................................................
ine Source
"
"
....................................................................................
- //,,,,..,....,...I........,.........
- I/
- /; Propraa Name: THS32010.C
- I f Date Created: 07107193
Copyright: UniversidadAutonoaaIetropolitana
Language: Borland C 2.0
Time Created: 23:!0:11
Author: Alberto
GarEia
Castillo
Description : Programa principal del Simulador del Co-procesador aateaatico TX3201O
- !I
O
1
2.
3
4
5
...........................................
- //
- 1; .............................................................................
- #include "stdio.h'
- #include 'd0s.h'
- linc1l;de "ctype.h"
- #include 'rtdlib.ha
- #include "c:\tws32010\var.cn
I t Definition de variables
globales
11
- #include 'c:\tas32010\THS.C~
I $ Procedimientos de manejo de ventanas t I
- #include 'c:\tms3i010\pantalla.c' I t Panta!la de presentation del prograsa 11
6 - FILE tfopen0;
7
FILE tfp;
B - char nomb_arch[40j;
9 0 - / t """"~""""""-
-
PRINCIPAL
................................
t1
1 -
2 - cain O
3 - {
4 - unsigned int i,instruccion=O;
5
b
7
9
9
-
O
1 3
-
4
-
2
cooen:ar( 1;
carga-arch();
pantalla0;
despliega2(pos);
interface();
for (i=O; i(=1024; itt)
{
instruction=~EH_PROG[PC];
5 -1
7 -
interface();
Tabla(instrutcion);
1
b
8 - It
.................................................................
9 O - Tabla(instruccion)
1 - unsigned instruction;
2 - :
3 - unsigned int 0p=0;
4 -
5 6
-
7 -
5
9
,O
1
2
-
-
-
op=linstruccion 4 Oxf000);
switch lop)
(
case Ox0
: ADD(instruccion);
break;
case Ox1000 : SUa[instruccion);
break;
c35e Ox2000 : LAC( instruction);
t1
- File:
]urce Print
C:\TMS32010\TtIS3201O.C
"""""""""""""""""""""""""""""""""""""""""""""-"""""""""~~~"""""""""~
he Some
""""""""""""""""""""""""""""~""""""""""""""""---"""""~"""""""""""~
break:
A case OxjOOO : op=(instruccion & OxfOOI;
4 switch (op)
5 -
_"_
6
7
9
9
0
-
i
-
{
b -
case Ox0 :
case Ox100 : SARIinstruccion);
break;
case Ox800 :
case 0x900 : LAR(instruccion1;
break;
1
break:
case 0x4000 : op=Iinstruccion & Oxf00);
switch ( o p )
7 -
{
2 3 4. -
5 8 9 0 -
1 3
-
3 4 5 h -
7
8
9
0
-
t1 2 3 -
4 15 I& 17 18 19 'O -
11
12
I;
-
-
-
14 15 16 17
M
-
-
19 100 101 102 103 104 -
case Ox0 :
case Ox100 :
case Ox200 :
case 0x300 :
case 0x400 :
case 0x500 :
case OxbOO :
case 0x700 : IN( instruccion 1;
break;
case Ox800 :
case 0x900 :
case OxaOO :
case OxbOO :
case OxcOO :
case OxdOO :
case OxeOO :
case OxfOO : OUT(instruccion);
break;
1
break;
case 0x5000 : op=(instruccion & Oxf001;
switch (opl
{
case Ox0 : SLCL(instruccion);
break;
case 0x800 :
case 0x900 :
case OxaOO :
case OxhOO :
case OxcOO :
case OxdOO :
case OxeOO :
case OxfOO : SACH(instruccion I;
break;
1
break;
case OxSOOO : op=[instruxion &: Oxf00I;
?age: 2
jourc-
_"
Print
- File:
C:\T~S3?010\TnS3?010.C
Page: 3
.ine Source
........................................................................................
107 -
LO5
switch lop1
LO6
{
,08 LO9 -
'12 113 ;14 -
i10
ill
115 I16 -
!19 i20 21 %2223 .24 125 126 -
117
:la
.27 .&
?B 29 -
.30 .31 -
i32 133
134
.35
-
.37 138 .S9 :40 141 .42 143 ,44 145 -
136
146
147
-
-
.48 -
!49 ;50 151 152 153 .54
!55
.56
-
-
case Ox0 : ADDH(instruccion1;
break;
case Ox100 : ADDSfinstruccionI;
break;
case 0x200 : S1IBtiíinstruccionl;
break;
case 0x309. : SUBS(instrucci0n);
break;
case 0x400 : SUBC(instruccion1;
break;
case 0x500 : ZALH(instruccion1;
break;
case 0x600 : ZALS(instru:cionl;
break;
case 0x700 : TBLR(instruccion1 I
break;
case Ox800 :op=(instruccion & OxOf0);
switch lop1
(
case Ox8O:op=(instruccion & Oxfl;
switch (op1
{
case
case
break;
case
case
break;
Ox0 :
0x1 : LARP(instruccion1;
Ox8 :
0x9 : HAR(instruccion1;
1
break;
case 0x90: HlR(instruccion1;
break;
1
break;
case 0x900 : DHOV(instruccionl;
break;
case OxaOO : IT(instruccion1;
break:
case OxbOO : LTD(instruccion1;
break;
case OxcOO: LTAIinstruccion 1;
break;
case OxdOO : HPY(instruccion1;
break;
case OxeOO : LDPKlinstruccion);
break;
case OxfOO : LDP(instruccion1;
break;
1
break;
,
irce Print
-
File: C:\TnS32@10\TnS32010.C
Paq?: 4
..............................................................................................
\eSource
"- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7 -
3 3 3-
ca5e 0x7000 : op=(ínstrl;ctior; 4 Oxf00);
w i t c h fop1
(
ca5e Ox0 :
case 0x100 : LARK(instruccion1;
I-
break:
2 3is5-
5-
789-
OI'2 3 '4 '5 '6 '7 18
-
31 32 19
30
93
84
85
-
-
-
87 88 89 90 91 92 .93 .94 .95 U6
.74 L97 .98 -
199 !O0
201
202
203
-
207
208
-
-
-
204 205 ?Ob -
-
case Ox800
break;
ca5e 0x900
break;
case OxaOO
break;
ta5e OxbOO
break;
case OxcOO
break;
case OxdOO
break;
case OxeOO
break;
case OxfOO
snitch ( o p )
{
: XORfinstruccion:;
: AND(instruccion1;
: OR(in5truccion~;
: LSTlinstruccionl;
: SST(instruccionl;
: TBLH(instruccion1;
: LACKtinstruccion);
:op=[instruccion b 0xOf0);
case OxBO:op=(instruccion L Oxf 1;
switch [op)
(
case
break;
case
break;
case
break;
case
break;
case
break;
case
break;
case
break;
Ox0 : CLAV€=36; / t NOP t /
0x1 : D I N T O ;
Ox2 : €INTO;
Ox8 : ABSIinstruccion);
0x9 : Z R C [ I ;
Oxa : R O W ( 1;
Oxb : SON!(
1;
case Oxc : CGLA( 1;
break;
case Oxd : RET( 1;
break;
case Oxe : PACO;
break;
case Oxf : I\PAC(I;
break;
I
break;
case Ox90:op=[instruccion b Oxf);
snitch [OD)
,
;ource Print - File: C:\iMS3=010\T~S3?01O.C
Page: 5
"""""""""""""""""""""~"""""~"""""""""~""""""""""""~"""
.ine Source
!O9
!lo
111
.........................................................................................
i
-
-
!I2
!13
!14
!15
'16
!I7
-
-
!1B -
!19 !20 !21 !22 !23 224 !25 -
i26
-
!27 -
!?a !29
50
!31
!32
133
!34
!35
!36
!37
!38
239
!40
!41
!42
!43
!44
245
-
-
-
-
-
!46 217 !40 249 !50 251 !52 253 3 4 255 156 257 259 39 !bo -
case O x 0
break;
case Oxc
break;
case Oxd
brfak;
: SPACO;
: PUSH
: POP(
1
break;
1
break;
1
break;
case 0x8000 :
case Ox9OOO : KPY#(instruccionl;
break;
case OxfOOO :op=(instruccion 8 Oxf001;
snitch (op)
I
case 0x400 :PC++;
instruccion=tlEfl-PRCG[PCl;
BANZ(instruccionf;
break;
case 0x500 :PC++:
instruccion=tlE#-PROG[PCI;
BV ( ins truccion
1;
break;
case Ox600 :PC++;
instruccion=HE~-PRO6[PCl;
BIOZ(instruccion);
break;
case 0x800 : break;
case 0x900 : PC++;
instruccion=HEN~PRO6IPCl;
B(instruccionf;
break;
case OxaOO :PC++;
instruccion=HEK~PRO6[PCl;
BL!(instruccionI;
break;
case OxbOO :PC++;
instruccion=~EM~PRC6IPCl;
BLiZ (instruccion 1;
break;
case OxcOO :
PC++;
instruccion=HEH-PRO6[Pil;
B6Z (instruccion 1;
break;
case OxdOO :
PCtt;
instruccion=HEH~PRO6[PCl;
- File:
;ource
" "_
C:\T!lS3?010\TES32010.C
P332:
""""""""""~"""""""""""""""""""""""""""~""""""""""""""""""----
. i n ~Source
"""""~"""""""""""""""""""""""""""""""""""""~""""-"""""-""""""""----
,""
!6l
!6?
lb3
!64
!65
!bb
!67
I68
!69
170
!71
!72
!73
!74
!75
!76
177
!78
-
BGEZ[instruccionI;
break;
case
OxeOO :
-
PC++;
-
instruccion=~E#_FROG~PCI;
BNZ(instruccion1;
break;
case
OxfOO :
-
-
-
PC++;
-
instruccion=~EH_PROG[PCI;
-
-
1
/t
BZ(instruccion1;
break;
1
break;
1
................................................................
!79 !80 - carga-arch0
!81 - {
! U - char c ;
!83 - int abrir, nun, instruccian, i;
!84 - clrscro;
185 - abrir = abre-arch[&narb-arch);
!a6 !87 - if (abrir == O )
/ t si existe 11
!68 - {
289 gotoxy(10,lOOI;
290 printf (' \nLEYENDO EL ARCHIVO %s\n',norb-arch);
291 f p = fopen(nomb_arch,'r');
i92
-
while ([c=getc(fp))!=EOF)
293 294 - if (c=='B')
295 296 instruccion=O;
297 nua=O;
298 for[i=O; i(=3 i++ I
299 I
300
301
-
302
-
303 304
305
306
307
508
309
-
-
-
-
310
311 -
512
-
c=getc[fpl;
snitch(c1
{
ca5e ' O ' : nua=O;
instruction=( instruccion{(4) :nun);
break;
case '1': nuell;
instruction=( instruccion!(3)
:nun):
break;
case '2': nua=2;
instruction=( instruccion!i4) Inur):
break;
case ' 3 ' : nun=3;
tl
b
Page: 7
;ource print - File: C:\THSj20!O\TnS320iO.C
,""""~"""~""~""~~"""~"~""""""~~""~~""""~~"""""-""""---------------------------------------------
.ine Source
............................................................................................
i14
-
break;
case ' 4 ' : ~iun=4;
instruction=( (instruccion(i4) !nu#):
break:
case '5': num=5;
instruction=( (instruccicsn<(4) :nus):
break;
case ' 6 ' : nun-6;
instruction=( (instruccion((4):nun);
break;
case '7': nua=7;
instruction=( (instruccion((4) :nuel;
break;
case '8' : nup=8;
instruction=( (instruccion((41
break;
case ' 9 ' : nur1=9;
instruction=( (instruccion((41
break;
case ' A ' : nun=lO;
instruction=( (instruccion((4)
break;
case 'E': nua=ll;
instruction=( (instruccion((4):nuo);
break;
case ' C ' : n w 1 2 ;
instruction=( (instruccion((4) :nual;
break;
case 'D' : nua=13;
instruccion=((instruccion((4) :nun);
break;
case ' E ' : nus=l4;
instruction=( (instruccion((4) :numJ;
break;
case ' F ' : nua=15;
instruccion=((instruccion((4) :nuel;
break:
I
1
i15 i16 -
:li >;a -
*.
i1F
20
21 22 23 i?4 25 26 27 28 29 -
;:o -
;31 ij2 v.
t.jJ
:34 ;35 -
1
a:; i36
J7
;39
-
;40 ;41 i42 i43
-
i44 i45
i46
-
i47 148 i49 50 i51 152 j53 i54 -
flE~-PRO~[CONTl=instruccion;
++COHT;
1
;55 -
556 157 -
Ea - 1
559
-
i63
-
1
1
- / $ .................................................................
i61 562 - abre-arch(char no~b~arch[401)
(60
564
,
(
FILE linfile;
tl
,urce Print
_"~"~"~"
-
File: C:\THS3?010\TMS3?010.C
Fage:
ine Source
""
..................................................................
55 -
int encuentra;
S6
57
do
-
&if -
71 72 73 74 b9
70
75 7b
-
77 78 79 30 91 a2 E3 -
E4
-
E5
86
87
-
-
clrscr0;
gotoxy~10,501;
printf( 'DME EL ARCHIVO A ANGLIZAR : ' 1;
gets(noeb-arch);
if ( !strlen(noab-mhl 1
encuentra = 1;
else
(
infile = fopen( nolb-arch, "r' I ;
if ( !infile 1
{
printf( 'NO EXISTE EL ClRCHIVO !\n" 1;
deiay(2000);
encuentra = 2;
1
else
encuentra = O ;
fclose(infi1e);
i t CIERRA EL ARCHIVO t !
I
}while ((encuentra != O)&&(encuentra != 1 ) ) ;
returnlencuentra);
m109 - ADD(instruccion)
110 - unsigned int instrutcion;
t11 - {
112 - unsigned int shift;
113 shift = (instruction & OxfOO
114 shift = shift>N;
115 mod-dir=(instruccion 4 0x80)
I15 if (mod-dir==O)
a
Fqe: 9
ource Print - File: C:\TnS3?010\TnSS?OlO.C
....................................................................................................
_"_ineSource
.............................................................................................
17 18 19 ?O 21 22 -
(
dsa=(instruccion & Ox7f I ;
ACC=ACC~(CRTFI_ME~[~~~~((~~~~~);
bandera=?;
3
else
24 25 '26 27 28 23
29
30
31
- 3
35
36
37
33
- I
(
orcc=ACCt(CCITA-~EnlRE6-~UXIARPlj((shift);
DIR-IND(instruccion1;
1
CLCIVE=l;
PC++;
- /$ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52 33 - ADDH(instruccion1
34 - unsiqrted int instruccion;
59 40 41 -
long int dato;
rod-dir=( instruccion & 0x90);
if (zod-dir==O)
42 43 44 .45 46 47 4a .49
-
.50 .51 .52 -
r53 - 1
154 155 - / t
{
dna=(instruccion & Ox7f 1;
dato= (DCITA_HEH[daaI((l6);
ACC=ACCtdato;
bandera=2;
1
else
dato=(DRTA-~EII[REG-CIUX[ARPIl((l6);
ACC=ACCtdato;
DIR-IND(instruccion);
1
CLAVE.2;
PCtt:
""~"""~""~""~"""""""""""-------------------
.56 -
- ADDS(instruccion1
- unsigned int instruccion;
-(
b 6 0 - long int dato;
nod-dir=( instruccion B 0x801;
ibl if (eod-dir==O)
i62 I63 {
i57
38
159
164
dma=( instruccion & Ox7f 1;
dato= (DATA-HEMIdwj dr Oxffffl;
ACC=ACCtdato;
bandera=Z;
-
lbfl -
11
it5
166
167
I
tt
jurKp
_"
Print - File: C:\TnS32010\TnS32010.C
""_"~""""""""""~"""~
Page: 10
ine Source
""
""""""""""""""""""""""""""~"""""""""""""""""""""""""-""-----""---"""
else
71 lL 73 -
5.9
I
70
dato=iDAlA-HEn[ffEs-RUX[ARPll
ACC=ACC+dato;
DIR-IND(instruccion1;
1
CLWE=3;
PC+;
-1
74 75
76
-
77 - I
78 79 - I $
"""_""""""""""""""""""""""""""""-
8 Oxffff);
11
- ANDIinstruccionI
82 - unsigned int instruction;
93 - {
rod-dir=(instruccion & 0x80);
84 if (rod-dir==O)
85 86 {
dna=(instruccion & Ox7f);
87 -
30
81
88
99
90
71
92
93
94
95
9b
ACC=(ACC P 0x0000ffff);
ACC=(RCC & DATA-HEt![dmal) ;
bandera=Z;
1
-
-
else
-
{
ACC=(IICC L 0x0000ffff);
ACC=(ACC P REG-AUX[C\RPII;
DIR_IND(instruccion);
97 1
CLAVE.4;
98 PC tt;
99 100 - 1
101 102 - / t
103 io4 - RPAC( 1
lf
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
i05
io6
iG7
io8
-
-
{
ACC=bCC+F;
CLRVEz5;
- FCtt;
i09 - bandera=5;
i10 - 1
-
ill
j12 - / t
i13
j14
tl
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
-
i15
- B(instruccion1
- unsigned int instruccion;
jl6
-
j17
j19
-
j19 i20 -
{
unsigned int pna;
paa=(instruccion & Oxfff);
PL=pma;
CLAVE=6;
Ource print
-
File: C:\TnS32010\TnS3fOlO.C
""""""~"
~""~"""""~_
P a p : 11
....................................................................
i n e Source
"
"
....................................................................................
21 - bandera=5;
:2? - 1
23
-
24
25
-
t/
""""""""""""~""""~""""""-------------------
- BRNZ( instruction)
27 - cnsigned int instruccion;
2t
m28 29 30 131 32 33 34 35 36 17 38 39 40 41 42 43
44 45 46 47 4a ,49 150 '51 -
(
unsigned int p a ;
pma=(instruction & Oxfff);
if [ [REG-flUX[ARPl & Oxlff1! = O )
(
RE6_RUX[sRP]=RE6_F\U~[aRPl-l;
PC=paa;
1
else
I
RE6_AUX[ARP]=Ri6-RUX[ARPl-l;
PCt+;
1
CLAVE=7;
-1
/t
bandera=5;
"""""~""""""""""""""""-"---------------
BGEZ(instruccion)
unsigned int instruccion;
(
unsigned int paa;
paa=(instruccion & O x f f f ) ;
152 -
if (flCC)=O)
-
PC=paa;
else
153
i54
tl
-
PC++;
156 - CLAVE=8;
157 - bandera=5;
158 - 1
159 150 - / t ""~"~"""""""""""""""~""""--------------151h2 - BGZ(instruccion)
155 -
163 - unsigned int instruccion;
i64
i65
i6b
i67
i68
$9
i70
i71
i72
-
-
(
unsigned int pma;
pma=(instrutcion & Oxfff);
if(ACC>O)
PC=pra;
else
PC++;
CLAVE=9;
bandera=5;
ti
Page: 12
;ource Print - F i l e : C:\TnS32@10\[email protected]
""""""""""""""""""""~""~""""""""""""""""""""""""""""""--"-""""----
,_
.ine Source
~""""~""""""""""""""""""""""~""""""""""""-""""""""""""""""""""""--
,""
173 - 1
I74
-
IR9
j90
-
i75 - / t ~""""""""""""""""""""""""""""--"-i7b i77 - BIOi(instruccion)
i73 - unsigned int instruction;
i79 - {
Xi0 - unsigned int pna;
i61 - pwa=(instruccion P Oxfff);
i82 - if(BIO==O)
i83 PC=pwa;
i34 - else
i85 PC++;
ia6 - CLGVE=10;
i97 - bandera=5;
i88 - )
/t
................................................................
si
:/
i91 i92 - BLEZlinstruccion)
i93 - unsigned int instruccion;
i94 - I
j95 - unsigned int paa;
596 - paa=(instruccion P Oxfff);
j97 - if(ACC(=O)
j98 PC=paa;
599 - else
500 PC++;
$01 - CLAVEz11;
502 - banderaz5;
503 - 1
504
505
-
- / t "~"~""""~~~"""""""""""""""""""-------507 - BLZ(in5truccion)
508 - unsigned int instruccion;
509 - {
510 - unsigned int pma;
511 - paa=(instruccion & Oxfff);
612 - if(bCC(0)
513 PC=paa;
614 - else
515 PC++;
I/
506
CLIIVE=12;
517
bandera=5;
618 - I
519 620 - / $ ................................................................
616 -
-
2 - BNZ í instruction1
521
6
b?3
b23
- unsigned int instruccion:
-
{
:/
;ourcp
Print
- File:
Page: 13
C:\iMS52010\T~S3?U!~~.C
""~""""""""~"~"""""""""""""""""""""""""""""""""""""""""----------------
.ine Source
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""---"-
125 126 127 128
129
-
130 -
131 132
63
134
-I
-
]35 - / t
136
""""""~"~"~""""""""""""""---"----------
tl
-
- BV(instrutcion1
157
138 139 i40 141 ,42 ,43 144 145 146 147 i48 149 150 '151 32 i53 54 155
unsigned int paa;
p@a=linstruction & Oxfff 1;
if(ACC!=O)
PC=pma;
else
PC++;
CLAVEz13;
bandera=5;
unsigned int instruccion;
{
unsigned int pea;
paa=(instruccion & Oxfff);
if(OV==l)
{
PC=paa;
ov=o;
1
else
PC++;
ESTADO=status( I ;
CLAVEz14;
bandera=5;
}
It
tl
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
-
- BZ(instruction1
157 - unsigned int instruction;
i58 - (
i59 - unsigned int pma;
160 - pra=(instruccion & Oxfff 1;
561 - if(ACC==O)
I62 PC=pna;
i63 - else
ib4 PC++:
565 - CLAVEz15;
ib6 - bandera=5;
i67 - 1
i56
- It ""_""""
i70 571 - DINTO
i72 - {
173 - INT#=l;
168
569
ji4
575
-
-
i76 -
ESTADO=status( 1;
CLAVEz18;
PC++;
ti
ource Print
- Fil.:
"""_
Pagz: 14
C:\TflS3201?\TnS32010.C
"""""""""~"""""""""""""""""""""""""""""""""""----""""""-
ine Source
"
"
77
t78
79
,go
-
"""""""""""""""""""""""""""""""""~""""~"""""""""""""""""---""--"----1
bandera=5;
- / t """""""""""""""""""""""""~""""---
t/
.a1 132 - DMOV(instruccion)
83 - unsigned int instruccion;
384 - {
185 $6
-
1a7 -
nod dir=linstruccion k 0x80);
if ~iaod-dir==Ol
{
198 -
189 ,90
-
191 192 193 -
dra=(instruccion & Ox7f);
DATA~~E\[dmatll=DCITA_nEnldeal;
bandera=2;
1
else
I
I95 196 -
D~TA_\E~[RE6~AUX~ftRP]+lI=DdTA_~E~[Ri6_ilUX[ARPll
;
I94
DIR~IND(instruccionI;
1
197 PC++;
198 - CLAVEz19;
199 - 1
!O0 '01
- / $ ""~"""""""""""~""~"""""""""""-"-----
tl
- EINTO
104 - {
705 - 1 N W O ;
'06 - ESTADO=status( 1 ;
707 - PC++;
M 8 - CtAVE=?O;
109 - bandera=5;
'02
io3
710 - 1
111 -
713 712
/t
________________________________________-----------------------11
114 - LACIinstruccionl
715 - unsigned int instruccion;
716 - I
717 - unsigned int s h i f t ;
718 s h i f t = (instruccion & OxfOO
719 shift = shiftiN;
720 w~d-dir=(instruccion k 0x801
721 i f (nod-dir==O)
122 123 724 -
725 726 727
728
-
-
I
daa=(instruccion & 0x7f I ;
~CC=(DIIT~-RErl[dmal((shift);
bandera=Z;
1
else
I
!
iource Print
- File: C:\lHS32010\TWS32010.C
Page: 15
.ine Source
.................................................................
'29
'30 '31 -
ACC=IDCITA-~E~lFiEG-Gux[CIRPll(Cshift);
DIR_IND(instruccion);
'32 -.I.
.M
-
'34 - ]
"C
JJ
'36
-
/t
1
CLAVE=2?;
PC++;
................................................................
11
'37 '38 - LACK(instruccion1
:3? - unsigned int instruccion;
'40 - I
'41 - unsigned int cte=O;
'42 - cte=(instruccion & Oxff);
'43 - ACC=(ACC t O X O ) ;
' 4 4 - BCC=cte;
'45 '46 -
PCtt;
CLAVE=23;
bandera=4;
'47 48
'49
'50
-1
- / t ________________________________________-------------------&I
'51 '52 - LAR(instruccion1
53 - unsigned int instruccion;
'54 - {
'55 - unsigned int arp-aux;
arp-aux= (instruccion & 7001;
arp-aux=I arp_aux)>8);
nod-dir=(instruccion & 0x80);
if (mod-dir==Ol
'56 -
'57 '58 '59 -
'60 '61
{
-
'62 -
RE6~AUX[arp~auxl=DIIlB_HE~[deal;
'63 '64 '65 '66 -
'67 '$8 '59 '70 '71 -
dna=(instruccion & Ox7f I ;
bandera=2;
1
else
I
RE6_GUX[arp~aux]=DGT~~~EHiRE6~GUX[arp~aux11;
DiR-IND(instruccion);
1
PCtt;
CLAVE=24;
'72 - 1
'13 5'4 '75 -
/ a "~"""""""""""""""""""""""""""----"
'76 - LARK(instruccion)
'77 - unsigned int instruccion;
'78 - I
'77 - unsigned int cte-aux;
'80 - arp_aux=(instruccicn & 0x7001;
tl
- F iPage:
l e : C:\TnS32010\i#S32010.C
ource
lb
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
~
ine Source
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
51 - ar?_aux=[arp_aua>)a);
82 - cte-aux=( instruccion t O x f f 1;
a: 84
REG-AUXIarp-auxl=cte-aux;
-
PC++;
85 - CLAVE=25;
35 - bandera=b;
57 - r
88 a9 - I;1 """"""""~""""""""""""""-""-----"------90 91 - .A8P(instrutcionl
92 - msigned int instruction;
94 -
93
tl
r
1
unsigned int ctel;
95 - ctel= (instruccion & 0x1);
96 - ARP=ctel;
97 - ESTRDO=5tatusO;
'98 - PCtt;
99 - CLAVE=26;
100 - bandera=7;
IO1 - I
!O2 103
104
105
¡Ob
-
/t
""""""""""""""""""""""""----------------
tl
LDP(instruccion1
- unsigned int instruccion;
?O7 - {
108 - unsignedintLSB;
~od-dir=(instruccion & 0x801;
109 if (aod-dir==Ol
110 Ill (
312 113 314 115 316 117 318 319 320 -
322 323 324 325 -
dna=(instruccion & Ox7f);
LSB=(Oxl & DATA-tlEH[deal);
DP=LSB;
bandera=2;
1
else
LSB=(Oxl & CATA_HEH[RE6_AUX[ARPlll;
DP=LSB;
321
DIR-IHD(instruccion);
7
i
ESTADO=status( I ;
PCtt;
CLAVE=27;
,
I
laurce Print
- File:
Pag?: 17
C:\THSj2010\T~lS32010.C
.ine Source
.""
1'1
.JJ
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
-
unsigned int ctel=G;
ctel=(instruccion k 3x11;
DP=ctel;
ESTADC=status();
134 135 156 -
137 138 I39 -
PC++;
CLAVE=ZR;
bandera=7;
140 - 1
131 117 - / $
"""""""""~"""""~"""""""~""""""~------
tl
143 I44 - LST(instruccion1
135 - unsigned int instruction;
146 - {
147 eod-dir=(instruccion & 0x80);
139 149 j50 -
if(fiod-dir==O)
{
dma=(instruccion & Ox7f);
ESTAOO=DATA_nEHídnal;
bandera=?;
1
eláe
i51 152 153
-
I54 i55 355 -
{
159 -
157
1
PC++;
159 -
363 364 -
360
361
362
365
366
367
1
/t
...............................................................
11
,
- LT(instruccion1
- unsigned int instruccion;
-{
369 370 371 372 373 374 -
376
877
CLAVEz29;
I
358
875
ESTADO=DAT~_HEH[RE6-AUX[ARPlI ;
DIR_IND(instruccion);
Pod-dir=(instruccion & 0x80);
if (nod-dir==OI
{
dsa=(instruccion & Ox7f);
T=DATA-HEH[dral;
bandera=Z;
7
i
-
else
{
l=OATA~fE~[RE6~~UX[~RPll;
DIR_IND(instruccion);
378 979 -
i
aso -
PC++;
BE1 - CLAVE=30;
682 - 1
a93 884
-
12
________________________________________----------------------$1
Page: 16
TflS32010\TnS32010.C
Ource Print - Fils:
ineSource
...........................................................................
85
:86
-
- LTA(instruccion1
E7 - unsigned int instruccion;
:sa -
199 190 i91 192 -
{
mod-dir=[instruccicn & 0x80);
if(&od-dir==O)
{
dsa=(instruccion & Ox7fI;
T=DATA-HEM[dral;
ACE= ACCtF;
bandera=?;
194 i95 196 197 198 199 'O0 -
193
'O1
1
else
{
T=DATA-HEH[RE~-AUX[ARP]] ;
K C = ACCtP;
-
DIR_IHD(instruccion);
1
'O2 '03 -
'04
'05
106
to7
!O8
PC++;
-
-
CLGVE=31;
}
- 1:
________________________________________-----------------------11
-
,O9 - LTD(instruccion)
110 - unsigned int instruccion;
?I1 - {
112 mod-dir=(instruttion & 0x80);
I13 if(aod-dir==Ol
114 {
115 dra=Iinstruction k Ox7f);
116 T=DATA-HER[daal;
117 DATA_HEH[dratl]=DFITA_HE~[dral;
118 K C = ACCtP;
719 bandera=2;
120
1
-
121 ?22 -
else
(
?23 124 125 -
?28 129 j30 131 732 132 -
T=DATA_HEH[REG-AUX[ARPII;
DATA_~EH[REG_AUX[ARP]+l]=DATA_~EHtREG-AUXIARPII;
ACC= ACCtP;
DiR-IND(instruccion1;
1
126
u7
134
-
136
-
!
PC++;
CLAVE=32;
1
11 ~""~"""""_"""""""""""""""""""""""-
YAR( instruccion)
135 - unsigned int instruction;
{
tl
-
ource
Page: 19
File: C:\TWS3=010\T~S32010.C
.............................................................................
_"ine_ Source
.............................................................................
- aod-dir=(instruccion & 0x80);
38 - if (nod_dir==Ox80)
19 DIR-INGO;
40 - else
41 bandera=?;
42 - PCtt;
37
93
44
- CLBVE=33;
- :
45 -
- /a ................................................................
47 48 - HPY[instruccion)
49 - unsigned int instruccion;
46
50
51
a/
-(
-
52 53 -
55 55 57 54
58 -
nod-dir=(instruccion & 0x80);
if (aod_dir==O)
(
doa=(instruccion 4 Ox7fI;
P=TSDATA-HEH[~I~I;
bandera=2;
1
else
(
P=TtDATA_~EH[REG_CIUX[ARPIl;
DIR-IND(instruccionl;
1
- PC++;
- CLBVEz34;
-1
67 - / t ................................................................
¿a, '69 - HPYK(instruccion1
59
50
61
62
63
64
65
66
ti
!
70 - unsigned int instruccion;
'71 - (
72 - int ctes;
'73 - ctes=(instruccion
74 - P=ctestT;
'75 - PCtt;
76 - CLAVE.35;
'77.bandera=5;
'78 - I
'79 '30 - / t
L Oxlfff);
ti
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
'81
-
'32 - OR(instruccion)
'83 - unsigned int instruction;
'84 - (
'85 nod-dir=(instruccion 4 0x80);
-
'86
'87
'38 -
if (rod-dir==OI
{
daa=(instruccion & 0x7f 1;
)urce Print
-
F i l e : C:\THS3?010\iHS;?010.C
Page: 2i:
................................................................................
ine Source
"
"
...........................................................................
39 70 71 -
y2
-
ACC=(ACC & Oxffffl;
ACC=(ACC : DATA-HEHrdaal);
3
?3 -
else
94 -
{
75 CICC=(ACC h Oxffff):
36 ACC=(ACC I DCIlA_flEn[RE6_AUXtARPll);
77 DIR_IND(instruccionl;
98 1
99 PC++;
000CLdVEz37;
001- I
002003- / # ................................................................
t!
004005- P A C O
006- (
007ACC=P;
008PC++;
CLAVEz39;
009010bandera=5;
011- 1
0123!3- / t """_""""""""""""""""""""""~""---""--
t/
0141015- ROVI1( 1
,016- [
~017- O W O ;
. O W ESTADO=status( 1;
;019- P C t t ;
,020- CLAVEz43;
1021- bandera=5;
1022- 1
1023-
1024- / t
________________________________________-------------------------ti
10251026- SACLlinstruction)
1027- unsigned int instruccion;
1028- (
1029mod-dir=Iinstruccion k 0x80);
103010311032-
1033-
1034103510361037-
if (mod-dir==O)
{
daa=(instruction h Oxif I ;
DATA-HEfl[dsa]=GCC;
bandera.2;
1
else
{
1038-
10391040-
1
DaTA_nEn[RE6_ilux[~RP]l=ACC;
DIR_IND(instruccion);
\T~Sj2010\TnSj?010.C
hurte Print - File:
Pag.:
21
.ine Source
_"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
~
PCtt;
.041CLAYE=45;
1042,043- I
;0441045- / t
.046L047- SGVH ( 1
.048- (
1049- OVH=l;
.050- ESTADO=statusO;
ti
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
1051- PCtt;
,052- CLAVE=47;
1053- bandera=5;
,054- 1
,055!O%- / t
S/
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
,057!O%-
SPACl)
,059- {
,060- ACC=GCC-P;
,051- PCtt;
CLAVE=4EI;
1062,063-
bandera=5;
iO64- 1
'9551066- / t
1067-
tl
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
1068- SST(instruccion)
1069- unsiqned int instruccion;
1070mod-dir=(instruccion I 0x80);
1071if (rtod-dir==O)
10721073-
{
dsa=(instruccion 6 O x 7 f ) ;
DATA_~EH[dral=status( 1;
bandera=Z;
107410751076-
I
else
1077107810791080108110821083108410851086-
{
I
PC++;
CLAVE=49;
1087- / t
10881089109010911092-
DATA_~E~[REG_AUX[ARPIl=~~atus(
I;
DIR_IND(instruccion);
.................................
SURlinstruccion)
unsigned int instruction;
{
unsigned int shift:
t/
- File:
jource
~"" " " "~" " "_
h
_"
Page:
C:\TMS32010\T#Sj2010.C
22
e Source
"~""""""""""""""""""""""""~"""""""""""""""""~""""""~"""""""""
1093-
!094lW51096109710981079110011011102-
shift = (instruction t Oxf001;
shift = shift)N;
nod-dir=(instruccion & 0x801;
if (wod-dir==O)
i
dna=(instruccion t Ox7fI;
AiC=AiC-(DGTA-~E~[dmal((shift);
bandera=2;
1
else
1103(
1104ACC=ACC-DaiA_nE#[REfi-AUX[ARPI];
llQ5DIR-IND(instruccion1;
11061
1107- PC+t;
1108- CLAVE=50;
1109- }
11101111- / t
1112-
11
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
1113- SUBS(instruccion)
1114- unsigned int instruction;
1115- (
111611171118111911201121112211231124112511261127112811291130113111321133- / t
1154-
mod-dir=linstruccion h OxiOI;
if (nod-dir==O)
(
dma=(instruccion h O x 7 f I ;
ACC=ACC-IjATA-HEH[dral;
bandera=2;
1
el se
(
ACC=ACC-DGTll_~EH[REfi-AUX[AR?]];
DIR-IND(instruccion1;
1
PCtt;
CLGVE=53:
ti
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
1135- TBLR(instruccion)
1136- unsigned int (instruccion);
1137- I
1136- seter(0xfff h [PC+lI);
11391140- PC= (ACC h Oxfff I :
1141- mcd-air=(instruccion h 0x80);
1132- if (cod-dir==O)
1143-
1144-
{
dma=(instruccion & Ox7f I ;
jource Print
~"~""_
"-¡ne_
- File: C:\TnS3;010\TMS320!0.C
Page: 23
SGurce
................................................................
DGTA_flE~[daal=#E~_PfiUGIFCl;
PC=;acar();
bandera=2;
114511461147114a-
I
1149-
else
{
11501151DATA-~Efl[~E6-AUX[ARPll=~E~-?~O~[?~l;
1152PC=sacar ( I ;
DIR-IND(instruccion1;
1153-
1
1159-
1155CLBVEz54;
1156- }
11571153-
115911601161116211631161-
________________________________________------------------------11
/t
TBL#(instruccion)
unsigned int (instrucc o n ) ;
(
meter(0xfff & (PCt1)
llb5-
PC= (ACC 0 O x f f f ) ;
iod-dir=(instruccion L 0x801;
if (mod-dir==O)
116611671168Ll6911701171117211731174117511761177-
{
dla=(instruccion & Ox7f I ;
HEH-PRO6[PCl=DATA-KEH[dmal;
PC=sacar( I ;
bandera=2;
1
else
!
{
HEH_PRO6[PC]=DATA-KEH[RE6-~UX[A~Pll;
PC=sacar(I ;
DIR_IND(instruccionl;
1178-
11791180-
1
CLA'JE255;
1181118211831181118511861187-
XOR(instruccion)
unsigned int instruccion;
1!88-
{
11891190-
119111921193119411951196-
1
/t
tl
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
mod-dir=(instruccion 8 0x801;
if (~od-dir==O]
{
daa=[instruccion & Ox7f 1;
ACC=(ACC & O x f f f f ) ;
ACC=(ACZ * DATA-tfEtf[draj);
bandera=2;
1
'üurce Print
-
Page: 24
File: C:\THS3?01~\T~S3?010.C
.ine Source
"""""""""""""""""""~"""""""""""""""""""""""""""""""""""""""""""-
197198199-
elsf
{
CICC=(ACC h Oxffff);
ACC=(GCC * DATA-H€H[RE6-GLIX[ARPIl I ;
2oc-
IR_INDlin;trutcionl;
201-
1
.202-
.?o;PC++;
,204CLAVEz56;
205- 1
.?Ob-
,207- / $
,208,209- ZAC ( )
o:;.-
$1
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
{
,211- ACC=O;
,212- PC++;
,213-CLAVE=57;
214-bandera=S;
,215- 1
,216117- f t ________________________________________-----------------------\L
tl
,2182 1 9 - ZALH(instruccion1
.220- unsigned int instruction;
1221- {
12221223-
12241225-
mod-dir=(instruccion & 0x80);
if (mod-dir==O)
{
dea=(instruccion & Ox7f 1;
ACC=(Oxffff & DATA-HEH[dmal);
ACC=(ACC((lb);
bandera=2;
122612271229}
12291230else
I
12311232ACC=(Oxffif I DATA_HEn[RE6_AUX[ARP31);
1233ACC=[ACC((16);
1234DIR_IND(instruccionl;
1
12351236PC++;
1237-CLAVE.58;
1239- 1
12391240- / t
................................
12411242- ZALS(instruccion)
1243- unsigned int instruccian;
1244- (
1245mod-dir=(instruccion & 0x90);
1246if (md-dir==O)
{
1247madsa=(instruccion & Ox7f);
ti
- Fil.: C:\THS32010\TMSj?010.C
""""""""""""""~"""""""""""""""""""""""""""""""""""""""""""""""""""-
;ource Print
"-ine
_ "Sourc:
_
Page: 25
~"~""""""_"""""~""""""~"""""""""""""""~""""-"""~~"""""""------------
ACC=(Oxffff & OATA-HEti[daajl;
bandera=?;
1249-
1250-
1251I
1252else
1253{
1254ACC=(Oxffff & DATG_rlEH[REG_AUX:ARP131;
1255DIR-IND(instruccion);
12561
1257PC++;
1258- CLiVEz59;
1259- 1
12b01751- 11 ________________________________________---------------------tl
1262126312541265126b126712681269127012711272127312741275-
IUS()
(
if ( ( A C C == oxaooooooo) I& ( o v H = = ~ ) )
ACC= Ox7fffffff;
else
if (ACC(01
ACC=-ltACC:
PC++;
CLAVE=O;
1
bandera=5;
________________________________________--_--------------------a/
12761277- IH(instruccion)
1278- unsigned int instruction;
1279- {
1280unsignedint port-dir;
1281port-dir=instruccion I 0x700;
1282port_dir=port_dir>)8;
1283-
m - gotoxy(1,25);
cputs('1nterrupcion provocada p o r el Puerto :'I;
cprintf('Zd',port-dir);
:'I;
1287- cputsl" Valor de entrada
1288cscanf('X4x',tvalorl;
1289acd-dir=(instruccion & 0x80);
1290if(mod-dir==O)
{
12911292dra=(instruccion k 0x71);
1293DllTi-HEN[daal=valor;
1294bandera=2;
1
12951296else I
1297DLTA-~EH[REG_AUX[ARP]]=valor;
1298DIR_IND(instruccioni;
1285-
1286-
1299-
}
1300despliega2ipos);
!
iou;[e
".ine
_
Print - File: C:\T~S32010\THS32010.C
"""""""""""""""""""""""""""""""""""""""""""-"-----------"---"-
Source
""""""""""""""""""""""""~""""""""""""""""""""""""""~"~""""""-""""
,301,302-
.;o:-
Page: 25
PCtt;
CLAVEZ21;
1
1304-
505-
________________________________________---------------------t/
305-
i307- OUT(instruccian1
i308- unsigned int instruccion:
1309- {
1310- unsignedint port-dir;
311- port-dir=instruccion & 0x700;
i312- port-dir=port_dir))B;
1313i314- Rod-dir=(instruccion & 0x80);
.315- if (nod-dir==O)
L315{
i317dBa=(instruccion & Ox7fl;
:318valor=DATA-HEfl[dmal;
1319bandera=2;
1
13201121- else
1322-
valor=D~Tb~HEH[RE6~AUX[~RPll;
i323- gotoXy(1,251;
1324- cputs("1nterrupcion provocada
al Puerto : ' I ;
i325- cprintf('Xd',port-dirl;
1326- cputs('con valor de salida : ' I ;
!327- cprintf('X4x',valor);
1328delay(6000);
1229- PCtt;
1330- CLAVE=38;
1331- 1
13321333- / t
________________________________________---------------------It
13341335- SAR(instruccion)
1336- unsigned int instruccion:
1337- {
1338- int AR;
1539- ARP=(instruccion&Ox700);
1340GRP=ARP>)R;
& 0x80);
1341-aod-dir=(instruccion
1342- if (sod-dir==Ol
{
13531344-dea=(instruccion
& Ox7f);
DATir_HEH[dma]=RE6-~UX[ARP];
13451346banderd;
1
13471548- else
{
13491350AR=RE6-AUX [ ARPj ;
1351if
((instruccion
h CxZO)==l)
1352RE~-~UX[~RPI=REs_CIUX[aRP]+l;
I
\TMS32010\T#S3?010.C
;ource Print - File:
Page: 27
.ine Source
....................................................................................
( ( instruccion & OxlO)==lI
RES-AUX:ARP:=REG-AUX[ARPI-l;
DATA-MEtl[ARl= REC-AUXIARPI;
if ([instruccion & Ox8)==0)
ARP=instruccion & 0x1;
if
,3531354. m -
i355,357358-
1
PCtt;
1359CLAVE=46;
1360:361- 1
!3621363- /a ...............................................................
.3b4;365- SACHiinstruccionl
a/
,366- unsigned int instruccion;
1367- {
,368- unsigned int shift;
i369- long int dato;
1370!371- shift =instruction & 0x700;
,372- shif t=shif t > M ;
!373-
.374i375!376-
1377-
1378i37913801381-
1382138313841385-
dato= ACC;
dato=dato((shift;
dato=dato)>lb;
mod-dir=(instruccion & 0x80);
if (mod-dir==O)
(
daa=(instruccion & Ox7f);
DATA-HEH[dmal=dato;
bandera=Z;
}
else
DATA_HEHIRE6-AUX[ARPll=dato;
PC++;
1386- CLAVEz44;
1387- 1
1388-
1389- / t
~""""""""""""""~"""""""""""-"""-----
1390-
1391- SUBH(instruccion)
1392- unsigned int instruccion;
1393- {
1394- long intdato;
1395- mod-dir=(instruccion & 0x80);
1396- if (aod-dir==O)
1397{
1398dma=(instruccion & 0x71 1;
1399dato=DATA-HEH[daa!;
1400dato=dato((lb;
1401ACC=ACC-dato;
1402-
14031404-
banderal2;
j
else
t/
jo,urce Print - File:
Page:C:\TflS3:310\THS3?010.f
_"_
28
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
h e Source
_"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
1405- {
1406dato=DATA_~En[R€s_A~x[ARP33;
dato=dato<<l6;
1407ACC=ACC-dato:
1408DIR_IND(instruccion);
14091410- 1
1411PCtt;
1412CLAVEz52;
1413- 3
14141415- ...............................................................
$/
14161417- SUEC(instruccion1
1418- unsigned int instruccion:
1419- {
1420- long int adder-output,dato;
1421- mod-dir=(instruccion & 0x80);
1422- if (mod-dir==OI
1423- (
1424-daa=(instruccion
& Ox7f);
143dato=DATA-~ER[deal;
dato=dato((lb;
1426adder-output=ACC-dato;
14271428-if((Oxffff0000
& adder-output)>= O )
C=(adder-outputlZitl;
1429else!430.ACC82;1431bandera=2;
14321433- 1
1434- else
1435- {
1436dato=DATA_~En[RE6-AUX[FiRPll;
dato=dato<(lb;
1437ACC=ACC-dato;
1438if I(OxffffOOOO 8 adder-output)>= O 1
1439CC=(adder-outputtZ)tl;
1440else
1441CC=ACCt2;
1442DIR-IHDIinstruccion);
14431444- }
1445- PC++;
1446CLAVEz51;
1447- }
14481449- ________________________________________----------------------t/
14501451- PGP( )
1452- (
14531454- ACC=sacar(I ;
1455- PC++;
1456-CLAVE.40:
h u r t e P r i n t -Page:
File: C:\THS32010\TMS320!0.i
29
h e Scurce
_"
"_"""""""""~""""
- . ,
L457- bandera=5;
14581459- 1
1460!461- I t ________________________________________------------------------tl
13521463-PUSH()
!464- {
1465146b- ReterlOxfff k ACCI;
1467- PC++;
1468CLAVEz41;
L469- b a n d e r a 3 1
14701471- 3
1472""""_"""""""""""""""""""""""1473- /a
________
tl
14741175- RET( 1
1476- (
14771478- PC=sacar( 1
1479- CLAVE.42;
1480bandera$;
14811482- 1
14831484- I t ________________________________________----------------------a/
14851486- CALAI )
148714881489- meter( [Oxfff & (PCt1)) I;
1490- PC=( K C & Oxfff 1;
1491- CLAVEz16;
1492bandera+:
14931494- }
14951496- /a ________________________________________-----------------------t!
149i1498- CALL( I
1499- {
15001501- meter(0xfff k (PCt21);
1502- P C = ( i n s t r u c c i o n & Oxfff);
1503- PC++;
1504- CLAVEz17;
1505bandera=5;
1506- 1
15071508- / t """"""""""""""""""""""""""""-""""
tl
;ourcE Print
-
F i l e : C:~TMS3;0!0\i~Sj?OlC.C
Page: 30
.in€ Source
.""
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
15G9-
L510- status()
.511- {
1512- unsigned intreg-status:
:SE1514-
reg-status=(l & O V ) ;
,515- reg-status=((reg-status((l1 :OVfl)
1516- reg-status=( (reg-status((l1~ INTY
!517- reg-status=(reg-status((4);
1518- reg_status=(reg_status~Oxf1:
i519- reg-status=((req-status((l1 :RRP) f
1520- reg_status=(reg_status((7);
1521- reg_status=(regstatus~Ox7f
1;
1522- reg_status=((reg-status(~l):OP];
1523- return(reg-status);
1524- 1
1525-
!
;oi;:ce Pririt - Fiie: C:\Tt4S320!O\TtlS.C
Pagz: 1
.ine Source
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
:
- //"""""""""""""""""""""""-""""""""""""""""
- /I
Author: Alberto Garcia
Castillo
- I / Date Created: 07/07/93
;
- /I
!
Tine Created: 23:33:34
- ! I Description : Conjunto de procedimientos para e l Bartejo de ventanas y
-I/
que controlan al simulador TIIS32010
- //"""""""""""-""""""""""""""""""""""""""""
I - #include 'c0nio.h''
i
I
8
t
-
.O
,1
-
.2
It tasaso de la pila de instrucciones $1
#define tam 4
#define l o ( f ) ((f) & Oxff)
It obtiene el ASCII de un cod. ext $1
3 4
-
#define
#define
#define
#define
#define
Ox3b00
F1
#define
#define
6 7 .I 9 5
!O
I1
!2
i3
14
'!5
16
17
!I
-
-
il
2
53
i4
15
0x4~00
Ox5000
0x4900
0x5100
F2
0x3~00
Ox3d00
F3
de algunas t /
It teclas para la interface tl
/ S codigosextendidos
structCola (
unsigned intInfo[ta~l;
int tope,base;
I Stack;
-
-
int ven 171 [41 = { {1,1,80,25), / t ventana base t l
(4,3917,211,
It ventana de Heaoria
del
Prog.t/
(54,3,77,12),
It ventana
Registros
de
Generales
11
I
t
ventana
de
la
Pila
t
/
(41,9,49,121,
/t ventana de Registros de Estadotl
(54,19,76,21),
(22,3,36,21},
I ! ventana
de tlehoria de
Datos !/
(41,15,77,16} I ; I t ventana con la instrucci'nactualtl
!9 i0
UP-ARRO#
DN-ARROW
PG-UP
PG-DN
-
-
i6 -
17
!i
19
10
il
12
-
IJ -
$4
15
16
17
18
19
j0
51
i?
signed int DATA-tlEfl[l44];
unsigned int flEfl_PR06[100] ;
int w,v,Pad,r-m,t)andera=O,
reg,EA,ext,li,ls,
nua-op,override,
flg-hlt,auxD,pos;
-
;t"""""""""""""""""""""""""""""""-""
void marco int uplx,int uply,int lorx,int lory,char
- I
-
inti,xs;
-
gotoxy(up x,uply);
putch(ZO1 ,
tl
ts)
teclas
ource
Print - Fils: C:\THS3?010\THS.f
Page: 2
..................................................................
.ine Source
""""""""""""""~""""""""""""~"""""""""""~""""""""~""""~""""""
for (i=(uplx+l);i (= (!orx-l);i++) putch(2Q5);
putch(l87);
for (i=(uplytl);i (= (1ory-l);itt) {
gotoxytuplx,i); putch(l861
gotoxy(lorx,i); putch(lS6l
1
gotoxy(uplx,lory);
putch(2001;
far (i=(uplxtl);i {= (lorx-1 ;itt) putch(205);
putch(l6E);
if ( $ 5 != O 1 {
xs = I ( lorx-uplx-strlen(s)~l)/~)t uplx;
if (x5 { uplx) xs = uplx;
for (i=O;(ts ! = O ) &k (i { (lorx-uplx+!)l;i++)
I
gotoxy(xs+i,uplyl; putch(ts++l;
1
1
}
'3
- /a
'4
-
'E
-
""~"""""""""""""""""""""""""""-"""
al
'5 - char lee-tecla (int S k )
76 17 - {
i9
30
I1
12
13
14
35
36
37
38
39
?O
91
72
?3
34
95
i'b
union REGS regs;
regs.h.ah = O ;
int86lOxlb,tregs,treqs);
t k = regs.x.ax;
if (lo(lk) == 3) exit(1);
return regs.h.al;
- 1
-
/$
""""""""""""""""""""""-""""""""""-
void beep (void)
-
-
(
1
98 - / X
sound(750);
delay(200);
nosound( 1;
...........................................................
- it
102 -
Dibuja las ventanas del simulador THS32C;lO en Video
100
101
void
103 104
tl
-
97 99
!
-
{
pantalla ( 1
tl
at
- Fil.:
,ource
C:\THS3?010\THS.C
Page: 3
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
.ineSource
.................................................................
05 06 07 .Oü 09 10 I1 -
clrscr0;
g0toxyi25,l);
cprintf (">) Simulador TflS32010 ( < ' I ;
aarco(venil1 [O]-1,venIll [lj-l,ven[lf [21t1,ven[lI [31+1,0
nets. Prog.");
marcofven[21 :O]-l,ven[i] [I]-l,ven[?l [21tl,ven[21
[31+1," Regs. Gerals.');
rarcoíveni31 [O]-l,ven!31 [l]-l,ven[3] [21tl,ven[31
[31+1," Pila '1;
~1arcoíven[41 [O]-l,ven[4] [l]-l,ven[4] [?l+l,ven[41
[31+1,n Rt?gs.de Edo.*l;
12 - carco[ven[51 [O]-l,ven[5] [1]-l,ven[5] [2]tl,ven[5] [31t1,"
Rea. de Datos ' I ;
13 - narco(ven[61 [O]-l,ven[b] ill-l,ven[b]
[Z]t!,ven[¿l
[31+1,O Instrucci'n
"I;
14- 1
15 ,lb - / t .......................................................................
ti
17 .18 - void pantalla20
19 - f
20 .21 - marco(ven[bI [Ol-l,ven[S] [l]-l,ven[6] [2]tl,ven[bI
[31+1,D fleworia de Datos '1;
22 .23 - 1
24 """""""""""""""""""~"""-""
25 - / $ _"""""
t/
?b 2 7 - void sel-ventana (int win
78 -
.29
-
{
.IO window(ven[winl[Ol,ven[winl[ll,ven[winl[2l,ven[winl
.51 - 1
[31);
132 -
134 - / $
.35 - I t
77
.33
11
tt
.....................................
Actualiza la ventanade que fuealterada
por la operation
136 .37 !38 - void actz-ventana lint nin,int dato,unsigned char scrol!)
.39 -
i40 141 142 !43 -
144
{
-
145 146 147 118 149
-
150 151 -
152
153
154
-
1
155 - / t
156 -
lowvideo();
sel-ventana(win1;
gotoxy(2,l);
if (scroll) I
delline0;
gatoxy(2,ven[winl [I] - ven[winl ilI+ll;
1
else inslinei);
cprintfín%4x I %4x",dato,HEH~PRU6[dat011;
noravideo();
sel-ventana(0);
________________________________________---------------------------$1
Despliega la ventana
de
tleooriaEatos
de
tl
ource Print - File: C:\TtlS320!0\TMS.C
Page: 1
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
ine Source
"
"
""""""""""""""""""""""""~"~""""""""""""""""""""""""""""""""~"""
57 -
58 - vcid despliega2(int pos)
59- {
60 - int x ;
61 62 63 -
sel-ventana(5);
for (x=O;x(= 18;x++) {
64 gotory(2,x+l);
55 cprintf('L4x I Xlix',po~+x,DATA~HE#[pos+xll;
66 1
b7 sel-ventana(01;
68- 1
59 70
-
11
- /a
72 -
________________________________________---------------------------$1
Oespliega l a ventana de Reeoria del Prograaa
71
73
t/
-
7 4 - void despliega (int l o c )
75 lb77
78
.79
O!
al
82
.83
{
-
int x;
-
sel-ventana(1);
for (x=O;x(= lB;x++) {
gotoxy(2,xtu;
cprintf("Z4x I 14x',loctx,~EH~PRO6Il~c+xll;
-
184 a5
-
1
li = lot; 1s = loctx-1;
sel-ventana(0);
.ab - 1
.87 .Ea
,a9 - / t """""""~""~~"""""""""""""""""""----------
.90 - It
Despliega la ventana de registros
generales
.91 .92 i95 - void registros ( 1
.94
-
L77
-
195 - I
.96 -
.sa 199 !O0
101 -
!O2
?O5
-
!O4 !O5 !O6 107 !o8
-
sei-ventana(2);
gotoxy(3,2); cputsI'Id.');
1
gotoxy(3,4); cprintf('
gotoxy(3,4); cprintf(' 1 gotoxy(3,5); cprintf(' 2 gotoxy(3,5); cprintf(* 2 gotoxy(3,bi; cprintf(' 3 gatoxy(3,6); cprintf(' 3 gotoxy[3,7); cprintf(' 4 gotaxy(3,7); cprintf(" 4 gotoxy(3,3); cprintfl" 5 gGtoxy(=,8); c p r i n t f ( " 5 -
RCC
"I;
ACC %lx',ACC);
P
"I;
P ZIx',P);
ARO
*I;
ARO Ilx',REG-AUX
AR1
'1;
AR1 XLx",REG-RUX
T
*I 1
T
Z$x",T);
tl
$1
w r c e Frint
- File:
Page: 5
C:\TMS3SOID\T~S.C
.......................................................................
i n e Scurcs
"
" "
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
~
"
"
"
09
10
-
11 12 13 14-
:
gotoxy(3,9i; cprintf(' 6 '1 ;
gotoxyi3,9); cprintf(' 6 - PC %3x8,PC1;
gotoxy(3,lO);cprintfi' 7 gotoxy(3,lO); cprintfi' 7 - BID Xld',BIOl;
sel-ventana(0);
15 -
- J t ....................................................................
17 '18 - void v e r i n s t 0
'16
tl
19 - {
'20 - char modo;
21 22 - sei-ventanalb);
?J 24 if (aod-dir==O)
25 nodo='D';
26 else
27 modo=' I * ;
29
29
30
i31
-
-
-
'32 33 -
.34I35 -
J4 -
J.7
:37 38 -
139 :40141
-
142 143 !45
-
145 146 147 !38 149 150 !51 152 -
!53
-
!54
55
!56
-
-
-
!57 !58 -
i59
!6O
-
qotoxy(2,l); cprintfi'
witch(bandera1
"1;
(
case O:
ca5e 1: gotocyl2,l); cprintfl' INS.
'1;
gotoxy(l3,l);
cprintfl'
daa
'1;
gotoxy(25,l); cprintf(' HOD.
'1;
break;
cprintft'
INS.
"1;
case 2: gotoxy(2,l);
gotoxy(2,l); cprintfl' IWS. XS',INSTR[CL~VE]I;
gotoxy(l3,l); cprintf(' dna %4x",dra);
gotoxy(25,l); cprintfl' HOD. Xc",rodo);
break;
case 3: gotoxy(2,l);
cprintf('
INS.
'I;
gotoxy(2,l); cprintf('
INS. Xs',IHSTR[CLAVEI);
gotoxy(l3,l); cprintf(' HOD. %c',nodo);
break;
case 4: gotoxy(2,l); cprintf('
INS.
gotoxy(2,l); cprintf(" INS. Zsn,,INSTR[CL4VEI);
gotoxyil3,l); cprintfi" CTE. %lx',,CICCI;
break;
n
case 5: gotoxy(2,l); cprintff' INS.
gotoxy(2,l); cprlntfi' INS. XsR,INSTR!CLAVE1);
I
break;
ca5e 6: gotoxy(2,l); cprintf(# !NS.
gotoxy(2,ll; cprintfi" INS. %s",INSTR[CLAVEI);
yotoxy(l3,l); cprintfi' CTE. %4x8,RE5_kUX[a:p_auxI)i
break;
case 7: gotoxyi2,l); cprintf(' INS.
'1;
gotoxy(2,l); cprintfi" INS. %s',IliSTR[CLGVE]);
gotoxy(l3,l); cprintfi" CTE. Xlu",ctel);
break;
I
!
iource Print
-
Page: 6
File: C:\TMS3?010\TES.C
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
.ine Source
,""
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
1
sel-ventanalo);
'61 -
152 163 164 - }
165 156 157 - / S
........................................................................
!69 - void
168
!?O !71 !72 !7Z !74 -
?75 -
!76 !77 !78 !79 !90
-
!S1 -
?94 !85 286 !E?
!83
int lac-a;
sel-ventana(5);
loc-a=loc;
gotoxy(3,2);
gotoxy(9,Z);
gctoxy(15,Z);
gotoxy(21,Z);
gotoxy(27,2);
gotoxy(33,2);
gotoxy(39,Z);
287 -
288
297
-
PrograsaIint lot)
{
290 291 292 293 - 1
294 -
cprintf("%4xa,DATA~HE~[locll;!oc~~;
cprintf('Z4xS,DIITA~HEH~locll;loc++;
cprintf(a%4xa,DAlCI~HEH[locl);loc~+;
cprintf('Z4x',DATA~HEH~locl);loc~+;
cprintf('%4xa,DCITA~ME~[iocll;ioc++;
cprintf(a%~xa,,D~TA~HEH[locl);~oct+;
cprintf('%4x',DATR~HE~[locl);ioctt;
gotoxy(3,31; rprintf('%4x',loc-a1; loc-a++;
qotoxy(9,3); cprintf~'X4xa,loc~al;ioc-a++;
gotoxy(15,3]; cprintf('X4xa,loc-al; loc-a++;
gotoxy(il,3); cprintf('Z4x',ioc_a); loc-a++;
loc-a++;
gotoxy(27,3); cprintf('X4x',loc-a);
loc-att;
gotoxy(33,:);cprintf('X4x',loc-a1;
gotoxy(39,3);cprintfI"X4x',loc-al; loc-at+;
sel-ventanaIO);
.
Sf
.
\TNS32010\iRS.C
lource Print
-
Page: 7
File:
.ine Source
.""
I 3
~"""""""""""""""""""""""~""~"""""~""~"""~""""""""""""""""""
-
/t
,19
-
{
20 i21 ;22 -
i23 24 125 26 27
-
;28 - 1
;29 -
;32 ;30
t/
t/
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
;14 - / t
Despliega la vtlntana con los Registros de estado
;15 ¡!6 27 - void banderas ( 1
;la -
/t
sei-ventana(4);
gotoxy(2,l); cputs('0V UVfl INTI! ARP DP');
qotoxy(2,Z);
cprintf('%ld',OV);
qotoxy(6,2);
cprintf('%ld',OVfll;
yotoxy(10,2);cprintf('%ld",INTH);
qotoxy(14,2); cprintf('Xld',ARP);
gotoxy(19,21;cprintf('%ld",DP);
sel-ventana(O1;
""_"""""""
tl
;33 - void loc-mes (int tloc,int cual)
;34 -
;35 - (
:36 gotoxy(l,25);
i37 X9 ;40 i41 i42 i43 ;44 -
cputsi'localidad de Henoria : ' I ;
cscanf( 'X4x" loc);
if (cual == 1)
i38
r
if ((tloc >= O ) && (tloc (= 143)) {
if (tloc (= 9) li = O ;
else if (tloc >= 144) li = 125;
else li = t l o c - 9;
despliega2IIil;
547 148 149 j45
i46
350
1
-
352 153 554 155 -
553 356
157 -
$59 -
362 360
I61
163
564
-
1
else {
i51
I
/t
I t HEHORIA DE DATOS t /
I t RERORIA
DE PROGRAHA $ I
if ((tloc >= O ] 81 (tloc (= 1023)) (
if (tloc (= 9) li = 0;
else if (tloc >= 1024) li = 1017;
else li = tloc - 9;
desplieqalli);
I
1
&I
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
void Nod-mea ( I
(
int cas;
;ource Print
-
Page:
File: C:\TMS32010\THS.C
a
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
.ine Source
~"""""""""""""""""""""""""""""""""~"""""""""""""""""""~""""""""
;55-
auxb=O;
gct~1~~(1,25);
- cputs(Yoca1idad de Feaoria : '1;
(58 cscanf['Z4xg,&ca;);
i69 if ((cas )= O ) Bt (cas (= 143)) I
I t ?lERORIR DE DATOS 1/
:70if (cas (= ? I li = O ;
;71 else if (cas >= 1441 li = 125;
!i2 else li = ca5 - 9;
;73 despliegaZ(li1;
i74 3
gotoxyi29,25); cputs('cantenido : '1;
;75 ;76 cscanf("%4xm,&auxb1;
i77 DATA_flER[ca51 = auxb;
;78 despliega2(ii);
379 - 1
;66 ;¿i
- / t ....................................................................
335 ;S4 - void podgrog(
;u5 - {
:a6 - int casilla;
97 a e - auxb=O;
xi9 gotoxy(1,251;
cputs('Loca1idad de fleroria : ' I ;
j90 i80
191
591 ;92 -
cscanf('Z4x',bcasilla);
if ((casilla >= O ) && (casilla <= 1023)) {
if (casilla (= 9) li = O;
else i f (casilla >= 1024) li = 1017;
else li = casilla - 9 ;
despliega(1i);
193 -
394 ;95 396
-
397 398 599 -
1
gotoxy(29,25); cputsl'contenido
cscanfl'%4xu,hauxb);
H€H-PROG[casilla] =auxb;
despliegailil;
400 101 402 403 404
405 - / t
106
-
:'I;
1
409
Hodifica
alguna
registros
las
deEstado
de
-
-
411 912 410
413
514
415
void rod-edoo
r
char ban;
-
-
116 -
ti
tl
""""""~""""~"""""""""""""~""~"""""""
/1
407 908
tl
gotoxy(1,25);
cputsl"€scriba ¡as iniciales del Registro Ll/!í/I/A/D a modificar : " I ;
cscanf( "Xlc',&banl;
- Fiie: C:\TYS3?010\TflS.C
ource
Page: 9
"""""""""~""""""""""~""""""""""""~""""""""""""""~"""""~""""""""
.in2 Source
"
" ..................................................................
17
-
switch(toupperfban)l {
case ' O ' : if (OV==l)
GV.0;
else
19 20 21 22 23 24 25 26 27 .26 29 30 31 32 JA 18
OV=l;
break;
tase
else
break;
case ' I ' : if (INTH == 1)
INTkO;
el se
INTH=1;
break;
tase ' A ' : i f (hRP == 1)
ARP=O:
-
else
36 -
40
41
142
A3
144
45
846
b47
148
: if [OV# == 11
OVt?=l;
34 37
38
39
'/I'
ovn=o;
"
35
I t ESTADO = s t a t u s ( ) ; $1
ARP=l;
-
break;
case
'D' : if (DP == 11
DP=O:
else
-
DP=1;
break;
}
-
- /t
ESTADO=status();
banderas[ 1;
1
......................................................................
- It
Rodifica
Registras
los
alguno
de
Generales
150
.51
152 - void rod-reg ( 1
.4?
i53 154 -
i56 157 I55
158 159
160
I61
I62
i63
I64
165
-
165
-
167
166
-
-
{
int id,val;
long int va12;
gotoxy(1,25); cputsI"1d. del r e g i s t r o : "1;
cscanf('Z2dB,tid);
gotoxy(23,25); cputsl'valor : ' I ;
if (id ==1 ;; id ==21
cscanf('Xlx',tval2];
else
cscanf('X4x',Cval);
if (id i= 1 t h id (= 8 ) {
witchiid1 {
case 1 : ACC = val?; break;
case 2 : P = va!?: break;
t/
t/
iource Print
-
Page: 10
File: C:\T#S32010\iXS.C
.ine S o u x e
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
lb9
170
171
172
173
174
175
176
177
\78
179
190
I81
182
183
184
-
case
case
case
case
-
-
despliega(PC);
PilaO;
break;
case 7 : BIU = val;
-
-
break;
-
-
i85
186
187
-
M9
-
-
I88 -
1
/t
.................................................................. tl
void w o d i n s t 0
(
intval;
char w-dir,inst-id;
190 191 ;9?
193
494
195
196
197
998
199
500
501
502
503
504
505
506
507
1
registros0;
1
-
(Ilnst. (D)ea ' (!!lodo : ' I ;
cscanf('Xc',&instid);
gotoxy(38,25); cputs('va1or : '1;
if (instjd=='H' :: inst-id== '1'1
cscanf('X4x',&vaIl;
else
cscanf('Tc',&m-dir);
switch(toupFer(inst_id)) I
case *H': aod-dir = val; break;
case '1': INS = va!;
break;
case
dma = a-dir;
break;
1
despliega(PC);
ver-instO;
-
gotoxy(1,25); cputs('Caebiar
-
-
-
3 : REfi-fiUXIOI = val; break;
4 : REG-fiUX[l] = val; break;
5 : T = val; break;
b : PC = val;
'DI:
}
508
509 - / t
"""""""""_"""""""""""""""""""""""-
510 - I t
Incerta
elelento
en el tope
de
511 512 - void aeter(unsigned int entrada)
513
514
-
-
515
516
5!7 518
519
520
{
i f ((Stack.tope == O ) && (Stack.Info[Stack.topel
Stack,tope=3;
for (i=O;i(=Z;tti)
Stack.Info[il=Stack.InfG[itll;
-
-
la Pila
1
Stack. Info[Stack. tope] = entrada;
!='\O'))
ti
ti
unr;igned int sacar0
(
if ~(Stat~.InfotStack.topej ! = ' \ O ' ) tttt (Stack.tope ==O)) i
Stack. tope=3;
salida=Stack.Info[Stack.topel;
Stack.Info[Stack.topel='\O';
I
else
{
if (Stack.tope !=O) {
Stack.tope=I(--Stack.topeI%41;
salida=Stack.Info[Stack.topel;
Stack.Info[Stack.topel='\O':
I
1
return(salida1;
1
j47
- /t"""""""""""""""""""""""""""""""""""
- / t Controla todos los lovirientos en
j48
549 j50 j51 - void interface 0
j52 553 - (
j54 int k,pos;
j55 int fl = 1;
j56
557
558
559
560
561
562
563
564
565
566
567
568
-
-
-
-
-
569 57C 571 572 -
t/
todas las ventanas del Simulador t i
despliega(PC1;
despliegaZ(0);
registroso;
PilaO;
banderas( 1;
ver-insti 1;
pod;
If11 (
gotoxy(1,24);
Hhile
cputs("F3.Inst./iR)egs.Sen./F2-~egs.Edo.~~~~em.Prog./~L~oc.Da~0s~~CIon~.
PgUp PgDn ' 1 ;
putch[24);putch(25);
gotoxy(1,25);
clrenl0;
cputs('Cosando : 'I;
lee-teclallkl;
swltch (k) {
!
iource Print
- File:
C:\TMS32010\TMS,C
Page: 12
.ine Source
""""""""""""""""""""""""""""""""~"""""""~""""""""~"*"""""""""""""
case UP-ARRG# : if (li > 0 1 (
act:-ventana[l,--li,O);
i73 j74 -
i77 i75
j76
"15;
1
break;
case DN-fiRROii : if (Is ( 1023) {
actz-ventana(l,++ls,l);
+tli;
1
break;
case PG-UP
: if (li ) O ) {
if (li-19 )= O) li = li-19;
else li = O;
despliega(1i);
i78 179 i80
i81
-
J02 j83 -
j86 i87 j84
j85
1
188 i89 J90 j9l 592 j93 394 -
case P6-DN
j95 - 0x1352 case
598 599 500 -Ox324d
596
j97
501 502
505
-
604 505 606 507 hoe
bC9
610
-
511 612 -
615 613
613
616
-
617 -
b22 b23 624 618
619
620
621
case0x1372
break;
: if (Is ( 1023) {
if (lst19 (= 1023) li = Istl;
else l i = 15 - (1st19-1024);
déspliegaili);
1
break;
:
: gotoxy(l,24);clreal0;
I t Registras t l
cputsl'tlodificacian de Registros");
mod-reg ( 1;
break;
:
/ t Henoria I!
case
caseOx326d
: gatoxy(l,24); clreol0;
cputs('Hadificacion de Heaoriao);
modgrog( 1;
break;
0 x 2 6 4 ~c a s e
:
/ t Laca1i:ar t I
case0x266~
: gotoxy(1,241;c!reolO;
cputs("Loca1i:ar casilla de tlesoria');
eod-#er( 1;
break;
I t Registros
Estado
de
t/
: gotoxy(l,24); c l r e o 1 0 ;
case F2
cputs('ilodifica 10s Registros de estado');
aod-eda( 1;
break;
case F3
: gotoxy(1,241; c l r e o l 0 ;
cputs('Hodifica 1nstrucci"n ' I ;
aod-ins t ( 1;
break;
caseOxZe43
:
/ t Continuar t /
caseOx2eb3
: f l = O; break;
caseOxOllb
: clrscr();
printf('Sa1ida del Simulador iHS32010.');
exit(0);
: teep0;
defaui
t
I
I
ource P r i n t
-
F i l e : C:\THS32010\T#S.C
Paqe: 13
Sowe
in2
"
" "
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
~
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
25
-
26
-
27- 1
'28 -
1
;ource F r i n t
- File:
C:\T%J2010\VdR.C
fag?: 1
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
"
~
"
"
"
"
"
"
~
"
"
"
"
.ine
Source
"_
I
Z
I
1
i
i
'
3
?
!O
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
~
- u n s i g n e di n t PC=O, O?', BIO, OVR, IN%, DP, GRP, TOS! REG_AUX:ll,entrada,salida:
- u n s i g n e di n t HEt!-FROG:lOOl, ESTADO, gad-dir, CONT,instruccion,lNS,CLRVE!dra;
- c n s i g n e d int arp-aux, c t e l ;
- s i g n e idn t I, l!ATP_HEH[1441;
- long int ACC, P;
- char INSTR[601[53 = ['BBS',RADDa,'ADDH','ADDS','ANDu,8APAC','B','~ANZ~,a~GEZ',
-
11
-
13
-
I?
-
"EGZ8,'BIOZ",aBLEZ','BLZ',u5NZ',"BV","BZ8,8CAL~','CALL',
'DINTs,'DHOV',sEINT','IN8,'LGCs,'~~C~',8~~R',nL~~K','LARP8,
'LDP','LDP#','LST','LT','LTA',8LTD','HARw,'flPY','HPYK','~OP*,
'CR',"OUTu,'PAC',"POP','PUSH8,n~ET','AOV~n,'S~CH',sS~CL',
'SARu,"SGVfl','SPAC','SST","SU5Q,'SUBi','SU~~','SUBS','TBLR',
'TB?#',QXDRC,'ZGCs,'ZALH~,'ZALSo};
int vaior,i;
h u r t e Frint
- Fil.: C:\TMS3?0!0\P~NTirLL~.C
Page: 1
.ine Source
""~"""""""""""""""""""""""""""~""""""""""""""""""""""""""-"--"--""-
.
!
-
1
-
#include
Bintlude
j
- #include
1 - #include
I
'
I
?
10
11
-
'aath.h"
'conio.h"
'5tdarg.h'
'graphics.h"
int
GraphDriver;
- int6raphHode;
- int HaxX,IaxY;
- int
RaxColors;
- int Errorcode;
-
- void Inicialvoid);
- void Pantlvoid);
- void Presentaciono;
- void StatusLine(char fa50 1;
- void DibBordeivoidl;
- void changetextstyle~lint font, int direction, intcharsize);
.a 19 - coaenzar( l
I?
.3
:4
.5
:6
,7
!O - (
!1
22
!3
!4
?5
16
27
28
-
IniciaO;
Panto;
closegraph0;
return(01;
-1
-
-
It
tl
"
"
"
"
"
"
"
"
"
"
"
"
~
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"
void Inicia(void1
29 - (
30
51
32
13
-
34
35
36
37
38
39 40 - 1
41 42 - / t
6raphDriver DETECT;
initgraph( k6raphDriver, k6raphHode,
1;
Errorcode = graphresult0;
if ( Errorcode != grUk I(
printf(O Graphics System Error: %5\n', grapherroresg( Errorcode I I ;
exit( 1 l;
1
HaxColors = geteaxcolor0 + 1;
HaxX = getmaxnl I;
RaxY = getraxytl;
I'
""_"""""""
45 - void Pant(void1
44 - {
45 - struct vienporttype info;
46
int h, M ;
47
Presentation();
48 - getviewsetting;( &info I ;
49 - changetextstyle( SOTHIC-FONT,
-
56
31
52
-
-
HORIZ-DIR, 4 1 ;
settextjustify( CENTER-TEXT, CENTER-TEXT I ;
h = info.bottoa - info.top;
u = info.right - infoeleft;
t/
jource P r i n t
_.ine
"
j3
j4
-
-
ja j9 i0 54
55
56
i7
;S
59
IO
Page: 2
...................................................................
J6
j7
52
í3
C:\TnS3?0!0\PAWTBLtA.C
Source
j5
'11
- File:
o u t t e x t x y ( n/?! hi?.:, 'SIflULADOR TES32010' I;
changetextstyle( DEFRilLT-FONT, HORIZ-DIR, 0.5 1;
s e t t e x t j u s t i f y i CENTER-TEXT,
CENTER-TEXT
1;
o u t t e x t x y ( w12, fhi?)tl.l, "REBLIZADO POR :' I;
o u t t e x t x y ( n/Z, (h/?)1!,2, 'M. DEL PILAR VILLcl CERVANTES'
o i i t t e x t x y i ti/?, (ht?)S1.3, 'ALBERTO GRRCIA CASTILLO' I ;
o u t t e x t x y l w/2, [h/?)t1.5, "NAYO-93' I;
StatusLine( "PRESIONA CUALWIER TECLA
PARA
CDtdTiNUBR"
I;
gettho;
cleardevice();
1;
-1
- / t "~"""""""~"""~""""""~""""""-""-""--""- voidPresentacion(1
t/
- {
-
I1
I? 73 i4 75 76 77 -
!e - 1
i nh te i g h t ;
cleardevice();
setcolor(HaxColors - 1 I;
s e t v i e w p o r t ( O , O , HaxX, HaxY, 1 1;
h e i g h t = t e x t h e i g h t ( 'H' 1;
changetextstyle( DEFAULT-FONT! HORIZ-DIR, I I;
s e t t e x t j u s t i f y ( CENTER-TEXT,
TOP-TEXT
I;
setviewport( O , heightt4, HaxX, HaxY-(heighttl), 1 1;
Dibhrdel);
setviewport( 1, heightt5, HaxX-1, HaxY-[heightt5),
1
I;
79 85
- / t ...................................................................
31
- v o i dS t a t u s l i n e (c h a r
82
85
e4
85
86
87
89
89
90
91
92
93
94
95
96
97
98
99
100
101
102
t/
1
- {
-
-
-
-
-
-
i nh te i g h t ;
s e t v i e w p o r t ( O , O , HaxX,
HaxY,
1 1;
setcolor(HaxColors - 1 I;
changetextstyle( DEFAULT-FONT, HORIZ-DIR, 1 I;
s e t t e x t j u s t i f y ( CENTER-TEXT,
TOP-TEXT
I;
s e t l i n e s t y l e ( SOLID-L!NE, O , NORH-WIDTH I ;
s e t f i l l s t y l e ( EHPTY-FILL, O 1;
h e i g h t = t e x t h e i g h t ( 'H' I;
bar( O , HaxY-lheightt41, HaxX, HaxY I;
r e c t a n g l e ( O, HaxY-(heightt4), flaxX, flaxY 1;
o u t t e x t x y ( HaxXI2,
fiaxV-(height+2),
atsg I;
setviewport( 1, heightt5, HaxX-1, HaxY-(height+51,
-1
!
1
I;
- ________________________________________--------------------------tl
- voidDibBcrde(void1
- c
-
103 104
lmsq
-
s t r u cvt i e n p o r t t y p e vp;
setcoior(HaxColors - 1 1;
s e t l i n e s t y l e ( SOLID-LIE, O, NOR#-SIIDTH
g e t v i e w s e t t i n g st lv p
1;
I;
:\T~S32010\FANTALLA.C
ource
- File:
Page: 3
""""""""""""""""""""""""""""""""""-"-"""-"-"""""""""""""""""""""~"""
ineSource
O5 - rectangle( O, O, vp.right-vp.left, vp.hottoa-vp.top
I;
06 - 1
O7 08 - / $ ...................................................................
.*
t/
o9
.10
- void changetextstyleiint font, int dirxtion, int charsize)
.I1 - I
.I? - intErrorcode:
.13
.14
-
.15 ,lb -
graphresult();
settextstyle(font, direction, charsize);
Errorcode = graphresult():
i f ( Errorcode != grUk ) (
closegraph();
printf(' Errar Grafito: %s\nn, grapherrorssgí Errorcode
exit( 1 1;
.17 118 .19 20 :21 - }
.?? - 1
)
I;
!