148.206.53.84148.206.53.84/tesiuami/UAM5374.pdf · tms3201.13 manual de usuario el s imljlador del...

78

Transcript of 148.206.53.84148.206.53.84/tesiuami/UAM5374.pdf · tms3201.13 manual de usuario el s imljlador del...

c

c

c

G r q u i t e c t u r a y A n 6 l i r ; i s d e I n s t r u c c i o n e s

Componzntes de la Rrquitectura

C: o r - 1 t a cI o I- ................ - .- - ........

" 1 !.?I i t..., ... i ) <:> <: >

! ................................................ I ........... ' ....... - - - ....... ' 4

' .......................... - .................... I .......... I ... ." .................. 3

!

.......... - ... -- ...........

Símbolo :: DP - ARP - INTF-

I NTM-

ov

CVM

!

1 ,

Implernentacibn ; int. I:'[- ".,

Implementacibn :: int T

Implementacibn : int FiOt"l [1536]

Principales Procesos d e Operacibn

Multiplicador

Desplazadores

Desplazadar de m A s d e un bit (Barrel Shifter)

Direccionamientos a la Memoria de Datos

- Direccianamientu I n d i r e c t a :

i

- Direccionamiento Inmediato :

i

,

- REGISTRO P.. T E INSTRL',rCION€S DE PIULTIFLICACI0h' :

-INSTRUCCIONES DE ENTRADA Y SALIDA Y OPERACIONES CON LA PIEMORICI DE DATOS

d e

es .

d e s i

d e

- LT 2 C a r - g a el r-eg;i .c,Irro T m

Cddiga = b4XX h. Descripcidn C a r g a a l 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 MANUAL DE U S U A R I O

EL S IMLJLADOR D E L CO-FROCESADOR TMS32C)l.C) ESTA COMPUESTO POR UN FKOGRAMF LLAMADO TMS32010.EXE EL C U A L E J E C U T A O PONE 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 E T E C L E A R :

C:\>TMS32010 <ENTER>

UNA VEZ INVOCADO EL S I S T E M A P E D I R A BUE SE E S C R I B A EL NOMERE D E L A 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 N E N UN F O R M A T O I G U A L A L S I G U I E N T E :

EO00ONO%IDT90000BF900~O.1304BOO90B00~6B6EO0~7F89E7E02E6700B4A~O7F~l6FNO~IDT 3 B7E03B6700B4900BF600~00l0BF~0~BO~0~B40O0~48O0BF9O0B0~~C7F3E9F NOBIDT 2 : N O B I D T 02-10-93 17:36:41 ASM32010 PC2.1 84.107 N O B I D T t

DESPUES DE TECLEAR EL NOMBRE DEL ARCHIVO APARECERf iN LAS VENTANAS QUE c O t w o N E r 4 AL SIMULADOR Y EN LA FC'IRTE INFERIOR DE LA PANTALLA AFARECE UNF L I N E A COlylO :

F3.Inst./(R)egs.Gen./F2-Regs.Edo./(M)em.Prog./(L)oc.Datos/(C)ont. PgUp P g D r

L A C U A L I N D I C A CJUE TECLAS ESTAN ACTIVGDAS PARA EL F U N C I O N E M I E N T O DEL S I S T E M A Y L A S C U A L E S SE D E S C R I B E N :

F3.Inst.- E S T A O P C I O N (F3j S I R V E FARfi M O D I F I C A R A L G U N A P A R T E D E L F I N S T R U C C I O N E S D E C I R :

( D 1 MA - D I R E C C I O N DE L G MEMOR I A ( I ) I \ I S T - L A I N S T R U C C I O N E N E J E C U C I O N (MICID - MODO D E D I R E C C I O N A M I E N T O , ES D E C I R y S I ES ( D ) I R E C T O O ( 1 ) N D I R E C T C

(R)egs.Gen.- EST& O P C I O N (R) S I R V E FkKfi PODER MODIF IC f iR fiLGUP-IU D E L E C R E G I S T R O S GENERALES UEL S IPlULfiDOR, ES D E C I R . ALGLJNO D E LEE R E G I S T R O S COMO SON :

ACC - GCUMULADQR ARO Y ARl - REGISTROS DE FROFOSITO GENERAL P - R E G I S T R O D E F H O F O S I T O G E N E R A L T - R E G I S T R O D E F R O F U S I T O GENERAL PC - CONTGrjOK DEL FROGKf iMf i

F2-Regs.Edo.- E S T A O F C I O N ( F 2 j S I R V E PARA M O D I F I C A R L O S R E G I S T R O S DE ESTADC QUE COMF'DNEN A L SIPlULADOFi :

OV -REGISTRO 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 ) OVM -REGISTRO DE MODO DE SOBREFLCIJO (O=DESHABIL ITADO 6 l = H A B I L I T A D O ) ARP -REGISTRO P f iRA SABER QUE REGISTRO SE ESTA USfiNDO (ARC) 0 A R 1 ) INTM -REGISTRO DE INTERRUPCION(O=HABILITADA ó l = D E S H A B I L I T A D O ) DP "REGISTRO AF'UNTADOR A L A P A G I N A DE MEMORIA DE DATOS ( ( 2 6 1 )

(M)em.Prog.- E S T A O P C I O N ( M ) S I R V E P A R A P O S E P l O D I F I C A R A L G U N A C E L D A DE 1.F M E M O R I A D E L FF:OGRGMA SOLO CON I N D I C A R Lfi D I R E C C I O N DE ESF CELDA DE MEMORIA Y L U E G O P E D I R A El- DFiTO GIUE SER6 INTRODUCIDC EN ESA D I R E C C I O N

ES IMPORTANTE RECf iLCAR CIUE UNA VEZ CAPTURADO EL DATO DESEADO L.4 F A N T A L L F REGRESfiK'R A DONDE AFUhITA EL PC PARA CONTINUAR EJECUTANDO EL FROGRAMA.

(L)oc .Datos- E S T A O F C I O N (L) S I R V E PARA PODER MODIFICAR ALGUNA CEL.DA DE 1-F MEMORIG DE DATOS Y A L I G U A L Q U E EN L A MEMORIA DE FROGRAMA SOLC SERA N E C E S A R I O I N D I C R R L A D I R E C C I O N D E L A M E M O R I A Q U E SE DESEF M O D I F I C A R Y LUEGO SE F E D I R A EL DATO CIUE QUEDARA EN ESA CELDF D E L A M E M O R I A

I

ES IMPORTANTE RECRLCAR ClUE UNA VEZ INTRODUCIDO EL DGTO DESEADO L F F f i N T A L L f i D E L A M E M O R I A G F E C T f i D O F E R M A N E C E R A A H 1 H A S T A CIUE SE DESEE M O D I F I C A R O T R A C E L D A .

CDN L G S T E C L A S DE PgUp, PgDn Y CON LAS F L E C H A S Arriba, Abajo NO5 F'ODREMUS MOVER L I B R E M E N T E D E N T R O D E Lfi PAI'JTALLG DE L A MEMOR I A DEL FROGRAMA .

PARA S A L I R DEL S ISTEMG SOLO ES N E C E S A R I O F R E S I O N A R L A T E C L A DE .::'.ESC:::.

Manual T e c n i c o sobre 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 t o s s o b r e l a s v p n t a n a s a t raves d e l a lectura d e l a t e c l a q u e se p r e s i o n e e n ese m o m e n t o . E s t o e5 p o s i b l e d e r e a l i z a r p o r m e d i . 0 d e l a l e c t u r a d e t ec las d e l a F u n c i ó n lee-tecla l a cual lee la t e c l a que se e n c u e n t r a e n e l B u f f e r d e tec lado.

U n a VEZ 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 o d e l a t e c l a e x i s t e e n t r e 1.0s y a d e f i n i d o s p r e v i a m e n t e d e m a n e r a g l o b a l . 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 a , e 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 n c o r r e s p o n d i e n t e a l c o d i g o d e s i f r a d o .

A n t e 5 d e que se lea 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 d e Memoria d e l F 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 s G e n e r a l e s y C o m p o n e n t e s d e l a I n s t r u c c i ó n a F r o c e s a r s e e n ese m o m e n t o v e r d i b u j o d e p a n t a l l a .

L o s c B i f i g o s d e l a s

# d e f i n e UP-ARROW # d e f i n e DN-RRHOW # d e f i n e FG-UF # d e f i n e PG-DN # d e f i n e F1 # d e f i n e F 2 # d e f i n e F3

teclas son :

0:.:4800 F l e c h a h a c i a a r r i b a O:.:SOO(j F l e c h a h a c i a a b a j o (3:.:49(3(3 P a g i n a a r r iba Ct :.: 5 1 C! C) F a i n a a b a j o 0 :.: 3 b 0 B 6:.:3cC10 Modifica reg is t ros d e E s t a d o (:t:.:3dCiO Modifica c o m p o n e n t e s d e I n s t r u c c i ó n

T e c l a s m y M p a r a modi f i car a l g u n a l 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 a m o d i f i c a r a l g u n a l 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 modi f i car cztlqun R e g i s t r o

G e n e r a l T e c l a s d e c y C p a r a c o n t i n L t . a r e j e c u t a n d o l a

c , i g u i e n t e i 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

I

Los cuale5 s o n c l a s i f i c a d a s e n u n Case p a r a d e s p u e s llamar a l a f u n c i ó n c 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 . En el caso d e que 5 ~ - p r e s i o n e a l g u n a .tecl;( que n o se este d e f i n i d a 3 o n a r - a u n B e e p provncado PO!' l a f u n c i o n con e l m i z m o n o m b r e .

E s t r u c t u r a q u e componen al Sistema

L a P i l a d e Eatos esta c o m p u e s t a de u n a r r e g l o d e 4 p n s i c i o n e s e n t e r a s y 2 e n t e r o s ( t o p e ? b a s e ) los c u a l e s f c ; n c i o n a n como c o n t a d o r e s d e n t r o d e a r r e g l o p a r a marcar l a b a s e d e l a P i l a y e l T o p e d e l a P i l a . C u a n d o u n d a 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 te 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 o q u e se l o c a l i z a e n l a b a s e d e l a P i . l a para l u e g o recorrer los d a t o s u n a p o s i c i b n h a c i a l a base d e l a P i l a e n u n a p o s i c i ó n y a s i p o d e r - i n t r o d u c i r e n ~l t o p e d e l a P i l a el n u e v o d a t o .

C o m o p o d e m o s observar e ? m o v i m i e n t o d e l a F i l a n o es p r e s i s a m e n t e e l d e u n a P i l a n o r m a l s i n o p o r u 1 c o n t r a r i o actua como una "cola circular" es d e c i r y c u a n d o e l . f r e n t e es 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 recorre a l . igual que r l f r e n t e p a r a meter e l n u e v o d a t o .

T a n t o la P l e m o r i a d e d a t o s como l a Memoria d e l F 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 DATA MEM y MEM PROG l o s c u a l e s s o n m o s t r a d o s e n p a n t a l la e n formato 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 Simulador s o n d e f i n i d a - , e n u n a r r e g l o H i d i m e n s i o n a l d e 7x4 l l a m a d a V e n y e l c u a l c o n t i e n e e n c a d a u n o a d e sus c e l d a s l a s c o o r d e n a d a s d e c a d a u n a d e lar; v e n t a n a s p r e s e n t a d a s e 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 pantal la, marco y se1 ventana I m p r i m i m o s e n m o n i t o r para a s i d a r l a I r n p r e s i o n d e v e n t a n a s i n d e p e n d i e n t e s .

i

Funcionemiento General de las Ventanas

U n a v e z p i n t a d o s l o s recuadros dil. c a d a v e n t a n a tratamos a c a d a V e n t a n a p o r s e p a r a d o y a sea p a r a co locar l o s daters i n t e r n o s a e l l a o p a r a z c t u a l i z a t - a a l g u n o d e e l l o s s o i a m ~ n t e hacemns r e f e r e n c i a d e ! a r r e g l o Ven. E s t a e n r e a l i d a d se l o g r a por q u e cada v e n t a n a e n r e a l i d a d f u n c i o n a d e m a n e r a i n d e p e n d i e n t e y c o n solo m e n c i o r ; a r que n i t m e r o d e v e n t a n a se desea a fec tar y m a n d a n d o l o como parametro d e l a f u n c i ó n s e l - v e n t a n a ( ) a c t u a r a c u a l q u i e r efecto d e p o s i c i ó n e i m p r e s i o n s o b r e l a misma.

F a r a p o d e r m o d i f i c a r o mo%verse sobre a l g u n a de l as 2 Memoria que e x i s t e n bas ta c o n i n d i c a r L ó M y l u e g o i n d i c a r que l n c a l i d a d d e memoria se desea modificar p a r a que l a r u t i n a d e d 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 que SE a ! . c a n z a n a ve r e n el m o n i t o r . F ' a r a e l caso d e l a Memoria d e l F r o g r a m a u n a v e z m o d i f i c a d a l a d i r e c c i ó n deseada se regresara 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 se 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 jecutarse y para e l caso d e l a Memoria d e Datos u n a .vez q u e se m o d i f i c a a l g u n a l o c a l i d a d d e l a

rn3. adff 235f 8716 &?2c

12 afae 1212 23dd

3pI Me a 1 2 3 4 5 b 7

m

a add3 1214

0 o a

23ff 8 "

1 21ad

h- Regs. Edo. 1

F3. Inst./(Rjegs. Gen.jF2-Regs. Edo./(Mjem. Frog./(Ljoc. Datos/lC)ont. PgUp PSDIl t 4 Comando :

.urce Pr in t - File: C:\TMj~2010\TRS320!0.C P a l e : 1 """"""""""""" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ine Source "" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

- / / , , , , . . , . . . . , . . . I . . . . . . . . , . . . . . . . . . ........................................... - I / - /; Propraa Name: THS32010.C Copyright: Universidad Autonoaa Ietropolitana - I f Date Created: 07107193 Language: Borland C 2.0

- / / Description : Programa principal del Simulador del Co-procesador aateaatico TX3201O - 1; ............................................................................. - #include "stdio.h'

O - #include 'd0s.h' 1 - linc1l;de "ctype.h" 2. - #include 'rtdlib.ha 3 - #include "c:\tws32010\var.cn I t Definition de variables globales 11 4 - #include 'c:\tas32010\THS.C~ I$ Procedimientos de manejo de ventanas t I 5 - #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 ................................ t 1 1 - 2 - cain O 3 - { 4 - unsigned int i,instruccion=O; 5 - cooen:ar( 1; b - carga-arch(); 7 - pantalla0; 9 - despliega2(pos); 9 - interface(); O - for (i=O; i(=1024; itt) 1 - { 2 - instruction=~EH_PROG[PC]; 3 - interface(); 4 - Tabla(instrutcion); 5 - 1 b - 1 7 - 8 - I t ................................................................. t 1 9 - O - Tabla(instruccion) 1 - unsigned instruction; 2 - : 3 - unsigned int 0p=0; 4 - 5 - op=linstruccion 4 Oxf000); 6 - switch lop) 7 - ( 5 - case Ox0 : ADD(instruccion); 9 - break; ,O - case Ox1000 : SUa[instruccion); 1 - break; 2 - c35e Ox2000 : LAC( instruction);

- ! I Time Created: 23:!0:11 Author: Alberto GarEia Castillo

-

]urce Print - Fi l e : C:\TMS32010\TtIS3201O.C ?age: 2 """""""""""""""""""""""""""""""""""""""""""""-"""""""""~~~"""""""""~ h e S o m e _"_ """"""""""""""""""""""""""""~""""""""""""""""---"""""~"""""""""""~ A - 4 - 5 - 6 - 7 - 9 - 9 - 0 -

2 - 3 - 4. - 5 - b - 7 - 8 - 9 - 0 - 1 -

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 -

i -

3 -

break: case OxjOOO : op=(instruccion & OxfOOI; switch (op) {

case Ox0 : case Ox100 : SARIinstruccion);

break; case Ox800 : case 0x900 : LAR(instruccion1; break;

1 break: case 0x4000 : op=Iinstruccion & Oxf00); switch ( o p ) {

case Ox0 : case Ox100 : case Ox200 : case 0x300 : case 0x400 : case 0x500 : case OxbOO : case 0x700 : IN( instruccion 1 ;

case Ox800 : case 0x900 : case OxaOO : case OxbOO : case OxcOO : case OxdOO : case OxeOO : case OxfOO : OUT(instruccion);

break;

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

break; 1 break; case OxSOOO : op=[instruxion &

I;

: Oxf00I;

jourc- Print - File: C:\T~S3?010\TnS3?010.C Page: 3

.ine Source _"" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . LO5 - LO6 - 107 - ,08 - LO9 - i10 - ill - ' 12 - 113 - ;14 - 115 - I16 - 117 - :la - !19 - i20 - 21 - %22 - 2 3 - .24 - 125 - 126 - .27 - .& ?B - 2 9 - .30 - .31 - i32 - 133 - 134 - .35 - 136 - .37 - 138 - .S9 - :40 - 141 - .42 - 143 - ,44 - 145 - 146 - 147 - .48 - !49 - ;50 - 151 - 152 - 153 - .54 - !55 - .56 -

switch lop1 {

case Ox0 : ADDH(instruccion1;

case Ox100 : ADDSfinstruccionI;

case 0x200 : S1IBtiíinstruccionl;

case 0x309. : SUBS(instrucci0n);

case 0x400 : SUBC(instruccion1;

case 0x500 : ZALH(instruccion1;

case 0x600 : ZALS(instru:cionl;

case 0x700 : TBLR(instruccion1 I

case Ox800 :op=(instruccion & OxOf0);

break;

break;

break;

break;

break;

break;

break;

break;

switch lop1 (

case Ox8O:op=(instruccion & Oxfl; switch (op1 {

case O x 0 : case 0x1 : LARP(instruccion1;

case Ox8 : case 0x9 : HAR(instruccion1;

break;

break; 1 break;

case 0x90: HlR(instruccion1; break;

1 break;

case 0x900 : DHOV(instruccionl;

case OxaOO : IT(instruccion1;

case OxbOO : LTD(instruccion1;

case OxcOO : LTAI instruccion 1 ;

case OxdOO : HPY(instruccion1;

case OxeOO : LDPKlinstruccion);

case OxfOO : LDP(instruccion1;

break;

break:

break;

break;

break;

break;

break; 1 break;

,

irce Print - File: C:\TnS32@10\TnS32010.C Paq?: 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . \e Source "- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 -

3 - 3 - 3 - I - 2 - 3 - is- 5 - 5 - 7 - 8 - 9 - O - I - '2 - 3 -

'4 - '5 - '6 - '7 - 18 - 19 - 30 - 3 1 - 32 - 93 - 84 - 85 - U6 - 87 - 88 - 89 - 90 - 91 - 9 2 - .93 - .94 - .95 - .74 - L97 - .98 - 199 - !O0 - 201 - 202 - 203 - 204 - 205 - ?Ob - 207 - 208 -

ca5e 0x7000 : op=(ínstrl;ctior; 4 Oxf00); w i t c h fop1 (

ca5e Ox0 : case 0x100 : LARK(instruccion1; break: case Ox800 : XORfinstruccion:; break; ca5e 0x900 : AND(instruccion1;

break; case OxaOO : OR(in5truccion~;

break; ta5e OxbOO : LSTlinstruccionl;

break; case OxcOO : SST(instruccionl;

break; case OxdOO : TBLH(instruccion1;

break; case OxeOO : LACKtinstruccion);

break; case OxfOO :op=[instruccion b 0xOf0);

snitch ( o p ) {

case OxBO:op=(instruccion L Oxf 1; switch [op) (

case Ox0 : CLAV€=36; / t NOP t /

case 0x1 : D I N T O ;

case Ox2 : €INTO;

case Ox8 : ABSIinstruccion);

case 0x9 : Z R C [ I ;

case Oxa : R O W ( 1;

case Oxb : SON!( 1 ;

case Oxc : CGLA( 1;

case Oxd : RET( 1 ;

case Oxe : PACO;

case Oxf : I\PAC(I;

break;

break;

break;

break;

break;

break;

break;

break;

break;

break;

break; I break;

snitch [OD) case Ox90:op=[instruccion b Oxf);

,

;ource Print - File: C:\iMS3=010\T~S3?01O.C Page: 5 """""""""""""""""""""~"""""~"""""""""~""""""""""""~""""""~

.ine Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . !O9 - !lo - 111 - !I2 - !13 - !14 - !15 - '16 - !I7 - !1B - !19 - !20 - !21 - !22 - !23 - 224 - !25 - i26 - !27 -

!29 - 5 0 - !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 - 3 9 - !bo -

!?a -

i case O x 0 : SPACO; break; case Oxc : PUSH break; case Oxd : POP( brfak; 1 break;

1 break; 1 break; case 0x8000 : case Ox9OOO : KPY#(instruccionl; break; case OxfOOO :op=(instruccion 8 Oxf001; snitch (op) I

instruccion=tlEfl-PRCG[PCl; BANZ(instruccionf;

case 0x400 :PC++;

break; case 0x500 :PC++:

instruccion=tlE#-PROG[PCI; BV ( ins truccion 1 ; break;

instruccion=HE~-PRO6[PCl; BIOZ(instruccion);

case Ox600 :PC++;

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 ;

case O x d O O : break;

PCtt; instruccion=HEH~PRO6[PCl;

;ource print - File: C:\T!lS3?010\TES32010.C P332: b """"_ """"""""""~"""""""""""""""""""""""""""~""""""""""""""""""---- . i n ~ Source

! 6 l - BGEZ[instruccionI; !6? - break; lb3 - case OxeOO : !64 - PC++; !65 - instruccion=~E#_FROG~PCI; !bb - BNZ(instruccion1; !67 - break; I68 - case OxfOO : !69 - PC++; 170 - instruccion=~EH_PROG[PCI; !71 - BZ(instruccion1; !72 - break; !73 - 1 !74 - break; !75 - 1 !76 - 1 177 -

!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;

,"" """""~"""""""""""""""""""""""""""""""""""""~""""-"""""-""""""""----

!78 - / t ................................................................ tl

290 - printf ( ' \nLEYENDO EL ARCHIVO %s\n',norb-arch);

i92 - while ([c=getc(fp))!=EOF) 291 - f p = fopen(nomb_arch,'r');

293 - 294 - if (c=='B') 295 - 296 - instruccion=O; 297 - nua=O; 298 - for [i=O; i(=3 299 - I 300 - c=getc[fpl; 301 - snitch(c1 302 - { 303 - ca5e ' O ' : nua=O; 304 - instruction=( 305 - break; 306 - case '1': nuell; 307 - instruction=( 508 - break; 309 - case '2' : nua=2; 310 - instruction=( 311 - break; 512 - case ' 3 ' : nun=3;

i++ I

instruccion{(4) :nun);

instruccion!(3) :nun):

instruccion!i4) Inur):

;ource print - File: C:\THSj20!O\TnS320iO.C Page: 7 ,""""~"""~""~""~~"""~"~""""""~~""~~""""~~"""""-""""---------------------------------------------

.ine Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

i14 - i15 - i16 - :li - >;a - i1F - 2 0 - 2 1 -

*.

break; case ' 4 ' : ~ i u n = 4 ;

instruction=( break:

case '5' : num=5; instruction=( break;

case ' 6 ' : nun-6;

(instruccion(i4) !nu#):

(instruccicsn<(4) :nus):

2 2 - instruction=( (instruccion((4) :nun); 2 3 - break; i?4 - case '7': nua=7; 25 - instruction=( (instruccion((4) :nuel; 2 6 - 2 7 - 2 8 - 2 9 - ;:o - ;31 - ij2 - 1 v. t.jJ - :34 - ;35 - i36 -

break;

instruction=( (instruccion((41 break;

instruction=( (instruccion((41 break;

instruction=( (instruccion((4) break;

case ' 8 ' : nup=8;

case ' 9 ' : nur1=9;

case ' A ' : nun=lO;

case 'E': nua=ll; J7 - instruction=( (instruccion((4) :nuo); ;:a - break; ;39 - case ' C ' : n w 1 2 ; ;40 - instruction=( (instruccion((4) :nual; ;41 - break; i42 - case 'D' : nua=13; i43 - instruccion=((instruccion((4) :nun); i44 - break; i45 - case ' E ' : nus=l4; i46 - instruction=( (instruccion((4) :numJ; i47 - break; 148 - case ' F ' : nua=15; i49 - instruccion=((instruccion((4) :nuel; 5 0 - break: i51 - I 152 - 1 j53 - f lE~ -PRO~[CONT l= ins t rucc ion ; i54 - ++COHT; ;55 - 1 556 - 1 157 - 1 E a - 1 559 - (60 - / $ ................................................................. t l i61 - 562 - abre-arch(char no~b~arch[401) i63 - ( 564 - FILE linfile;

,

,urce Print - File: C:\THS3?010\TMS3?010.C Fage: a

ine Source _"""""""""""""""""""""""""""""~""""""""""""""""~"""~"""""""""""~"""" "" ..................................................................

55 - S6 - 57 - &if - b9 - 70 - 71 - 72 - 73 - 74 - 75 - 7b - 77 - 78 - 79 - 30 - 91 -

E3 - E4 - E5 - 86 - 87 -

a2 -

int encuentra; do

c l r s c r 0 ;

printf( 'DME EL ARCHIVO A ANGLIZAR : ' 1; gets(noeb-arch); if ( !strlen(noab-mhl 1

else (

gotoxy~10,501;

encuentra = 1;

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);

m - 109 - 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)

ource Print - File: C:\TnS3?010\TnSS?OlO.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ine Source _"_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 - ( 18 - dsa=(instruccion & Ox7f I ; 19 - A C C = A C C ~ ( C R T F I _ M E ~ [ ~ ~ ~ ~ ( ( ~ ~ ~ ~ ~ ) ; ?O - bandera=?; 21 - 3 22 - else 23 - (

24 - orcc=ACCt(CCITA-~EnlRE6-~UXIARPlj((shift); 25 - DIR-IND(instruccion1;

F q e : 9

'26 - 1 27 - CLCIVE=l; 28 - PC++; 29 - 3 30 - 31 - / $ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

52 - 33 - ADDH(instruccion1 34 - unsiqrted int instruccion; 35 - I 36 - 37 - 33 - 59 - 40 - 41 - 42 - 43 - 44 - .45 - 46 - 4 7 - 4a - .49 - .50 - .51 - .52 - r53 - 154 - 155 - .56 - i57 - 3 8 - 159 - b 6 0 - ibl - i62 - I63 - 164 - it5 - 166 - 167 - lbfl -

long int dato; rod-dir=( instruccion & 0x90); if (zod-dir==O) { 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:

1

/ t ""~"""~""~""~"""""""""""------------------- t t

ADDS(instruccion1 unsigned int instruccion; ( long int dato; nod-dir=( instruccion B 0x801; if (eod-dir==O) { dma=( instruccion & Ox7f 1 ; dato= (DATA-HEMIdwj dr Oxffffl; ACC=ACCtdato; bandera=Z;

I

jurKp Print - File: C:\TnS32010\TnS32010.C Page: 10 _"""" """""_"""~"""""""""""""""""""""""""""""""""""""""~""""""""""""~ ine Source ""

5.9 - 70 - 71 -

73 - 74 - 75 - 7 6 - 77 - 78 - 79 - 30 - 81 - 82 - 93 - 84 - 8 5 - 86 - 87 - 88 - 99 - 90 - 71 - 92 - 93 - 94 - 95 - 9b - 97 -

99 -

-1 l L -

98 -

""""""""""""""""""""""""""~"""""""""""""""""""""""""-""-----""---""" else

I dato=iDAlA-HEn[ffEs-RUX[ARPll 8 Oxffff); ACC=ACC+dato; DIR-IND(instruccion1;

1 C L W E = 3 ; PC+;

I

I $ """_""""""""""""""""""""""""""""- 11

ANDIinstruccionI unsigned int instruction; {

rod-dir=(instruccion & 0x80); if (rod-dir==O) {

ACC=(ACC P 0x0000ffff); dna=(instruccion & Ox7f);

ACC=(RCC & DATA-HEt![dmal) ; bandera=Z; 1

else { ACC=(IICC L 0x0000ffff); ACC=(ACC P REG-AUX[C\RPII; DIR_IND(instruccion);

1

PCt t ; CLAVE.4;

100 - 1 101 - 102 - / t "~"""""""""""""""""""""""""""""" lf 103 - io4 - RPAC( 1 i05 - { io6 - ACC=bCC+F; iG7 - CLRVEz5;

i09 - bandera=5; i10 - 1 ill - j12 - / t """""""""""""""""""~"""""""""""" t l i13 - j14 - B(instruccion1 i15 - unsigned int instruccion; jl6 - { j17 - unsigned int pna; j19 - paa=(instruccion & Oxfff); j19 - PL=pma;

io8 - F C t t ;

i20 - CLAVE=6;

Ource print - File: C:\TnS32010\TnS3fOlO.C P a p : 11 """"""~" ~""~"""""~_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i n e

21 - :2? - 23 - 24 - 25 - 2t - 27 - m28 - 2 9 - 30 -

32 - 33 - 34 - 35 - 36 - 17 - 38 - 39 - 40 - 41 - 42 - 43 - 44 - 45 - 46 - 47 -

,49 - 150 - '51 - 152 - 153 - i54 - 155 - 156 - 157 - 158 - 159 - 150 - 151 - h2 - 163 -

""

131 -

4a -

Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . bandera=5;

1 """"""""""""~""""~""""""------------------- t /

BRNZ( instruction) cnsigned int instruccion; (

unsigned int p a ; pma=(instruction & Oxfff); if [ [REG-flUX[ARPl & Oxlff 1 ! = 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; bandera=5;

1

/ t """""~""""""""""""""""-"--------------- t l

BGEZ(instruccion) unsigned int instruccion; (

unsigned int paa; paa=(instruccion & O x f f f ) ; if (flCC)=O)

PC=paa; else

PC++; CLAVE=8; bandera=5;

1

/ t ""~"~"""""""""""""""~""""--------------- t i

BGZ(instruccion) unsigned int instruccion;

i64 - ( i65 - unsigned int pma; i6b - pma=(instrutcion & Oxfff); i67 - if(ACC>O) i68 - PC=pra; $9 - else i70 - PC++; i71 - CLAVE=9; i72 - bandera=5;

;ource Print - F i l e : C:\TnS32@10\[email protected] Page: 12 , _ """"""""""""""""""""~""~""""""""""""""""""""""""""""""--"-""""---- .ine Source ,"" ~""""~""""""""""""""""""""""~""""""""""""-""""""""""""""""""""""-- 173 - 1 I74 -

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 - ) IR9 - j90 - / t ................................................................ :/

i75 - / 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

$01 - CLAVEz11; 502 - banderaz5; 503 - 1 504 -

500 - PC++;

505 - / t "~"~""""~~~"""""""""""""""""""-------- I /

506 - 507 - BLZ(in5truccion) 508 - unsigned int instruccion; 509 - { 510 - unsigned int pma; 511 - paa=(instruccion & Oxfff); 612 - if(bCC(0) 513 - PC=paa; 6 1 4 - else 515 - PC++; 616 - CLIIVE=12; 517 - bandera=5; 618 - I 519 - 620 - / $ ................................................................ :/

521 - 6 2 - BNZ í instruction 1 b?3 - unsigned int instruccion: b23 - {

;ourcp Print - File: C:\iMS52010\T~S3?U!~~.C Page: 13 ""~""""""""~"~"""""""""""""""""""""""""""""""""""""""""----------------

.ine Source

125 - unsigned int paa; 126 - p@a=linstruction & Oxff f 1 ; 127 - if(ACC!=O) 128 - PC=pma; 129 - else

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""---"-

130 - PC++; 131 - CLAVEz13; 132 - bandera=5; 63 - I 134 -

136 - 157 - BV(instrutcion1 138 - unsigned int instruccion; 139 - { i40 - unsigned int pea; 141 - paa=(instruccion & Oxfff); ,42 - if(OV==l) ,43 - { 144 - PC=paa; 145 - ov=o;

147 - else i48 - PC++; 149 - ESTADO=status( I ; 150 - CLAVEz14; '151 - bandera=5; 3 2 - } i53 -

155 - i56 - 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 168 -

]35 - / t """"""~"~"~""""""""""""""---"---------- t l

146 - 1

5 4 - I t """""""""""""""~"""""""""""""""" t l

569 - It """"""""_"""""""""""""""""""""" t i

i70 - 571 - DINTO i72 - { 173 - INT#=l; j i 4 - ESTADO=status( 1; 575 - CLAVEz18; i76 - PC++;

ource Print - Fil.: C:\TflS3201?\TnS32010.C Pagz: 14 """""""""_ """""""""~"""""""""""""""""""""""""""""""""""----""""""- ine Source "" """""""""""""""""""""""""""""""""~""""~"""""""""""""""""---""--"----- 77 - bandera=5; t78 - 1 79 -

.a1 - 132 - DMOV(instruccion) 83 - unsigned int instruccion; 384 - { 185 - nod dir=linstruccion k 0x80); $6 - if ~iaod-dir==Ol

198 - dra=(instruccion & Ox7f); 189 - DATA~~E\[dmatll=DCITA_nEnldeal;

,go - / t """""""""""""""""""""""""~""""--- t /

1a7 - {

,90 - bandera=2; 191 - 1 192 - e l s e 193 - I I94 - D~TA_\E~[RE6~AUX~ftRP]+lI=DdTA_~E~[Ri6_ilUX[ARPll ; I95 - DIR~IND(instruccionI; 196 - 1 197 - PC++; 198 - CLAVEz19; 199 - 1 !O0 - '01 - / $ ""~"""""""""""~""~"""""""""""-"----- t l

'02 - io3 - E I N T O 104 - { 705 - 1 N W O ; '06 - ESTADO=status( 1 ; 707 - P C + + ; M 8 - CtAVE=?O; 109 - bandera=5; 710 - 1 111 - 712 - / t ________________________________________------------------------ 11

713 - 114 - LACIinstruccionl 715 - unsigned int instruccion; 716 - I 717 - unsigned int s h i f t ; 718 - s h i f t = (instruccion & O x f O O 719 - s h i f t = s h i f t i N ; 720 - w~d-dir=(instruccion k 0x801 721 - i f (nod-dir==O) 122 - I 123 - daa=(instruccion & 0x7f I ;

!

724 - ~CC=(DIIT~-RErl[dmal((shift); 725 - bandera=Z; 726 - 1 727 - else 728 - I

iource Print - File: C:\lHS32010\TWS32010.C Page: 15

.ine Source .................................................................

'29 - ACC=IDCITA-~E~lFiEG-Gux[CIRPll(Cshift); '30 - DIR_IND(instruccion); '31 - '32 - CLAVE=2?; .M - PC++; '34 - ]

1

I..-.

"C J J - '36 - / t ................................................................ 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 - PCtt; '46 - CLAVE=23; '47 - bandera=4; 48 - 1 '49 - '50 - / t ________________________________________-------------------- & I '51 - '52 - LAR(instruccion1 53 - unsigned int instruccion; '54 - { '55 - '56 - '57 - '58 - '59 - '60 - '61 - '62 - '63 - '64 - '65 - '66 - '67 - '$8 - ' 59 - '70 - '71 - '72 - '13 - 5'4 - '75 - '76 - '77 - '78 - '77 - '80 -

unsigned int arp-aux; arp-aux= (instruccion & 7001; arp-aux=I arp_aux)>8); nod-dir=(instruccion & 0x80); if (mod-dir==Ol

{ dna=(instruccion & Ox7f I ; RE6~AUX[arp~auxl=DIIlB_HE~[deal; bandera=2;

1 else

I RE6_GUX[arp~aux]=DGT~~~EHiRE6~GUX[arp~aux11; DiR-IND(instruccion); 1

PCtt; CLAVE=24;

1

/ a "~"""""""""""""""""""""""""""----" t l

LARK(instruccion) unsigned int instruccion; I unsigned int cte-aux; arp_aux=(instruccicn & 0x7001;

ource Print - F i l e : C:\TnS32010\i#S32010.C Page: lb """"~""""""""""""""""""""""""""""""""""""""""""""""""""""~"""""""~"

ine Source "" """"""""""""""""""""""~""""""""""""""""""""""""""""""""""""""""~

51 - 82 - a: - 84 - 85 - 35 - 57 - 88 - a9 - 90 - 91 - 92 - 93 - 94 - 95 - 96 - 97 - '98 - 99 - 100 - IO1 - !O2 - 103 - 104 - 105 ¡Ob - ?O7 - 108 - 109 - 110 - Ill - 312 - 113 - 314 - 115 - 316 - 117 - 318 - 319 - 320 - 321 - 322 - 323 - 324 - 325 -

I

ar?_aux=[arp_aua>)a); cte-aux=( instruccion t O x f f 1 ; REG-AUXIarp-auxl=cte-aux; PC++; CLAVE=25; bandera=b;

r

1; """"""""~""""""""""""""-""-----"------- t l

.A8P(instrutcionl msigned int instruction;

unsigned int ctel; ctel= (instruccion & 0x1); ARP=ctel; ESTRDO=5tatusO;

CLAVE=26; bandera=7;

I

/ t """"""""""""""""""""""""---------------- tl

LDP(instruccion1 unsigned int instruccion; {

r 1

PCtt;

unsigned int LSB; ~od-dir=(instruccion & 0x801; if (aod-dir==Ol ( dna=(instruccion & Ox7f); LSB=(Oxl & DATA-tlEH[deal); DP=LSB; bandera=2;

1

else

LSB=(Oxl & CATA_HEH[RE6_AUX[ARPlll; DP=LSB; DIR-IHD(instruccion);

7 i ESTADO=status( I ;

PCtt; CLAVE=27;

I ,

laurce Print - File: C:\THSj2010\T~lS32010.C Pag?: 17

.ine Source

.JJ - unsigned int ctel=G; 134 - ctel=(instruccion k 3x11; 135 - DP=ctel; 156 - ESTADC=status(); 137 - PC++;

I39 - bandera=7; 140 - 1 131 -

."" """"""""""""""""""""""""""""~""""""""""""""""""""""""""""""""""~

1'1

138 - CLAVE=ZR;

117 - / $ """""""""~"""""~"""""""~""""""~------ tl 143 - I44 - LST(instruccion1 135 - unsigned int instruction; 146 - { 147 - eod-dir=(instruccion & 0x80); 139 - if (fiod-dir==O) 149 - { j50 - dma=(instruccion & Ox7f); i51 - ESTAOO=DATA_nEHídnal; 152 - bandera=?; 153 - 1 I54 - eláe i55 - { 355 - ESTADO=DAT~_HEH[RE6-AUX[ARPlI ; 157 - DIR_IND(instruccion); 159 - 1 159 - PC++; 360 - CLAVEz29; 361 - 1 362 - 363 - / t ............................................................... 11 364 - 365 - LT(instruccion1 366 - unsigned int instruccion; 367 - { 358 - Pod-dir=(instruccion & 0x80); 369 - if (nod-dir==OI 370 - { 371 - dsa=(instruccion & Ox7f); 372 - T=DATA-HEH[dral;

374 - 875 - else 376 - { 877 - l=OATA~fE~[RE6~~UX[~RPll; 378 - DIR_IND(instruccion); 979 - i

373 - bandera=Z; 7 i

aso - PC++; BE1 - CLAVE=30; 682 - 1 a93 - 884 - 1 2 ________________________________________----------------------- $1

I ,

Ource Print - Fils: C:\TflS32010\TnS32010.C Page: 16

ine Source

85 - :86 - LTA(instruccion1 E7 - unsigned int instruccion;

199 - mod-dir=[instruccicn & 0x80) ; 190 - if (&od-dir==O) i91 - {

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

:sa - {

192 - dsa=(instruccion & Ox7fI; 193 - T=DATA-HEM[dral; 194 - ACE= ACCtF; i95 - bandera=?; 196 - 1 197 - else 198 - { 199 - T=DATA-HEH[RE~-AUX[ARP]] ; 'O0 - K C = ACCtP; 'O1 - DIR_IHD(instruccion); 'O2 - 1 '03 - PC++; '04 - CLGVE=31; '05 - } 106 - to7 - 1: ________________________________________------------------------ !O8 - ,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 - else ?22 - ( ?23 - T=DATA_HEH[REG-AUX[ARPII; 124 - DATA_~EH[REG_AUX[ARP]+l]=DATA_~EHtREG-AUXIARPII; 125 - ACC= ACCtP; 126 - DiR-IND(instruccion1; u 7 - 1 ?28 - PC++; 129 - CLAVE=32; j30 - 1

131 - 732 - 11 ~""~"""""_"""""""""""""""""""""""- t l 132 - 134 - YAR ( instruccion) 135 - unsigned int instruction; 136 - {

11

!

ource Print - File: C:\TWS3=010\T~S32010.C Page: 19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ine Source

37 - aod-dir=(instruccion & 0x80); 38 - if (nod_dir==Ox80) 19 - DIR-INGO; 40 - else 41 - bandera=?; 42 - PCtt; 93 - CLBVE=33; 44 - : 45 -

47 - 48 - HPY[instruccion) 49 - unsigned int instruccion; 50 - ( 51 - nod-dir=(instruccion & 0x80); 52 - if (aod_dir==O) 53 - ( 54 - doa=(instruccion 4 Ox7fI; 55 - P=TSDATA-HEH[~I~I; 55 - bandera=2; 57 - 1 58 - else 59 - ( 50 - P=TtDATA_~EH[REG_CIUX[ARPIl; 6 1 - DIR-IND(instruccionl; 62 - 1 63 - PC++; 64 - CLBVEz34; 65 - 1 66 -

_"_ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46 - /a ................................................................ a/

67 - / t ................................................................ t i ¿,a - '69 - HPYK(instruccion1 70 - unsigned int instruccion; '71 - ( 72 - int ctes; '73 - ctes=(instruccion L O x l f f f ) ; 74 - P=ctestT; '75 - PCtt; 76 - CLAVE.35; '77 .- bandera=5; '78 - I '79 - '30 - / t ~"""""""""""""""""""""""""""""""" t i '81 - '32 - OR(instruccion) '83 - unsigned int instruction; '84 - ( '85 - nod-dir=(instruccion 4 0x80); '86 - if (rod-dir==OI '87 - { '38 - daa=(instruccion & 0x7f 1;

!

)urce Print - F i l e : C:\THS3?010\iHS;?010.C Page: 2i: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ine Source "" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 - ACC=(ACC & Oxffffl; 70 - ACC=(ACC : DATA-HEHrdaal); 71 - y2 - 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++; 000- CLdVEz37; 001- I 002- 003- / # ................................................................ t ! 004- 005- P A C O 006- ( 007- ACC=P; 008- PC++; 009- CLAVEz39; 010- bandera=5; 011- 1 012- 3!3- / t """_""""""""""""""""""""""~""---""-- t / 014-

1015- ROVI1( 1 ,016- [ ~ 0 1 7 - O W O ; . O W ESTADO=status( 1; ;019- P C t t ; ,020- CLAVEz43; 1021- bandera=5; 1022- 1 1023- 1024- / t ________________________________________-------------------------- 1025-

ti

1026- SACLlinstruction) 1027- unsigned int instruccion; 1028- ( 1029- mod-dir=Iinstruccion k 0x80) ; 1030- if (mod-dir==O) 1031- { 1032- daa=(instruction h Oxif I ; 1033- DATA-HEfl[dsa]=GCC; 1034- bandera.2; 1035- 1 1036- else 1037- { 1038- DaTA_nEn[RE6_ilux[~RP]l=ACC; 1039- DIR_IND(instruccion); 1040- 1

hurte Print - File: C:\T~Sj2010\TnSj?010.C Pag.: 21

.ine Source _""

.041- 1042- ,043- ;044- 1045- .046- L047- .048- 1049- .050- 1051- ,052- 1053- ,054- ,055- !O%- ,057- !O%- ,059- ,060- ,051- 1062- ,063- iO64- '955- 1066- 1067- 1068- 1069- 1070- 1071- 1072- 1073- 1074- 1075- 1076- 1077- 1078- 1079- 1080- 1081- 1082- 1083- 1084- 1085- 1086- 1087- 1088- 1089- 1090- 1091- 1092-

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""~""~

PCtt; CLAYE=45;

I

/ t """""""""""""""""""""""""""""""~ ti

SGVH ( 1 (

OVH=l; ESTADO=statusO;

CLAVE=47; bandera=5;

1

/ t ""~"""""""""""""""""""""""""""""" S /

SPACl) { ACC=GCC-P; PCtt; CLAVE=4EI;

1

/ t """""~""""""""""""""""""""""""""" tl

SST(instruccion) unsiqned int instruccion;

PCtt;

bandera=5;

mod-dir=(instruccion I 0x80); if (rtod-dir==O) { dsa=(instruccion 6 O x 7 f ) ; DATA_~EH[dral=status( 1; bandera=Z;

I else { DATA_~E~[REG_AUX[ARPIl=~~atus( I ; DIR_IND(instruccion);

I PC++; CLAVE=49;

/ t ................................. t /

SURlinstruccion) unsigned int instruction; { unsigned int shift:

jource Print - File: C:\TMS32010\T#Sj2010.C Page: 22 _"""""""""""""""""""""""~"""""""""""""""""""""""""""""""""""""~""""~ h e Source _"" "~""""""""""""""""""""""""~"""""""""""""""""~""""""~"""""""""""""

1093- !094- lW5- 1096- 1097- 1098- 1079- 1100- 1101- 1102- 1103- 1104- llQ5- 1106- 1107- 1108-

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 (

ACC=ACC-DaiA_nE#[REfi-AUX[ARPI]; DIR-IND(instruccion1;

1 PC+t ; CLAVE=50;

1109- } 1110- 1111- / t """"""""""""~"""""""""""""""""""~ 11 1112- 1113- SUBS(instruccion) 1114- unsigned int instruction; 1115- ( 1116- 1117- 1118- 1119- 1120- 1121- 1122- 1123- 1124- 1125- 1126- 1127- 1128- 1129- 1130- 1131- 1132- 1133- 1154- 1135- 1136- 1137- 1136- 1139- 1140- 1141- 1132- 1143- 1144-

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:

/ t """"""""""~"""""""""""""""""""""" t i

TBLR(instruccion) unsigned int (instruccion); I

seter(0xfff h [PC+lI);

PC= (ACC h Oxff f I : mcd-air=(instruccion h 0x80); if (cod-dir==O) { dma=(instruccion & Ox7f I ;

jource Pr in t - File: C:\TnS3;010\TMS320!0.C Page: 23 _"""""""""""""""""""""""""""""~"""""~""""""""""""""""""""""""""""""~ -¡ne SGurce

1145- DGTA_flE~[daal=#E~_PfiUGIFCl; 1146- PC=;acar(); 1147- bandera=2;

1149- e l s e 1150- { 1151- DATA-~Efl[~E6-AUX[ARPll=~E~-?~O~[?~l; 1152- PC=sacar ( I ; 1153- DIR-IND(instruccion1; 1159- 1 1155- CLBVEz54; 1156- } 1157- 1153- 1159- / t ________________________________________-------------------------

""_ ................................................................

114a- I

11 1160- 1161- TBL#(instruccion) 1162- unsigned int ( ins t rucc 1163- ( 1161- meter(0xfff & (PCt1) l l b 5 - 1166- PC= (ACC 0 O x f f f ) ; 1167- iod-dir=(instruccion 1168- if (mod-dir==O) Ll69- {

o n ) ;

L 0x801;

1170- dla=(instruccion & Ox7f I ; 1171- HEH-PRO6[PCl=DATA-KEH[dmal; 1172- PC=sacar( I ; 1173- bandera=2; 1174- 1 1175- else 1176- { 1177- HEH_PRO6[PC]=DATA-KEH[RE6-~UX[A~Pll; 1178- PC=sacar( I ; 1179- DIR_IND(instruccionl; 1180- 1 1181- CLA'JE255; 1182- 1 1183- 1181- / t ""~"""""""""""""""""""""""""""""" t l

1186- XOR(instruccion) 1187- unsigned int instruccion; 1!88- { 1189- mod-dir=(instruccion 8 0x801; 1190- if (~od-dir==O] 1191- { 1192- daa=[instruccion & Ox7f 1; 1193- ACC=(ACC & O x f f f f ) ; 1194- ACC=(ACZ * DATA-tfEtf[draj); 1195- bandera=2; 1196- 1

1185-

!

'üurce Print - File: C:\THS3?01~\T~S3?010.C Page: 24

.ine Source

197- elsf 198- { 199- CICC=(ACC h Oxffff);

"""""""""""""""""""~"""""""""""""""""""""""""""""""""""""""""""-

2oc- ACC=(GCC * DATA-H€H[RE6-GLIX[ARPIl I ; 201- DIR_INDlin;trutcionl; .202- 1 .?o;- PC++; ,204- CLAVEz56; 205- 1 .?Ob- ,207- / $ """""""""""""""""""""""""""""""" $1 ,208- ,209- ZAC ( ) .;:o- { ,211- ACC=O; ,212- PC++; ,213- CLAVE=57; 214- bandera=S; ,215- 1 ,216- 117- f t ________________________________________------------------------

\L t l ,218- 2 1 9 - ZALH(instruccion1 .220- unsigned int instruction; 1221- { 1222- mod-dir=(instruccion & 0x80) ; 1223- if (mod-dir==O) 1224- { 1225- dea=(instruccion & Ox7f 1 ; 1226- ACC=(Oxffff & DATA-HEH[dmal); 1227- ACC=(ACC((lb); 1229- bandera=2; 1229- } 1230- else 1231- I 1232- ACC=(Oxffif I DATA_HEn[RE6_AUX[ARP31); 1233- ACC=[ACC((16); 1234- DIR_IND(instruccionl; 1235- 1 1236- P C + + ; 1237- CLAVE.58; 1239- 1 1239- 1240- / t ................................ t i 1241- 1242- ZALS(instruccion) 1243- unsigned int instruccian; 1244- ( 1245- mod-dir=(instruccion & 0x90); 1246- if (md-dir==O) 1247- { m a - dsa=(instruccion & Ox7f);

;ource Print - Fil.: C:\THS32010\TMSj?010.C Page: 25

-ine Sourc:

1249- ACC=(Oxffff & OATA-HEti[daajl; 1250- bandera=?; 1251- I 1252- else 1253- { 1254- ACC=(Oxffff & DATG_rlEH[REG_AUX:ARP131; 1255- DIR-IND(instruccion); 1256- 1 1257- PC++; 1258- CLiVEz59; 1259- 1 12b0- 1751- 11 ________________________________________---------------------- tl 1262- 1263- IUS() 1254- (

""""""""""""""~"""""""""""""""""""""""""""""""""""""""""""""""""""-

""_ ""_ ~"~""""""_"""""~""""""~"""""""""""""""~""""-"""~~"""""""------------

1265- if ( ( A C C == oxaooooooo) I& ( o v H = = ~ ) ) 126b- ACC= Ox7fffffff; 1267- else 1268- if (ACC(01 1269- ACC=-ltACC: 1270- PC++; 1271- CLAVE=O; 1272- bandera=5; 1273- 1 1274- 1275- ________________________________________--_--------------------- 1276- 1277- IH(instruccion) 1278- unsigned int instruction; 1279- { 1280- unsigned int port-dir; 1281- port-dir=instruccion I 0x700; 1282- port_dir=port_dir>)8; 1283-

1285- cputs('1nterrupcion provocada p o r el Puerto :'I; 1286- cprintf('Zd ',port-dir); 1287- cputsl" Valor de entrada : ' I ; 1288- cscanf('X4x',tvalorl; 1289- acd-dir=(instruccion & 0x80); 1290- if (mod-dir==O) 1291- { 1292- dra=(instruccion k 0x71); 1293- DllTi-HEN[daal=valor; 1294- bandera=2; 1295- 1 1296- else I 1297- DLTA-~EH[REG_AUX[ARP]]=valor; 1298- DIR_IND(instruccioni; 1299- } 1300- despliega2ipos);

a /

m- gotoxy(1,25);

!

iou;[e Print - File: C:\T~S32010\THS32010.C Page: 25

.ine Source

"""""""""""""""""""""""""""""""""""""""""""-"-----------"---"-

""_ """"""""""""""""""""""""~""""""""""""""""""""""""""~"~""""""-"""" ,301- PCtt; ,302- CLAVEZ21; .;o:- 1

1304- 505- ________________________________________---------------------- 305- i307- OUT(instruccian1 i308- unsigned int instruccion: 1309- { 1310- unsigned int port-dir; 311- port-dir=instruccion & 0x700; i312- port-dir=port_dir))B; 1313- i314- Rod-dir=(instruccion & 0x80); .315- if (nod-dir==O)

i317- dBa=(instruccion & Ox7fl; :318- valor=DATA-HEfl[dmal; 1319- bandera=2; 1320- 1 1121- 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); 1328- delay(6000);

1330- CLAVE=38; 1331- 1 1332- 1333- / t ________________________________________---------------------- It 1334-

t /

L315- {

1229- PCtt;

1335- SAR(instruccion) 1336- unsigned int instruccion: 1337- { 1338- int AR; 1539- ARP= (instruccion&Ox700); 1340- GRP=ARP>)R; 1341- aod-dir=(instruccion & 0x80); 1342- if (sod-dir==Ol 1353- { 1344- dea=(instruccion & Ox7f); 1345- DATir_HEH[dma]=RE6-~UX[ARP]; 1346- b a n d e r d ; 1347- 1 1548- else 1349- { 1350- AR=RE6-AUX [ ARPj ; 1351- if ((instruccion h CxZO)==l) 1352- RE~-~UX[~RPI=REs_CIUX[aRP]+l;

I

;ource Print - File: C:\TMS32010\T#S3?010.C Page: 27

.ine Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ,353- 1354- . m -

i355- ,357- 358- 1359- 1360- :361- 1 !362-

if ( ( instruccion & OxlO)==lI

DATA-MEtl[ARl= REC-AUXIARPI; if ([instruccion & Ox8)==0) ARP=instruccion & 0x1;

RES-AUX:ARP:=REG-AUX[ARPI-l;

1 PCtt; CLAVE=46;

1363- / a ............................................................... a / .3b4- ;365- SACHiinstruccionl ,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- dato= ACC; .374- dato=dato((shift; i375- dato=dato)>lb; !376- mod-dir=(instruccion & 0x80); 1377- if (mod-dir==O) 1378- ( i379- daa=(instruccion & Ox7f); 1380- DATA-HEH[dmal=dato; 1381- bandera=Z; 1382- } 1383- else 1384- DATA_HEHIRE6-AUX[ARPll=dato; 1385- PC++; 1386- CLAVEz44; 1387- 1 1388- 1389- / t ~""""""""""""""~"""""""""""-"""----- t / 1390- 1391- SUBH(instruccion) 1392- unsigned int instruccion; 1393- { 1394- long int dato; 1395- mod-dir=(instruccion & 0x80); 1396- if (aod-dir==O) 1397- { 1398- dma=(instruccion & 0x71 1; 1399- dato=DATA-HEH[daa!; 1400- dato=dato((lb; 1401- ACC=ACC-dato; 1402- banderal2; 1403- j 1404- e lse

jo,urce Print - File: C:\TflS3:310\THS3?010.f Page: 28 _""""""""_ """""""""""""""""""""""~""""""""""""""""""""""""""~""

h e Source _"" """""""""""""""""""""""""""""""""""""~"""""""""""""""""""""""""~

1405- { 1406- dato=DATA_~En[R€s_A~x[ARP33; 1407- dato=dato<<l6; 1408- ACC=ACC-dato: 1409- DIR_IND(instruccion); 1410- 1 1411- PCtt; 1412- CLAVEz52; 1413- 3 1414- 1415- ............................................................... 1416- 1417- 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); 1 4 3 - dato=DATA-~ER[deal; 1426- dato=dato((lb; 1427- adder-output=ACC-dato; 1428- if((Oxffff0000 & adder-output)>= O ) 1429- ACC=(adder-outputlZitl; !430- else 1431- ACC.ACC82; 1432- bandera=2; 1433- 1 1434- else 1435- { 1436- dato=DATA_~En[RE6-AUX[FiRPll; 1437- dato=dato<(lb; 1438- ACC=ACC-dato; 1439- if I (OxffffOOOO 8 adder-output)>= O 1 1440- ACC=(adder-outputtZ)tl; 1441- else 1442- ACC=ACCt2; 1443- DIR-IHDIinstruccion); 1444- } 1445- PC++; 1446- CLAVEz51; 1447- } 1448- 1449- ________________________________________----------------------- 1450- 1451- PGP( ) 1452- ( 1453- 1454- ACC=sacar( I ; 1455- PC++; 1456- CLAVE.40:

$ /

t /

h u r t e P r i n t - File: C:\THS32010\TMS320!0.i Page: 29

h e Scurce

L457- bandera=5; 1458- 1459- 1 1460- !461- I t ________________________________________------------------------- 1352- 1463- PUSH() !464- { 1465- 146b- ReterlOxfff k ACCI; 1467- PC++; 1468- CLAVEz41; L469- b a n d e r a 3 1

_"" """_"""""""""""""""""""""""""""""""""""""""""""~"""""""""""""""" - . ,

t l

1470- 1471- 3 1472- 1473- / a _ _ _ _ _ _ _ _ 1474- 1175- RET( 1 1476- ( 1477- 1478- PC=sacar( 1 1479- CLAVE.42;

""""_"""""""""""""""""""""""- t l

1480- bandera$; 1481- 1482- 1 1483- 1484- I t ________________________________________----------------------- 1485- 1486- CALAI ) 1487- 1488- 1489- meter( [Oxfff & (PCt1)) I; 1490- PC=( K C & Oxfff 1; 1491- CLAVEz16; 1492- bandera+: 1493- 1494- } 1495- 1496- / a ________________________________________------------------------ t !

a /

149 i - 1498- CALL( I 1499- { 1500- 1501- meter(0xfff k (PCt21); 1502- P C = ( i n s t r u c c i o n & Oxfff); 1503- PC++; 1504- CLAVEz17; 1505- bandera=5; 1506- 1 1507- 1508- / t """"""""""""""""""""""""""""-"""" t l

;ourcE Print - F i l e : C:~TMS3;0!0\i~Sj?OlC.C Page: 30

.in€ Source

."" """""""""""""""""""""""""""~"""""""""""""""""""""""""""""""""""~

15G9- L510- status() .511- { 1512- unsigned int reg-status: : S E - 1514- reg-status=(l & O V ) ; ,515- reg-status=( (reg-status((l1 : O V f l ) 1516- reg-status=( (reg-status((l1~ INTY !517- reg-status=(reg-status((4); 1518- reg_status=(reg_status~Oxf 1: i519- reg-status=( (req-status((l1 : R R P ) 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-

f

!

;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 - ! I Description : Conjunto de procedimientos para e l Bartejo de ventanas y teclas

8 - //"""""""""""-""""""""""""""""""""""""""""

I - #include 'c0nio.h''

.O - #define tam 4 It tasaso de la pila de instrucciones $1 ,1 - .2 - #define l o ( f ) ((f) & Oxff) It obtiene el ASCII de un cod. ext $1 3 - 4 - #define UP-ARRO# 0x4~00 / S codigos extendidos de algunas t/ 5 - #define DN-ARROW Ox5000 It teclas para la interface tl 6 - #define PG-UP 0x4900 7 - #define PG-DN 0x5100 .I - #define F1 Ox3b00 9 - #define F2 0x3~00

!O - #define F3 Ox3d00 I1 - !2 - struct Cola ( i3 - unsigned int Info[ta~l; 14 - int tope,base; '!5 - I Stack; 16 - 17 - !I - !9 - int ven 171 [41 = { {1,1,80,25), / t ventana base t l i0 - (4,3917,211, It ventana de Heaoria del Prog.t/ il - (54,3,77,12), It ventana de Registros Generales 11

I - I / que controlan al simulador TIIS32010

t -

2 - (41,9,49,121, I t ventana de la Pila t / 53 - (54,19,76,21), /t ventana de Registros de Estado tl

15 - (41,15,77,16} I ; I t ventana con la instrucci'nactualtl i4 - (22,3,36,21}, I ! ventana de tlehoria de Datos !/

i6 - 17 - signed int DATA-tlEfl[l44]; i! - unsigned int flEfl_PR06[100] ; 19 - int w,v,Pad,r-m,t)andera=O, 10 - reg,EA,ext,li,ls, il - nua-op,override, 12 - flg-hlt,auxD,pos; IJ - $4 - ;t"""""""""""""""""""""""""""""""-"" tl 15 - 16 - void marco 17 - 18 - I 19 - int i,xs; j0 - 51 - gotoxy(up i? - putch(ZO1

int uplx,int uply,int lorx,int lory,char ts)

x,uply); ,

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 putch(l6E); if ( $ 5 != O 1 {

;itt) putch(205);

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 ""~"""""""""""""""""""""""""""-""" a l '4 - '5 - char lee-tecla (int Sk) 76 - 17 - { 'E - union REGS regs; i 9 - 30 - regs.h.ah = O ; I1 - int86lOxlb,tregs,treqs); 12 - t k = regs.x.ax; 13 - if (lo(lk) == 3) exit(1); 14 - return regs.h.al; 35 - 1 36 - 37 - / $ """"""""""""""""""""""-""""""""""- t l 38 - 39 - void beep (void) ?O - 9 1 - ( 72 - sound(750); ?3 - delay(200); 34 - nosound( 1; 95 - 1 i'b - 97 -

t l 99 - it Dibuja las ventanas del simulador THS32C;lO en Video at 100 - 101 - 102 - v o i d pantalla ( 1 103 - 104 - {

98 - / X ...........................................................

!

,ource Print - Fil.: C:\THS3?010\THS.C Page: 3

.ine Source

05 - c l r s c r 0 ; 06 - g0toxyi25,l); 07 - cprintf (">) Simulador TflS32010 ( < ' I ; .Oü - aarco(venil1 [O]-1,venIll [lj-l,ven[lf [21t1,ven[lI [31+1,0 nets. Prog." ) ; 09 - marcofven[21 :O]-l,ven[i] [I]-l,ven[?l [21tl,ven[21 [31+1," Regs. Gerals.'); 10 - rarcoíveni31 [O]-l,ven!31 [l]-l,ven[3] [21tl,ven[31 [31+1," Pila '1; I1 - ~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 ; 1 4 - 1 15 -

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;

"""""""""""""""~""""""~"""""""""""""""""""""""""""""""""""""""""""~

.................................................................

,lb - / t ....................................................................... t i

22 - .23 - 1 24 - 25 - / $ _""""""""""" ?b - 27 - void sel-ventana (int win 78 - .29 - {

"""""""""""""""""""~"""-"" t /

.IO - window(ven[winl [Ol,ven[winl [ll,ven[winl [2l,ven[winl [31);

.51 - 1 132 -

134 - / $ ..................................... 11 .35 - I t Actualiza la ventana de que fue alterada por la operation t t 136 - .37 - !38 - void actz-ventana lint nin,int dato,unsigned char scrol!) .39 - i40 - { 141 - lowvideo(); 142 - sel-ventana(win1;

144 - if (scroll) I

146 - gatoxy(2,ven[winl [I] - ven[winl ilI+ll; 147 - 1 118 - else inslinei); 149 - cprintfín%4x I %4x",dato,HEH~PRU6[dat011; 150 - noravideo(); 151 - sel-ventana(0); 152 - 1 153 - 154 - ________________________________________---------------------------- $1 155 - / t Despliega la ventana de tleooria de Eatos tl 156 -

7 7 . 3 3 -

!43 - gotoxy(2,l);

145 - delline0;

ource Print - File: C:\TtlS320!0\TMS.C Page: 1

ine Source

57 - 58 - vcid despliega2(int pos) 5 9 - { 60 - int x ; 61 - 62 - sel-ventana(5); 63 - for (x=O;x(= 18;x++) {

55 - cprintf('L4x I Xlix',po~+x,DATA~HE#[pos+xll; 66 - 1 b7 - sel-ventana(01; 6 8 - 1 59 - 70 - 11 ________________________________________---------------------------- $1

"""""""""~""""""""""""~""""""""""""""""""""""""""~"""""""""""""""""

"" """"""""""""""""""""""""~"~""""""""""""""""""""""""""""""""~""""~

64 - gotory(2,x+l);

71 - / a Oespliega l a ventana de Reeoria del Prograaa t / 72 - 73 - 7 4 - void despliega (int l o c ) 75 - l b - { 77 - int x; 78 - .79 - sel-ventana(1); !O - for (x=O;x(= lB;x++) {

82 - cprintf("Z4x I 14x',loctx,~EH~PRO6Il~c+xll; .83 - 1 184 - li = lot; 1s = loctx-1; a5 - sel-ventana(0);

.87 - ,a9 - / t """""""~""~~"""""""""""""""""""---------- t l .90 - It Despliega la ventana de registros generales $1

a l - gotoxy(2,xtu;

.ab - 1

.Ea -

.91 -

.92 - i95 - void registros ( 1 .94 - 195 - I .96 - L77 - sei-ventana(2);

199 - gotoxy(3,4); cprintf(' 1 - RCC " I ; !O0 - gotoxy(3,4); cprintf(' 1 - ACC %lx',ACC); 101 - gotoxy(3,5); cprintf(' 2 - P " I ; !O2 - gotoxy(3,5); cprintf(* 2 - P ZIx',P); ?O5 - gotoxy(3,bi; cprintf(' 3 - ARO * I ; !O4 - gatoxy(3,6); cprintf(' 3 - ARO Ilx',REG-AUX !O5 - gotoxy[3,7); cprintf(' 4 - AR1 '1; !O6 - gotaxy(3,7); cprintf(" 4 - AR1 XLx",REG-RUX 107 - gotoxy(3,3); cprintfl" 5 - T * I 1 !o8 - gGtoxy(=,8); c p r i n t f ( " 5 - T Z$x",T);

.sa - gotoxy(3,2); cputsI'Id.');

w r c e Frint - File: C:\TMS3SOID\T~S.C Page: 5

i n e Scurcs

09 - gotoxy(3,9i; cprintf(' 6 - '1 ; 10 - gotoxyi3,9); cprintf(' 6 - PC %3x8,PC1; 11 - gotoxy(3,lO); cprintfi' 7 - 12 - gotoxy(3,lO); cprintfi' 7 - BID Xld',BIOl; 13 - sel-ventana(0); 1 4 - : 15 -

.......................................................................

"" """""""""""""~"""""""""""""""""""""""""""""~"""""""~""""""""~""""

'16 - J t .................................................................... tl 17 - '18 - void verinst0

'20 - char modo; 19 - {

21 - 22 - ?J - 24 - 25 - 26 - 27 - 29 - 29 - 30 - i31 - '32 - 33 - .34 - I35 - J4 - :37 - 38 - 139 - :40 - 141 - 142 - 143 - !45 - 145 - 146 - 147 - !38 - 149 - 150 - !51 - 152 - !53 - !54 - 5 5 - !56 - !57 - !58 - i59 - !6O -

J . 7

sei-ventanalb);

if (aod-dir==O) nodo='D';

else modo=' I * ;

qotoxy(2,l); cprintfi' witch(bandera1

case O: ca5e 1: gotocyl2,l); cprintfl' INS.

(

gotoxy(l3,l); cprintfl' daa '1; gotoxy(25,l); cprintf(' HOD. '1; break;

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 2: gotoxy(2,l); cprintft' INS. "1;

case 3: gotoxy(2,l); cprintf(' INS. ' I ;

" 1 ;

'1;

gotoxy(2,l); cprintf(' INS. Xs',IHSTR[CLAVEI); gotoxy(l3,l); cprintf(' HOD. %c',nodo); break;

gotoxy(2,l); cprintf(" INS. Zsn,,INSTR[CL4VEI); gotoxyil3,l); cprintfi" CTE. %lx',,CICCI; break;

gotoxy(2,l); cprlntfi' INS. XsR,INSTR!CLAVE1); break;

gotoxy(2,ll; cprintfi" INS. %s",INSTR[CLAVEI);

case 4: gotoxy(2,l); cprintf(' INS. I

case 5: gotoxy(2,l); cprintff' INS. n

ca5e 6: gotoxy(2,l); cprintf(# !NS. I

yotoxy(l3,l); cprintfi' CTE. %4x8,RE5_kUX[a:p_auxI)i break;

gotoxy(2,l); cprintfi" INS. %s',IliSTR[CLGVE]); gotoxy(l3,l); cprintfi" CTE. Xlu",ctel); break;

case 7: gotoxyi2,l); cprintf(' INS. '1;

!

iource Print - File: C:\TMS3?010\TES.C Page: 6

.ine Source """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""~

,"" """"""""~"""""""""""""""""""""""""""""""""""~"""~"""""""""""""""~

'61 - 1 152 - sel-ventanalo); 163 - 164 - } 165 - 156 -

. .

157 - / S ........................................................................ S f 168 - !69 - void PrograsaIint lot) !?O - { !71 - int lac-a; !72 - !7Z - sel-ventana(5); !74 - ?75 - loc-a=loc; !76 - gotoxy(3,2); cprintf("%4xa,DATA~HE~[locll;!oc~~; !77 - gotoxy(9,Z); cprintf('Z4xS,DIITA~HEH~locll;loc++; !78 - gctoxy(15,Z); cprintf(a%4xa,DAlCI~HEH[locl);loc~+; !79 - gotoxy(21,Z); cprintf('Z4x',DATA~HEH~locl);loc~+; !90 - gotoxy(27,2); cprintf('%4xa,DCITA~ME~[iocll;ioc++; !S1 - gotoxy(33,2); cprintf(a%~xa,,D~TA~HEH[locl);~oct+; !E? - gotoxy(39,Z); cprintf('%4x',DATR~HE~[locl);ioctt; !83 - ?94 - gotoxy(3,31; rprintf('%4x',loc-a1; !85 - qotoxy(9,3); cprintf~'X4xa,loc~al; 286 - gotoxy(15,3]; cprintf('X4xa,loc-al; 287 - gotoxy(il,3); cprintf('Z4x',ioc_a); 288 - gotoxy(27,3); cprintf('X4x',loc-a); 297 - gotoxy(33,:); cprintf('X4x',loc-a1; 290 - gotoxy(39,3); cprintfI"X4x',loc-al; 291 - sel-ventanaIO); 292 - 293 - 1 294 -

loc-a++; ioc-a++; loc-a++; loc-a++; loc-a++; loc-att; loc-at+;

lource Print - File: C:\TNS32010\iRS.C Page: 7

.ine Source

."" ~"""""""""""""""""""""""~""~"""""~""~"""~"""""""""""""""""""""""""

I 3 - / t """""""""""""""""""""""~"""""""""" t / ;14 - / t Despliega la vtlntana con los Registros de estado t / ;15 - ¡!6 - 27 - void banderas (1 ; la - ,19 - { 20 - sei-ventana(4); i21 - gotoxy(2,l); cputs('0V UVfl INTI! ARP DP');

i23 - qotoxy(6,2); cprintf('%ld',OVfll; 24 - yotoxy(10,2); cprintf('%ld",INTH); 125 - qotoxy(14,2); cprintf('Xld',ARP); 26 - gotoxy(19,21; cprintf('%ld",DP); 27 - sel-ventana(O1; ;28 - 1 ;29 - ;30 -

;32 - ;33 - void loc-mes (int tloc,int cual)

;22 - qotoxy(2,Z); cprintf('%ld',OV);

- / t """"""""_"""""""""""""""""""""""""" t l

;34 - ;35 - :36 - i37 - i38 - X9 - ;40 - i41 - i42 - i43 - ;44 - j 4 5 - i46 - 547 -

149 - 350 - i51 - 352 - 153 - 554 - 155 - 356 - 157 -

148 -

( gotoxy(l,25); cputsi'localidad de Henoria : ' I ; cscanf ( 'X4x" loc) ; if (cual == 1)

if ((tloc >= O ) && (tloc (= 143)) { I t HEHORIA DE DATOS t / r

if (tloc (= 9) li = O ; else if (tloc >= 144) li = 125; else li = t loc - 9; despliega2IIil; 1

1 else { 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

553 - / t """""""""""""""""""""""""""""""""" &I $59 - 360 - void Nod-mea ( I I61 - 362 - ( 163 - int cas; 564 -

;ource Print - File: C:\TMS32010\THS.C Page: a

.ine Source

;55 - auxb=O; ;66 - gct~1~~(1,25); ;¿i - cputs(Yoca1idad de Feaoria : '1; (58 - cscanf['Z4xg,&ca;); i69 - if ((cas )= O ) Bt (cas (= 143)) I I t ?lERORIR DE DATOS 1/

;71 - else if (cas >= 1441 li = 125;

""""""""""""""""""""~"""""""""""""""""""""""""""""""""""""""""""""

~"""""""""""""""""""""""""""""""""~"""""""""""""""""""~"""""""""~

:70 - if (cas (= ? I li = O ;

! i 2 - else l i = ca5 - 9; ;73 - despliegaZ(li1;

;75 - gotoxyi29,25); cputs('cantenido : '1; ;76 - cscanf("%4xm,&auxb1; i77 - DATA_flER[ca51 = auxb; ;78 - despliega2(ii); 379 - 1 i80 - 191 -

i74 - 3

- / t .................................................................... t l 335 - ;S4 - ;u5 - :a6 - 9 7 - a e - xi9 - j90 - 591 - ;92 - 193 - 394 - ;95 - 396 - 397 - 398 - 599 - 400 - 101 - 402 - 403 - 404 -

void podgrog( { int casilla;

auxb=O;

cputs('Loca1idad de fleroria : ' I ; cscanf('Z4x',bcasilla); if ((casilla >= O ) && (casilla <= 1023)) {

gotoxy(1,251;

if (casilla (= 9) li = O; else i f (casilla >= 1024) li = 1017; else li = casilla - 9 ; despliega(1i); 1

gotoxy(29,25); cputsl'contenido : ' I ; cscanfl'%4xu,hauxb); H€H-PROG[casilla] =auxb; despliegailil;

1

405 - / t """"""~""""~"""""""""""""~""~""""""" t i 106 - /1 Hodifica alguna de las registros de Estado t l 407 - 908 - 409 - void rod-edoo

411 - 912 - char ban;

410 - r

413 - 514 - gotoxy(1,25); 415 - cputsl"€scriba ¡as iniciales del Registro Ll/!í/I/A/D a modificar : " I ; 116 - cscanf( "Xlc',&banl;

ource Print - Fiie: C:\TYS3?010\TflS.C Page: 9

.in2 Source

17 - switch(toupperfban)l { 18 - case ' O ' : if (OV==l) I t ESTADO = s t a t u s ( ) ; $1 19 - GV.0; 20 - else 21 - OV=l; 22 - break; 23 - tase '/I' : if [OV# == 11 24 - ovn=o; 25 - else 26 - OVt?=l; 27 - break; .26 - case ' I ' : if (INTH == 1) 29 - I N T k O ; 30 - el se 31 - INTH=1; 32 - break; J A - tase ' A ' : i f (hRP == 1) 34 - ARP=O: 35 - else 36 - ARP=l;

38 - case 'D' : if (DP == 11 39 - DP=O: 40 - else 4 1 - DP=1; 142 - break; A3 - } 144 - ESTADO=status(); 45 - banderas[ 1; 846 - 1 b47 - 148 - / t ...................................................................... t /

"""""""""~""""""""""~""""""""""""~""""""""""""""~"""""~""""""""~""""~

"" ..................................................................

"

37 - break;

.4? - I t Rodifica alguno de los Registras Generales t / 150 - .51 - 152 - i53 - 154 - I55 - i56 - 157 - 158 - 159 - 160 - I 6 1 - I62 - i63 - I64 - 165 - 165 - 167 - 166 -

void rod-reg (1

{ 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 ( i d i= 1 t h id (= 8 ) { witchiid1 {

case 1 : ACC = val?; break; case 2 : P = va!?: break;

iource Print - File: C:\T#S32010\iXS.C Page: 10

.ine S o u x e """"""""""""~""""""""""""""""""""""""""""""""""~""""""""""""""""

lb9 - case 3 : REfi-fiUXIOI = val; break; 170 - case 4 : REG-fiUX[l] = val; break; 171 - case 5 : T = val; break;

173 - despliega(PC); 174 - PilaO; 175 - break; 176 - case 7 : BIU = val; 177 - break; \78 - 179 - 1 190 - registros0; I81 - 1 182 - 1 183 - 184 - / t .................................................................. i85 -

172 - case b : PC = val;

tl

186 - void wodinst0 187 - I88 - ( M9 - int val; 190 - char w-dir,inst-id; 191 - ;9? - gotoxy(1,25); cputs('Caebiar (Ilnst. (D)ea ' (!!lodo : ' I ; 193 - cscanf('Xc',&instid); 494 - gotoxy(38,25); cputs('va1or : '1; 195 - if (instjd=='H' :: inst-id== '1'1 196 - cscanf('X4x',&vaIl; 197 - else

199 - switch(toupFer(inst_id)) I

501 - case '1': INS = va!; break; 502 - case ' D I : dma = a-dir; break; 503 - 1 504 - despliega(PC); 505 - ver-instO; 506 - } 507 - 508 - 509 - / t """""""""_"""""""""""""""""""""""- ti 510 - I t Incerta elelento en el tope de la Pila t i 511 - 512 - void aeter(unsigned int entrada) 513 - { 514 - 515 - i f ((Stack.tope == O ) && (Stack.Info[Stack.topel ! = ' \ O ' ) ) 516 - Stack,tope=3;

518 - Stack.Info[il=Stack.InfG[itll ; 519 - 520 - Stack. Info[Stack. tope] = entrada;

998 - cscanf('Tc',&m-dir);

500 - case *H' : aod-dir = val; break;

5!7 - for (i=O;i(=Z;tti)

1

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

return(salida1; 1

1

j47 - /t""""""""""""""""""""""""""""""""""" t / j48 - / t Controla todos los lovirientos en todas las ventanas del Simulador t i 549 - j50 - j51 - j52 - 553 - j54 - j 5 5 - j56 - 557 - 558 - 559 - 560 - 561 - 562 - 563 - 564 - 565 - 566 - 567 - 568 - 569 - 57C - 571 - 572 -

! void interface 0

( int k,pos; int fl = 1;

despliega(PC1; despliegaZ(0); registroso; P i l a O ; banderas( 1 ; ver-insti 1;

Hhile If11 ( p o d ;

gotoxy(1,24); cputs("F3.Inst./iR)egs.Sen./F2-~egs.Edo.~~~~em.Prog./~L~oc.Da~0s~~CIon~. PgUp PgDn ' 1 ; putch[24);putch(25);

clrenl0; cputs('Cosando : 'I; lee-teclallkl; swltch (k) {

gotoxy(1,25);

iource Print - File: C:\TMS32010\TMS,C Page: 12

.ine Source """"""""""""""""""""""""""""""""~"""""""~""""""""~"*"""""""""""""

i73 - j74 - i75 - j76 - i77 - i78 - 179 - i80 - i81 - J02 - j83 - j84 - j85 - j86 - i87 - 188 - i89 - J90 - j9l -

j93 - 394 - j95 -

j97 - 598 - 599 - 500 - 501 - 502 - 505 - 604 - 505 - 606 - 507 -

bC9 - 610 - 511 - 612 - 613 - 613 - 615 - 616 - 617 - 618 - 619 - 620 - 621 - b22 - b23 - 624 -

592 -

596 -

hoe -

I

case UP-ARRG# : if (li > 0 1 ( act:-ventana[l,--li,O); "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); 1

break; case P6-DN : if (Is ( 1023) {

if (lst19 (= 1023) li = Istl; else l i = 15 - (1st19-1024);

déspliegaili); 1

break; case 0x1352 : I t Registras t l case 0x1372 : gotoxy(l,24); clreal0;

cputsl'tlodificacian de Registros"); mod-reg ( 1 ; break;

case Ox324d : / t Henoria I! case Ox326d : gatoxy(l,24); clreol0;

cputs('Hadificacion de Heaoriao);

break; c a s e 0 x 2 6 4 ~ : / t Laca1i:ar t I c a s e 0 x 2 6 6 ~ : gotoxy(1,241; c!reolO;

modgrog( 1 ;

cputs("Loca1i:ar casilla de tlesoria'); eod-#er( 1; break; I t Registros de Estado t /

cputs('ilodifica 10s Registros de estado'); aod-eda( 1 ; break;

cputs('Hodifica 1nstrucci"n ' I ; aod-ins t ( 1 ; break;

case F2 : gotoxy(l,24); clreo10;

case F3 : gotoxy(1,241; clreol0;

case OxZe43 : / t Continuar t / case Ox2eb3 : f l = O; break; case OxOllb : clrscr();

printf('Sa1ida del Simulador iHS32010.'); exit(0);

defaui t : t e e p 0 ;

I

ource P r i n t - F i l e : C:\THS32010\T#S.C Paqe: 13

i n 2 S o w e

25 - 1 26 - 2 7 - 1 '28 -

"" """""""""""""""""""""""~"""""""""~"""~"""""""""""""""~"""""""""""

;ource F r i n t - File: C:\T%J2010\VdR.C fag?: 1

.ine Source

I - u n s i g n e d i n t PC=O, O?', BIO, OVR, IN%, DP, GRP, TOS! REG_AUX:ll,entrada,salida: Z - u n s i g n e d i n t HEt!-FROG:lOOl, ESTADO, gad-dir , CONT,instruccion,lNS,CLRVE!dra; I - c n s i g n e d int arp-aux, c t e l ; 1 - s i g n e d i n t I, l!ATP_HEH[1441; i - long int ACC, P; i - char INSTR[601[53 = ['BBS',RADDa,'ADDH','ADDS','ANDu,8APAC','B','~ANZ~,a~GEZ', ' - "EGZ8,'BIOZ",aBLEZ','BLZ',u5NZ',"BV","BZ8,8CAL~','CALL', 3 - 'DINTs,'DHOV',sEINT','IN8,'LGCs,'~~C~',8~~R',nL~~K','LARP8, ? - 'LDP','LDP#','LST','LT','LTA',8LTD','HARw,'flPY','HPYK','~OP*, !O - 'CR',"OUTu,'PAC',"POP','PUSH8,n~ET','AOV~n,'S~CH',sS~CL', 11 - 'SARu,"SGVfl','SPAC','SST","SU5Q,'SUBi','SU~~','SUBS','TBLR', I? - 'TB?#',QXDRC,'ZGCs,'ZALH~,'ZALSo}; 13 - int vaior,i;

"""""""""""""""""""""~"""""""""""""""""""""""""""""""~"~""""""~"""""

""_ """~"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""~

h u r t e Frint - Fil.: C:\TMS3?0!0\P~NTirLL~.C Page: 1

.ine Source

. - #include 'aath.h" ! - Bintlude 'conio.h" j - #include '5tdarg.h' 1 - #include 'graphics.h"

""~"""""""""""""""""""""""""""~""""""""""""""""""""""""""-"--"--""-

1 -

I - int GraphDriver; ' - int 6raphHode; I - int HaxX, IaxY; ? - int RaxColors; 10 - int Errorcode; 11 - I? - void Inicialvoid); .3 - void Pantlvoid); :4 - void Presentaciono; . 5 - void StatusLine(char :6 - void DibBordeivoidl; ,7 - void changetextstyle

19 - coaenzar( l ! O - ( !1 - IniciaO; 22 - Panto; !3 - closegraph0; !4 - return(01; ?5 - 1 16 -

.a -

fa50

~l int

1;

font, int direction, int charsize);

27 - It """"""""""""~""""""""""""""""""""" tl 28 - void Inicia(void1 29 - ( 30 - 6raphDriver DETECT; 51 - initgraph( k6raphDriver, k6raphHode, I' 1; 32 - Errorcode = graphresult0; 13 - if ( Errorcode != grUk I ( 34 - printf(O Graphics System Error: %5\n', grapherroresg( Errorcode I I ; 35 - exit( 1 l ; 36 - 1 37 - HaxColors = geteaxcolor0 + 1; 38 - HaxX = getmaxnl I ; 39 - RaxY = getraxytl; 40 - 1 41 - 42 - / t """"""""_""""""""""""""""""""""""" t / 45 - void Pant(void1 44 - { 45 - struct vienporttype info; 46 - int h, M ;

47 - Presentation(); 48 - getviewsetting;( &info I ; 49 - changetextstyle( SOTHIC-FONT, HORIZ-DIR, 4 1 ; 56 - settextjustify( CENTER-TEXT, CENTER-TEXT I ; 31 - h = info.bottoa - info.top; 52 - u = info.right - infoeleft;

jource P r i n t - F i l e : C:\TnS3?0!0\PAWTBLtA.C Page: 2

. ine Source _"" ...................................................................

j3 - o u t t e x t x y ( n /? ! hi?.:, 'SIflULADOR TES32010' I; j 4 - changetex ts ty le ( DEFRilLT-FONT, HORIZ-DIR, 0.5 1; j5 - s e t t e x t j u s t i f y i CENTER-TEXT, CENTER-TEXT 1; J6 - o u t t e x t x y ( w12, fhi?)tl.l, "REBLIZADO POR :' I ; j7 - o u t t e x t x y ( n/Z, (h/?)1!,2, 'M. DEL PILAR VILLcl CERVANTES' 1; ja - o i i t t e x t x y i ti/?, (ht?)S1.3, 'ALBERTO GRRCIA CASTILLO' I ; j9 - o u t t e x t x y l w/2, [h/?)t1.5, "NAYO-93' I; i 0 - Sta tusL ine( "PRESIONA CUALWIER TECLA PARA CDtdTiNUBR" I; '11 - g e t t h o ; 52 - c lea rdev i ce ( ) ; í3 - 1 54 - 55 - / t "~"""""""~"""~""""""~""""""-""-""--""- t / 56 - void Presentac ion(1 i7 - { ;S - i n t h e i g h t ; 59 - c lea rdev i ce ( ) ; IO - se tco lo r ( HaxCo lors - 1 I ; I1 - se tv i ewpor t ( O , O , HaxX, HaxY, 1 1; I? - he igh t = t e x t h e i g h t ( 'H' 1; 73 - changetex ts ty le ( DEFAULT-FONT! HORIZ-DIR, I I ; i 4 - s e t t e x t j u s t i f y ( CENTER-TEXT, TOP-TEXT I ; 75 - se tv iewpor t ( O , he igh t t4 , HaxX, HaxY- (he igh t t l ) , 1 1; 76 - Dibhrdel) ; 77 - se tv iewpor t ( 1, he igh t t5 , HaxX-1, HaxY-[heightt5), 1 I;

79 -

31 - vo id S ta tus l i ne ( cha r lmsq 1 82 - { 85 - i n t h e i g h t ; e4 - se tv i ewpor t ( O , O , HaxX, HaxY, 1 1; 85 - se tco lo r ( HaxCo lors - 1 I; 86 - changetex ts ty le ( DEFAULT-FONT, HORIZ-DIR, 1 I ; 87 - s e t t e x t j u s t i f y ( CENTER-TEXT, TOP-TEXT I; 89 - s e t l i n e s t y l e ( SOLID-L!NE, O , NORH-WIDTH I ; 89 - s e t f i l l s t y l e ( EHPTY-FILL, O 1; 90 - he igh t = t e x t h e i g h t ( 'H' I; 91 - bar ( O , HaxY-lheightt41, HaxX, HaxY I; 92 - r ec tang le ( O, HaxY-(heightt4), flaxX, flaxY 1; 93 - ou t tex t xy ( HaxXI2, fiaxV-(height+2), atsg I; 94 - se tv iewpor t ( 1, he igh t t5 , HaxX-1, HaxY-(height+51, 1 I; 9 5 - 96 - 1 97 - 98 - ________________________________________--------------------------- t l 99 - void DibBcrde(void1 100 - c 101 - s t r u c t v i e n p o r t t y p e vp; 102 - se tco io r ( HaxCo lors - 1 1; 103 - s e t l i n e s t y l e ( SOLID-LIE, O, NOR#-SIIDTH I ; 104 - g e t v i e w s e t t i n g s l t v p 1;

!e - 1

85 - / t ................................................................... t /

!

ource Print - File: C:\T~S32010\FANTALLA.C Page: 3

ine Source

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? - int Errorcode: .13 - .14 - graphresult(); .15 - settextstyle(font, direction, charsize); ,lb - Errorcode = graphresult(): .17 - i f ( Errorcode != grUk ) ( 118 - closegraph(); .19 - printf(' Errar Grafito: %s\nn, grapherrorssgí Errorcode ) I ; 20 - exit( 1 1; :21 - } .?? - 1

!