Você está na página 1de 256

0,&52352&(66$'25(6

&21&(,726,03257$17(6
(',d2

5REHUWR0=LOOHU (GLomRGRDXWRU
)ORULDQySROLV6&%UDVLO 

&RS\ULJKW5REHUWR0=LOOHU 'LUHLWRVDXWRUDLVUHVHUYDGRV

)LFKDFDWDORJUiILFD =P =LOOHU5REHUWR0 0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV5REHUWR0 =LOOHUHG)ORULDQySROLV(GGRDXWRU SLOWDEV ,QFOXLELEOLRJUDILD ,6%1 0LFURSURFHVVDGRUHV,QWHO 0LFURSURFHVVDGRU ,QWHO 0LFURSURFHVVDGRU ,7tWXOR &'8 &DWDORJDomRQDIRQWHSRU2QpOLD6LOYD*XLPDUmHV&5%

$JUDGHFLPHQWRV
$JUDGHoR DR SURIHVVRU 9LWyULR %UXQR 0D]]ROD GR 'HSDUWDPHQWR GH ,QIRUPiWLFD H (VWDWtVWLFD GD 8)6& SHOR PDWHULDO FHGLGR TXH VHUYLX GH LQVSLUDomRSDUDDOJXQVFDStWXORVDLQGDQDSULPHLUDHGLomRGHVWHWUDEDOKR $JUDGHoRHVSHFLDOPHQWHDRSURIHVVRU :HUQHU.UDXV-UGR'HSDUWDPHQWRGH $XWRPDomR H 6LVWHPDV SHOD UHYLVmR FUtWLFD H FXLGDGRVD GR WH[WR H SHODV LQHVWLPiYHLVVXJHVW}HVTXHDMXGDUDPD WRUQiOR PDLV FODUR H PDLV ULFR $VVLP FRPR VHX FROHJD -RQL GD 6LOYD )UDJD LQFHQWLYRXPH PXLWDV YH]HV D LQRYDU H PHOKRUDURPDWHULDOGLGiWLFR $JUDGHoRWDPEpPDRVSURIHVVRUHV+DUL%UXQR0RKUH5DLPHV0RUDHVFROHJDV GR 'HSDUWDPHQWR GH (QJHQKDULD (OpWULFD SHOD FRQVWDQWH GLVSRVLomR SDUD GLVFXWLUGHWDOKHVWpFQLFRVHSHORLQFHQWLYRTXHWRUQRXUHDOLGDGHHVWHOLYUR $RSURIHVVRU*HUDOGR.LQGHUPDQQWDPEpPFROHJDGHGHSDUWDPHQWRGHYRXP DJUDGHFLPHQWR HVSHFLDO SRU WHU FRORFDGR j PLQKD GLVSRVLomR WRGD D VXD H[SHULrQFLD FRPR DXWRU H HGLWRU PRVWUDQGRPH R PHOKRU FDPLQKR SDUD UHDOL]DUHVWDSXEOLFDomR2PHVPRIH]RSURIHVVRUHFROHJD$UQDOGR-RVp3HULQ TXDQGRGDSXEOLFDomRGDHGLomRDQWHULRU $RVDFDGrPLFRV5DIDHO&DUORV-XQJ6SHURWWRH7KLDJR3HUHLUD%HUWRGRFXUVR GH(QJHQKDULDGH&RQWUROHH$XWRPDomRH0DUFHOR/XtV/6DQWRVGRFXUVR GH (QJHQKDULD (OpWULFD DJUDGHoR D EXVFD GH HUURV QD SULPHLUD HGLomR $RV PHXVDOXQRVGH0LFURSURFHVVDGRUHVGRVHJXQGRVHPHVWUHGHDJUDGHoRD GHGLFDomRHRHPSHQKRTXHGHPRQVWUDUDPQRVWHVWHVGR$EDFXV $JUDGHoRWDPEpPRDSRLRUHFHELGRGR'HSDUWDPHQWRGH(QJHQKDULD(OpWULFD HGR'HSDUWDPHQWRGH$XWRPDomRH6LVWHPDV 'H IRUPD FROHWLYD DJUDGHoR DV VXJHVW}HV DV FUtWLFDV H R LQFHQWLYR GH PXLWRV RXWURVDOXQRVFROHJDVHDPLJRV  'LRPDUD DJUDGHoR R FDULQKR R DPRU H D SDFLrQFLD VHP RV TXDLV HVWH WUDEDOKRQmRWHULDVLGRWHUPLQDGR

$SUHVHQWDomR
$YHORFLGDGHFRPTXHDFRQWHFHDHYROXomRGD ,QIRUPiWLFD SRGHULDOHYDUD FUHU TXH D WDUHID GR SURIHVVRU GH XPD GLVFLSOLQD FRPR D GH 0LFURSURFHVVDGRUHV VHULDDGHDWXDOL]DUFRQWLQXDPHQWHRPDWHULDODSUHVHQWDGRDRVDOXQRVSDUDTXH HVWHVILFDVVHPDSDUGDVFRQVWDQWHVLQRYDo}HVWHFQROyJLFDV (VWDLGpLDQmRUHVLVWHSRUpPDXPDDQiOLVHPDLVSURIXQGDVHpHVWHRWLSRGH FRQKHFLPHQWR GDGR DRV DOXQRV TXH HVWmR QR PHLR GR VHX FXUVR HQWmR GLILFLOPHQWHHOHOKHVVHUi~WLOTXDQGRVHIRUPDUHPGHSRLVGHDOJXQVDQRV2V FRQFHLWRV IXQGDPHQWDLV TXH QRUWHLDP R IXQFLRQDPHQWR GRV PLFURSURFHVVDGRUHVVmRVREHVWHDVSHFWRPDLVLPSRUWDQWHVGRTXHRV~OWLPRV ODQoDPHQWRV GD LQG~VWULD SRUTXH QmR PXGDP H VHUmR ~WHLV VHPSUH 3RU HVWD UD]mR R PDWHULDO DTXL FRQWLGR SURFXUD YDORUL]DU VREUHWXGR RV FRQFHLWRV LQGHSHQGHQWHV GD LQRYDomR WHFQROyJLFD 'D PHVPD IRUPD MXVWLILFDVH D XWLOL]DomR GR PLFURSURFHVVDGRU  QRV SULPHLURV FDStWXORV SRLV HVWH DSUHVHQWD D VLPSOLFLGDGH QHFHVViULD DR LQtFLR GRV HVWXGRV DR PHVPR WHPSR TXH RV FRQKHFLPHQWRV DGTXLULGRV VmR HPSUHJDGRV QR UHVWDQWH GR OLYUR TXH XWLOL]D R  (VWH FRUUHVSRQGH DRV SURFHVVDGRUHV PDLV DYDQoDGRV GD ,QWHO TXDQGR RSHUDP QR PRGR UHDO H VHUYH DVVLP GH EDVH SDUD XP HVWXGR PDLV DSURIXQGDGR $FRPSDQKDQGR R WUDEDOKR GRV DOXQRV TXH FRQFOXHP D GLVFLSOLQD SXGH FRQVWDWDU TXH HOHV VmR FDSD]HV GH HQWHQGHU R IXQFLRQDPHQWR GH PLFURSURFHVVDGRUHVGLIHUHQWHVGDTXHOHVTXHHVWXGDPRVHGHWUDEDOKDUFRPHOHV DSOLFDQGR RV SULQFtSLRV TXH DSUHQGHUDP e SRU LVVR TXH DFUHGLWR QHVWD DERUGDJHPHIRLWDPEpPHVWHRSULQFLSDOIDWRUTXHPHOHYRXDDFHLWDUGLYHUVDV VXJHVW}HVGHDOXQRVHFROHJDVSDUDODQoDUHVWHOLYUR $SHVDUGRVQRYRVFDStWXORVDFUHVFHQWDGRVQHVWDHGLomRRWH[WRQmRSUHWHQGH FREULU GH IRUPD FRPSOHWD R YDVWR DVVXQWR GH TXH WUDWD H QmR GLVSHQVD D ELEOLRJUDILD FLWDGD 'HYH VHU HQWHQGLGR FRPR XP JXLD SDUD DTXHOHV TXH SUHWHQGHPVHDSURIXQGDUHPOLYURVHVSHFtILFRVVREUHXPRXRXWURSURFHVVDGRU HPTXHMiQmRKiHVSDoRSDUDWUDWDURVFRQFHLWRVPDLVEiVLFRV$GHQVLGDGHGD

YL

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

H[SRVLomRDXPHQWDDRORQJRGRWH[WRWRUQDQGRRLQGLFDGRSDUDXPFXUVRGH JUDGXDomR  PHGLGD TXH R DOXQR DYDQoD HP VXD OHLWXUD SDVVD D UHFHEHU LQIRUPDo}HVQXPHVWLORFDGDYH]PDLVSUy[LPR GDTXHOH GRV PDQXDLV H OLYURV TXHWHUiGHOHUTXDQGRWUDEDOKDUHPXPSURMHWRSURILVVLRQDO 2OLYURWHPXPDSDUWH WHyULFD H RXWUD SUiWLFD FXMR HVWXGR SRGH VHU LQLFLDGR VLPXOWDQHDPHQWH 1HVWH FDVR R SURIHVVRU GH ODERUDWyULR WHP TXH DGLDQWDU DOJXQVFRQFHLWRVDQWHVTXHVHMDPDSUHVHQWDGRVQDWHRULDPDVLVVRpQHFHVViULR DSHQDVQDVSULPHLUDVDXODVSRLVORJRDPEDVDVSDUWHVVHVLQFURQL]DP2QtYHO GHGHWDOKHGDVDXODVGHODERUDWyULRQmRSUHFLVDVHURPHVPRGDVDXODVWHyULFDV H HVWH SHTXHQR HVIRUoR DGLFLRQDO WHP VLGR UHFRPSHQVDGR SRU XP JDQKR GH WHPSRVLJQLILFDWLYRHPFDGDVHPHVWUHHSHODPDLRUPRWLYDomRGRVDOXQRVSDUD RHVWXGRFRPSOHWRGDWHRULDUHODFLRQDGD $OWHUQDWLYDPHQWH SRGHVH DYDQoDU SULPHLUR QD WHRULD DWp R ILQDO GR FDStWXOR VREUH FRQFHLWRV EiVLFRV H LQLFLDU D SDUWH GH ODERUDWyULR MXQWDPHQWH FRP R HVWXGR WHyULFR GR  (VWD DERUGDJHP p D PDLV LQWHUHVVDQWH SDUD R DXWRGLGDWDRXSDUDDTXHOHVTXHDLQGDQmRWLYHUDPFRQWDWRFRPRPDWHULDOGR FDStWXORTXHQRUPDOPHQWHpXPDUHYLVmRGHFRQKHFLPHQWRVMiDGTXLULGRVHP RXWUDVGLVFLSOLQDV $VQRYLGDGHVGHVWDHGLomRVmRRVFDStWXORVVREUHLQWHUUXSo}HVHPDQLSXODomR GH VWULQJV GR  H SULQFLSDOPHQWH D LQWURGXomR GR VRIWZDUH $EDFXV GHVHQYROYLGRHVSHFLDOPHQWHSDUDDFRPSDQKDUROLYURHSHUPLWLUDUHDOL]DomRGH WRGRVRVH[SHULPHQWRVFRPRHPXPFRPSXWDGRUSHVVRDO$VIDFLOLGDGHV LQFOXtGDVQHVWHSURJUDPDEDVHLDPVHHPYiULRVDQRVGHH[SHULrQFLDHPWHVWHVH GHSXUDomRGHVRIWZDUHHQDREVHUYDomRGDVSULQFLSDLVGLILFXOGDGHVHQFRQWUDGDV SHORVDOXQRVQDYLVXDOL]DomRGRVFRQFHLWRVPDLVLPSRUWDQWHV 2 WH[WR DSURYHLWDGR GD SULPHLUD HGLomR VRIUHX XPD UHYLVmR FRPSOHWD H RV H[HUFtFLRV FRQVLGHUDGRV PDLV GLItFHLV UHFHEHUDP PDLV GLFDV SDUD RULHQWDU VXD VROXomR (VSHURTXHRHVIRUoRGHGLFDGRDHVWDVPRGLILFDo}HVSRVVDPHOKRUDUXPSRXFR PDLVDPLQKDPRGHVWDFRQWULEXLomRSDUDRHVWXGRGRVPLFURSURFHVVDGRUHV

2$XWRU )ORULDQySROLV

PLQKDPmH

$EDFXVDSRLRYLD,QWHUQHW
$ SiJLQD ZZZHHOXIVFEUPLFURSURFHVVDGRUHV RIHUHFH DPSOR VXSRUWH DR PDWHULDODTXLFRQWLGR$SDUWLUGHVWHHQGHUHoRpSRVVtYHOREWHUR$EDFXVXP VLPXODGRUSDUDRPLFURSURFHVVDGRUGHVHQYROYLGRSHORDXWRU2$EDFXVp XP SURJUDPD SDUD R DPELHQWH 0LFURVRIW :LQGRZV TXH SHUPLWH H[HFXWDU RV SURJUDPDV SDUD R  FRQWLGRV QR OLYUR H WDPEpP UHVROYHU RV H[HUFtFLRV SURSRVWRV 'HVWD IRUPD R DOXQR TXH WHQKD VHX SUySULR FRPSXWDGRU QmR SUHFLVDGHSHQGHUGH KRUiULRVGHODERUDWyULRSDUDUHDOL]DURVH[SHULPHQWRVHD LQVWLWXLomR GH HQVLQR SRGH XWLOL]DU PHOKRU R SRWHQFLDO UHSUHVHQWDGR SHORV FRPSXWDGRUHVGHVHXVDOXQRV 7DPEpPRDXWRGLGDWDHRSURILVVLRQDOPDLVH[SHULHQWHSRGHPVHEHQHILFLDUGR XVRGR$EDFXVXPDYH]TXHHVWHVHFRQVWLWXLQXPDIHUUDPHQWDGHVLPXODomRH GHSXUDomRGHSUDWLFDPHQWHTXDOTXHUSURJUDPDHVFULWRSDUDR $OpP GR $EDFXV D SiJLQD FLWDGD SHUPLWH REWHU DV OLVWDJHQV GRV SURJUDPDV FRQWLGRV QR OLYUR H RIHUHFH RXWUDV LQIRUPDo}HV LQWHUHVVDQWHV WDLV FRPR OLQNV SDUDSiJLQDVFRPLQIRUPDo}HVFRPSOHPHQWDUHVHELEOLRJUDILD 2$EDFXVpJUDWXLWRVHPSUHTXHXWLOL]DGRSDUDILQVHGXFDFLRQDLV

(PSUHJRGHWHUPRVWpFQLFRV
2 SUHVHQWH WH[WR ID] DPSOR XVR GH GLYHUVRV WHUPRV GD ,QIRUPiWLFD H GD (QJHQKDULD(OpWULFD$OJXQVGHVVHVWHUPRVHPERUDGHXVRFRUUHQWHQRMDUJmR WpFQLFR QmR ID]HP SDUWH GR YRFDEXOiULR RILFLDO GD /tQJXD 3RUWXJXHVD H SRU LVVR GHYHULDP D ULJRU DSDUHFHU HP GHVWDTXH QR WH[WR (QWUHWDQWR FRQVLGHUDQGR D QDWXUDOLGDGH FRP TXH WDLV WHUPRV DSDUHFHP QD FRPXQLFDomR RUDOHQDFRPXQLFDomRLQIRUPDOHVFULWDHQWUHSHVVRDVGHVVDViUHDVRSWRXVHSRU HVFUHYrORVGHIRUPDLQGLVWLQWDHPEHQHItFLRGDHVWpWLFDHGDXQLIRUPLGDGHMi TXH R GHVWDTXH GHVVDV SDODYUDV DSHQDV GHYLGR j VXD RULJHP SRGHULD GHVYLDU GHVQHFHVVDULDPHQWHDDWHQomRGROHLWRU $VHJXLUXPDOLVWDGRVSULQFLSDLVWHUPRVTXHUHFDHPQHVVDFODVVLILFDomRHVHX VLJQLILFDGR DVVHPEODU JHUDURFyGLJRREMHWRFRUUHVSRQGHQWHDXPSURJUDPD DVVHPEOHU IHUUDPHQWDTXHJHUDRFyGLJRREMHWRGHXPSURJUDPD ELW GtJLWRELQiULR E\WH SDODYUDGHELWV FDUU\ YDULiYHO ELQiULD TXH VLQDOL]D YDL  RX HPSUHVWD  HP RSHUDo}HVDULWPpWLFDV FKLS SDVWLOKDFLUFXLWRLQWHJUDGR GHEXJJHU IHUUDPHQWDSDUDGHSXUDUSURJUDPDV GHIDXOW GL]VHGRYDORUDVVXPLGRSRUXPDYDULiYHOQDDXVrQFLD GH YDORU HVSHFLILFDGR GLVSOD\ PRVWUDGRUWLSLFDPHQWHGLJLWDOGHOHGVRXFULVWDOOtTXLGR GRXEOHZRUG FRQMXQWRGHGXDVSDODYUDVGHELWV GULYHU GLVSRVLWLYRGHKDUGZDUHRXVRIWZDUH IODJ YDULiYHOELQiULD ODEHO UyWXORRXHWLTXHWDTXHLGHQWLILFDXPDOLQKDGHFyGLJR ODWFK FLUFXLWRGLJLWDOGHDUPD]HQDPHQWR

[LL OLQNDU OLQNHU RQFKLS RSFRGH SRLQWHU SURPSW TXDGZRUG UHVHW VHW VWDFN VWULQJ WLPHU ZRUG

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV JHUDU D IRUPD ILQDO GH XP SURJUDPD D SDUWLU GRV PyGXORV FRP FyGLJRREMHWR IHUUDPHQWDSDUDOLQNDU QDPHVPDSDVWLOKDGHFLUFXLWRLQWHJUDGR FyGLJRKH[DGHFLPDOTXHLGHQWLILFDXPDRSHUDomR DSRQWDGRU HVSDoR GD LQWHUIDFH GH XVXiULR GH XP SURJUDPD HP TXH VH GLJLWDPFRPDQGRV SDODYUDGHELWV YROWDDRHVWDGRLQLFLDORXDWULEXLomRGRYDORUDXPDYDULiYHO DWULEXLomRGRYDORUDXPDYDULiYHO SLOKD FDGHLDGHFDUDFWHUHVDOIDQXPpULFRV WHPSRUL]DGRU SDODYUDGHELWV

;H/,1.VmRSURJUDPDVGD$'62)7:$5(,1& 0$60/,1.6\PGHE06'26H:LQGRZVVmRSURJUDPDVGD0LFURVRIW

6XPiULR
$ $ $
*5$'(&,0(1726



,,,

35(6(17$d2

 ,
17(51(7

%$&86

$32,29,$

 

,;

( 6

035(*2'(7(50267e&1,&26

;,

805,2

  

;,,,

/ / 3

,67$'(),*85$6

;;,

,67$'(7$%(/$6

;;,,,

$57(

,7

(25,$

 

,   2   8 $SULPHLUDJHUDomR   $PiTXLQDGHYRQ1HXPDQQ   $VHJXQGDJHUDomR   $WHUFHLUDJHUDomR   $TXDUWDJHUDomR   $ , 
1752'8d2$26&20387$'25(6 %-(7,92 0328&2'(+,675,$ )$0/,$ 17(/

  &  6 &  &DVRVSDUWLFXODUHVGHFRQYHUVmRGHEDVH


21&(,726%6,&26 ,67(0$6'(180(5$d2 219(562'(%$6(

[LY

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
(35(6(17$d2'(10(526,17(,526

5  2EWHQomRGRYDORUVLPpWULFRGHXPQ~PHUR  6XEWUDomRXVDQGRDGLomR  $ %&'  7   0 7  2   , $  $H[HFXomRGHXPDLQVWUXomR $ 
5(35(6(17$d2 $%(/$6'(&2',),&$d2'(&$5$&7(5(6 $1,38/$d2'(%,76 ,326'(0(05,$6 3(5$d(6'(67587,9$6(12'(67587,9$6 17(535(7$d2'2&217('2'$0(05,$ (;(&8d2'(352*5$0$6 0(05,$(26%$55$0(1726

,   2   2 $  6   2SDSHOGDSLOKDQDFKDPDGDGHVXEURWLQDV 8WLOL]DomRGDSLOKDQDSUHVHUYDomRGHUHJLVWUDGRUHV
1752'8d2$2 5,*(0(&$5$&7(567,&$67e&1,&$6 02'(/2'(352*5$0$d2 3,/+$ 8% 527,1$6

3    $ $ ( $  ,   )RUPDWR  &ODVVLILFDomR   ) $ '  ( $   ( $ 2  7RPDQGRGHFLV}HV
52*5$0$d2'2 66(0%/(5(/,1*8$*(0 66(0%/< 035(*2'$/,1*8$*(0 66(0%/< 16758d(6'2 250$72'(80$/,1+$'(&',*2 ,5(7,9$6'2$66(0%/(5 66(0%/< 7$3$6'2'(6(192/9,0(172(0 ;(03/2'(352*5$0$(0 66(0%/< 66(0%/< 8752675(&+26'(&',*2

6XPiULR

[Y

5HSHWLo}HV &DVRVSDUWLFXODUHVGHPXOWLSOLFDomR  , , + 3 , (


17(5583d(6'2

17(5583d(6;68% 527,1$6

$%,/,7$1'2(,1,%,1'2,17(5583d(6

5,25,'$'(6'$6,17(5583d(6

17(5583d(6'(+$5':$5(('(62)7:$5( 6&5(9(1'275$7$'25(6'(,17(5583d2

        

2   ,     8   6 1RWDomR 0XOWLSOLFLGDGHGHHQGHUHoRV  2 $  2  & $60 )   0 (QGHUHoDPHQWRYLDUHJLVWUDGRU  (QGHUHoDPHQWRLPHGLDWR  (QGHUHoDPHQWRDEVROXWRRXGLUHWR   (QGHUHoDPHQWRLQGLUHWR  (QGHUHoDPHQWRLQGH[DGR   (QGHUHoDPHQWREDVHDGR   (QGHUHoDPHQWREDVHDGRLQGH[DGR   (QGHUHoDPHQWRUHODWLYR   'HWHUPLQDomRGRVHJPHQWRXWLOL]DGR 
0,&52352&(66$'25 1752'8d2 ; 03(48(12352%/(0$ (*0(17$d2 65(*,675$'25(6'(6(*0(172 9,62'2352&(66$'25 02'(/2'(352*5$0$d2 216,'(5$d(662%5($/,1*8$*(0 250$72'$6,16758d(6'2 2'26'((1'(5(d$0(172

[YL

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
$50(7526(9$5,9(,6/2&$,6 1752'8d2

3     , 3    3DVVDJHPDWUDYpVGHUHJLVWUDGRUHV  3DVVDJHPDWUDYpVGHYDULiYHLVJOREDLV   3DVVDJHPDWUDYpVGDSLOKD   $QLQKDPHQWRGHVXEURWLQDV QHVWLQJ   &RPSDUDomRHQWUHRVPpWRGRV  &   9DULiYHLVORFDLVFRPLQLFLDOL]DomR 
$66$*(0'(3$50(75263$5$68% 527,1$6 5,$d2'(9$5,9(,6/2&$,6

,     , &DUDFWHUtVWLFDVJHUDLV   $WDEHODGHYHWRUHVGHLQWHUUXSomR   $VLQDOL]DomRGDVLQWHUUXSo}HV  +DELOLWDQGRHGHVDELOLWDQGR  2GHVYLRSDUDRWUDWDGRU  ,QWHUUXSo}HVGHVRIWZDUH  ,QWHUUXSo}HVUHVHUYDGDV 
17(5583d(6'2 17(5583d(6

0     ,   $ 8    2     2 (   &RPSDUDomRGHWDEHODV   9DUUHGXUDGHWDEHODV  /HLWXUDGHWDEHODV  ,QLFLDOL]DomRGHWDEHODV 
$1,38/$d2'(675,1*6 1752'8d2 6,16758d(6 0(;(03/2 &3,$'(7$%(/$6 635(),;26'(5(3(7,d2 &2551&,$'(,17(5583d(6 ;(03/26'($3/,&$d2

6XPiULR 3
$57(

[YLL

,,/

$%25$75,2

 

2$     2 $   $   $MDQHOD3URJUDPD   $MDQHOD3URFHVVDGRU  $MDQHOD0HPyULD   $MDQHOD'LVSOD\  $MDQHOD/HGV  $MDQHOD&KDYHV   $MDQHOD$VVHPEOHU    2 2PHQX$UTXLYR   2PHQX)HUUDPHQWDV   2PHQX2So}HV   2PHQX$MXGD   &      2 $ (  
%$&86 6,08/$'25(2$66(0%/(5 0(05,$ 6-$1(/$6 60(186 2',),&$d2'(,16758d(6'2 $66(0%/(5'2 %$&86 ;(5&&,26

  )   2 8   (GLomR   0RQWDJHP  /LQNDJHP   ([HFXomR   (   (  
(55$0(17$6'('(6(192/9,0(172 3$3(/'2$66(0%/(5 7,/,=$d2'$6)(55$0(17$6'(62)7:$5( ;(03/2 ;(5&&,26

6  $

8% 527,1$66,08/$'$6(0 668% 527,1$6

520   

[YLLL ( (

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
;(03/2 ;(5&&,26

              + %     &  &     
219 $60 219 $60

' 2 ( 6  (




$7$-8/,$1$ %-(7,92

;(5&&,235232672

2/8d2

;(5&&,26&203/(0(17$5(6

& / / (

219(562'(%$6( ,67$*(0'( (;

,67$*(0'(

$6(

;(5&&,26&203/(0(17$5(6

,    8 $   7 &RQWDGRUGHFLPDOFRPLQLELGRUSRULQWHUUXSomR  &RPRQmRID]HU   &RPRID]HU  (  
17(5583d(61$357,&$ 7,/,=$d2'$67(&/$6'(,17(5583d2'2 %$&86 5$7$'25(6'(,17(5583d21$357,&$ ;(5&&,26

3 $ $ & (

257$6'((175$'$(6$'$ 63257$6'( '2

/,*$d2'2

21),*85$d2'2

;(03/2((;(5&&,26

 (6 $           
%$&86 $2

$ 3&     2 2     2 &RPDQGRV    (
66(0%/<3$5$2 $66(0%/(5 /,1.(5 '(%8**(5 ;(5&&,26

6XPiULR
(67(('(385$d2 8% 527,1$61($5()$5

[L[

7     6  ([SORUDQGRDVOLVWDJHQV   ([SORUDQGRRVUHFXUVRVGR6\PGHE  ,QWURGX]LQGRHUURV   3DVVDQGRSDUkPHWURV   ( 7 (
1'(5(d$0(172%$6($'2(,1'(;$'2 $%(/$6(0$75,=(6 ;(5&&,26

           :      
,1'2:6

' 3 '26 '26 2 ( 7 , ( 9 ( $ $
1(;2

(69,$1'2,17(5583d(6 52*5$0$65(6,'(17(6 ,'/(,17(55837

,'/(,17(55837(2

352*5$0$

;(5&&,26

5$%$/+$1'2&20675,1*6

1,&,$/,=$d2(&3,$'(7$%(/$6 ;(5&&,26

$55('85$'(675,1*6

;(5&&,26

           

,

16758d(6'2

1(;2

    $  7     $ ,
16758d(6'2 %5(9,$785$6 )/$*6(',5(7,9$6 ,326 6 16758d(6

,

$ $

1(;2

& 6

20$1'26'2

<0'(%

 

1(;2

'26 %,26   ) %,26   6HUYLoRVGHYtGHR ,17+   ) '26 
(59,d26'2 ('2 81d(6'2 81d(6'2

[[

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV 6HUYLoRVJHUDLV ,17+   '26,GOHLQWHUUXSW ,17+  

$ $ $ $

1(;2

$

548,926 &20

 

1(;2

$ 3

',5(7,9$

$6680(    

1(;2

52*5$0$6&200/7,3/26$548,926

1(;2

'

,9,62'(10(526,17(,526

 

()(51&,$6%,%/,2*5),&$6

  ((/8)6&  

87526/,9526'(352)(6625(6'2

/LVWDGHILJXUDV
) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
,*

,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,*

,* ,*

0 2 5 5 5 2 $ $ & 0 ' 0 ) 0 $ $ 2 ( 2 ( ' ( ( (

2'(/2'$048,1$'(921

$/*25,702'(&219(562'(%$6(

(35(6(17$d2&,5&8/$5'2610(526'(

(35(6(17$d2'(10(526326,7,926(1(*$7,926 (/$d(6'(&203/(0(172(175(6,0e75,&26

6'*,726'26,67(0$+(;$'(&,0$/(80$7$/+2 620$'(10(526

/*816(/(0(1726'$

21(;2'(800,&52352&(66$'250(05,$ (05,$'( .

,675,%8,d2'266,1$,612&,5&8,72,17(*5$'2 2'(/2'(352*5$0$d2'2

81&,21$0(172'$3,/+$12

(&$1,602'(&+$0$'$'(80$68% 527,1$

06&$5$'(,17(5583d(69,67$3(/$,16758d2 06&$5$'(,17(5583d(69,67$3(/$,16758d2 0(&$1,602'(6(*0(17$d2

1'(5(d$0(172'(0(05,$&20 02'(/2'(352*5$0$d2'2

;(03/2'()250$72'(,16758d2'2 (7$/+$0(172'23267%<7(

1'(5(d$0(172$%62/872

1'(5(d$0(172,1',5(72

1'(5(d$0(172,1'(;$'2

       %&' &38    %       6,0  5,0       029$;>+@  029$;>%;@   029$;>+',@   1
(80$11 %,76 ('$0(05,$

[[LL ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
,* ,*

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV ( ( $ $ $ $ 3 & $ $ 2$ ' $ $ $ $ $ 2$ $ $ ' 2 2 & 5 / 2 $$
1'(5(d$0(172%$6($'2 1'(5(d$0(172%$6($'2,1'(;$'2

,*

3,/+$&20'2,63$50(7526

,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,* ,*

3,/+$$362$50$=(1$0(172'29$/25'( 3,/+$(080$68% 527,1$

3,/+$$3625(72512'$68% 527,1$

$66$*(0'(3$50(7526(068% 527,1$6$1,1+$'$6 5,$d2'(80$9$5,$9(//2&$/

7$%(/$'(9(725(6'(,17(5583d2'2 7$%(/$'(9(725(6'(,17(5583d2'2 %$&86

(7$/+('$-$1(/$ -$1(/$ -$1(/$ -$1(/$ -$1(/$ -$1(/$

66(0%/(5'2

&$,;$'(',/2*2

&$,;$'(',/2*2

(69,26'$6,16758d(6

352&(662'(0217$*(0 $66(0%/< 352&(662'(/,1.$*(0

,5&8,72(/e75,&26,08/$'2'$7(&/$

(35(6(17$d2'2&20321(17(

,*$d2'$6&+$9(6('26/('6$2 5(*,675$'25'(&20$1'2'2

75,%872'(9'(2(002'27(;72

029>%;+@&;   029$;>%;6,@    %3    )$5                  3   3     0 '     / &   $     6  7   567      567            
52*5$0$ 52&(66$'25 (05,$ ,63/$< ('6 +$9(6 %$&86 8% 527,1$6 5$7$'25(6

/LVWDGHWDEHODV
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
$%

$% $% $% $% $% $% $% $% $% $% $% $% $%

$% $% $% $% $% $% $%

 $ , 2  $  $ $6&,,  $   2 6 6 6  6  )   ' $  (    , 2     6 ,   $   3    6  520     ( $ 3 $60  $9  
(92/8d2'$)$0/,$ 17(/ 6'*,726'26,67(0$+(;$'(&,0$/(6(89$/25 6620$6(/(0(17$5(6126,67(0$+(;$'(&,0$/ 7$%(/$ 3*,1$'(&',*26 3(5$d(6(06&$5$63$5$0$1,38/$d2'(%,76 ( '2 ,1$,6 ,1$,6'2%$55$0(172'(&21752/( /$*6'2 ,5(7,9$6'$/,1*8$*(0 66(0%/<'2 1'(5(d26'('(69,2'$6,17(5583d(6'2 17(5583d(6'(+$5':$5(('(62)7:$5( 65(*,675$'25(6'(6(*0(172'2 (*0(1726'()$8/7($/7(51$7,9$6 17(5583d(65(6(59$'$6'2 6,16758d(6'(0$1,38/$d2'(675,1*6 5(),;26'(5(3(7,d2'2 8% 527,1$66,08/$'$6(0 1'(5(d26'$63257$612 %$&86 5,1&,3$,6',5(7,9$6'2 $/25(6'26&$0326'2$75,%872

3DUWH,7HRULD

,QWURGXomRDRVFRPSXWDGRUHV
2EMHWLYR
+i DOJXPDV GpFDGDV FRPSXWDGRUHV YrP VHQGR HPSUHJDGRV HP HVFDOD FUHVFHQWH HP LQVWLWXLo}HV JRYHUQDPHQWDLV H PLOLWDUHV HPSUHVDV UHVLGrQFLDV EDQFRVHLQVWLWXLo}HVGHHQVLQR2Q~PHURGHDSOLFDo}HVHGHXVXiULRVpFDGD YH] PDLRU SRLV D UHGXomR GRV FXVWRV GH SURGXomR GRV PLFURSURFHVVDGRUHV WRUQRXSRVVtYHOVXDSDUWLFLSDomRGHQRVVDYLGDGLiULDGHIRUPDQDWXUDOHPXLWDV YH]HV DWp GHVSHUFHELGD (VWHV FRPSRQHQWHV PRGLILFDP QRVVD IRUPD GH FRPXQLFDomRFRPRXWUDVSHVVRDVDDGPLQLVWUDomRGHQRVVRVEHQVQRVVDIRUPD GHWUDEDOKDUHQRVVROD]HU 8PD IRUPDGHDFRPSDQKDUHVWD HYROXomR FRQVLVWH HP REVHUYDU DV PXGDQoDV QDV FDUDFWHUtVWLFDV GRV FRPSXWDGRUHV TXH YrP VHQGR SURGX]LGRV $OJXPDV GHVVDV FDUDFWHUtVWLFDV HP HVSHFLDO DTXHODV XWLOL]DGDV QD HVSHFLILFDomR GH FRPSXWDGRUHV SHVVRDLV VmR KRMH GH FRQKHFLPHQWR JHUDO R QRPH GR PLFURSURFHVVDGRU DGRWDGR D FDSDFLGDGH GD PHPyULD H GR GLVFR UtJLGR D TXDQWLGDGH GH PHPyULD FDFKH D YHORFLGDGH GH DFHVVR j ,QWHUQHW 3RU LVVR R OHLWRU VDEH TXH HVWi GLDQWH GH XPD WHFQRORJLD TXH VH UHQRYD GHQWUR GH XP SUD]RPXLWRFXUWR (VWHIDWRVHDSUHVHQWDFRPRXPGHVDILRHVSHFLDOSDUDRHQVLQRGDGLVFLSOLQDGH 0LFURSURFHVVDGRUHV 3RGHVH SHQVDU D SULQFtSLR TXH HVWD WDUHID FRQVLVWH HP PDQWHU RV DOXQRV D SDU GRV ~OWLPRV DYDQoRV GRV JUDQGHV IDEULFDQWHV H HP DWXDOL]DU R PDLV UiSLGR SRVVtYHO R PDWHULDO GLGiWLFR 8PD UHIOH[mR PDLV SURIXQGD SRUpP PRVWUD TXH HVWH QmR p R PHOKRU FDPLQKR 2 SULQFLSDO DUJXPHQWR FRQWUD HVWH WLSR GH SURFHGLPHQWR p D SUySULD HYROXomR GD WHFQRORJLD XP DOXQR TXH UHFHEHVVH QD PHWDGH GR VHX FXUVR FRQKHFLPHQWRV HVSHFtILFRVVREUHRPLFURSURFHVVDGRUPDLVDWXDOHVWDULDGHVDWXDOL]DGRQDpSRFD GDVXDIRUPDWXUD(QVLQDUDOJRVREUHPLFURSURFHVVDGRUHVQmRSRGHSRUWDQWR VLJQLILFDUDSHQDVRHVWXGRGHXPGHWHUPLQDGRFRPSRQHQWHeSUHFLVRGDUDR DOXQRFRQGLo}HVSDUDTXHHOHPHVPRVHMDFDSD]KRMHHGHSRLVGHIRUPDGRGH



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

GHVFREULUHGHHQWHQGHURVQRYRVODQoDPHQWRVGDLQG~VWULDGHFRPSXWDGRUHV e SUHFLVR SUHSDUiOR SDUD GHFLIUDU RV HQLJPDV TXH R DJXDUGDP DR LQYpV GH WHQWDUSUHYHUWRGDVDVSHGUDVHPVHXFDPLQKRHUHPRYrODVGHDQWHPmR $TXL QmRVHSRGHGDURSHL[HpSUHFLVRHQVLQDUDSHVFDU 3RU LVVR R TXH VH HQIDWL]D QHVWH OLYUR VmR RV FRQFHLWRV TXH LQGHSHQGHP GD HYROXomRWHFQROyJLFDHTXHSRUWDQWRHVWmRHFRQWLQXDUmRDHVWDUSUHVHQWHVHP WRGRV RV PLFURSURFHVVDGRUHV WDOYH] FRP SHTXHQDV YDULDo}HV e SRU LVVR WDPEpP TXH p SRVVtYHO XWLOL]DU PLFURSURFHVVDGRUHV VLPSOHV QRV H[HPSORV H H[HUFtFLRVGDSDUWHGHODERUDWyULR2TXHPXGDpR MHLWR GH ID]HU FDGD FRLVD PDVDVFRLVDVIHLWDVVmRHVVHQFLDOPHQWHDVPHVPDV'HVWDIRUPDHVSHUDVHTXH R WHPSR H R HVIRUoR GHGLFDGRV DR HVWXGR GDV SiJLQDV VHJXLQWHV VLUYDP QmR VRPHQWHSDUDXPVHPHVWUHPDVSDUDWRGDXPDYLGD

8PSRXFRGHKLVWyULD
$KLVWyULDGRVFRPSXWDGRUHVFRPHoRXTXDQGRRKRPHPSHUFHEHXTXHVDEHU FRQWDU SRGHULD VHU ~WLO SDUD XPD VpULH GH DWLYLGDGHV HVVHQFLDLV j VXD VREUHYLYrQFLDFRPRFRPSDUDUTXDQWLGDGHVGH SHVVRDV FRQWURODU XP HVWRTXH GH DOLPHQWRV RX VDEHU TXDQWRV GLDV p SUHFLVR HVSHUDU SDUD FROKHU R TXH VH SODQWRX 'XUDQWH PXLWRV DQRV HVVHV FiOFXORV IRUDP IHLWRV FRP D XWLOL]DomR LQWXLWLYDGRVGHGRVGDVPmRVRXGHWUDoRVIHLWRVHPSODFDVGHEDUUR~PLGRRX DLQGDGHSHTXHQRVREMHWRVFRPRSHGUDVRXSHGDoRVGHPDGHLUD 8PPDUFRLPSRUWDQWHQD DQWLJLGDGH IRL D LQYHQomR GR iEDFR FUHGLWDGD DRV EDELO{QLRV TXH KHUGDUDP JUDQGH SDUWH GRV FRQKHFLPHQWRV GRV DQWLJRV VXPpULRV RFXSDQWHV GD 0HVRSRWkPLD D SDUWLU GR DQR  D& 'H Oi HVWH LQVWUXPHQWRVHGLIXQGLXSDUDR(JLWRRQGH Ki UHJLVWURV GH VXD XWLOL]DomR HP D&HWDPEpPSDUDD&KLQDHDQGLD DQWHV GH VH WRUQDU FRQKHFLGR QD (XURSD $OL IRL GXUDQWH VpFXORV R SULQFLSDO PHLR GH ID]HU FiOFXORV SRLV R VLVWHPD GH QXPHUDomR URPDQR DPSODPHQWH GLIXQGLGR WRUQDYD GLItFLO DWp PHVPRXPDVLPSOHVDGLomR TXDQWRp/;,,&;,9" 2iEDFRIRLFDLQGRHP GHVXVR QD (XURSD D SDUWLU GR VpFXOR ;,,, TXDQGR D GLIXVmR GR VLVWHPD GH QXPHUDomRLQGRDUiELFRIDFLOLWRXDUHDOL]DomRGHFiOFXORVPDQXDLVPDVDLQGDp XWLOL]DGRHPGLYHUVRVSDtVHVGDVLD 0HVPR DVVLP SHUPDQHFHX R PpWRGR GH FiOFXOR PDLV HILFLHQWH DWp  TXDQGRRPDWHPiWLFRIUDQFrV%ODLVH3DVFDOLQYHQWRXXPDPiTXLQDGHFDOFXODU PHFkQLFD/HLEQL]FRQVWUXLXXPDYHUVmRPDLVDYDQoDGDGDPiTXLQDGH3DVFDO XP SRXFR PDLV WDUGH H DWp R VpFXOR ;,; VXUJLUDP YiULRV RXWURV SURMHWRV JUDQGHSDUWHGRVTXDLVQmRS{GHVHULPSOHPHQWDGDSRUTXHDLQG~VWULDGDpSRFD QmR WLQKD FRPR SURGX]LU DV SHoDV FRP D SUHFLVmR QHFHVViULD 'HYLGR j VXD

,QWURGXomRDRVFRPSXWDGRUHV



FRQVWUXomR HVWDV PiTXLQDV FDUDFWHUL]DYDPVH SRU XPD JUDQGH ULJLGH] HP UHODomRDRVSURJUDPDVTXHSRGLDPH[HFXWDUGHPRGRTXHVHULDPFODVVLILFDGDV DWXDOPHQWHFRPRPiTXLQDVGHGLFDGDV

$SULPHLUDJHUDomR 



-iQRVpFXOR;;RVDYDQoRVGDHOHWU{QLFDHPSDUWLFXODURDSHUIHLoRDPHQWRGD YiOYXODSHUPLWLUDPDFRQVWUXomRGHQRYRVHTXLSDPHQWRVSDUDDUHDOL]DomRGH FiOFXORVPDWHPiWLFRVRVFRPSXWDGRUHVGHSULPHLUDJHUDomR 2V FRPSXWDGRUHV PRGHUQRV QDVFHUDP GH XP JUDQGH HVIRUoR IHLWR HP GLIHUHQWHV SDtVHV GXUDQWH D ,, *XHUUD 0XQGLDO (P  R LQYHQWRU DOHPmR .RQUDG=XVHSURGX]LXR=XWLOL]DGRQRSURMHWRGHDYL}HVHPtVVHLV 1RV(VWDGRV8QLGRVRPDWHPiWLFR+RZDUG$LNHQHRVHQJHQKHLURV&ODLU' /DNH%0'XUIHHH)(+DPLOWRQGHVHQYROYHUDPR0DUN,XPFRPSXWDGRU HOHWURPHFkQLFRTXHXWLOL]DYDUHOpVHILFRXSURQWRHP6XDSULQFLSDO XWLOL]DomR GHXVH QD FULDomR GH WDEHODV EDOtVWLFDV SDUD PHOKRUDU D SUHFLVmR GD DUWLOKDULDGDPDULQKD 2 SULPHLUR FRPSXWDGRU HOHWU{QLFR &RORVVXV IRL LQYHQWDGR SHOR PDWHPiWLFR $ODQ7XULQJQD,QJODWHUUDHILFRXSURQWRHP)RLSURMHWDGRHXWLOL]DGR HVSHFLILFDPHQWH SDUD GHFLIUDU FyGLJRV GH FRPXQLFDomR GR H[pUFLWR DOHPmR H VXDH[LVWrQFLDIRLPDQWLGDHPVHJUHGRGXUDQWHGpFDGDV &RQWUDVWDQGRFRPDDSOLFDomRGHGLFDGDGR&RORVVXVRSULPHLURFRPSXWDGRU HOHWU{QLFR GH SURSyVLWR JHUDO IRL R (1,$& (OHFWURQLF 1XPHULFDO ,QWHJUDWRU DQG&DOFXODWRU )RLSURMHWDGRSHORVHQJHQKHLURV-RKQ:0DXFKO\H-3UHVSHU (FNHUW-UGD8QLYHUVLGDGHGD3HQVLOYkQLDQRV(VWDGRV8QLGRVHHQWURXHP RSHUDomR HP  2FXSDYD XPD iUHD GH P SHVDYD  WRQHODGDV H XWLOL]DYDFHUFDGHYiOYXODVTXHFRQVXPLDPN:HHUDPLQWHUOLJDGDV SRU NP GH ILRV 2 FDORU JHUDGR HUD LPHQVR H[LJLQGR XP VLVWHPD GH YHQWLODomR IRUoDGD +DYLD WDPEpP XPD HTXLSH GH WpFQLFRV TXH ILFDYD FRQWLQXDPHQWHVXEVWLWXLQGRDVYiOYXODVTXHVHTXHLPDYDPGXUDQWHDRSHUDomR (PERUD DV YiOYXODV IXQFLRQDVVHP DSHQDV FRPR FKDYHV RV FRPSXWDGRUHV FRQVWUXtGRVDWpHVWDpSRFDQmRXWLOL]DYDPRVLVWHPDGHQXPHUDomRELQiULRSDUD UHSUHVHQWDU GDGRV /HYDGRV SHOD WUDGLomR GH FRQWDU QR VLVWHPD GHFLPDO RV SURMHWLVWDV DJUXSDYDP DV YiOYXODV HP DUUDQMRV TXH UHSUHVHQWDYDP Q~PHURV GHFLPDLV $OpP GLVVR DV LQVWUXo}HV D H[HFXWDU QmR WLQKDP D IRUPD GH SURJUDPDVDUPD]HQDGRVQDPHPyULDPDVHUDPGHWHUPLQDGDVSRUXPFRQMXQWR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

GHFKDYHVHFRQH[}HVHPSDLQpLVGHFRPDQGR$PRGLILFDomRGHVWHVFRQFHLWRV FRXEHDXPPDWHPiWLFRFKDPDGR-RKQYRQ1HXPDQQ

$PiTXLQDGHYRQ1HXPDQQ 
-RKQ /RXLV YRQ 1HXPDQQ QDVFHX HP  QD +XQJULD 6XDV KDELOLGDGHV PDWHPiWLFDVH[WUDRUGLQiULDVMiHUDPHYLGHQWHVDRVVHLVDQRVTXDQGRHUDFDSD] GH GLYLGLU PHQWDOPHQWH Q~PHURV GH DWp RLWR DOJDULVPRV (VWXGRX QDV XQLYHUVLGDGHV GH %XGDSHVWH H GH %HUOLP H QD (VFROD 7pFQLFD 6XSHULRU GH =XULTXHIRUPDQGRVHHP(QJHQKDULD4XtPLFD2EWHYHHPVHJXLGDRWtWXORGH GRXWRU HP 0DWHPiWLFD SHOD 8QLYHUVLGDGH GH %XGDSHVWH H D SDUWLU GH  SDVVRXDWUDEDOKDUHP3ULQFHWRQ(8$$OLIRLHVFROKLGRSDUDVHUXPGRVVHLV SURIHVVRUHVGH0DWHPiWLFDGR,QVWLWXWRGH(VWXGRV$YDQoDGRVTXDQGRGDVXD IXQGDomRHP$VDWLYLGDGHVGHVVHLQVWLWXWRLQFOXtDPWHPDVUHODFLRQDGRVj VROXomRGHSUREOHPDVFRPSXWDFLRQDLV RSUySULR$ODQ7XULQJHVWXGRXDOLGH D 'HQWUR GHVWH DPELHQWH YRQ 1HXPDQQ VH LQWHUHVVRX SHOR SURMHWR GH FRPSXWDGRUHVHGHFLGLXFULDURVHXSUySULR,QWURGX]LXQDLQG~VWULDRFRQFHLWR GH SURJUDPD DUPD]HQDGR DR FRPSUHHQGHU TXH VHULD SRVVtYHO UHSUHVHQWDU SURJUDPDV VRE IRUPD QXPpULFD H SRUWDQWR DUPD]HQiORV HP PHPyULD GD PHVPDPDQHLUDTXHRVGDGRV3HUFHEHXDLQGDTXHDDULWPpWLFDGHFLPDOSRGHULD VHU VXEVWLWXtGD FRP YDQWDJHQV SHOD DULWPpWLFD ELQiULD &ULRX DVVLP XP PRGHORSDUDUHSUHVHQWDUVXDPiTXLQDTXHpDLQGDKRMHDEDVHGDDUTXLWHWXUD GHTXDVHWRGRVRVFRPSXWDGRUHV $ ILJXUD  LOXVWUD HVVH PRGHOR TXH FRPSUHHQGH FLQFR FRPSRQHQWHV D PHPyULD D XQLGDGH DULWPpWLFD H OyJLFD $/8  D XQLGDGH GH FRQWUROH H DV XQLGDGHV GH HQWUDGD H GH VDtGD $V LQVWUXo}HV TXH D PiTXLQD HUD FDSD] GH H[HFXWDU SHUPLWLDP WUDQVIHULU GDGRV HQWUH HVVHV FRPSRQHQWHV H UHDOL]DU RSHUDo}HVPDWHPiWLFDVHOHPHQWDUHVFRPHOHV
0HPyULD

&38

8QLGDGHGH FRQWUROH

8QLGDGHDULWPpWLFD HOyJLFD

(QWUDGD 6DtGD

)LJ0RGHORGDPiTXLQDGHYRQ1HXPDQQ

,QWURGXomRDRVFRPSXWDGRUHV



2FRQMXQWRGDXQLGDGHGHFRQWUROHHGD $/8ILFRXWDPEpPFRQKHFLGRFRPR XQLGDGH FHQWUDO GH SURFHVVDPHQWRRX&38GRLQJOrV FHQWUDO SURFHVVLQJ XQLW &RQYpP OHPEUDUTXHDGLYLVmRGRPRGHORQHVVHVFRPSRQHQWHVpXPDDEVWUDomRTXHQmR VH UHIOHWH GLUHWDPHQWH QD FRQVWUXomR UHDO GR FRPSXWDGRU 1RV SULPHLURV FRPSXWDGRUHV HP SDUWLFXODU FDGD EORFR RFXSDYD PXLWR HVSDoR H XWLOL]DYD FHQWHQDVHDWpPLOKDUHVGHFRPSRQHQWHVGLVFUHWRV

$VHJXQGDJHUDomR 
&RP D LQYHQomR GR WUDQVLVWRU HP  R PXQGR GRV FRPSXWDGRUHV IRL WRPDGRGHDVVDOWRSRUXPDRQGDGHQRYRVSURMHWRVTXHGHXRULJHPQDGpFDGD GH  D GXDV HPSUHVDV TXH VH WRUQDUDP PXQGLDOPHQWH FRQKHFLGDV '(& H ,%0 2V FRPSXWDGRUHV 3'3 3'3 ,%0 ,%0 &'& ,%0 H *DPPD IRUDP DOJXQV GRV SURGXWRV TXH VXUJLUDP QHVWH SHUtRGR 1R HQWDQWR RV HOHYDGRV FXVWRV GHVVDV PiTXLQDV UHVWULQJLDP VXD YLDELOLGDGHDDSOLFDo}HVHVWUDWpJLFDVGRJRYHUQRHDJUDQGHVHPSUHVDV

$WHUFHLUDJHUDomR 
1RILQDOGDGpFDGDGHVXUJLUDPRVSULPHLURVFLUFXLWRVLQWHJUDGRV$UUDQMRV GHDOJXPDVGH]HQDVGHWUDQVLVWRUHVFRPRRVXWLOL]DGRVSDUDID]HUIOLSIORSVRX SRUWDV OyJLFDV IRUDP VXEVWLWXtGRV SRU FRPSRQHQWHV ~QLFRV TXH RFXSDYDP PHQRV HVSDoR H HUDP PDLV IiFHLV GH PRQWDU 2V FXVWRV FDtUDP FULDQGR XPD QRYDIDL[DGHPHUFDGRTXHLQFOXtDHPSUHVDVGHPpGLRSRUWHXQLYHUVLGDGHVH FHQWURV GH SHVTXLVD $V FDUDFWHUtVWLFDV ItVLFDV GRV QRYRV FRPSRQHQWHV UHGX]LUDP RV WHPSRV GH SURSDJDomR GRV VLQDLV HOpWULFRV H SURSRUFLRQDUDP FRPLVVRXPDXPHQWRGHGHVHPSHQKR-XQWDVHVWDVPXGDQoDVFDUDFWHUL]DUDP XPD QRYD JHUDomR GH PiTXLQDV GD TXDO VmR H[HPSORV R ,%0 H RV PLQLFRPSXWDGRUHVGDVpULH3'3GD'(& $WpDJHUDomRDQWHULRUDH[HFXomRGHXPSURJUDPDEORTXHDYDD&38PHVPR TXH HVWD HVWLYHVVH DSHQDV DJXDUGDQGR D UHVSRVWD GH DOJXP HTXLSDPHQWR SHULIpULFR$ILPGHDSURYHLWDUHVVHVLQWHUYDORVGHRFLRVLGDGHVXUJLXDLGpLDGD PXOWLSURJUDPDomRTXHFRQVLVWHHPLQVWDODUGLYHUVRVSURJUDPDVVLPXOWDQHDPHQWH QD PHPyULD GR FRPSXWDGRU ,VVR QmR WRUQD SRVVtYHO D H[HFXomR VLPXOWkQHD SRLVD&38p~QLFDHVRPHQWHXPGHVVHVSURJUDPDVSRGHHVWDUHPH[HFXomR QXP GHWHUPLQDGR LQVWDQWH 1R HQWDQWR RV SURJUDPDV SRGHP VHU H[HFXWDGRV FLFOLFDPHQWH HP SHTXHQRV LQWHUYDORV GH WHPSR H[FOXLQGRVH RV TXH QmR SUHFLVDPGHDWHQomR(VWDWpFQLFDUHFHEHHPLQJOrVRQRPHGH WLPHVKDULQJ6H



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

D YHORFLGDGH GH H[HFXomR p VXILFLHQWHPHQWH DOWD RV XVXiULRV GRV GLIHUHQWHV SURJUDPDVWrPDLPSUHVVmRGHTXHWRGRVVmRH[HFXWDGRVVLPXOWDQHDPHQWH

$TXDUWDJHUDomR 
$ SDUWLU GRV DQRV  R JUDQGH GHVHQYROYLPHQWR GD WHFQRORJLD GH FLUFXLWRV LQWHJUDGRV IH] FRP TXH R Q~PHUR GH WUDQVLVWRUHV TXH SRGLDP VHU LQWHJUDGRV QXPDSDVWLOKDGHVLOtFLRDWLQJLVVHDIDL[DGRVPLOKDUHVHORJRHPVHJXLGDGRV PLOK}HV ,VWR VH UHIOHWLX HP QRYD TXHGD GH SUHoRV H QRYR DXPHQWR GH FDSDFLGDGHGRVFRPSXWDGRUHV 6XUJLUDPHQWmRRVFRPSXWDGRUHVSHVVRDLVTXHSDVVDUDPDVHUXWLOL]DGRVSDUD SURFHVVDPHQWR GH WH[WR FiOFXORV DX[LOLDGRV SRU SODQLOKDV HOHWU{QLFDV H HP SURMHWRVJUiILFRVDWLYLGDGHVSDUDDVTXDLVRVJUDQGHVFRPSXWDGRUHVQmRHUDP EHPDGDSWDGRV $ LQWHUOLJDomR GRV FRPSXWDGRUHV SHVVRDLV SULPHLUDPHQWH DWUDYpV GH UHGHV ORFDLV H ORJR GHSRLV DWUDYpV GD ,QWHUQHW DOLDGD DR HPSUHJR GD PXOWLPtGLD PXOWLSOLFRXPXLWDVYH]HVDVSRVVLELOLGDGHVGHDSOLFDomRGHVVDVPiTXLQDV $OpP GLVVR D UHGXomR GH FXVWR H GH YROXPH GRV FRPSRQHQWHV SURGX]LGRV SHUPLWLXVXDDSOLFDomRQRVDVVLPFKDPDGRVVLVWHPDVHPEXWLGRVTXHFRQWURODP DHURQDYHVHPEDUFDo}HVDXWRPyYHLVHHTXLSDPHQWRVGHSHTXHQRSRUWH $ FDSDFLGDGH GH FiOFXOR GDV PiTXLQDV DWXDLV VXSHUD HP GLYHUVDV RUGHQV GH PDJQLWXGH DTXHOD GRV LQVWUXPHQWRV SULPLWLYRV (PERUD VHMD WHRULFDPHQWH SRVVtYHO ID]HU FRP XP iEDFR RV PHVPRV FiOFXORV TXH VH ID]HP FRP RV PLFURSURFHVVDGRUHV D FDSDFLGDGH H D YHORFLGDGH GHVWHV WRUQDUDP SRVVtYHLV DSOLFDo}HVTXHDQWHVHUDPLQLPDJLQiYHLV 0HVPRDVVLPDFRPSDUDomRHQWUHiEDFRVHPLFURSURFHVVDGRUHVPRVWUDTXHR HVWDGRDWXDOGDWHFQRORJLDHPSDUWLFXODUGDLQIRUPiWLFDpXPDPDQLIHVWDomRGH XP GHVHMR SHUPDQHQWH GR KRPHP GH GHVFREULU YHUGDGHV H GH SUHYHU IDWRV DWUDYpVGRFiOFXORHFRPLVVRGHDPSOLDUVHXGRPtQLRVREUHDQDWXUH]D

$IDPtOLD,QWHO
$ ,QWHO IXQGDGD HP  SURGX]LD PHPyULDV GH FRPSXWDGRU DWp TXH D %XVLFRPIDEULFDQWHGHFDOFXODGRUDVGR-DSmRODQoRXRGHVDILRGHVHFRQVWUXLU XPDXQLGDGHFHQWUDOGHSURFHVVDPHQWRQXP~QLFRFLUFXLWRLQWHJUDGR$,QWHO FRQVHJXLX DWHQGHU R SHGLGR DQXQFLDQGR R QRYR FRPSRQHQWH HP  3RU WUDWDU RV GDGRV HP JUXSRV GH  ELWV HVWH UHFHEHX R QRPH GH  3RXFR GHSRLVIRLODQoDGDXPDYHUVmRGHRLWRELWVGHQRPLQDGD(VWDVIRUDPDV

,QWURGXomRDRVFRPSXWDGRUHV



SULPHLUDV &38V LQWHJUDGDV QXP ~QLFR FKLS  RV SULPHLURV PLFURSURFHVVDGRUHV $ SURGXomRLQLFLRXHPSHTXHQDHVFDODSRLVDHPSUHVDQmRLPDJLQDYDRLQWHUHVVH TXH HVVHV FRPSRQHQWHV GHVSHUWDULDP 6HP VDEHU HVWDYD LQLFLDQGR XPD HUD PDUFDGDSRUXPDHYROXomRVXUSUHHQGHQWH (PIXQomRGRVXFHVVRDOFDQoDGRD,QWHOSDVVRXDSURMHWDUXPQRYRFKLSSDUD XOWUDSDVVDUDEDUUHLUDGRV N%GH PHPyULD OLPLWH LPSRVWR SHOR Q~PHUR GH SLQRV GR  (P  ODQoRX R  TXH IRL DPSODPHQWH XWLOL]DGR LQFOXVLYH FRP DSOLFDo}HV HP DSDUHOKRV GRPpVWLFRV 'RLV DQRV PDLV WDUGH IRL ODQoDGR R  XPD YHUVmR GR  FRP PRGLILFDo}HV QRV VLVWHPDV GH LQWHUUXSomRHGHHQWUDGDVDtGD (PVHJXLGDDSDUHFHUDPDSULPHLUD&38GH ELWVRHVXDYHUVmRFRP EDUUDPHQWR GH  ELWV R  (VWD YDULDQWH GR  PRVWURXVH LQWHUHVVDQWH SDUD IDFLOLWDU D PLJUDomR GH SURGXWRV TXH XVDYDP R  SDUD D QRYD DUTXLWHWXUDGHELWV2WRUQRXVHXPSDGUmRHPWHUPRVGHFRPSXWDGRU SHVVRDOSRUTXHIRLHVFROKLGRSHOD,%0SDUDFRPSRUR3&;7 2V PLFURSURFHVVDGRUHV  H  VmR H[WHQV}HV GR  H GR  UHVSHFWLYDPHQWH ,QFOXHP QD SUySULD SDVWLOKD DOJXQV SHULIpULFRV FRPR FRQWURODGRUHVGH'0$HWHPSRUL]DGRUHVTXHRVWRUQDPLQWHUHVVDQWHVSDUDXVR GHGLFDGRFRPRPLFURFRQWURODGRUHV(QWUHWDQWRQXQFDIRUDPFKLSVDOWDPHQWH XWLOL]DGRV $HYROXomRGRVSURFHVVDGRUHVDWpHVWHSRQWRPRWLYRXDSURGXomRGHVRIWZDUH PDLV VRILVWLFDGR ,VWR WURX[H XP DXPHQWR YHUWLJLQRVR GD GHPDQGD GH HVSDoR GHHQGHUHoDPHQWRTXHVHQWLPRVDWpRVGLDVDWXDLVDSHVDUGRHQRUPHDYDQoRMi FRQVHJXLGR $R PHVPR WHPSR D FRPSOH[LGDGH GRV SURJUDPDV DXPHQWDYD H WRUQRXVH FODUR TXH KDYLD QHFHVVLGDGH GH PHOKRUDU VXD RUJDQL]DomR (UD LPSRUWDQWHLPSHGLUTXHXPSURJUDPDXVXiULRWLYHVVHDFHVVRDUHFXUVRVFUtWLFRV SDUDRIXQFLRQDPHQWRJOREDOGRFRPSXWDGRUTXHGHYHULDPVHUDGPLQLVWUDGRV DSHQDVSHORVLVWHPDRSHUDFLRQDO&RPHVWHVIDWRUHVHPPHQWHD,QWHOODQoRXR FDSD]GHHQGHUHoDUGLUHWDPHQWHDWp 0%GH PHPyULDTXDQGRRSHUD QRDVVLPFKDPDGRPRGRSURWHJLGRRTXDORIHUHFHWDPEpPRVXSRUWHQHFHVViULRj DWULEXLomR GH GLUHLWRV GH DFHVVR DRV GLIHUHQWHV SURJUDPDV HP H[HFXomR 2 SURFHVVDGRU VXSRUWD DLQGD R PRGR GH HQGHUHoDPHQWR YLUWXDO TXH SHUPLWH HVWHQGHURHVSDoRGHHQGHUHoDPHQWRD *%1RDVVLPFKDPDGR PRGRUHDOR FRPSRUWDVHFRPRR 2IRLXWLOL]DGRQR3&$7HUHSHWLXRVXFHVVRGR2SDVVRVHJXLQWH H QDWXUDO IRL D SDVVDJHP SDUD  ELWV FRQFUHWL]DGD FRP R ODQoDPHQWR GR  (VWH IRL VHJXLGR UDSLGDPHQWH SHOR  R SULPHLUR D SRVVXLU XP FRSURFHVVDGRU PDWHPiWLFR RQFKLS 'HSRLV GLVVR IRL ODQoDGD D IDPtOLD 3HQWLXPFDGDYH]FRPPDLVUHILQDPHQWRVSDUDDXPHQWDURGHVHPSHQKR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

1RSHUtRGRGHVFULWRSDVVRXVHGHXPD &38GHELWVDXPDGHELWVFRP GHVHPSHQKR PDLV GH  YH]HV VXSHULRU $ WDEHOD  DSUHVHQWD DOJXPDV FDUDFWHUtVWLFDVTXHLOXVWUDPHVVDHYROXomR
1RPH           6;  3HQWLXP $QR              'DGRV ELWV ELWV ELWV ELWV ELWV ELWV ELWV ELWV ELWV ELWV ELWV ELWV ELWV (QGHUHoRV N% N% N% N% 0% 0% 0% 0% 0% *% *% 7% *% 7% *% 7% *% 7% &RPHQWiULR SULPHLURPLFURSURFHVVDGRU SULPHLURPLFURELWV VXSHUDEDUUHLUDGRVN%DPSORXVR FRP(6PRGLILFDGD SULPHLUD&38ELWVQXPFKLS FRPEDUUDPELWV,%03& SHULIpULFRVRQFKLS SHULIpULFRVRQFKLS SURWHomRHHQGHUHoDPHQWRYLUWXDO SULPHLUD&38ELWV FRPEDUUDPHQWRELWV PDLVUiSLGRFRSURFHVVDGRURQFKLS GLYHUVRVPRGHORVHYROXLQGR

7DE$HYROXomRGDIDPtOLD,QWHO 0DLV LQIRUPDo}HV SRGHP VHU REWLGDV QD ,QWHUQHW D SDUWLU GR LWHP /LQNV ,QWHUHVVDQWHVQDKRPHSDJHTXHGiVXSRUWHDHVWHOLYUR

Os valores entre parnteses so alcanados utilizando endereamento virtual.

&RQFHLWRVEiVLFRV
6LVWHPDVGHQXPHUDomR
2V VLVWHPDV GH QXPHUDomR TXH QRV LQWHUHVVDP VmR RV VLVWHPDV GLWRV SRVLFLRQDLVDTXHOHVHPTXHDFRQWULEXLomRGHFDGDDOJDULVPRRXGtJLWRSDUDR YDORU GD TXDQWLGDGH UHSUHVHQWDGD GHSHQGH GD SRVLomR TXH HOH RFXSD QR Q~PHUR 2 VLVWHPD GHFLPDO TXH XVDPRV QR GLDDGLD p SRVLFLRQDO 3RU H[HPSORDFRQWULEXLomRGRGtJLWRpGHXPDXQLGDGHQRQ~PHURH GH GH]XQLGDGHVQRQ~PHUR &RQWUDVWDPFRPHVVHWLSRGHVLVWHPDRVVLVWHPDVQmRSRVLFLRQDLVWDLVFRPRRV Q~PHURVURPDQRVHPTXHDFRQWULEXLomRGRGtJLWR,pGHXPDXQLGDGHHP, H HP FDGD XPD GDV SRVLo}HV GH ,, 2V VLVWHPDV QmR SRVLFLRQDLV VmR SRXFR SUiWLFRVSDUDDUHDOL]DomRGHFiOFXORVHSRULVVRQmRVHUmRDERUGDGRVHPPDLRU GHWDOKH ([LVWHPGRLVFRQFHLWRVIXQGDPHQWDLVSDUDDFRPSUHHQVmRGRWH[WRTXHVHJXHH TXH HPERUD QmR UHSUHVHQWHP SURSULDPHQWH XPD QRYLGDGH PHUHFHP VHU H[SOLFLWDGRVpSUHFLVRGLVWLQJXLUFODUDPHQWHHQWUHR YDORUGHXPQ~PHURHVXD UHSUHVHQWDomR 2 YDORU GHXPQ~PHURFRUUHVSRQGHjTXDQWLGDGHTXHHOHUHSUHVHQWDDRSDVVR TXHD UHSUHVHQWDomRGHVVHQ~PHURFRUUHVSRQGHDRVGtJLWRVTXHHVFUHYHPRVSDUD VLPEROL]iOR 1R VLVWHPD GHFLPDO SRU H[HPSOR UHSUHVHQWDPRV D TXDQWLGDGH GR]H YDORU SHORQ~PHUR UHSUHVHQWDomR 1RVLVWHPDKH[DGHFLPDOTXH YHUHPRVORJRDVHJXLUDPHVPDTXDQWLGDGHpUHSUHVHQWDGDSHORQ~PHUR& $R ORQJR GR SUHVHQWH WH[WR XWLOL]DUHPRV R VLVWHPD GHFLPDO VHPSUH TXH IRU QHFHVViULR ID]HU UHIHUrQFLD DR YDORU GH XP Q~PHUR +DYHUi HQWmR XPD FRLQFLGrQFLDHQWUHRYDORUHVXDUHSUHVHQWDomRQRVLVWHPDGHFLPDO  SRU FDXVDGDQHFHVVLGDGHGHVHHVFROKHUDOJXPVLVWHPDSDUDIDODUVREUHRYDORUGRV Q~PHURV3DUDHYLWDUFRQIXVmRpLPSRUWDQWHHVWDUDWHQWRSDUDVDEHUTXDQGRR WH[WRVHUHIHUHDRYDORUGHXPQ~PHURTXHQXQFDPXGDHTXDQGRVHUHIHUHj VXDUHSUHVHQWDomRTXHGHSHQGHGRVLVWHPDHVFROKLGR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

8P VLVWHPD SRVLFLRQDO p HVSHFLILFDGR HP WHUPRV GH XPD FRQVWDQWH GHQRPLQDGD EDVHTXHGHWHUPLQDDUHODomRHQWUHRYDORUGHXP Q~PHUR H VXD UHSUHVHQWDomRDWUDYpVGDH[SUHVVmR Valor = d i B i 
i=0 n 1



HPTXH d i pRLpVLPRGtJLWRGRQ~PHURFRQWDGRGDGLUHLWDSDUDDHVTXHUGD QpRQ~PHURGHGtJLWRVH BpDEDVH 3RU H[HPSOR QR VLVWHPD GHFLPDO TXH UHFHEH HVWH QRPH SRU WHU EDVH  R YDORU GR Q~PHUR  p GDGR SRU           TXH FRUUHVSRQGH j TXDQWLGDGH  1R VLVWHPD ELQiULR R YDORU GH  p GDGR SRU        TXHFRUUHVSRQGHjTXDQWLGDGH eLPSRUWDQWHQRWDUWDPEpPTXHTXDQGRXVDPRVVLVWHPDVGHEDVHVGLIHUHQWHV PXGDRQ~PHURGHVtPERORVGHTXHSUHFLVDPRVSDUDUHSUHVHQWDUVHXVGtJLWRV 8PVLVWHPDGHQXPHUDomRGHEDVH NXWLOL]D NGtJLWRVGLIHUHQWHV,VWRVLJQLILFD TXH SDUD VLVWHPDV GH EDVH PHQRU GR TXH  QHP WRGRV RV GtJLWRV GH  D  VHUmRXWLOL]DGRV3RUH[HPSORRVLVWHPDRFWDO EDVH XWLOL]DDSHQDVRVGtJLWRV GHDHRVLVWHPDELQiULRDSHQDVRVGtJLWRVH3RURXWURODGRVLVWHPDVGH EDVHPDLRUGRTXHSUHFLVDPGHVtPERORVQRYRVSDUDUHSUHVHQWDURVGtJLWRV DOpPGR2VLVWHPDKH[DGHFLPDOTXHVHUiODUJDPHQWHXWLOL]DGRDRORQJRGR WH[WRSUHFLVDGHVtPERORVSDUDUHSUHVHQWDUDVTXDQWLGDGHVGHD2VGtJLWRV GH  D  IRUDP PDQWLGRV SDUD DV TXDQWLGDGHV GH  D  FRPR QR VLVWHPD GHFLPDO H DV OHWUDV GH $ DWp ) HVFROKLGDV SDUD DV TXDQWLGDGHV GH  D  $ WDEHODPRVWUDRVGtJLWRVGRVLVWHPDKH[DGHFLPDOHVHXYDORU
       

'tJLWR 9DORU

 

 

 

$ 

% 

& 

' 

( 

) 

7DE2VGtJLWRVGRVLVWHPDKH[DGHFLPDOHVHXYDORU 9ROWDQGR j HTXDomR  R YDORU GR Q~PHUR KH[DGHFLPDO ' p GDGR SRU   '     TXH FRUUHVSRQGH j TXDQWLGDGH  'L]HPRV HQWmRTXHpGDGRSRU'HPKH[DGHFLPDO eWDPEpPLPSRUWDQWHHVWDEHOHFHUXPDQRWDomRSDUDHVSHFLILFDUDEDVHHPTXH VHUHSUHVHQWDXPYDORUSDUDHYLWDUFRQIXVmR6HPSUHTXHQHFHVViULRQ~PHURV ELQiULRV VHUmR VHJXLGRV SHOD OHWUD < Q~PHURV RFWDLV SHOD OHWUD 4 Q~PHURV GHFLPDLV SHOD OHWUD 7 H Q~PHURV KH[DGHFLPDLV SHOD OHWUD + ,VWR SHUPLWLUi
  

&RQFHLWRVEiVLFRV



GLVWLQJXLU Q~PHURV FRPR < GH + 1~PHURV VHP VXIL[R GHYHP VHU FRQVLGHUDGRVGHFLPDLV $KDELOLGDGHGHID]HUFiOFXORVVLPSOHVQRVLVWHPDKH[DGHFLPDOpPXLWRYDOLRVD TXDQGRVHWUDEDOKDFRPSURJUDPDomRGHPLFURSURFHVVDGRUHVGDPHVPDIRUPD FRPR D KDELOLGDGH GH ID]HU FiOFXORV VLPSOHV QR VLVWHPD GHFLPDO p ~WLO HP QRVVDVDWLYLGDGHVGLiULDV3RULVVRFRQYpPHVWHQGHUDFDSDFLGDGHDSUHQGLGDGH VRPDUGHVGHDWpGHIRUPDDLQFOXLUWDPEpPRVQRYRVGtJLWRVGH$ DWp)$WDEHODDSUHVHQWDDVVRPDVQRYDVQRVLVWHPDKH[DGHFLPDO
 $ % & ' ( )  $ % & ' ( )  % & ' ( )   & ' ( )    ' ( )     ( )      )                                  $       %      $ &     $ % '    $ % & ( )    $ $ % % & & ' ' (

7DE$VVRPDVHOHPHQWDUHVQRVLVWHPDKH[DGHFLPDO

&RQYHUVmRGHEDVH
$FRQYHUVmRGHEDVHpXPSURFHVVRTXHSHUPLWHREWHUDUHSUHVHQWDomRGHXP YDORU HP XP GDGR VLVWHPD GH QXPHUDomR D SDUWLU GH XPD UHSUHVHQWDomR FRQKHFLGDHPRXWURVLVWHPDGHEDVHGLIHUHQWH 1DVHomRDQWHULRUYLPRVTXH7pHTXLYDOHQWHD'+SRUTXHFDOFXODPRV RVYDORUHVGHDPEDVHHVWHVFRLQFLGLUDP0DVHPJHUDOQmRWHUHPRVDVRUWHGH DGLYLQKDUDUHSUHVHQWDomRGHVHMDGDHSRULVVRSUHFLVDPRVGHXPDOJRULWPRSDUD SDVVDUGHXPVLVWHPDDRXWUR2DOJRULWPRGDGRDVHJXLUUHVROYHHVWHSUREOHPD H SRGH VHU LPSOHPHQWDGR HP XP SURJUDPD VLPSOHV FRQIRUPH IHLWR QR FDStWXOR$WDUHIDpGHWHUPLQDUDUHSUHVHQWDomRGDTXDQWLGDGHNQDEDVHB  'LYLGD N SRU B VHMDP q0 H r0 R TXRFLHQWH H R UHVWR GHVVD RSHUDomR UHVSHFWLYDPHQWHVHMDDLQGD i   VH qi IRU LJXDO D ]HUR D UHSUHVHQWDomR GH N QD EDVH B p riri-1ri-2...r1r0 H D FRQYHUVmRHVWiWHUPLQDGD&DVRFRQWUiULRLQFUHPHQWHiHFRQWLQXH  GLYLGD qi-1 SRU B; VHMDP qi H ri R TXRFLHQWH H R UHVWR GHVVD GLYLVmR UHVSHFWLYDPHQWH9ROWHDRSDVVR $ ILJXUD  PRVWUDDVGLYLV}HVHIHWXDGDVSDUDREWHUDUHSUHVHQWDomRGRYDORU QRVLVWHPDKH[DGHFLPDO



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV r0 1234 16 2 77 16 13 4 16 r1 4 0 r2

)LJ2DOJRULWPRGHFRQYHUVmRGHEDVH 'LYLGLPRVSRUTXHGi q0 H r0  &RQWLQXDQGRGLYLGLPRV SRUHREWHPRVq1 Hr1  RX'+ HHQWmRGLYLGLPRVSRUTXHGi q2 H r2 1HVWHSRQWRSDUDPRVHDOLQKDPRVRVUHVWRVQDIRUPD r2r1r0 SDUDREWHURUHVXOWDGRHVSHUDGR'+ $ VHJXLU DQDOLVDUHPRV D IXQGDPHQWDomR PDWHPiWLFD GR DOJRULWPR GDGR &RPHoDPRV FRP R FDVR WULYLDO HP TXH R Q~PHUR D FRQYHUWHU p WDO TXH R DOJRULWPRSiUDORJRDSyVDSULPHLUDGLYLVmRTXDQGRHQWmRWHPRV N = q 0 B + r0 = 0. B + r0 = r0  


RTXHSHUPLWHHVFUHYHUNFRPRr0 6HIRUHPQHFHVViULDVGXDVGLYLV}HVWHUHPRV N = q 0 B + r0 H q 0 = q1 B + r1 = 0. B + r1 = r1  6XEVWLWXLQGR  HP  YHP N = r1 B + r0  RTXHSHUPLWHHVFUHYHUNFRPRr1r0 3DUDRFDVRGHWUrVGLYLV}HVWHUHPRV N = q 0 B + r0  q 0 = q1 B + r1 H q1 = q 2 B + r2 = 0. B + r2 = r2 6XEVWLWXLQGR  HP  HGHSRLVHP  WHPRV N = r2 B 2 + r1 B + r0 

  

   

TXHSHUPLWHHVFUHYHU1FRPRr2r1r0 2 DOJRULWPR p EDVHDGR QD JHQHUDOL]DomR GHVWHV UHVXOWDGRV SDUD Q~PHURV DUELWUDULDPHQWHJUDQGHV

&RQFHLWRVEiVLFRV



&DVRVSDUWLFXODUHVGHFRQYHUVmRGHEDVH
4XDQGR D FRQYHUVmR TXH VH GHVHMD ID]HU GHYH DFRQWHFHU HQWUH EDVHV WDLV TXH XPDpSRWrQFLDLQWHLUDGDRXWUDSRGHVHXWLOL]DUXPDWDOKR 6HMDP %RULJH %GHVWDVEDVHVGHRULJHPHGHGHVWLQRUHVSHFWLYDPHQWH1RFDVRHP TXHDEDVHGHGHVWLQRpPDLRUGRTXHDGHRULJHPHH[LVWHXPQ~PHURLQWHLUR Q WDOTXH
n Bdest = Borig   pSRVVtYHODJUXSDURVGtJLWRVGDUHSUHVHQWDomRGHRULJHPGH Q HP QHDWULEXLUD FDGDJUXSRIRUPDGRXPGtJLWRGDUHSUHVHQWDomRGHGHVWLQR &RPR H[HPSOR VHMD D WDUHID GH FRQYHUWHU SDUD R VLVWHPD KH[DGHFLPDO R Q~PHURELQiULR&RPRDEDVHGHGHVWLQR  pSRWrQFLD LQWHLUDGDEDVHGHRULJHP  SRUTXHDPEDVHVWmRUHODFLRQDGDVSHODLJXDOGDGH   R YDORU GH Q p  ,VVR VLJQLILFD TXH SRGHPRV DJUXSDU RV GtJLWRV GR Q~PHURELQiULRGHHPHHVFUHYHUSDUDFDGDJUXSRXPGtJLWRKH[DGHFLPDO 'H IDWR   '       H    GH PRGR TXH D UHSUHVHQWDomRSURFXUDGDp'+ ,QYHUVDPHQWHQRFDVRHPTXHDEDVHGHGHVWLQRpPHQRUGRTXHDGHRULJHPH H[LVWHXPQ~PHURLQWHLUR QWDOTXH n Borig = Bdest   p SRVVtYHO GHVDJUXSDU RV GtJLWRV GD UHSUHVHQWDomR GH RULJHP HP Q GtJLWRV GD UHSUHVHQWDomRGHGHVWLQR 3RU H[HPSOR VHMD D WDUHID GH FRQYHUWHU R Q~PHUR RFWDO  SDUD ELQiULR &RPR D EDVH GH RULJHP   p SRWrQFLD LQWHLUD GD EDVH GH GHVWLQR   SRUTXH DPEDVHVWmRUHODFLRQDGDVSHODLJXDOGDGH  RYDORUGH Qp,VVRVLJQLILFD TXH SRGHPRV GHVDJUXSDU RV GtJLWRV GR Q~PHUR RFWDO HP JUXSRV GH  GtJLWRV ELQiULRV'HIDWR    H GHPRGRTXH DUHSUHVHQWDomRSURFXUDGDp )LQDOPHQWH p SRVVtYHO FRPELQDU RV GRLV PpWRGRV H ID]HU FRQYHUV}HV HQWUH EDVHVTXHHPERUDQmRVHMDPSRWrQFLDLQWHLUDXPDGDRXWUDVmRSRWrQFLDVGH XPPHVPRQ~PHURPHQRUeRFDVRGDVEDVHVHTXHQmRVmRSRWrQFLDV XPDGDRXWUDPDVVmRDPEDVSRWrQFLDVGH &RPR H[HPSOR VHMD D WDUHID GH FRQYHUWHU R Q~PHUR RFWDO  SDUD KH[DGHFLPDO &RQYHUWHPRV SULPHLUDPHQWH  SDUD R VLVWHPD ELQiULR REWHQGR      (P VHJXLGD UHDUUDQMDPRV RV GtJLWRV ELQiULRV HPJUXSRVGHGDGLUHLWDSDUDDHVTXHUGDFRPSOHWDQGRR~OWLPRFRP]HURVj HVTXHUGDVHQHFHVViULR2EWHPRVHQWmR TXHFRQYHUWLGR SDUDKH[DGHFLPDOUHVXOWDHP%%+



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

5HSUHVHQWDomRGHQ~PHURVLQWHLURV
$RVHLQLFLDURHVWXGRGRVPLFURSURFHVVDGRUHVpLPSRUWDQWHGHL[DUFODURFRPR VH ID] D UHSUHVHQWDomR GDV TXDQWLGDGHV QXPpULFDV HQYROYLGDV PHUHFHQGR HVSHFLDO DWHQomR RV Q~PHURV LQWHLURV FRP H VHP VLQDO >0RUV@ H >:6@ WUD]HPLQIRUPDo}HVTXHFRPSOHPHQWDPRPDWHULDODTXLH[SRVWR 3DUDUHSUHVHQWDUQ~PHURVSRVLWLYRVXWLOL]DVHQRUPDOPHQWHRYDORUGRSUySULR Q~PHURELQiULR$VVLPSRUH[HPSORDVTXDQWLGDGHVHVmRUHSUHVHQWDGDV SRUHUHVSHFWLYDPHQWH 3DUD RV Q~PHURV QHJDWLYRV D FRQYHQomR HVFROKLGD p D TXH UHSUHVHQWD RV Q~PHURVHPFRPSOHPHQWRGHGHVFULWDFRPPDLVGHWDOKHVQDVHomR 1XPFRPSXWDGRUVHPSUHH[LVWHXPOLPLWHSDUDRPDLRUQ~PHURTXHVHSRGH UHSUHVHQWDUGDGRTXHDPHPyULDSRUPDLRUTXHVHMDpILQLWD(VWHOLPLWHYDULD GH XP FRPSXWDGRU SDUD RXWUR H SDUD RV H[HPSORV TXH VHJXHP VXSRUHPRV VHP SHUGD GH JHQHUDOLGDGH TXH RV UHJLVWUDGRUHV GLVSRQtYHLV SDUD UHSUHVHQWDU QRVVRV Q~PHURV VmR GH  ELWV (QWmR SRGHPRV UHSUHVHQWDU DR WRGR   Q~PHURVGLIHUHQWHVGHD6HWHQWiVVHPRVFRQWLQXDUDOpPGROLPLWH WHUtDPRV 0DVFRPRSRGHUtDPRVUHSUHVHQWDUDSHQDV RVTXDWURGtJLWRVPHQRVVLJQLILFDWLYRVHVWDUtDPRVGHYROWDDRSRLV WHPSRUKLSyWHVHXPELWDPDLVGRTXHRSHUPLWLGR (VWDYROWDjRULJHPVXJHUHGLVSRURVQ~PHURVDRUHGRUGHXPFtUFXORHQmRDR ORQJR GH XP HL[R LQILQLWR FRPR VH ID] QD PDWHPiWLFD FRQYHQFLRQDO (VWD UHSUHVHQWDomR DSDUHFH QD ILJXUD  TXH SHUPLWH YLVXDOL]DU R TXH DFRQWHFH TXDQGRID]HPRVRSHUDo}HVGHVRPDHVXEWUDomR3DUDH[HFXWDUDVRPDGHGRLV Q~PHURV D H E EDVWD HQFRQWUDU D UHSUHVHQWDomR GH D QR FtUFXOR H DYDQoDU E SRVLo}HVQRVHQWLGRKRUiULR3DUDID]HUDVXEWUDomR DESRURXWURODGREDVWD UHFXDU E SRVLo}HVDSDUWLUGH DQRVHQWLGRDQWLKRUiULR([HPSORVGHFiOFXORV SRVVtYHLVVmRRX
1111 1110 1101 1100 1011 1010 1001 1000 0111 0000 0001 0010 0011 0100 0101 0110

)LJ5HSUHVHQWDomRFLUFXODUGRVQ~PHURVGHELWV

&RQFHLWRVEiVLFRV



$ ILJXUD WDPEpPPRVWUDRTXHDFRQWHFHTXDQGRRUHVXOWDGRGHXPDVRPD H[FHGH R PDLRU Q~PHUR UHSUHVHQWiYHO QR FDVR  6H WHQWDUPRV VRPDU  SRU H[HPSOR FKHJDPRV D  H QmR D  TXH VHULD R UHVXOWDGR FRUUHWR H[DWDPHQWH FRPR DFRQWHFH TXDQGR VRPDPRV GRLV Q~PHURV QXP SURFHVVDGRUHQmRWHPRVFRPRUHJLVWUDURYDL 2 PRGHOR DSUHVHQWDGR DWp DTXL p VXILFLHQWH SDUD RV FDVRV HP TXH QmR DSDUHFHPYDORUHVQHJDWLYRVQRVFiOFXORVUHDOL]DGRV1RHQWDQWRVDEHPRVTXH H[LVWHP JUDQGH]DV TXH SRGHP DVVXPLU YDORUHV QHJDWLYRV H SRU LVVR p QDWXUDO SHUJXQWDURTXHDFRQWHFHTXDQGRRUHVXOWDGRGHXPDRSHUDomRpXPQ~PHUR QHJDWLYR 6H QD ILJXUD  WHQWDUPRV UHSUHVHQWDU R FiOFXOR GH  FRPHoDPRVQDSRVLomRHUHFXDPRVXPDSRVLomRQRVHQWLGRDQWLKRUiULR RTXHQRVOHYDD 'D PHVPDIRUPDRVQ~PHURVQHJDWLYRVVXEVHTHQWHV ILFDULDPHPHWF 3RGHUtDPRVFRQWLQXDUGHVWDIRUPDHFKHJDU DWpRQ~PHURTXHUHSUHVHQWDULDHQWmRRYDORU0DVDt ILFDUtDPRVVHP Q~PHURVSRVLWLYRVHSRULVVRpQHFHVViULRGHILQLUXPDIURQWHLUDTXHVHSDUHRV Q~PHURVSRVLWLYRVGRVQHJDWLYRV &RVWXPDVH FRQVLGHUDU SRVLWLYRV RV Q~PHURV FXMR ELW PDLV VLJQLILFDWLYR p  H QHJDWLYRVRVQ~PHURVFXMRELWPDLVVLJQLILFDWLYRp  R TXH GLYLGH DR PHLR R FRQMXQWR GH Q~PHURV UHSUHVHQWiYHLV ,VWR WDPEpP IDFLOLWD D WDUHID GH GHWHUPLQDURVLQDOGHXPQ~PHURHPXPSURJUDPDSRLVEDVWDDQDOLVDUHVVHELW 1R FDVR GRV Q~PHURV GH  ELWV ILFDPRV FRP  Q~PHURV QHJDWLYRV H  Q~PHURV SRVLWLYRV FRQVLGHUDQGRVH R ]HUR LQFOXtGR QHVWHV ~OWLPRV $ GLVSRVLomRGHVVHVQ~PHURVDRUHGRUGRFtUFXORDSDUHFHQDILJXUD 1RWHTXHDJRUDDFDSDFLGDGHGHUHSUHVHQWDomRGHQ~PHURVQmRYDLPDLVGH DPDVVLPGHDWp3DUDUHSUHVHQWDUQ~PHURVDOpPGHVWHVOLPLWHVVHULD SUHFLVRDGRWDUUHJLVWUDGRUHVPDLRUHVSRUH[HPSORGHRXELWV
(-1) 1111 (-2) 1110 (-3) 1101 (-4) 1100 (-5) 1011 (-6) 1010 1001 (-7) 1000 (-8) 0111 (7) (0) 0000 (1) 0001 0010 (2) 0011 (3) 0100 (4) 0101 (5) 0110 (6)

)LJ5HSUHVHQWDomRGHQ~PHURVSRVLWLYRVHQHJDWLYRV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
3

1RFDVRJHUDOGHQ~PHURVGH QELWVRDVSHFWRGRFtUFXORpVHPHOKDQWHDRGD ILJXUD2Q~PHURGHGLYLV}HVpVHPSUHLJXDOD RVQ~PHURVSRVLWLYRVYmR GH  DWp     H RV Q~PHURV QHJDWLYRV GH  DWp   (VWHV Q~PHURV VmR HQFRQWUDGRV QD GRFXPHQWDomR GH FRPSLODGRUHV GH OLQJXDJHQV GH DOWR QtYHO FRPR & RX 3DVFDO TXDQGR VH DSUHVHQWDP RV OLPLWHV GD FDSDFLGDGH GH UHSUHVHQWDomRGRVGLIHUHQWHVWLSRVGHYDULiYHLVLQWHLUDV
3
 3


2EWHQomRGRYDORUVLPpWULFRGHXPQ~PHUR
(VFROKLGDDUHSUHVHQWDomRSDUDRVQ~PHURVSRVLWLYRVHQHJDWLYRVSDVVDUHPRVD LQYHVWLJDU VH H[LVWH XPD PDQHLUD IiFLO GH GDGR XP Q~PHUR D REWHU VHX VLPpWULFR D 6HFRPSDUDUPRVGLUHWDPHQWHDVUHSUHVHQWDo}HVGHHH HDVVLPSRUGLDQWHFRQIRUPHUHSUHVHQWDGRSHODVOLQKDVWUDFHMDGDVGDILJXUD QmR YHUHPRV GH LPHGLDWR TXDOTXHU FRLVD TXH SDUHoD IDFLOLWDU D REWHQomR GH XPDDSDUWLUGDRXWUD
(-1) 1111 (-2) 1110 (-3) 1101 (-4) 1100 (-5) 1011 (-6) 1010 1001 (-7) 1000 (-8) 0111 (7) (0) 0000 (1) 0001 0010 (2) 0011 (3) 0100 (4) 0101 (5) 0110 (6)

)LJ5HODo}HVGHFRPSOHPHQWRHQWUHVLPpWULFRV 1RHQWDQWRVHFRPSDUDUPRVDVUHSUHVHQWDo}HVGHHHHHDVVLPSRU GLDQWHFRQIRUPHUHSUHVHQWDGRSHODVOLQKDVFKHLDVYHUHPRVTXHXPDSRGHVHU REWLGDGDRXWUDWURFDQGRVHRV]HURVSRUVHYLFHYHUVD2UHVXOWDGRREWLGR FRPHVWDRSHUDomRFKDPDVHFRPSOHPHQWRGHGRQ~PHURHPTXHVWmRHSRULVVR SRGHPRV GL]HU TXH R VLPpWULFR GH XP Q~PHUR D GR FtUFXOR SRGH VHU REWLGR DWUDYpVGDH[SUHVVmR D  FRPSOHPHQWRGHGHD   2 PHPEUR GLUHLWR GHVVD H[SUHVVmR p FRQKHFLGR FRPR FRPSOHPHQWR GH  GH D 3RGHVHPRVWUDU FRPR" TXH FRPSOHPHQWRGHGHD   D  HPTXHQpRQ~PHURGHELWVXWLOL]DGRVSDUDUHSUHVHQWDURVQ~PHURV
3

&RQFHLWRVEiVLFRV



1RWH DLQGD TXH D H[SUHVVmR  IXQFLRQD LQGHSHQGHQWHPHQWH GH VHU D XP Q~PHURSRVLWLYR RX QHJDWLYR 3RU H[HPSOR SDUD REWHU D UHSUHVHQWDomR GH  SDUWLQGRGH   FRPSOHPHQWDPRVRVELWV  HVRPDPRV  REWHQGR  ,QYHUVDPHQWH SDUD REWHU D UHSUHVHQWDomR GH  D SDUWLU GH    FRPSOHPHQWDPRV  HVRPDPRV   

6XEWUDomRXVDQGRDGLomR
$UHSUHVHQWDomRHPFRPSOHPHQWRGHDSUHVHQWDDLQGDXPDRXWUDYDQWDJHP TXH p D GH SHUPLWLU D UHDOL]DomR GH VXEWUDo}HV XWLOL]DQGR D DGLomR ,VWR p SDUWLFXODUPHQWH LQWHUHVVDQWH QD LPSOHPHQWDomR GH FLUFXLWRV GLJLWDLV XPD YH] TXHRPHVPRFLUFXLWRSRGHVHUXWLOL]DGRSDUDH[HFXWDUDPEDVDVRSHUDo}HV 2 SRQWR GH SDUWLGD SDUD ID]HU D VXEWUDomR DE FRP DX[tOLR GD DGLomR p REVHUYDU TXH VH SRGHPRV UHSUHVHQWDU Q~PHURV GH QR Pi[LPR Q ELWV p YHUGDGHTXH DE D3E  3 SRLVXPDYH]TXHFDPLQKDPRVVREUHRFtUFXORRIDWRU UHSUHVHQWDXPDYROWD FRPSOHWDHQmRDIHWDRUHVXOWDGR3HODHTXDomR DE D FRPSOHPHQWRGHGHE   3RU H[HPSOR R UHVXOWDGR GH  SRGH VHU REWLGR VRPDQGRVH    DR FRPSOHPHQWRGHGH  TXHp  GHVFRQVLGHUDQGRVHRYDL TXHQmRWHPFRPRVHUUHJLVWUDGR    2XWUD IRUPD GH YLVXDOL]DU R IXQFLRQDPHQWR GHVWH DUWLItFLR FRQVLVWH HP REVHUYDUQDILJXUDTXHVRPDUDpRPHVPRTXHGDUXPDYROWD FRPSOHWD QR FtUFXOR H YROWDU  SRVLo}HV 3RU LVVR TXDQGR VH SDUWH GH  FKHJDVHDTXHpRUHVXOWDGRFRUUHWR

$UHSUHVHQWDomR%&'
8PDWDUHIDTXHVHDSUHVHQWDFRPIUHTrQFLDQDHODERUDomRGHSURJUDPDVpD DSUHVHQWDomR GH XP UHVXOWDGR QXPpULFR FRQWLGR QXP UHJLVWUDGRU GR SURFHVVDGRU HP DOJXP WLSR GH PRVWUDGRU WDO FRPR XP GLVSOD\ GH FULVWDO OtTXLGR1HVWHVFDVRVRSURJUDPDGRUQRUPDOPHQWHWHPjVXDGLVSRVLomRXPD VXEURWLQD TXH DSUHVHQWD R YDORU KH[DGHFLPDO FRQWLGR QR UHJLVWUDGRU GLUHWDPHQWH QR PRVWUDGRU 6H R YDORU TXH HVWi FRQWLGR QR UHJLVWUDGRU TXH p VHPSUHKH[DGHFLPDOGHYHVHUPRVWUDGRQRVLVWHPDGHFLPDOHQWmRpQHFHVViULR SULPHLUDPHQWH REWHU D UHSUHVHQWDomR GHFLPDO GHVVH YDORU SDUD GHSRLV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

DSUHVHQWiOR(VWDFRQYHUVmRGHEDVHTXHQmRGHL[DGHVHUWUDEDOKRVDSRGHVHU HYLWDGDTXDQGRVHWUDEDOKDFRPQ~PHURVQRIRUPDWR%&' ELQDU\FRGHGGHFLPDO  GHFLPDOFRGLILFDGRFRPRELQiULR 2 IRUPDWR %&' XWLOL]D R VLVWHPD KH[DGHFLPDO 1R HQWDQWR VmR SHUPLWLGRV DSHQDVRVGtJLWRVGH DRTXHSHUPLWHOHURVQ~PHURVFRPRGHFLPDLV3RU H[HPSOR R Q~PHUR 7 GHFLPDO  p UHSUHVHQWDGR FRPR + H QmR FRPR &+ TXH VHULD R XVXDO 'HVWD IRUPD VH IRU QHFHVViULR DSUHVHQWDU HVVH YDORU QXPPRVWUDGRURUHVXOWDGRVHUiFRUUHWR (VWD DERUGDJHP WHP QDWXUDOPHQWH D OLPLWDomR GH TXH D UHSUHVHQWDomR XWLOL]DGD SDUD R Q~PHUR  UHSUHVHQWD QD YHUGDGH D TXDQWLGDGH     H LVVR FDXVD SUREOHPDV TXDQGR VH ID]HP RSHUDo}HV FRP HVVHV Q~PHURV 1R HQWDQWR p SRVVtYHO HODERUDU UHJUDV VLPSOHV TXH SHUPLWHP ID]HU DGLo}HV H VXEWUDo}HV FRP Q~PHURV %&' 3DUD WDQWR FRORFDPRV LQLFLDOPHQWH RVGtJLWRVGRVLVWHPDKH[DGHFLPDOQRFtUFXORGDILJXUD
(F) 1111 (E) 1110 (D) 1101 (C) 1100 (B) 1011 (A) 1010 1001 (9) 1000 (8) 0111 (7) (0) 0000 (1) 0001 0010 (2) 0011 (3) 0100 (4) 0101 (5) 0110 (6)

)LJ2VGtJLWRVGRVLVWHPDKH[DGHFLPDOHXPDWDOKR 2EVHUYDPRV HQWmR TXH D VRPD GH GRLV GtJLWRV VHUi FRUUHWD HQTXDQWR QmR XOWUDSDVVDU  3RU H[HPSOR +  +  + p R PHVPR TXH 7 7  7 4XDQGRRYDORUSDVVDGHSRUpPSRGHPVXUJLUOHWUDVQRUHVXOWDGR FRPRHP     $+  RX HQWmR R UHVXOWDGR SRGH HVWDU LQFRUUHWR FRPR HP    +  (P TXDOTXHU GRV FDVRV R SUREOHPD p TXH DV VHLV OHWUDV GH $ D ) GHYHULDPVHUVDOWDGDVSDUDTXHVHREWLYHVVHRUHVXOWDGRGHVHMDGRFRPRVHDR LQYpV GH DYDQoDU VREUH R FtUFXOR IRVVH XWLOL]DGR R DWDOKR UHSUHVHQWDGR SHOD OLQKDWUDFHMDGDGDILJXUD,VWRSHUPLWHHODERUDURVHJXLQWHDOJRULWPRSDUDD VRPDGHQ~PHURV%&' VRPDURVGtJLWRVFRPRKH[DGHFLPDLV VHDVRPDIRUVXSHULRUDVRPDUPDLV ([HPSOR QD VRPD    DPERV Q~PHURV %&' GHYHUtDPRV REWHU  WDPEpP%&' VXSRQKDSDUDHVWHH[HPSORTXHWHPRVFRPRUHJLVWUDUQ~PHURV

&RQFHLWRVEiVLFRV



GHGtJLWRV 0DVDVRPDKH[DGHFLPDOVLPSOHVUHVXOWDHP $$+ UHVXOWDGRQmR YiOLGRFRPR%&'$SOLFDQGRRDOJRULWPRWHPRVRVVHJXLQWHVSDVVRV VRPDPRVFRPFRPRRUHVXOWDGR $+ pVXSHULRUDVRPDPRVPDLV H REWHPRV + HVFUHYHPRV R  FRPR GtJLWR PHQRV VLJQLILFDWLYR GR UHVXOWDGRHYDL VRPDPRVHVVHFRPHFRPHREWHPRV%+WDPEpPVXSHULRUD(QWmR VRPDPRVQRYDPHQWHPDLVHREWHPRV+TXHFRORFDGRjHVTXHUGDGR REWLGR DQWHULRUPHQWH Gi + TXH p D UHSUHVHQWDomR FRUUHWD GR Q~PHUR %&'GHVHMDGR$ILJXUDLOXVWUDDRSHUDomR   %$   )LJ$VRPDGHQ~PHURV%&' $ VXEWUDomR GH Q~PHURV %&' p DQiORJD $ ILJXUD  SHUPLWH FRQFOXLU TXH QHVVH FDVR R SUREOHPD DSDUHFH TXDQGR p SUHFLVR HPSUHVWDU  H TXH D FRUUHomRFRQVLVWHHPVXEWUDLUPDLVVHPSUHTXHLVVRDFRQWHFHURTXHHTXLYDOH D SHUFRUUHU R DWDOKR WUDFHMDGR QR VHQWLGR LQYHUVR 3RU H[HPSOR QXP SURFHVVDGRUGHELWVRFiOFXORQDDXVrQFLDGHFRUUHomRGiRUHVXOWDGR KH[DGHFLPDO(+6XEWUDLQGRPDLVREWpPVHRUHVXOWDGR%&'GHVHMDGR $ PDLRULD GRV PLFURSURFHVVDGRUHV WHP XPD LQVWUXomR TXH LPSOHPHQWD D FRUUHomR SDUD D VRPD GH GRLV Q~PHURV %&' PDV QmR SDUD D VXEWUDomR 3RU LVVR VXUJH DTXL XPD DSOLFDomR LPSRUWDQWH GD VXEWUDomR DWUDYpV GD VRPD HPSUHJDQGRRFRPSOHPHQWR GH  2 FRPSOHPHQWR GH  GH XP Q~PHUR p REWLGR DFUHVFHQWDQGRVH  DR VHX FRPSOHPHQWR GH  (VWH SRU VXD YH] p R Q~PHUR FXMRV GtJLWRV UHSUHVHQWDP D TXDQWLGDGH TXH IDOWD DRV GtJLWRV FRUUHVSRQGHQWHV QR Q~PHUR RULJLQDO SDUD FKHJDU D  3RU H[HPSOR R FRPSOHPHQWR GH  GH  p  H R FRPSOHPHQWR GH  GH  p  2V FRPSOHPHQWRVGH GHVVHVQ~PHURVVmRHQWmRH UHVSHFWLYDPHQWH 1RWH TXH D H[HPSOR GR TXH DFRQWHFH FRP RV Q~PHURV ELQiULRV H R FRPSOHPHQWRGHRFRPSOHPHQWRGHpWDOTXHDVRPDGHXPQ~PHURFRP VHX FRPSOHPHQWR p  RQGH 1 p D TXDQWLGDGH GH GtJLWRV GR Q~PHUR HP TXHVWmR H  3RULVVRDVXEWUDomR D  E SRGH VHU UHDOL]DGD FRPR D E  RQGH N p R Q~PHUR GH GtJLWRV GLVSRQtYHLV SDUD UHSUHVHQWDU RV YDORUHV D H E +DYHUi XP YDLTXHH[FHGHRQ~PHURGHELWVGDUHSUHVHQWDomRHQmRVHUiUHJLVWUDGR




0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$VXEWUDomR%&'GLVFXWLGDDFLPDVHULDIHLWDDVVLP REWHURFRPSOHPHQWRGHGHTXHp  VRPDUFRPTXHGi$+ FRUULJLURUHVXOWDGRSHORDOJRULWPRGDVRPD%&'REWHQGR+ GHVFDUWDU D FHQWHQD XPD YH] TXH SRU KLSyWHVH D UHSUHVHQWDomR HUD GH  ELWVREWHQGRRUHVXOWDGR

7DEHODVGHFRGLILFDomRGHFDUDFWHUHV
2V GLVSRVLWLYRV GH HQWUDGD H VDtGD GRV FRPSXWDGRUHV SUHFLVDP FRP IUHTrQFLD WURFDU LQIRUPDo}HV VRE IRUPD GH WH[WR R TXH HQYROYH FDUDFWHUHV DOIDQXPpULFRV &DGDXPGHVVHVFDUDFWHUHVWHPTXHVHUFRGLILFDGRSRUXPQ~PHURELQiULR H SDUD TXH VHMD SRVVtYHO WURFDU FRP IDFLOLGDGH LQIRUPDo}HV HQWUH GLIHUHQWHV FRPSXWDGRUHVpFRQYHQLHQWHTXHHVVDFRGLILFDomRVHMDQRUPDOL]DGD &RPHVWH LQWXLWR VXUJLX QD GpFDGD GH  D WDEHOD $6&,, $PHULFDQ 6WDQGDUG &RGH IRU ,QIRUPDWLRQ ,QWHUFKDQJH  TXH DWULEXLX RV Q~PHURV GH + D )+ DRV  FDUDFWHUHV FRQVLGHUDGRV PDLV XVXDLV QD pSRFD 1RWH TXH LVWR VLJQLILFD TXH RV FDUDFWHUHV$6&,,SUHFLVDPGHELWVSDUDVXDFRGLILFDomR
+H[ 










%


&


'

(


n



o


p


m


%LS


%N


7DE


/)


&5


#
 


 
 

































 



     

6SF







































 
0


!


"


#


$


%


&


'


(


)


*


+


,


-


.


/


1


2


3


4


5


6


7


8


9


:


;


<


=


>


?


@


A


B


C


D


E


F


G


H


I


J


K


L


M


N


O


P


Q


R


S


T


U


V


W


X


Y


Z


[


\


]


^


_


`

 

 





























7DE$WDEHOD$6&,, &RPRSDVVDUGRWHPSRVXUJLXDQHFHVVLGDGHGHSDGURQL]DUDUHSUHVHQWDomRGH FDUDFWHUHVDFHQWXDGRVFDUDFWHUHVXWLOL]DGRVHPPROGXUDVGHMDQHODVGHWH[WRH PXLWRVRXWURV3DVVRXVHHQWmRHVWHQGHUDWDEHOD$6&,,SDUDELWV&RQWXGR FRQVWDWRXVH TXH SDUD VDWLVID]HU RV XVXiULRV GH WRGRV RV SDtVHV TXH XWLOL]DP

&RQFHLWRVEiVLFRV



FRPSXWDGRUHVVHULDPQHFHVViULRVPXLWRPDLVGRTXHRV FDUDFWHUHVTXHVH SRGHP UHSUHVHQWDU GHVVD IRUPD 3RU LVVR VXUJLUDP YiULDV H[WHQV}HV GHQRPLQDGDV SiJLQDV GH FyGLJR FRGH SDJHV  1HVVDV WDEHODV RV SULPHLURV  FDUDFWHUHVVmRLGrQWLFRVDRVGDWDEHOD$6&,,HRVGHPDLVYDULDPGHDFRUGRFRP DV QHFHVVLGDGHV GD OtQJXD GR XVXiULR 1R %UDVLO D SiJLQD GH FyGLJRV PDLV XWLOL]DGDpSiJLQDGHFyGLJRVDSUHVHQWDGDQDWDEHOD
+H[ 










%


&


'

(


n



o


p


m


%LS


%N


7DE


/)


&5


#
 


 
 

































 



      

6SF







































 
0


!


"


#


$


%


&


'


(


)


*


+


,


-


.


/


1


2


3


4


5


6


7


8


9


:


;


<


=


>


?


@


A


B


C


D


E


F


G


H


I


J


K


L


M


N


O


P


Q


R


S


T


U


V


W


X


Y


Z


[


\


]


^


_


`


a

 
c


d




p


k


l


j


n


o


r


s


q


w


v


u


b

 
e






{


|


z









g


h











 $
i


t


y


~


x


f









 











 %  &

 

 

 

 









 

 

 



  


m



 





 



 

 '













 

 

 

 



 

 (








}









 

 )




























 































7DE$SiJLQDGHFyGLJRV ([LVWHP DLQGD PXLWDV RXWUDV H[WHQV}HV VREUH DV TXDLV p SRVVtYHO REWHU LQIRUPDo}HV GHWDOKDGDV QD ,QWHUQHW $V WDEHODV DFRPSDQKDGDV GH XP ERP KLVWyULFRGHWRGRRHVIRUoRGHQRUPDOL]DomREHPFRPRSHUJXQWDVHUHVSRVWDV IUHTHQWHV VREUH R DVVXQWR SRGHP VHU HQFRQWUDGDV D SDUWLU GR LWHP /LQNV ,QWHUHVVDQWHVQDKRPHSDJHTXHGiVXSRUWHDROLYUR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

&RPR D SURJUDPDomR GH PLFURSURFHVVDGRUHV HQYROYH IUHTHQWHPHQWH R WUDEDOKRFRPFDUDFWHUHVDOIDQXPpULFRVpFRQYHQLHQWHVDEHUGHFRUTXH OHWUDVPDL~VFXODVLQLFLDPHP+ OHWUDV PLQ~VFXODV LQLFLDP HP + H GLIHUHP GDV PDL~VFXODV DSHQDV SRU  ELW RVGtJLWRVGHDRFXSDPDIDL[D+D+

0DQLSXODomRGHELWV
$PDQLSXODomRGHELWVLQGLYLGXDLVGHQWURGHXPE\WHpGHJUDQGHLPSRUWkQFLD QR GHVHQYROYLPHQWR GH SURJUDPDV SDUD PLFURSURFHVVDGRUHV $SDUHFH IUHTHQWHPHQWH QD PDQLSXODomR GH FDUDFWHUHV DOIDQXPpULFRV RX QD LQWHUDomR FRP KDUGZDUH H[WHUQR DWUDYpV GH SRUWDV SDUDOHODV GH HQWUDGD H VDtGD &RP D PDQLSXODomRGHELWVpIiFLOWUDQVIRUPDUOHWUDVPLQ~VFXODVHPPDL~VFXODVHYLFH YHUVDRXGHWHUPLQDUVHXPQ~PHURpSDURXtPSDU1RFDVRGHXPDSRUWDGH HQWUDGDSRGHVHUQHFHVViULRGHWHUPLQDURYDORUGHXPGHVHXV ELWV D ILP GH GHWHUPLQDU D SRVLomR GH XPD FKDYH OLJDGD H[WHUQDPHQWH DR SLQR TXH FRUUHVSRQGH D HVVH ELW 1R FDVR GH XPD SRUWD GH VDtGD SRGH VHU QHFHVViULR VHWDU]HUDURXFRPSOHPHQWDUXPFHUWRELWVHPSHUWXUEDURHVWDGRGRVGHPDLV SDUDHYLWDUTXHRVGLVSRVLWLYRVFRQHFWDGRVDHVWHVVHMDPOLJDGRVRXGHVOLJDGRV LQGHYLGDPHQWH $ PDQLSXODomR GH ELWV p SRVVtYHO JUDoDV j SUHVHQoD GDV DVVLP FKDPDGDV RSHUDo}HV OyJLFDV QR FRQMXQWR GH LQVWUXo}HV GRV PLFURSURFHVVDGRUHV HP JHUDO $1' 25 H ;25 (VWDV LQVWUXo}HV DFHLWDP GRLV E\WHV FRPR RSHUDQGRV H UHVXOWDP HP XP E\WH FXMRV ELWV VmR REWLGRV DWUDYpV GD DSOLFDomR GHVVDV RSHUDo}HVDRVELWVGRVRSHUDQGRVWRPDGRVDRVSDUHV3RUH[HPSOR+$1' +UHVSHFWLYDPHQWHH  UHVXOWD HP  RX + 'DPHVPDIRUPD+25+ +H+;25+ +&RQILUD $VLQVWUXo}HVDSUHVHQWDGDVSHUPLWHPDOWHUDURYDORUGHELWVLQGLYLGXDLVGHQWUR GHXPE\WHGHVGHTXHVHHVFROKDPFRQYHQLHQWHPHQWHDRSHUDomRHRVHJXQGR RSHUDQGRDVHUXWLOL]DGRTXHpFRQKHFLGRSRUPiVFDUD $VDSOLFDo}HVPDLVFRPXQVGHPDQLSXODomRGHELWVVmRDVVHJXLQWHV VHWDUXPRXPDLVELWVGHXPE\WHDRSHUDomROyJLFDXWLOL]DGDp25HDPiVFDUD HVFROKLGDGHPRGRTXHRVELWVFRUUHVSRQGHQWHVjVSRVLo}HVTXHGHYHPVHU VHWDGDVHVWHMDPHPHRVGHPDLVHP3RUH[HPSORSDUDVHWDURVELWVH GR E\WH  VHP DOWHUDU RV GHPDLV HVFROKHPRV FRPR PiVFDUD  2 UHVXOWDGR GD RSHUDomR 25 FRP HVVHV DUJXPHQWRV p 

&RQFHLWRVEiVLFRV



]HUDU XP RX PDLV ELWV GH XP E\WH D RSHUDomR OyJLFD XWLOL]DGD p $1' H D PiVFDUD HVFROKLGD GH PRGR TXH RV ELWV FRUUHVSRQGHQWHV jV SRVLo}HV TXH GHYHPVHU]HUDGDVHVWHMDPHPHRVGHPDLVHP  3RUH[HPSORSDUD]HUDU RV ELWV  H  GR E\WH  VHP DOWHUDU RV GHPDLV HVFROKHPRV FRPR PiVFDUD2UHVXOWDGRGDRSHUDomR$1'FRPHVVHVDUJXPHQWRVp  FRPSOHPHQWDUXPRXPDLVELWVGHXPE\WHD RSHUDomROyJLFDXWLOL]DGDp;25HD PiVFDUD HVFROKLGD GH PRGR TXH RV ELWV FRUUHVSRQGHQWHV jV SRVLo}HV TXH GHYHPVHUFRPSOHPHQWDGDVHVWHMDPHP H RVGHPDLVHP3RUH[HPSOR SDUDFRPSOHPHQWDURVELWVHGRE\WH VHPDOWHUDURVGHPDLV HVFROKHPRVFRPRPiVFDUD 2 UHVXOWDGRGDRSHUDomR;25FRP HVVHVDUJXPHQWRVp WHVWDU VH XP RX PDLV ELWV GH XP E\WH HVWmR VHWDGRV D RSHUDomR OyJLFD XWLOL]DGD p $1'HDPiVFDUDHVFROKLGDGHPRGRTXHRVELWVFRUUHVSRQGHQWHVjSRVLomR TXH GHYH VHU WHVWDGD HVWHMDP HP  H RV GHPDLV HP  3RU H[HPSOR SDUD WHVWDUVHRELWGHXPE\WHTXDOTXHUHVWiVHWDGRHVFROKHPRVFRPRPiVFDUD 2UHVXOWDGRGDRSHUDomR$1'FRPHVVHVDUJXPHQWRVVHUiLJXDO D]HURVHRELWQmRHVWLYHUVHWDGRHGLIHUHQWHGH]HUR LJXDOD+ VHRELW  HVWLYHU VHWDGR (VWHV GRLV UHVXOWDGRV SRVVtYHLV LJXDO D ]HUR GLIHUHQWH GH ]HUR  SRGHP VHU H[SORUDGRV PHGLDQWH HPSUHJR GDV LQVWUXo}HV GH GHVYLR FRQGLFLRQDOGRVPLFURSURFHVVDGRUHVTXHSHUPLWHPID]HUFRPTXHWUHFKRV GHFyGLJRGLVWLQWRVVHMDPH[HFXWDGRVSDUDFDGDFDVR $ WDEHOD  UHVXPH DV RSHUDo}HV H PiVFDUDV SDUD RV WLSRV GH PDQLSXODomR DSUHVHQWDGRV 2EMHWLYR 6HWDU =HUDU &RPSOHPHQWDU 7HVWDU 0iVFDUD SDUDVHWDUQRVGHPDLV SDUD]HUDUQRVGHPDLV SDUDFRPSOHPHQWDUQRVGHPDLV SDUDWHVWDUQRVGHPDLV 2SHUDomR 25 $1' ;25 $1'

7DE2SHUDo}HVHPiVFDUDVSDUDPDQLSXODomRGHELWV

7LSRVGHPHPyULDV
$LQG~VWULDHOHWU{QLFDQXPFRQVWDQWHHVIRUoRSDUDDXPHQWDUDFDSDFLGDGHGH DUPD]HQDPHQWR GRV FKLSV GH PHPyULD Mi HPSUHJRX GLYHUVDV WpFQLFDV GH SURGXomRTXHUHVXOWDUDPHPYiULRVWLSRVGHPHPyULDV'RSRQWRGHYLVWDGD



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

GLVFLSOLQD GH 0LFURSURFHVVDGRUHV SRUpP R TXH LQWHUHVVD p GLVWLQJXLU DV PHPyULDVFXMRFRQWH~GRSRGHVHUDOWHUDGRSHORSURJUDPD FRPRDVPHPyULDV 5$0 65$0 H '5$0  GDTXHODV FXMR FRQWH~GR SHUPDQHFH IL[R FRPR DV 520V H (3520V  3RU LVVR R WH[WR VH UHIHUH jV PHPyULDV IL[DV HP JHUDO FRPR520VHjVYROiWHLVFRPR5$0V 3URMHWRVGHFRPSXWDGRUHVSUHFLVDPGLVWLQJXLUDVUHJL}HVGDPHPyULDRQGHXP SURJUDPDSUHFLVDHVFUHYHUGDTXHODVRQGHpVXILFLHQWHWHUDFHVVRDSHQDVSDUDOHU e SUHFLVR WDPEpP VHSDUDU RV FRQWH~GRV GH PHPyULD TXH QmR SRGHP VHU SHUGLGRV TXDQGR R VLVWHPD p GHVOLJDGR GDTXHOHV TXH VHPSUH SRGHP VHU UHFRQVWUXtGRV SHOR SURJUDPD H TXH SRGHP SRUWDQWR UHVLGLU HP PHPyULD YROiWLO)LQDOPHQWHpSUHFLVROHYDUHPFRQWDTXHRDFHVVRjPHPyULD5$0p PDLV UiSLGR GR TXH R DFHVVR j 520 7UDEDOKDQGR FRP HVWDV UHVWULo}HV R SURMHWLVWDGHWHUPLQDRQGHXWLOL]DUFDGDWLSRGHPHPyULD(PJHUDODUHJLmRD SDUWLU GD TXDO R SURFHVVDGRU EXVFD D SULPHLUD LQVWUXomR D H[HFXWDU DVVLP TXH UHFHEH DOLPHQWDomR p PDSHDGD HP 520 e R FDVR SRU H[HPSOR GR %,26 %DVLF ,QSXW2XWSXW 6\VWHP  GRV 3&V TXH UHVLGH HP 520 QD SODFDPmH H p UHVSRQViYHO SRU FDUUHJDU R VLVWHPD RSHUDFLRQDO GR GLVFR UtJLGR SDUD RXWUDV UHJL}HVGDPHPyULDPDSHDGDVHP5$0 (P VLVWHPDV PHQRUHV GHGLFDGRV p FRPXP TXH R SURJUDPD UHVLGD FRPSOHWDPHQWHHP520GHPRGRTXHQmRKiQHFHVVLGDGHGHVHFDUUHJiORD SDUWLU GH XP GLVFR 0HVPR QHVVH WLSR GH VLVWHPD SRUpP R XVR GH 5$0 p TXDVH VHPSUH LQGLVSHQViYHO SRLV p FRPXP TXH R SURJUDPD H[HFXWDGR QHFHVVLWHGHXPDiUHDSDUDJXDUGDUUHVXOWDGRVWHPSRUiULRV

2SHUDo}HVGHVWUXWLYDVHQmRGHVWUXWLYDV
$VRSHUDo}HVGHOHLWXUDGHXPDSDODYUDGDPHPyULDRXGHXPUHJLVWUDGRUGH XPSURFHVVDGRUVmRQmRGHVWUXWLYDVDRSDVVRTXHDVRSHUDo}HVGHHVFULWDVmR GHVWUXWLYDV (VWHV WHUPRV VLJQLILFDP TXH R FRQWH~GR GH XPD SDODYUD GD PHPyULDRXGHXPUHJLVWUDGRUSHUPDQHFHLQDOWHUDGRTXDQGRpOLGRHTXHDRVH VREUHVFUHYHUHVVHFRQWH~GRFRPRXWURYDORURYDORURULJLQDOpSHUGLGR e ~WLO WHU HVWDV SURSULHGDGHV HP PHQWH TXDQGR VH FRPHoD D HVWXGDU R IXQFLRQDPHQWRGHSURJUDPDVSDUDPLFURSURFHVVDGRUHVeSRULVVRTXHVHSRGH DILUPDUSRUH[HPSORTXHXPDLQVWUXomRGHPRYLPHQWDomRGHGDGRVWDOFRPR 029$%DTXDOFRSLDSDUDRUHJLVWUDGRU$RFRQWH~GRGRUHJLVWUDGRU % H QmRRFRQWUiULR GHVWUyLRFRQWH~GRDQWHULRUGRUHJLVWUDGRU$PDVSUHVHUYDR FRQWH~GRGH%6HHPXPGDGRLQVWDQWH$FRQWpPRYDORUH%FRQWpP HQWmRDH[HFXomRGDLQVWUXomRDFLPDGHL[DDPERVRVUHJLVWUDGRUHVFRP

&RQFHLWRVEiVLFRV



,QWHUSUHWDomRGRFRQWH~GRGDPHPyULD
$ H[HFXomR GH XP SURJUDPD SRU XP SURFHVVDGRU HQYROYH FRQVWDQWHPHQWH R DFHVVRjPHPyULDVHMDSDUDDOHLWXUDGDVLQVWUXo}HVTXHGHYHPVHUH[HFXWDGDV VHMD SDUD R DFHVVR DRV GDGRV Oi DUPD]HQDGRV ,VWR VLJQLILFD TXH D PHPyULD DUPD]HQDLQVWUXo}HVH[HFXWiYHLVHWDPEpPQ~PHURVLQWHLURVUHDLVHFDUDFWHUHV DOIDQXPpULFRV 7RGRVHVVHVFRQWH~GRVGLIHUHQWHVVmRUHSUHVHQWDGRVSRUVHTrQFLDVGHXPRX PDLV Q~PHURV ELQiULRV $ LQWHUSUHWDomR GHVVHV Q~PHURV p IHLWD SHOR SURFHVVDGRU H SHOR SURJUDPD QD PHGLGD HP TXH R YDORU HP TXHVWmR p OLGR FRPR XPD LQVWUXomR FRPR XP Q~PHUR RX FRPR XP FDUDFWHU DOIDQXPpULFR 3RU H[HPSOR GDGR TXH XPD SRVLomR GH PHPyULD FRQWpP R YDORU + LVWR SRGHVHULQWHUSUHWDGRGDVVHJXLQWHVIRUPDV VHHVWHYDORUDSDUHFHUHPXPSURJUDPDSDUDRPLFURSURFHVVDGRU  IDUi FRPTXHHVWHH[HFXWHDLQVWUXomR029%$ FRPRQ~PHURLQWHLURUHSUHVHQWDUiDTXDQWLGDGH +  FRPR FDUDFWHU DOIDQXPpULFR FRUUHVSRQGHUi j OHWUD * GH DFRUGR FRP D WDEHOD$6&,, 2HVWXGRGRVPLFURSURFHVVDGRUHVHQYROYHIUHTHQWHPHQWHVLWXDo}HVHPTXHp QHFHVViULRDQDOLVDURFRQWH~GRGHXPDFHUWDUHJLmRGHPHPyULDeSUHFLVRWHU HP PHQWH SRUWDQWR TXH D LQWHUSUHWDomR GHVVH FRQWH~GR QmR SRGH VHU IHLWD VLPSOHVPHQWHROKDQGRVHSDUDRVYDORUHVPDVTXHpQHFHVViULRWDPEpPVDEHU FRPRSURJUDPDHPTXHVWmRIDUiXVRGHOHV

$H[HFXomRGHSURJUDPDV
2 PLFURSURFHVVDGRU p R HOHPHQWR HQFDUUHJDGR GD H[HFXomR GRV SURJUDPDV DUPD]HQDGRVQDPHPyULDGHXPFRPSXWDGRU&RUUHVSRQGHjXQLGDGHFHQWUDO GHSURFHVVDPHQWR &38 HQRFRQWH[WRGRPRGHORGDILJXUDFRPSUHHQGH D XQLGDGH GH FRQWUROH UHVSRQViYHO SHOD OHLWXUD H SHOD GHFRGLILFDomR GDV LQVWUXo}HVHDXQLGDGHOyJLFDHDULWPpWLFD $/8 TXHHIHWXDRSHUDo}HVFRPRD DGLomRHDVRSHUDo}HVOyJLFDV$1'H25 $&38FRQWpPDLQGDXPDiUHDGHPHPyULD GH DOWD YHORFLGDGH GLYLGLGD HP UHJLVWUDGRUHV XWLOL]DGRV QR SURFHVVDPHQWR GDV LQVWUXo}HV 2 Q~PHUR GHVVHV UHJLVWUDGRUHVHDVRSHUDo}HVTXHSRGHPVHUIHLWDVFRPFDGDXPGHOHVYDULDGH XPD &38 SDUD RXWUD HPERUD H[LVWDP DOJXQV TXH VmR FRPXQV D WRGRV RV PLFURSURFHVVDGRUHVSRUVHUHPHVVHQFLDLVSDUDRVHXIXQFLRQDPHQWR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

3HOR PHQRV XP GHVVHV UHJLVWUDGRUHV SUHFLVD WHU IXQFLRQDOLGDGH SDUD H[HFXWDU RSHUDo}HVDULWPpWLFDVHOyJLFDVHUHFHEHHPJHUDORQRPHGH DFXPXODGRU $  2XWURUHJLVWUDGRULPSRUWDQWHpRFRQWDGRUGHSURJUDPD SURJUDPFRXQWHU3&jV YH]HVWDPEpPFKDPDGRGH LQVWUXFWLRQSRLQWHU,3 RQGHRSURFHVVDGRUDUPD]HQD RHQGHUHoRGHPHPyULDGDSUy[LPDLQVWUXomRDVHUH[HFXWDGD$H[HFXomRGH XPDLQVWUXomRDWXDOL]DDXWRPDWLFDPHQWHHVWHUHJLVWUDGRUGHPRGRTXHHOHHVWi VHPSUH DSRQWDQGR SDUD D LQVWUXomR VHJXLQWH TXH p OLGD DVVLP TXH WHUPLQD D H[HFXomRGDLQVWUXomRHPDQGDPHQWR8PWHUFHLURH[HPSORpRDSRQWDGRUGD SLOKD VWDFNSRLQWHU63 XWLOL]DGRSDUDFRQWURODURDFHVVRDXPDiUHDGHPHPyULD XWLOL]DGDSDUDDUPD]HQDUYDORUHVWHPSRUiULRVFRPRSDUkPHWURVSDVVDGRVSDUD VXEURWLQDV H HQGHUHoRV GH UHWRUQR GH VXEURWLQDV H GH WUDWDGRUHV GH LQWHUUXSomR$ILJXUDLOXVWUDRVHOHPHQWRVFLWDGRV
Regio com cdigo executvel

IR A

PC SP

CPU

Memria

Regio reservada para a pilha

)LJ$OJXQVHOHPHQWRVGD&38HGDPHPyULD ([LVWHPDLQGDUHJLVWUDGRUHVQmRDFHVVtYHLVDRSURJUDPDGRUTXHD &38XWLOL]D LQWHUQDPHQWHeRFDVRGRUHJLVWUDGRUGHLQVWUXomR LQVWUXFWLRQUHJLVWHU,5 RQGH VmR DUPD]HQDGDV DV LQVWUXo}HV OLGDV GD PHPyULD SDUD TXH SRVVDP VHU GHFRGLILFDGDVHH[HFXWDGDV

$H[HFXomRGHXPDLQVWUXomR
$ H[HFXomR GH XPD LQVWUXomR SHOD &38 SRGH VHU GHVFULWD GH IRUPD VLPSOLILFDGDSHORVVHJXLQWHVSDVVRV OHLWXUD GD LQVWUXomR D H[HFXWDU RV FyGLJRV KH[DGHFLPDLV TXH FRPS}HP D LQVWUXomRVmROLGRVDSDUWLUGRE\WHHQGHUHoDGRSHORFRQWDGRUGHSURJUDPD 3& HFRSLDGRVSDUDRUHJLVWUDGRUGHLQVWUXomR ,5  DWXDOL]DomRGRFRQWDGRUGHSURJUDPD RQ~PHURGHE\WHVOLGRVQRSDVVRDQWHULRU pVRPDGRDR3&TXHSDVVDHQWmRDDSRQWDUSDUDDLQVWUXomRVHJXLQWH

&RQFHLWRVEiVLFRV



GHFRGLILFDomR GD LQVWUXomR D &38 LGHQWLILFD D XQLGDGHV UHVSRQViYHO SHOD H[HFXomR GD LQVWUXomR SRU H[HPSOR D $/8 VH IRU XPD RSHUDomR DULWPpWLFD  H VH VHUmR Ki QHFHVVLGDGH GH GDGRV H[WHUQRV SRU H[HPSOR YDORUHVFRQWLGRVQDPHPyULDRXGHXPDSRUWDGHHQWUDGD  OHLWXUD GRV GDGRV VH QHFHVViULR SDUD RV UHJLVWURV LQWHUQRV GD &38 GDGRV H[WHUQRV VmRFRSLDGRVSDUDUHJLVWUDGRUHVLQWHUQRVRQGHSRGHPVHUPDQLSXODGRV H[HFXomRGDLQVWUXomR DLQVWUXomRpOHYDGDVDHIHLWR REWpPVHRUHVXOWDGRGH XPDVRPDSRUH[HPSOR  DUPD]HQDPHQWR GH UHVXOWDGRV HYHQWXDLV UHVXOWDGRV VmR WUDQVIHULGRV SDUD VHXV OXJDUHVGHGHVWLQR ILPGRFLFORD&38UHWRUQDDRSDVVRSDUDH[HFXWDUDLQVWUXomRVHJXLQWH (VWDVHTrQFLDpFRQKHFLGDFRPR FLFORGHOHLWXUDGHFRGLILFDomRH[HFXomRHUHSUHVHQWD RSULQFtSLRGHIXQFLRQDPHQWRGHWRGRPLFURSURFHVVDGRU

$PHPyULDHRVEDUUDPHQWRV
$PHPyULDDUPD]HQDRVSURJUDPDVHPH[HFXomRHRVGDGRVSURFHVVDGRVSRU HVWHVSURJUDPDV&RQVLVWHGHXPFRQMXQWRGHFpOXODVGHQRPLQDGDV SDODYUDV RX E\WHVTXHVmRLGHQWLILFDGDVXQLYRFDPHQWHSRUXPQ~PHURGHQRPLQDGR HQGHUHoR ItVLFR RX VLPSOHVPHQWH HQGHUHoR 3RGHVH LPDJLQDU XPD PHPyULD GH P E\WHV FRPRXPDWDEHODGHPOLQKDVHPTXHRVHQGHUHoRVVmRXVDGRVSDUDQXPHUDUDV OLQKDVHFDGDOLQKDWHPFDSDFLGDGHSDUDFRQWHUXPE\WH &DGD E\WH p FRPSRVWR GH XP Q~PHUR IL[R GH GtJLWRV ELQiULRV RX ELWV 'HVWD IRUPDXPE\WHFRPSRVWRGH QELWVSRGHDVVXPLU 3YDORUHVGLIHUHQWHVGHD 32VE\WHVGDPiTXLQDGHYRQ1HXPDQQSRUH[HPSORWLQKDPELWVR TXH SHUPLWLD D UHSUHVHQWDomR GH GXDV LQVWUXo}HV GH  ELWV RX HQWmR GH XP Q~PHUR LQWHLUR GH  ELWV FRP XP ELW GH VLQDO $WXDOPHQWH p FRQYHQomR HVWDEHOHFLGDTXH Q HSRULVVRRYDORUTXHFDGDE\WHSRGHDVVXPLUYDULDGH D 'L]VH TXH R YDORU DVVXPLGR SRU XP E\WH p R GDGR DUPD]HQDGR QR HQGHUHoRFRUUHVSRQGHQWH +iVLWXDo}HVHPTXHRVYDORUHVGLVWLQWRVTXHXPE\WHSRGHDVVXPLUQmR VmR VXILFLHQWHV SDUD UHSUHVHQWDU XPD JUDQGH]D FRP TXH VH WUDEDOKD 1HVWHV FDVRVDJUXSDPVHGRLVRXPDLVE\WHVSDUDIRUPDUDUUDQMRVGHPDLVELWVRTXH DXPHQWD H[SRQHQFLDOPHQWH D FDSDFLGDGH GH UHSUHVHQWDomR 'L]VH TXH GRLV E\WHV ELWV IRUPDPXPZRUGTXDWURE\WHV ELWV IRUPDPXP GRXEOHZRUGH RLWRE\WHV ELWV IRUPDPXPTXDGZRUG 2Q~PHURQGHELWVGHXPE\WHWHPLQIOXrQFLDVREUHRQ~PHURGHOLQKDVItVLFDV DWUDYpV GDV TXDLV DFRQWHFH D WUDQVIHUrQFLD GH GDGRV HQWUH R SURFHVVDGRU H D



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

PHPyULD2FRQMXQWRGHVVDVOLQKDVItVLFDVpGHQRPLQDGREDUUDPHQWRGHGDGRVHR Q~PHURGHOLQKDVTXHRFRQVWLWXLpDVXD ODUJXUD $ODUJXUDGREDUUDPHQWRGH GDGRV GH XP SURFHVVDGRU p HP JHUDO XP P~OWLSOR GH Q 6mR FRPXQV EDUUDPHQWRVGHGDGRVFRPODUJXUDVGHHELWV $WUDYpV GR EDUUDPHQWR GH GDGRV p SRVVtYHO WDQWR OHU TXDQWR PRGLILFDU R FRQWH~GR GD PHPyULD H R SURFHVVDGRU SUHFLVD GH XP PHFDQLVPR TXH OKH SHUPLWD LQGLFDU TXDO GHVVDV RSHUDo}HV GHYH VHU HIHWXDGD 3DUD WDQWR H[LVWH R EDUUDPHQWR GH FRQWUROH2VGLYHUVRVEDUUDPHQWRVTXHLQWHUOLJDP R SURFHVVDGRU j PHPyULDDSDUHFHPQDILJXUD
Dados Processador Endereos Controle Memria

)LJ&RQH[mRGHXPPLFURSURFHVVDGRUjPHPyULD 2 EDUUDPHQWR GH FRQWUROH FRQWpP WLSLFDPHQWH RV VLQDLV 5' UHDG  H :5 ZULWH TXHGLVWLQJXHPDVGXDVIRUPDVGHDFHVVRDOpPGHXPVLQDOTXHGL]VH HVWHDFHVVRVHUHIHUHGHIDWRjPHPyULDRXDRXWURGLVSRVLWLYR 2SURFHVVDGRUSUHFLVDWDPEpPGHXPPHFDQLVPRSDUDHVSHFLILFDURHQGHUHoR GRE\WHTXHSUHWHQGHDFHVVDU(VWHSURFHVVRUHFHEHRQRPHGH HQGHUHoDPHQWR GH XPE\WHHVHGiDWUDYpVGREDUUDPHQWRGHHQGHUHoRVTXHpRXWURFRQMXQWRGHOLQKDV ItVLFDV TXH FRQHFWDP R SURFHVVDGRU j PHPyULD LQGHSHQGHQWH GR EDUUDPHQWR GHGDGRV $ILPGHHQGHUHoDUXPGHWHUPLQDGRE\WHRSURFHVVDGRUFRORFDDFRPELQDomR GHELWVTXHFRUUHVSRQGHDRVHXHQGHUHoRH[SUHVVRQRVLVWHPDGHQXPHUDomR ELQiULRQDVOLQKDVGHVVHEDUUDPHQWR'HVWDIRUPDRQ~PHURPi[LPRGHE\WHV TXH SRGHP VHU HQGHUHoDGRV SRU XP SURFHVVDGRU p LJXDO D 2 HP TXH P p D ODUJXUDGREDUUDPHQWRGHHQGHUHoRV6mRFRPXQVEDUUDPHQWRVGHHELWV TXH FRUUHVSRQGHP UHVSHFWLYDPHQWH D FDSDFLGDGHV GH HQGHUHoDPHQWR GH  N%  H*%  2VHQGHUHoRVRFXSDPDIDL[DGHD2 $PHPyULDGDPiTXLQDGHYRQ1HXPDQQSRUH[HPSORWLQKDFDSDFLGDGHSDUD   SDODYUDV GH  ELWV QXPHUDGDV GH  D  $V LQVWUXo}HV TXH FRQIRUPHPHQFLRQDGR WLQKDP  ELWV HUDP FRPSRVWDV GH GRLV FDPSRV XP FDPSRGHELWVSDUDHVSHFLILFDURWLSRGHLQVWUXomRHRXWURGHELWVSDUD HQGHUHoDUXPDGDVSDODYUDVGDPHPyULD

&RQFHLWRVEiVLFRV



$ XWLOL]DomRGHGtJLWRVELQiULRVWHPXPLQFRQYHQLHQWHQmRpSUiWLFRWUDEDOKDU FRPQ~PHURVGH  RX DOJDULVPRV3RULVVRDGRWDVHXPDUHSUHVHQWDomR DOWHUQDWLYDSDUDHVVHVQ~PHURVXWLOL]DQGRRVLVWHPDKH[DGHFLPDOHPOXJDUGR VLVWHPD ELQiULR $ SDVVDJHP GH XP VLVWHPD SDUD RXWUR p VLPSOHV SRLV RV GtJLWRVKH[DGHFLPDLVFRUUHVSRQGHQWHVDXPQ~PHURELQiULRSRGHPVHUREWLGRV DJUXSDQGRVH RV ELWV GH  HP  FRQIRUPH H[SRVWR QD VHomR  'HVWD IRUPDRQ~PHURGHDOJDULVPRVILFDGLYLGLGRSRU $ ILJXUD  LOXVWUD XPD PHPyULD GH E\WHV GH  ELWV HQGHUHoDGRV DWUDYpV GH HQGHUHoRVGHELWV (QGHUHoR ELWV + + + + + + + + + + $+ %+  )))(+ ))))+ 'DGR ELWV + + + + + + + + + + ))+ (+  $%+ &'+

)LJ0HPyULDGHN% 1HVWHFDVRH[LVWHPHQGHUHoRVGLIHUHQWHVTXHSHUPLWHPHQGHUHoDUDRWRGR   E\WHV RX DLQGD  N% FRQYHQFLRQDVH TXH N%    E\WHV  E\WHV  2V HQGHUHoRV RFXSDP D IDL[D TXH YDL GH D    ))))+ 2VYDORUHVGRVGDGRVIRUDPHVFROKLGRVDRDFDVRGHQWURGRLQWHUYDORTXHYDLGH +D ))+2VWUrVEDUUDPHQWRVDSUHVHQWDGRVWUDEDOKDPHPFRQMXQWR SDUDUHDOL]DUFDGDDFHVVRGRSURFHVVDGRUjPHPyULDVHMDSDUDOHUXPE\WHGH XPDLQVWUXomRGHSURJUDPDVHMDSDUDOHURXPRGLILFDUDOJXPGDGR 4XDQGRH[HFXWDXPDLQVWUXomRTXHH[LJHDOHLWXUDGDPHPyULDRSURFHVVDGRU FRORFD SULPHLUDPHQWH R HQGHUHoR GR E\WH D VHU OLGR QR EDUUDPHQWR GH



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

HQGHUHoRV H LQGLFD DWUDYpV GR EDUUDPHQWR GH FRQWUROH TXH VH WUDWD GH XPD RSHUDomR GH OHLWXUD $ PHPyULD UHDJH HQWmR FRORFDQGR QR EDUUDPHQWR GH GDGRV R YDORU GR E\WH HQGHUHoDGR TXH R SURFHVVDGRU FRSLD SDUD DOJXP UHJLVWUDGRU 8PD RSHUDomR GH HVFULWD WDPEpP LQLFLD FRP D DWLYDomR GR EDUUDPHQWR GH HQGHUHoRVPDVREDUUDPHQWRGHFRQWUROHLQIRUPDjPHPyULDTXHVHWUDWDGH XPD RSHUDomR GH HVFULWD (VWD UHDJH HQWmR FRSLDQGR R GDGR TXH R SURFHVVDGRUFRORFDQREDUUDPHQWRGHGDGRVSDUDDFpOXODHQGHUHoDGD

,QWURGXomRDR
2ULJHPHFDUDFWHUtVWLFDVWpFQLFDV
2PLFURSURFHVVDGRUIRLODQoDGRHPFRPRVXFHVVRUGR(VWH WLQKDDSHQDVXPDHQWUDGDGHLQWHUUXSomRHQmRWLQKDVLVWHPDGHFRPXQLFDomR VHULDO R TXH GLILFXOWDYD VHX XVR HP SURMHWRV FRQVLGHUDGRV LQWHUHVVDQWHV SHOD ,QWHO 2 JHUDGRU GH FORFN H R FRQWURODGRU GH VLVWHPD HUDP H[WHUQRV PDV R LGHDOVHULDSRGHULQWHJUiORVFRPD&38$OpPGLVVRKDYLDQHFHVVLGDGHGHGXDV WHQV}HVGHDOLPHQWDomR 9H9 TXDQGRRLGHDOVHULDXVDUDSHQDVXPD 2 QRYR SURFHVVDGRU VDWLVIH] WRGRV HVWHV UHTXLVLWRV $ ILP GH PDQWHU D FRPSDWLELOLGDGH GH VRIWZDUH FRP R  R FRQMXQWR GH LQVWUXo}HV GHVWH IRL PDQWLGR $FUHVFHQWDUDPVH DSHQDV DV LQVWUXo}HV 5,0 H 6,0 QHFHVViULDV SRU FDXVDGDVQRYDVLQWHUUXSo}HVHGRVLVWHPDGHFRPXQLFDomRVHULDO$YHORFLGDGH GHH[HFXomRDXPHQWRXHPGHYLGRjPXGDQoDGDIUHTrQFLDGHFORFNGH SDUD0+]HDRXWUDVPRGLILFDo}HVLQWHUQDV 2 PLFURSURFHVVDGRU  p HQFDSVXODGR HP XP FLUFXLWR LQWHJUDGR GH  SLQRVFRPRVVLQDLVH[WHUQRVGLVWULEXtGRVFRQIRUPHLQGLFDGRQDILJXUD
X1 X2 RESET OUT SOD SID TRAP RST 7.5 RST 6.5 RST 5.5 INTR INTA AD0 AD1 AD2 AD3 AD4 AD5 AD6 AD7 VSS 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 VCC HOLD HLDA CLK (OUT) RESET IN READY IO/M S1 RD WR ALE S0 A15 A14 A13 A12 A11 A10 A9 A8

8 0 8 5

)LJ'LVWULEXLomRGRVVLQDLVQRFLUFXLWRLQWHJUDGR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

2VSLQRV9FF 9 H9VVUHVSHFWLYDPHQWHSLQRVHUHFHEHPDWHQVmR GHDOLPHQWDomR2VVLQDLV;H; SLQRVH FRUUHVSRQGHPjVHQWUDGDVGR JHUDGRU GH FORFN LQWHUQR $ HVWDV HQWUDGDV FRQHFWDVH XP FLUFXLWR RVFLODGRU FULVWDOUHGH5&HWF SDUDDJHUDomRGRFORFN&/. SLQR pXPDVDtGDQD TXDO VH WHP R VLQDO GH FORFN GR  TXH SRGH VHU XWLOL]DGR SRU FLUFXLWRV SHULIpULFRVTXHFRPS}HPXPVLVWHPD$IUHTrQFLDGHVWHVLQDOpLJXDOjPHWDGH GDIUHTrQFLDGRVLQDOJHUDGRHP;H; 2 EDUUDPHQWR GH HQGHUHoRV GR  p FRPSRVWR GH  OLQKDV R TXH OKH FRQIHUH XPD FDSDFLGDGH GH HQGHUHoDPHQWR GH  N% 2V VLQDLV $ D $ SLQRVD FRUUHVSRQGHPDRVELWVPDLVVLJQLILFDWLYRVGREDUUDPHQWRGH HQGHUHoRV $' D $' SLQRV  D   VmR OLQKDV XWLOL]DGDV WDQWR SDUD HQGHUHoRV TXDQWR SDUD GDGRV R TXH FRQVWLWXL XPD QRYLGDGH FRP UHODomR DR TXHWLQKDOLQKDVVHSDUDGDVSDUDGDGRVHHQGHUHoRV2GXSORXVRGHVWDV OLQKDVIRLLQWURGX]LGRQRSDUDDFRPRGDUWRGRVRVVHXVVLQDLVQRPHVPR Q~PHURGHSLQRVGRDILPGHTXHIRVVHSRVVtYHOXWLOL]DURPHVPRWLSRGH SDVWLOKD SDUD RV GRLV PLFURSURFHVVDGRUHV H WRUQRXVH FRPXP D SDUWLU GHVWD pSRFD$PXOWLSOH[DomRGHGDGRVHHQGHUHoRVpUHDOL]DGDHPIXQomRGRVFLFORV GH EDUUDPHQWR GR PLFURSURFHVVDGRU 1R SULPHLUR FLFOR GH XPD LQVWUXomR GH DFHVVRjPHPyULDHVWHVSLQRVFRUUHVSRQGHPDRVRLWRELWVPHQRVVLJQLILFDWLYRV GR EDUUDPHQWR GH HQGHUHoRV 1RV GHPDLV FLFORV FRUUHVSRQGHP DRV RLWR ELWV GR EDUUDPHQWR GH GDGRV 2 VLQDO $/( $GGUHVV /DWFK (QDEOH SLQR  SHUPLWHDRKDUGZDUHH[WHUQRGLVWLQJXLURVGDGRVGRVHQGHUHoRVHpFRQFHELGR SDUDVHUXVDGRFRPRVLQDOGHFORFNSDUDXPODWFKTXHFDSWXUDRVHQGHUHoRV 2V SLQRV 62' H 6,'  H   ID]HP D VDtGD H D HQWUDGD GH GDGRV GH IRUPD VHULDO UHVSHFWLYDPHQWH (VWDV RSHUDo}HV VmR UHDOL]DGDV DWUDYpV GDV LQVWUXo}HV 6,0 6HW,QWHUUXSW0DVN H5,0 5HDG,QWHUUXSW0DVN TXHDOpPGHKDELOLWDU RXLQLELULQWHUUXSo}HVSHUPLWHPHQYLDURXUHFHEHUGDGRVQHVVHVSLQRV 75$3 567 567 567 H ,175 SLQRV  D   FRUUHVSRQGHP D HQWUDGDV TXH SHUPLWHP VLQDOL]DU SHGLGRV GH LQWHUUXSomR GH KDUGZDUH ,17$ SLQR pXPVLQDOGHUHFRQKHFLPHQWRGHLQWHUUXSomRHQYLDGRHPUHVSRVWDD XPSHGLGRGHLQWHUUXSomRIHLWRSHODHQWUDGD,175 +2/' SLQR   p XPD HQWUDGD TXH SHUPLWH D XP GLVSRVLWLYR H[WHUQR UHTXLVLWDU R GLUHLWR GH XWLOL]DomR GRV EDUUDPHQWRV GH GDGRV H GH HQGHUHoRV 4XDQGR HVWD HQWUDGD p DWLYDGD R  HQWUD HP HVWDGR GH DOWD LPSHGkQFLD SHUPLWLQGR TXH XP GLVSRVLWLYR H[WHUQR DVVXPD R FRQWUROH GRV EDUUDPHQWRV ,VWRSHUPLWHDLPSOHPHQWDomRGRDFHVVRGLUHWRjPHPyULD '0$  $VDtGD+/'$ +ROG$FNQRZOHGJHSLQR LQGLFDDRGLVSRVLWLYRH[WHUQRTXH UHTXLVLWRXRFRQWUROHGRVEDUUDPHQWRVTXHHVWHVHVWmRDFHVVtYHLV

,QWURGXomRDR



5($'< SLQR   p XPD HQWUDGD TXH RIHUHFH VXSRUWH DR PHFDQLVPR GH JHUDomR GH HVWDGRV GH HVSHUD ZDLW VWDWHV  SDUD DV RSHUDo}HV GH OHLWXUD HP PHPyULDRX(6 $SyVWHUUHTXLVLWDGRDOHLWXUDGHXPGDGRR VHFRORFD HPHVWDGRGHHVSHUDDWpTXHRGLVSRVLWLYRDWLYHHVVDHQWUDGDLQGLFDQGRTXHR GDGRHVWiGLVSRQtYHOQREDUUDPHQWR 5(6(7 ,1 SLQR   SHUPLWH UHLQLFLDOL]DU R  2 FRQWDGRU GH SURJUDPD DVVXPHRYDORU+ID]HQGRFRPTXHDH[HFXomRGRSURJUDPDUHFRPHFHD SDUWLU GHVWH HQGHUHoR (VWD RSHUDomR WDPEpP GHVDELOLWD DV LQWHUUXSo}HV PDV QmRPRGLILFDRFRQWH~GRGRVGHPDLVUHJLVWUDGRUHVGDPiVFDUDGHLQWHUUXSo}HV RX GRV IODJV $ VDtGD 5(6(7 287 SLQR   p XWLOL]DGD SDUD VLQDOL]DU D UHLQLFLDOL]DomRGRSURFHVVDGRUDRXWURVFLUFXLWRVGRVLVWHPDTXHSRGHPHQWmR UHDJLUGHIRUPDFRQYHQLHQWH 6H6 H VmRVDtGDVTXHLQGLFDPRHVWDGRGR GHDFRUGRFRPD WDEHOD6mR~WHLVHPWHVWHVGHVLVWHPDVHPGHVHQYROYLPHQWR 6     6     (VWDGR 5HWHQomR (VFULWD /HLWXUD ,QWHUUXSomR

7DE6LQDLV6H6GR 2V VLQDLV ,20 5' H :5 SLQRV   H  UHVSHFWLYDPHQWH  IRUPDP R EDUUDPHQWR GH FRQWUROH &RQIRUPH DSUHVHQWDGR QD VHomR  5' H :5 GL]HPVHDRSHUDomRpGHOHLWXUDRXGHHVFULWDUHVSHFWLYDPHQWH 3DUDHQWHQGHURSDSHOGRVLQDO,20pSUHFLVRVDEHUTXHRVEDUUDPHQWRVGH GDGRV H GH HQGHUHoRV QmR VmR FRQHFWDGRV VRPHQWH j PHPyULD PDV WDPEpP FRPSDUWLOKDGRVFRPRXWURVGLVSRVLWLYRVIRUPDQGRRHVSDoRGHHQGHUHoRVGH HQWUDGD H VDtGD ,2  $VVLP TXDQGR R SURFHVVDGRU FRORFD XP HQGHUHoR QR EDUUDPHQWRHVWHpSHUFHELGRWDQWRSHODPHPyULDTXDQWRSRUHVVHVGLVSRVLWLYRV SHULIpULFRV3RU LVVR H[LVWHP LQVWUXo}HV GH DFHVVR j PHPyULD H LQVWUXo}HV GH DFHVVRDRHVSDoRGH(6 $GLIHUHQoDHQWUHHODVHVWiQDDWLYDomR RXQmR GR VLQDO,20TXHpXWLOL]DGRSHORVFLUFXLWRVGHGHFRGLILFDomRGHHQGHUHoRVSDUD GHWHUPLQDUVHGHYHPVHOHFLRQDUDPHPyULDRXXPGLVSRVLWLYRSHULIpULFR $ WDEHOD  DSUHVHQWD DV FRPELQDo}HV SRVVtYHLV H XP H[HPSOR GH LQVWUXomR SDUDFDGDXPDGHODV2VVLQDLV5'H:5QXQFDVmRDWLYDGRVVLPXOWDQHDPHQWH 2VWUDoRVQDWDEHODLQGLFDPHVWDGRGHDOWDLPSHGkQFLD VWDWH 

 ,20     

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV :5      5'      6LJQLILFDGR (VFULWDHPPHPyULD /HLWXUDHPPHPyULD (VFULWDHP(6 /HLWXUDHP(6 2SHUDomRLQWHUQD ([HPSOR 67$+ /'$+ 287+ ,1+ ,15$

7DE6LQDLVGREDUUDPHQWRGHFRQWUROH

2PRGHORGHSURJUDPDomR
2PRGHORGHSURJUDPDomRGHXPPLFURSURFHVVDGRUpXPDDEVWUDomRXWLOL]DGD QRGHVHQYROYLPHQWRGHSURJUDPDVeLQGHSHQGHQWHGDDUTXLWHWXUDGRKDUGZDUH H VXD IXQomR p SURYHU R SURJUDPDGRU GH XPD UHSUHVHQWDomR TXH IDFLOLWH R HQWHQGLPHQWR H D PHPRUL]DomR GR FRQMXQWR GH LQVWUXo}HV ,QFOXL RV UHJLVWUDGRUHVHRVIODJVGRSURFHVVDGRUHGHSHQGHQGRGDFRPSOH[LGDGHGHVWH SRGHP DSDUHFHU WDPEpP GLVSRVLWLYRV SHULIpULFRV FRPR SRUWDV GH HQWUDGD H VDtGD 2 PRGHOR WDPEpP p ~WLO SDUD DYDOLDU D FDSDFLGDGH GH SURFHVVDPHQWR GH XP PLFURSURFHVVDGRUSRLVRWDPDQKRHDTXDQWLGDGHGRVUHJLVWUDGRUHVSHUPLWHP HVWLPDUVXDFDSDFLGDGHGHHQGHUHoDPHQWRHFRPDSUiWLFDVDEHURTXHHVSHUDU GR VHX FRQMXQWR GH LQVWUXo}HV e XP ERP KiELWR LQLFLDU R HVWXGR GH XP SURFHVVDGRUQRYRSRUHVWHPRGHOR 2PRGHORGHSURJUDPDomRGRpDSUHVHQWDGRQDILJXUD


3& $ %
 



63 ' +
 

)ODJV & 


36: %& $&




( / &


'( +/ )ODJV

)LJ0RGHORGHSURJUDPDomRGR 2V UHJLVWUDGRUHV 3& H 63 DPERV GH  ELWV VmR R 3URJUDP &RXQWHU H R 6WDFN 3RLQWHU'HVHPSHQKDPDVIXQo}HVGHOLQHDGDVQDVHomR

,QWURGXomRDR



%&'(+H/VmRUHJLVWUDGRUHVGHELWVGHXVRJHUDO$SDUHFHPDRVSDUHV QRPRGHORGHSURJUDPDomRSRUTXHDOJXPDVLQVWUXo}HVRVDIHWDPHPFRQMXQWR FRPRVHIRUPDVVHPUHJLVWUDGRUHVGHELWV 8P H[HPSOR GH LQVWUXomR TXH DIHWD XP SDU GH UHJLVWUDGRUHV p ,1; + TXH LQFUHPHQWDRSDU+/GDVHJXLQWHIRUPD VRPDDRYDORUFRQWLGRHP/ VHKRXYHUYDLVRPDDRYDORUFRQWLGRHP+ 2 DFXPXODGRU $  SDUWLFLSD GD JUDQGH PDLRULD GDV RSHUDo}HV OyJLFDV H DULWPpWLFDV $V LQVWUXo}HV TXH UHDOL]DP RSHUDo}HV GH GRLV DUJXPHQWRV WDLV FRPRDVRPDXVDPFRPRSULPHLURDUJXPHQWRVHPSUHRDFXPXODGRU3RULVVR RV PQHP{QLFRV GHVVDV LQVWUXo}HV HVSHFLILFDP DSHQDV R VHJXQGR DUJXPHQWR TXH SRGH VHU XPD FRQVWDQWH RX RXWUR UHJLVWUDGRU e R FDVR GD LQVWUXomR $''%TXHDFUHVFHQWDRYDORUGRUHJLVWUDGRU%DRDFXPXODGRU 2DFXPXODGRUID]SDUWHGHXPDSDODYUDGH ELWVGHQRPLQDGD36: SURJUDP VWDWXV ZRUG  HP FXMR E\WH PHQRV VLJQLILFDWLYR UHVLGHP RV IODJV (VWHV VmR YDULiYHLV ELQiULDV PRGLILFDGDV LQGLYLGXDOPHQWH SHOR UHVXOWDGR GH GLYHUVDV RSHUDo}HVHPHVSHFLDODVOyJLFDVHDULWPpWLFDV1RWHTXHKiDSHQDV  IODJV2V ELWV QmR XWLOL]DGRV WrP YDORUHV IL[RV H QmR VmR LPSRUWDQWHV $ WDEHOD  UHODFLRQDRVIODJVGRHRVFULWpULRVTXHGHWHUPLQDPVHXYDORU )/$* = =HUR 6 6LJQ 3 3DULW\ & &DUU\ $& $X[& &RQGLomRQHFHVViULDHVXILFLHQWHSDUDIODJ  5HVXOWDGRGHXPDRSHUDomRpQXOR 5HVXOWDGRGHXPDRSHUDomRpQHJDWLYR 5HVXOWDGRGHXPDRSHUDomRWHPSDULGDGHSDU 2SHUDomRH[LJHYDLRXHPSUHVWD 2SHUDomRH[LJHYDLGRELWSDUDRELW 7DE)ODJVGR eLPSRUWDQWHVDOLHQWDUTXHHPERUDRVIODJVVHMDPDIHWDGRVSHORVUHVXOWDGRVGDV RSHUDo}HV H[HFXWDGDV HOHV QmR UHIOHWHP QHFHVVDULDPHQWH R FRQWH~GR GR DFXPXODGRU3RUH[HPSORDRSHUDomR 68%$]HUDULDRDFXPXODGRUHGHL[DULD HVWHIODJHP6HORJRHPVHJXLGDIRVVHH[HFXWDGDDLQVWUXomR09,$+ R FRQWH~GR GR DFXPXODGRU SDVVDULD D VHU GLIHUHQWH GH ]HUR PDV R IODJ SHUPDQHFHULD VHWDGR SRUTXH D LQVWUXomR 09, QmR DIHWD RV IODJV 3RUWDQWR R VLPSOHV IDWR GH R ]HUR IODJ HVWDU HP  QmR JDUDQWH TXH R DFXPXODGRU HVWHMD ]HUDGR 2XWUR FDVR LPSRUWDQWH p R GDV LQVWUXo}HV GH FRPSDUDomR 7RGD FRPSDUDomR HIHWXD LQWHUQDPHQWH XPD VXEWUDomR VHP QR HQWDQWR DOWHUDU R FRQWH~GR GR DFXPXODGRU 3RU H[HPSOR VH R DFXPXODGRU FRQWpP R Q~PHUR + H p



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

H[HFXWDGDDLQVWUXomR &3,+DVXEWUDomRIHLWDLQWHUQDPHQWHFRORFDUiR ]HUR IODJ HP  SDUD VLQDOL]DU TXH R UHVXOWDGR GD FRPSDUDomR p XPD LJXDOGDGH 2 YDORUGRDFXPXODGRUSRUpPFRQWLQXDVHQGR+2VH[HPSORVDSUHVHQWDGRV LOXVWUDPDLPSRUWkQFLDGHVHREVHUYDUDVUHJUDVVHJXQGRDVTXDLVRVIODJVVmR SRVLFLRQDGRV TXDQGR VH HVFUHYH XP SURJUDPD $V WDEHODV GR DQH[R  GmR LQIRUPDo}HVVREUHFRPRDVLQVWUXo}HVGRDIHWDPRVIODJV

$SLOKD
$ SLOKD RX VWDFN HP LQJOrV  p XPD UHJLmR GD PHPyULD XWLOL]DGD SHOR SURFHVVDGRU SDUD DUPD]HQDU YDORUHV WHPSRUiULRV FRPR SDUkPHWURV SDUD VXEURWLQDV H HQGHUHoRV GH UHWRUQR e XP FRQMXQWR GH E\WHV RQGH VH SRGH HVFUHYHUHOHUUHVSHLWDQGRDVVHJXLQWHVUHJUDV DSLOKDGHYHVHUYLVWDWDOTXDOXPDSLOKDGHSUDWRVGHFR]LQKD%\WHVQRYRV VmRFRORFDGRVQRWRSRGDSLOKDHDUHPRomRGRVE\WHVWHPTXHVHUIHLWDQD RUGHPLQYHUVDGDVXDFRORFDomR1mRYDOHSX[DUXPSUDWRGRPHLRGDSLOKD HPTXDOTXHULQVWDQWHDSHQDVR~OWLPRE\WHHPSLOKDGRHVWiDFHVVtYHO DSLOKDpFRQWURODGDSHORUHJLVWUDGRU63 SRQWHLURGDSLOKDRXVWDFNSRLQWHU TXH DSRQWDSDUDR~OWLPRHOHPHQWRHPSLOKDGRpGHYHUGRSURJUDPDLQLFLDOL]DU HVWH UHJLVWUDGRU FRP D LQVWUXomR /;,63HQGHUHoR! SDUD TXH D iUHD HVFROKLGDVHMDFRUUHWDPHQWHHQGHUHoDGD DWUDQVIHUrQFLDGHGDGRVHQWUHSLOKDH&38HQYROYHVHPSUHXPSDUGHE\WHV ELWV 1DHVFULWDRE\WHPDLVVLJQLILFDWLYRpPRYLGRSULPHLURHGHSRLVR PHQRVVLJQLILFDWLYR1DOHLWXUDDRUGHPpDLQYHUVD HVWDVRSHUDo}HVVyVmRSHUPLWLGDVSDUDRVVHJXLQWHVUHJLVWUDGRUHV 36: 3URJUDP6WDWXV:RUGFRQWHQGRDFXPXODGRUHIODJV  RVSDUHVGHUHJLVWUDGRUHV%&'(H+/ DV LQVWUXo}HV XWLOL]DGDV QD PRYLPHQWDomR VmR 386+ HVFULWD  H 323 OHLWXUD VHJXLGDVGRDUJXPHQWRTXHLGHQWLILFDRVUHJLVWUDGRUHVHQYROYLGRV 386+36:SRUH[HPSORFRORFDR36:QDSLOKD TXDQGR XPD LQVWUXomR ID] UHIHUrQFLD D XP SDU GH UHJLVWUDGRUHV LQGLFD VRPHQWHRQRPHGRUHJLVWUDGRUPDLVVLJQLILFDWLYRGRSDU3RUH[HPSORSDUD WUDQVIHULU RV GRLV E\WHV GR WRSR GD SLOKD SDUD R SDU GH UHJLVWUDGRUHV %& HVFUHYHVHDSHQDV323%HQmR323%& $ILJXUDLOXVWUDRIXQFLRQDPHQWRGDSLOKDQRFDVRGDH[HFXomRGDVHTrQFLD GHLQVWUXo}HV
PUSH B POP D

,QWURGXomRDR



QXPD VLWXDomR HP TXH RV UHJLVWUDGRUHV % H & FRQWrP UHVSHFWLYDPHQWH RV YDORUHV + H + $V RSHUDo}HV UHDOL]DGDV FRSLDP HVWHV YDORUHV SDUD R SDU '(
63 "" "" "" "" "" "" ,QtFLR 63 ""   "" "" "" $SyV386+% 63 ""   "" "" "" $SyV323' (QGHUHoRV GHFUHVFHQWHV

)LJ)XQFLRQDPHQWRGDSLOKDQR 1RLQtFLRRFRQWH~GRGDSLOKDSRGHVHUTXDOTXHUHpLJQRUDGRSHORSURJUDPD $H[HFXomRGHXPDLQVWUXomR386+FRQVLVWHGRVVHJXLQWHVSDVVRV  RYDORUGH63pGHFUHPHQWDGRGH  RFRQWH~GRGRUHJLVWUDGRUPDLVVLJQLILFDWLYRGRSDU QRFDVRGRH[HPSORR UHJLVWUDGRU% pFRSLDGRSDUDRHQGHUHoRFRQWLGRHP63  RYDORUGH63pGHFUHPHQWDGRGH  RFRQWH~GRGRUHJLVWUDGRUPHQRVVLJQLILFDWLYRGRSDU QRFDVRGRH[HPSOR RUHJLVWUDGRU& pFRSLDGRSDUDRHQGHUHoRFRQWLGRHP63HVWHSDVVDDVHU RQRYRWRSRGDSLOKD(VWDpDVLWXDomRLQWHUPHGLiULDQDILJXUDDFLPD $H[HFXomRGHXPDLQVWUXomR323FRQVLVWHGRVVHJXLQWHVSDVVRV  RE\WHHQGHUHoDGRSRU63pFRSLDGRSDUDRUHJLVWUDGRUPHQRVVLJQLILFDWLYR GRSDUHVSHFLILFDGR QRFDVRGRH[HPSORRUHJLVWUDGRU(   RYDORUGH63pLQFUHPHQWDGRGH  RE\WHHQGHUHoDGRSRU63pFRSLDGRSDUDRUHJLVWUDGRUPDLVVLJQLILFDWLYRGR SDUHVSHFLILFDGR QRFDVRGRH[HPSORRUHJLVWUDGRU'   RYDORUGH63pLQFUHPHQWDGRGHHVWHSDVVDDVHURQRYRWRSRGDSLOKD $VUHJUDVDSUHVHQWDGDVWrPDOJXPDVLPSOLFDo}HVTXHYDOHDSHQDUHVVDOWDU DOHLWXUDGDSLOKDQmRDOWHUDRFRQWH~GRGDiUHDGHPHPyULDXWLOL]DGD RIDWRGHRVYDORUHVVHUHPUHWLUDGRVGDSLOKDVHPSUH QD RUGHP LQYHUVD GD VXD FRORFDomR QmR GHYH JHUDU D IDOVD LGpLD GH TXH RV YDORUHV SUHFLVDP VHU OLGRVSDUDGHQWURGRVPHVPRVUHJLVWUDGRUHVGHRQGHYLHUDP$SLOKDSRGH GH IDWR VHU XWLOL]DGD SDUD WURFDU R FRQWH~GR GH GLIHUHQWHV SDUHV GH UHJLVWUDGRUHVFRPRQRIUDJPHQWRGHFyGLJRDEDL[RTXHWURFDRFRQWH~GR GRSDU%&FRPRGRSDU'(
PUSH B PUSH D POP B POP D



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

DSLOKDFUHVFHQRVHQWLGRGRVHQGHUHoRVGHFUHVFHQWHV p UHVSRQVDELOLGDGH GR SURJUDPDGRU FXLGDU SDUD TXH D SLOKD QmR FUHVoD D SRQWRGHLQYDGLUiUHDVGHPHPyULDGHVWLQDGDV SDUD RXWURV ILQV FRPR SRU H[HPSORXPDUHJLmRGHGDGRVRXRSUySULRFyGLJRGRSURJUDPD 

6XEURWLQDV
6XEURWLQDV VmR WUHFKRV GH FyGLJR SDUD RV TXDLV R SURFHVVDPHQWR SRGH VHU GHVYLDGR PHGLDQWH LQVWUXo}HV GH FRQWUROH GH IOX[R ([HFXWDGR R FyGLJR FRUUHVSRQGHQWH XP PHFDQLVPR GH UHWRUQR ID] FRP TXH D H[HFXomR GR SURJUDPDFRQWLQXHQDLQVWUXomRVHJXLQWHjTXHSURYRFRXRGHVYLR&RVWXPDVH GHQRPLQDU HVVH GHVYLR GH FKDPDGD GD VXEURWLQD H D YROWD DR SRQWR GH FRQWLQXDomRGHUHWRUQRFRQIRUPHDILJXUD 3URJUDPD SULQFLSDO  ,QVWUXomR GHGHVYLR   &KDPDGD 6XEURWLQD ,QtFLR    )LP

(QGHUHoR GHUHWRUQR

5HWRUQR

)LJ0HFDQLVPRGHFKDPDGDGHXPDVXEURWLQD 6mRGXDVDVUD]}HVTXHSRGHPWRUQDU LQWHUHVVDQWH D GLYLVmR GH XP SURJUDPD HPVXEURWLQDV SRGHPDEULJDUWUHFKRVGHFyGLJRTXHH[HFXWDPIXQo}HVHVSHFtILFDVRTXH SHUPLWH RUJDQL]DU PHOKRU R SURJUDPD H WRUQiOR PDLV IDFLOPHQWH FRPSUHHQVtYHOSRUWHUFHLURV SRGHPVHUFKDPDGDVGHTXDOTXHUOXJDUGRSURJUDPDWDQWDVYH]HVTXDQWDV VHGHVHMDU$VVLPTXDQGRXPDWDUHIDSUHFLVDVHUH[HFXWDGDUHSHWLGDVYH]HV RFyGLJRFRUUHVSRQGHQWHVySUHFLVDVHUHVFULWRXPD~QLFDYH]

2SDSHOGDSLOKDQDFKDPDGDGHVXEURWLQDV
$ SULQFLSDO LQVWUXomR GR  XWLOL]DGD SDUD FKDPDU XPD VXEURWLQD p D LQVWUXomR &$// HQGHUHoR GH GHVWLQR! (VWD LQVWUXomR SURYRFD XP GHVYLR LQFRQGLFLRQDOSDUDRHQGHUHoRIRUQHFLGRTXHGHYHVHURHQGHUHoRGHLQtFLRGD VXEURWLQDH[LVWHPDLQGDRXWUDVFRPR&& FDOOLIFDUU\ &= FDOOLI]HUR HWF

,QWURGXomRDR



TXH H[HFXWDUmR R GHVYLR VRPHQWH VH D FRQGLomR FRUUHVSRQGHQWH HVWLYHU VDWLVIHLWD (P TXDOTXHU GRV FDVRV TXDQGR R GHVYLR DFRQWHFH R SURFHVVDGRU SDVVD D OHU DV LQVWUXo}HV D SDUWLU GR HQGHUHoR IRUQHFLGR &RQWXGR GHYH FRQWLQXDUQRHQGHUHoRGDLQVWUXomRVHJXLQWHDRFDOO HQGHUHoR GH UHWRUQR DSyVR WpUPLQRGDVXEURWLQDFKDPDGD,VWRH[LJHRDUPD]HQDPHQWRGRHQGHUHoRGH UHWRUQRIHLWRPHGLDQWHXVRGDSLOKD2SURFHVVDPHQWRGDVLQVWUXo}HVGRWLSR &$//FRQVLVWHGRVVHJXLQWHVSDVVRV LQLFLD SHOR LQFUHPHQWR GR 3& TXH SDVVD D DSRQWDU SDUD R HQGHUHoR GD LQVWUXomR VHJXLQWH j TXH IRL OLGD (VWH p SRU GHILQLomR R HQGHUHoR GH UHWRUQR 2 SURFHVVDGRU FRSLD HVWH YDORU GR 3& SDUD D SLOKD FRP D FRUUHVSRQGHQWHGLPLQXLomRGRYDORUGH63GHGXDVXQLGDGHV$VVLPRWRSR GDSLOKDSDVVDDFRQWHURHQGHUHoRGHUHWRUQR RHQGHUHoRGHGHVWLQRIRUQHFLGRQDLQVWUXomRGHFKDPDGDpFRSLDGRSDUDR 3& ID]HQGR FRP TXH D SUy[LPD LQVWUXomR H[HFXWDGD VHMD D SULPHLUD LQVWUXomRGDVXEURWLQDFKDPDGD 2 SURFHVVDPHQWR GH XPD LQVWUXomR &$// p SRUWDQWR HTXLYDOHQWH D XP 386+GR3& HPERUDQmRH[LVWDDLQVWUXomR386+3& VHJXLGRGHXP-03 SDUDRHQGHUHoRGHGHVWLQR 2 WpUPLQR GH XPD VXEURWLQD p LQGLFDGR SHOD LQVWUXomR 5(7 UHWXUQ  SURFHVVDGDFRPRVHJXH RVGRLVE\WHVGRWRSRGDSLOKDVmRUHPRYLGRVHFRORFDGRVQR3& SURJUDP FRXQWHU  GH PDQHLUD TXH D SUy[LPD LQVWUXomR D VHU H[HFXWDGD VHUi DTXHOD HQGHUHoDGD SRU HVWHV GRLV E\WHV &RQVLGHUDQGR TXH R WRSR GD SLOKD FRQWHQKD R HQGHUHoR GH UHWRUQR VDOYR SHOD LQVWUXomR &$// R SURJUDPD FRQWLQXDUiVXDH[HFXomRFRQIRUPHGHVHMDGR 2SURFHVVDPHQWRGHXPDLQVWUXomR5(7p SRUWDQWR HTXLYDOHQWH D XP 323 SDUDR3& HPERUDQmRH[LVWDDLQVWUXomR3233&  e IXQGDPHQWDOFRPSUHHQGHUTXHRUHWRUQRDRSRQWRGHH[HFXomRFRUUHWRVy VHUi SRVVtYHO VH QR LQVWDQWH GD H[HFXomR GD LQVWUXomR 5(7 R WRSR GD SLOKD FRQWLYHU R HQGHUHoR GH UHWRUQR 6H LVWR QmR IRU YHUGDGH VHMD SRUTXH D VXEURWLQD GHL[RX 63 FRP XP YDORU LQFRUUHWR VHMD SRUTXH R HQGHUHoR GH UHWRUQR IRL DGXOWHUDGR R SURJUDPD VHUi GHVYLDGR SDUD XP HQGHUHoR VHP VHQWLGRHPXLWRSURYDYHOPHQWHVHSHUGHUi,VWRQmRTXHUGL]HUTXHDVXEURWLQD QmR WHQKD GLUHLWR GH XWLOL]DU D SLOKD  SHOR FRQWUiULR p DWp FRPXP TXH HOD FKDPH VXDV SUySULDV VXEURWLQDV  PDV VLP TXH WRGD VXEURWLQD WHP D UHVSRQVDELOLGDGHGHUHPRYHUGDSLOKDRVYDORUHVTXHSRUYHQWXUDDOLDUPD]HQH DQWHVGHWHUPLQDU



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

8WLOL]DomRGDSLOKDQDSUHVHUYDomRGHUHJLVWUDGRUHV
4XDQGR VH FKDPD XPD VXEURWLQD p QHFHVViULR VDEHU TXDLV UHJLVWUDGRUHV SRGHUmRVHUPRGLILFDGRVGXUDQWHVHXSURFHVVDPHQWR6HLPHGLDWDPHQWHDQWHV GD FKDPDGD DOJXP GHVVHV UHJLVWUDGRUHV FRQWLYHU XP YDORU TXH VH GHVHMD FRQVHUYDUSDUDGHSRLVGRUHWRUQRHVWHSUHFLVDVHUDUPD]HQDGRHPDOJXPRXWUR OXJDUHGHSRLVUHFXSHUDGR$SLOKDVHSUHVWDGHIRUPDEDVWDQWHSUiWLFDSDUDHVWD ILQDOLGDGHHSRULVVRpFRPXPHQFRQWUDUWUHFKRVGHFyGLJRFRPR
PUSH PSW PUSH B CALL 1234H POP B POP PSW ; ; ; ; ; salva PSW na pilha salva par BC sub-rotina que altera BC e PSW recupera par BC recupera PSW

1RWH TXH D RUGHP HP TXH VH UHFXSHUDP RV UHJLVWUDGRUHV GHYH VHU D LQYHUVD GDTXHODHPTXHVmRVDOYRVDPHQRVTXHVHGHVHMHTXHRFRUUDWURFDGHYDORUHV

3URJUDPDomRGR
$VVHPEOHUHOLQJXDJHP$VVHPEO\
8P DVVHPEOHUpXPDIHUUDPHQWDGHVRIWZDUH XPSURJUDPD TXHVLPSOLILFDD WDUHID GH FULDU SURJUDPDV 5HFHEH FRPR HQWUDGD XP DUTXLYRWH[WR FRP  DV LQVWUXo}HV GR SURJUDPD GHQRPLQDGR GH DUTXLYRIRQWH H JHUD XP DUTXLYRREMHWR TXHFRQWpPRVFyGLJRVELQiULRVFRUUHVSRQGHQWHV $ ILP GH TXH R DVVHPEOHU SRVVD ORFDOL]DU H VHJXLU DV LQVWUXo}HV GR DUTXLYRIRQWH R SURJUDPDGRU GHYH VHJXLU FHUWDV UHJUDV 2 FRQMXQWR GHVVDV UHJUDV GHWHUPLQD D VLQWD[H D VHU HPSUHJDGD QD HVFULWD GR DUTXLYR H GHILQH DVVLPXPDOLQJXDJHPGH SURJUDPDomR 8PD OLQJXDJHP GHVWLQDGD D WUDEDOKDU FRPDVLQVWUXo}HVGHXPSURFHVVDGRUpGHQRPLQDGD OLQJXDJHP$VVHPEO\ (P $VVHPEO\ DV SDODYUDVFKDYH TXH UHSUHVHQWDP DV LQVWUXo}HV VmR PQHP{QLFRV TXH FRUUHVSRQGHP GLUHWDPHQWH DRV FyGLJRV KH[DGHFLPDLV GR SURFHVVDGRU8PDYH]TXHFDGDSURFHVVDGRUWHPXPFRQMXQWRGHPQHP{QLFRV SUySULRH[LVWHXPDOLQJXDJHP$VVHPEO\SDUDFDGDSURFHVVDGRU 2V PQHP{QLFRV VmR DEUHYLDWXUDV TXH OHPEUDP D IXQomR GD LQVWUXomR TXH UHSUHVHQWDP WDLV FRPR 029 GR LQJOrV PRYH SDUD DV LQVWUXo}HV GH PRYLPHQWDomRGHGDGRV RX-03 GRLQJOrV MXPSSDUDRVGHVYLRV  $ OLQJXDJHP $VVHPEO\ QR HQWDQWR QmR SRGH VH OLPLWDU DRV PQHP{QLFRV SRUTXHDOpPGHGL]HUTXDLVVmRDVLQVWUXo}HVTXHGHYHUmRFRPSRURSURJUDPD p SUHFLVR GL]HU WDPEpP RQGH HODV GHYHP ILFDU HVWDEHOHFHU VLQ{QLPRV SDUD FRQVWDQWHV H FULDU H XWLOL]DU YDULiYHLV 3RU FDXVD GLVVR H[LVWHP DOpP GRV PQHP{QLFRV DV GLUHWLYDV GH PRQWDJHP RX VLPSOHVPHQWH GLUHWLYDV RX DLQGD SVHXGRLQVWUXo}HV(VWDVVmRSDODYUDVFKDYHSHUPLWLGDVGHQWURGDOLQJXDJHPPDV TXH QmR JHUDP FyGLJR H[HFXWiYHO SRUTXH QmR FRUUHVSRQGHP D TXDOTXHU LQVWUXomRGRSURFHVVDGRU DSHQDVDMXGDPDGHWHUPLQDUDWDUHIDGRDVVHPEOHU $VGLUHWLYDVPDLVFRPXQVVmRGLVFXWLGDVQDVHomR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

(PSUHJRGDOLQJXDJHP$VVHPEO\
'R SRQWR GH YLVWD GR SURJUDPDGRU TXH Mi HVFUHYHX SURJUDPDV XWLOL]DQGR GLUHWDPHQWHFyGLJRVKH[DGHFLPDLVRXELQiULRVRXVRGDOLQJXDJHP$VVHPEO\p PXLWRYDQWDMRVRSRUIDFLOLWDUHDJLOL]DUDSURGXomRGHSURJUDPDV 'R SRQWR GH YLVWD GH TXHP XWLOL]D OLQJXDJHQV GH DOWR QtYHO R HPSUHJR GR $VVHPEO\WHPYDQWDJHQVHGHVYDQWDJHQV3RUXPODGRFRQVWLWXLXPDIRUPDGH H[SORUDURVUHFXUVRVGRSURFHVVDGRUTXHQmRVmRDFHVVtYHLVGHRXWUDIRUPDHGi DRSURJUDPDGRUFRQWUROHWRWDOVREUHVXDVRSHUDo}HV3RURXWURODGRHPJHUDOp SUHFLVRHVFUHYHUYiULDVLQVWUXo}HV$VVHPEO\SDUDFRQVHJXLURPHVPRUHVXOWDGR GHXPDLQVWUXomRGHOLQJXDJHPGHDOWRQtYHOHWDPEpPFXLGDUGHWDUHIDVTXHGH RXWURPRGRVHULDPDXWRPDWL]DGDVSHORFRPSLODGRUePDLVIiFLOFRPHWHUHUURV H HVWHV VmR FRP IUHTrQFLD GLItFHLV GH ORFDOL]DU ,VWR DXPHQWD RV FXVWRV H R WHPSR GH GHVHQYROYLPHQWR H SRU LVVR p EDVWDQWH UDUR HQFRQWUDU SURJUDPDV HVFULWRV WRWDOPHQWH HP $VVHPEO\ (P JHUDO RV SURJUDPDV VmR HVFULWRV TXDVH TXH H[FOXVLYDPHQWH HP OLQJXDJHQV GH DOWR QtYHO H R $VVHPEO\ p HPSUHJDGR DSHQDVHPSDUWHVHVSHFtILFDVSRUUD]}HVGHRWLPL]DomRGHHVSDoRGHPHPyULD RXGHYHORFLGDGHGHH[HFXomRRXDLQGDSDUDID]HUDFHVVRDKDUGZDUHH[WHUQR $SHVDU GHVVH XVR UHODWLYDPHQWH UHVWULWR R HVWXGR GD SURJUDPDomR HP EDL[R QtYHO p H[WUHPDPHQWH YDOLRVR SDUD SURJUDPDU HP RXWUDV OLQJXDJHQV SRUTXH FHUWRVHOHPHQWRVGHVWDVVySRGHPVHUFRPSUHHQGLGRVFRPFODUH]DTXDQGRVH FRQVHJXHLQWHUSUHWDUVHXVLJQLILFDGRHPWHUPRVGHQtYHOPDLVEDL[R 2 PDWHULDO DSUHVHQWDGR WDPEpP SHUPLWH UHXQLU FRQKHFLPHQWRV GH iUHDV TXH QRUPDOPHQWH VmR WUDWDGDV HP VHSDUDGR FRPR VLVWHPDV GLJLWDLV H WpFQLFDV GH SURJUDPDomR(VWDLQWHJUDomRpIXQGDPHQWDOSDUDTXHVHSRVVDFRPSUHHQGHUR IXQFLRQDPHQWRGHXPVLVWHPDFRPSXWDFLRQDOHPWRGRVRVQtYHLVHIRUQHFHDV EDVHVSDUDRUDFLRFtQLRQHFHVViULRHPDQiOLVHSURMHWRHWHVWHGHVLVWHPDV

,QVWUXo}HVGR
(VWD VHomR DSUHVHQWD DOJXPDV FDUDFWHUtVWLFDV GDV LQVWUXo}HV GR  TXH IDFLOLWDPVXDFRPSUHHQVmRHPHPRUL]DomR 2 FRQMXQWR FRPSOHWR GH LQVWUXo}HV p DSUHVHQWDGR QR DQH[R  H SDUD XPD GHVFULomR GHWDOKDGD GH FDGD LQVWUXomR UHFRPHQGDVH FRQVXOWDU >,QWH@ RX >9LVF@

3URJUDPDomRGR



)RUPDWR
$VLQVWUXo}HVFRQVLVWHPGHGRLVFDPSRVRFDPSRGHFyGLJR RSFRGH HRFDPSR GRV RSHUDQGRV 2 RSFRGH GL] R TXH D LQVWUXomR ID] H SRU LVVR HVWi VHPSUH SUHVHQWH H p R SULPHLUR E\WH GH WRGDV DV LQVWUXo}HV 2V RSHUDQGRV SRGHP RFXSDUDWpGRLVE\WHVGHPRGRTXHRFRPSULPHQWRWRWDOGHXPDLQVWUXomRGR YDULDGHXPDWUrVE\WHV3RUH[HPSORDLQVWUXomR5/&QmRQHFHVVLWDGH PDLRUHV LQIRUPDo}HV SDUD VDEHU TXH GHYH URWDFLRQDU R FRQWH~GR GR DFXPXODGRUpXPDLQVWUXomRGHE\WH-iDLQVWUXomR&3,SUHFLVDGHPDLVXP E\WHSDUDFRPSDUDUFRPRDFXPXODGRUHDLQVWUXomR/;,%GDGR!SUHFLVD GHGRLVE\WHVSDUDIRUPDURGDGRGHELWV 4XDVH WRGDV DV LQVWUXo}HV ID]HP UHIHUrQFLD D XP RX PDLV UHJLVWUDGRUHV GR SURFHVVDGRU LGHQWLILFDGRV SHODV OHWUDV $ % & ' ( + H / $OJXPDV LQVWUXo}HVUHIHUHQFLDPHVVHVUHJLVWUDGRUHVDRVSDUHVDJUXSDQGRRVGDVHJXLQWH IRUPD % FRP & ' FRP ( + FRP / H $ FRP RV IODJV (VVHV SDUHV VmR LGHQWLILFDGRVUHVSHFWLYDPHQWHSRU%'+H36: $OHWUD0pXWLOL]DGDSDUDUHIHUHQFLDULQGLUHWDPHQWHRFRQWH~GRGHXPDSRVLomR GHPHPyULD2HQGHUHoRXWLOL]DGRSHODVLQVWUXo}HVTXHXVDPHVVHPHFDQLVPRp RFRQWH~GRGRSDU+/QRLQVWDQWHGDVXDH[HFXomR(VWHPHFDQLVPRp~WLOQD YDUUHGXUDGHWDEHODVRXYHWRUHV 2VGDGRVSRGHPVHUGHRXGHELWVGHSHQGHQGRGRHQYROYLPHQWRGHXP ~QLFR UHJLVWUDGRU RX GH XP SDU GH UHJLVWUDGRUHV 2V HQGHUHoRV WrP  ELWV TXDQGRVHUHIHUHPDXPDSRVLomRGHPHPyULDHELWVTXDQGRVHUHIHUHPDXP HQGHUHoRGH(6 0QHP{QLFRVFRPDOHWUD;UHIHUHPVHDRSHUDo}HVUHDOL]DGDVVREUHXPSDUGH UHJLVWUDGRUHVRXXPUHJLVWUDGRUGHELWV$LQVWUXomR'&;%SRUH[HPSOR GHFUHPHQWDRSDU%&HDLQVWUXomR,1;63LQFUHPHQWDRVWDFNSRLQWHU 9DORUHV QXPpULFRV FRQWLGRV QDV LQVWUXo}HV VmR GHQRPLQDGRV GDGRV LPHGLDWRV (VWHV SRGHP VHU H[SUHVVRV HP GLIHUHQWHV VLVWHPDV GH QXPHUDomR LQGLFDGRV SRU XPD OHWUD DGLFLRQDGD j GLUHLWD GR GDGR + KH[DGHFLPDO  ' RX 7 GHFLPDO 4 RFWDO RX% ELQiULR 1~PHURVVHPLQGLFDGRUVmRFRQVLGHUDGRV GHFLPDLV2VGDGRVH[SUHVVRVHPKH[DGHFLPDOGHYHPLQLFLDUVHPSUHFRPXP GtJLWR QXPpULFR SRU H[HPSOR )$&$+ GHYH VHU HVFULWR )$&$+  &DVR FRQWUiULR QmR VmR LQWHUSUHWDGRV FRPR VtPERORV QXPpULFRV PDV FRPR ODEHOV RXVLQ{QLPRVGHILQLGRSHORXVXiULR&RQVWDQWHVHPFyGLJR$6&,,SRGHPVHU UHSUHVHQWDGDVHQWUHDSyVWURIRV SRUH[HPSORYRQ1HXPDQQ 



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

&ODVVLILFDomR
$VLQVWUXo}HVGRFODVVLILFDPVHHPTXDWURWLSRV LQVWUXo}HV OyJLFDV H DULWPpWLFDV TXH SHUPLWHP HIHWXDU RSHUDo}HV FRPR DGLomR VXEWUDomRGHVORFDPHQWRGHELWVFRPSOHPHQWRLQFUHPHQWRHDMXVWHGHFLPDO $1'25;25$',$''68%$1,5$/'$$HWF  LQVWUXo}HV GH WUDQVIHUrQFLD GH GDGRV TXH SHUPLWHP WUDQVIHULU GDGRV HQWUH UHJLVWUDGRUHVPHPyULDHSHULIpULFRV 029,1/'$386+HWF  LQVWUXo}HVGHGHVYLRTXHSHUPLWHPDOWHUDUDVHTrQFLDQRUPDOGHH[HFXomRGR SURJUDPD DWUDYpV GH FKDPDGDV H UHWRUQRV GH VXEURWLQDV RX VDOWRV -03 &$//5(7-1=51=&&567HWF  LQVWUXo}HV GH FRQWUROH GR SURFHVVDGRU TXH SHUPLWHP FRQWURODU VHX HVWDGR GH H[HFXomRWDLVFRPRDUHWHQomR +/7 RXDKDELOLWDomRGHLQWHUUXSo}HV

)RUPDWRGHXPDOLQKDGHFyGLJR$VVHPEO\
&DGD OLQKD GH XP SURJUDPD HP $VVHPEO\ SRGH DSUHVHQWDU RV VHJXLQWHV FDPSRV ODEHO UyWXOR  PQHP{QLFR RSHUDQGRV H FRPHQWiULR e LPSRUWDQWH VDOLHQWDUTXHRVODEHOVGHYHPVHUHVFULWRVVHPSUHDSDUWLUGDSULPHLUDFROXQDGH FDGDOLQKDHTXHLQVWUXo}HVHGLUHWLYDVQmRSRGHPFRPHoDUQDSULPHLUDFROXQD 2VFDPSRVVmRGHOLPLWDGRVDWUDYpVGHDOJXQVVtPERORVSUySULRVXPRXPDLV HVSDoRV HP EUDQFR SHUPLWHP VHSDUDU GRLV FDPSRV GRLV SRQWRV   SHUPLWHP HVSHFLILFDURILQDOGRFDPSRGHXPODEHORSRQWRHYtUJXOD  PDUFDRLQtFLR GR FDPSR GH FRPHQWiULRV H D YtUJXOD   SHUPLWH VHSDUDU GRLV RSHUDQGRV 2V FRPHQWiULRVHQFHUUDPVHDXWRPDWLFDPHQWHQRILQDOGDOLQKD8PH[HPSORGH OLQKDFRPWRGRVHVVHVHOHPHQWRVp
START: MVI A,00H ; Inicializa contador

1HVWH H[HPSOR START p XP ODEHO H MVI p R PQHP{QLFR GD LQVWUXomR 2V RSHUDQGRVVmRAH00H 2 XVR GRV ODEHOV DXPHQWD D FODUH]D H D IDFLOLGDGH GH PDQXWHQomR GRV SURJUDPDV H OLYUD R SURJUDPDGRU GR FiOFXOR GH HQGHUHoRV SDUD FRORFDU QDV LQVWUXo}HV 3RU H[HPSOR SDUD ID]HU XP GHVYLR SDUD XPD GHWHUPLQDGD OLQKD EDVWD HWLTXHWiOD FRP XP ODEHO H GHSRLV XVDU HVWH ODEHO FRPR RSHUDQGR GD LQVWUXomRGHGHVYLR
LOOP: MOV INX CMP JNZ A,M H L,B LOOP

; Instruo de desvio

3URJUDPDomRGR



2DVVHPEOHUVHHQFDUUHJDGHFDOFXODURHQGHUHoRGDOLQKDGHGHVWLQRHWLTXHWDGD FRP LOOP3RUH[HPSORVHHVVDOLQKDFDLUQRHQGHUHoR + RDVVHPEOHU JHUDUi QD ~OWLPD OLQKD GR WUHFKR D LQVWUXomR JMP 2010H H FRUULJLUi HVWH HQGHUHoRVHPSUHTXHRWUHFKRPXGDUGHOXJDU6HRSURJUDPDGRURSWDVVHSRU QmRXWLOL]DURODEHOWHULDTXHID]HUHVVDFRUUHomRPDQXDOPHQWH

'LUHWLYDVGRDVVHPEOHU
$V GLUHWLYDV GH PRQWDJHP SHUPLWHP GHILQLU VtPERORV HVWDEHOHFHU HQGHUHoRV HVSHFtILFRV SDUD GHWHUPLQDGRV WUHFKRV GR SURJUDPD FRPR SRU H[HPSOR R HQGHUHoRLQLFLDO  RXDLQGDUHVHUYDUiUHDVGHPHPyULDSDUDYDULiYHLVJOREDLVe LPSRUWDQWH OHPEUDU VHPSUH TXH DV GLUHWLYDV QmR ID]HP SDUWH GR FRQMXQWR GH LQVWUXo}HVGRSURFHVVDGRUHTXHQmRJHUDPFyGLJRELQiULR $V SULQFLSDLV GLUHWLYDV XWLOL]DGDV HP SURJUDPDV SDUD R  VmR GHVFULWDV D VHJXLUDFRPSDQKDGDVGHH[HPSORV

QRPH!'%YDORULQLFLDO!
$GLUHWLYD'% GHILQHE\WH SHUPLWHUHVHUYDUiUHDVGHPHPyULDHLGHQWLILFDUHVVDV iUHDVFRPXPQRPH2QRPHXWLOL]DGRQDGLUHWLYDWRUQDVHXPVLQ{QLPRSDUD R HQGHUHoR GR SULPHLUR E\WH UHVHUYDGR 8PD YH] TXH p SRVVtYHO UHIHUHQFLDU HVVH QRPH D SDUWLU GH TXDOTXHU SRQWR GR SURJUDPD R HVSDoR UHVHUYDGR p FRQKHFLGRFRPRXPDYDULiYHOJOREDO$VGLUHWLYDVFLWDGDVSHUPLWHPDLQGDDWULEXLU YDORUHVLQLFLDLVDHVVDVYDULiYHLVFRQIRUPHLOXVWUDPRVH[HPSORVDVHJXLU
V1 DB 200

FULDXPDYDULiYHOJOREDOGHE\WHFXMRYDORULQLFLDOp2VtPEROR V1SDVVD DVHUXPVLQ{QLPRSDUDRHQGHUHoRGDYDULiYHO$HVFROKDGHVWHHQGHUHoRSRGH VHU IHLWD SHOR SURJUDPDGRU DWUDYpV GD GLUHWLYD 25* Y DGLDQWH  RX HQWmR GHL[DGD D FDUJR GR DVVHPEOHU 1HVWH FDVR D YDULiYHO VHUi VLPSOHVPHQWH FRORFDGDQDVHTrQFLDGHWXGRTXHRDVVHPEOHUYLQKDFULDQGRDWpDOL $ OLQKDDVHJXLUFULDXPDYDULiYHOJOREDOGHE\WHVLQLFLDOL]DGRV FRQIRUPH D VHTrQFLD GDGD SRGH VHU LQWHUSUHWDGD FRPR XPD WDEHOD FXMR SULPHLUR HOHPHQWRUHVLGHQRHQGHUHoRV2
V2 P1 DB 1,2,3 DB MIC

$OLQKDVHJXLQWHGHILQHXPDFDGHLDGHFDUDFWHUHVRXVWULQJRFXSDQGRE\WHV 2VYDORUHVLQLFLDLVGRVE\WHVFULDGRVSHODOLQKDDFLPDFRUUHVSRQGHPDRFyGLJR $6&,,GHFDGDFDUDFWHUUHVSHFWLYDPHQWH'++H+



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

25*HQGHUHoR!
2 VtPEROR 25* YHP GD SDODYUD LQJOHVD RULJLQ (VWD GLUHWLYD HVWDEHOHFH R HQGHUHoRHPTXHRDVVHPEOHUFRORFDUiDSUy[LPDLQVWUXomRRXYDULiYHOJOREDO e XWLOL]DGD SDUD GHWHUPLQDU R HQGHUHoR LQLFLDO GR SURJUDPD H D SRVLomR GH RXWURV WUHFKRV GH FyGLJR TXDQGR VH GHVHMD TXH HVWHV UHVLGDP QXP HQGHUHoR EHP GHWHUPLQDGR FRPR QR FDVR GRV WUDWDGRUHV GH LQWHUUXSomR 4XDQGR VHJXLGD SRU XPD GDV GLUHWLYDV GH UHVHUYD GH iUHD GH PHPyULD YLVWDV DFLPD VHUYH SDUD GHWHUPLQDU D SRVLomR GH XPD iUHD GH GDGRV 8P SURJUDPD SRGH FRQWHUYiULDVGLUHWLYDV25* 2 HQGHUHoR SRGH VHU IRUQHFLGR QD IRUPD DEVROXWD XP YDORU JHUDOPHQWH HP KH[DGHFLPDO RXUHODWLYDjSRVLomRGDOLQKDDWXDOFXMRHQGHUHoRpUHSUHVHQWDGR SHORVtPEROR $3RUH[HPSOR
ORG 2000H

UHIHUHVHjSRVLomRGHPHPyULDFXMRHQGHUHoRp+H
ORG $+100

WUDQVIHUHRSRQWRGHFRQWLQXDomRGDPRQWDJHPE\WHVDGLDQWH

VLQ{QLPR!(48YDORU!
3HUPLWHDVVRFLDUXPQRPHDXPYDORU3RUH[HPSOR
LIMIT EQU 0FFH

SHUPLWH XWLOL]DU R VtPEROR /,0,7 FRPR VLQ{QLPR SDUD R YDORU ))+ HP TXDOTXHUSDUWHGRSURJUDPD 2XVRGHVLQ{QLPRVpDOWDPHQWHUHFRPHQGiYHOSRUGXDVUD]}HVSULQFLSDLV DXPHQWDPDTXDOLGDGHGRSURJUDPDSRUIDFLOLWDUHPVHXHQWHQGLPHQWR IDFLOLWDPDPDQXWHQomRVHRYDORUSUHFLVDUVHUPRGLILFDGR1HVWHFDVREDVWD DOWHUDU D GLUHWLYD SDUD UHGHILQLU R YDORU VH QmR VH XWLOL]DVVH R VLQ{QLPR R YDORU XWLOL]DGR WHULD TXH VHU PRGLILFDGR HP WRGRV RV SRQWRV GR SURJUDPD RQGHWLYHVVHVLGRFRORFDGR

(1'
,QGLFDRILPGRSURJUDPDIRQWHDRDVVHPEOHUTXHLJQRUDTXDOTXHUOLQKDHVFULWD DSyVHVWDGLUHWLYD6XDSUHVHQoDpREULJDWyULDQRILQDOGRSURJUDPDVRESHQD GHRDVVHPEOHUVHSHUGHUeLPSRUWDQWHOHPEUDUGHFRORFDUHVSDoRVQRLQtFLR GDOLQKDSRLVWUDWDVHGHXPDGLUHWLYDHQmRGHXPODEHO $WDEHODUHVXPHDVGLUHWLYDVDSUHVHQWDGDV

3URJUDPDomRGR 'LUHWLYD 25* (48 '%YDORU! '%YDORU! '%VWULQJ! (1' )XQomR 'HILQLUHQGHUHoR &ULDUVLQ{QLPR &ULDUYDULiYHO &ULDUYHWRUHV &ULDUVWULQJV$6&,, )LQDOGHSURJUDPD ([HPSOR
ORG 2000H TAMANHO EQU 25H COUNT TABELA MSG DB 00H DB 15H, 22H, ... DB END Mensagem 1



7DE'LUHWLYDVGDOLQJXDJHP$VVHPEO\GR

(WDSDVGRGHVHQYROYLPHQWRHP$VVHPEO\
8P SURJUDPD HP GHVHQYROYLPHQWR VRIUH GLYHUVDV WUDQVIRUPDo}HV GHVGH R PRPHQWRHPTXHpHGLWDGRDWpFKHJDUjVXDIRUPDH[HFXWiYHO1RUPDOPHQWH HVWDVWUDQVIRUPDo}HVVmRUHDOL]DGDVFRPRDX[tOLRGHIHUUDPHQWDVGHGLFDGDV$V HWDSDVTXHFRPS}HPRSURFHVVRGHGHVHQYROYLPHQWRVmRWLSLFDPHQWH JHUDomR GR FyGLJRIRQWH HP TXH VH HVFUHYH XWLOL]DQGR XP HGLWRU GH WH[WR R SURJUDPD HP OLQJXDJHP $VVHPEO\ HVWH SRGH FRPSUHHQGHU XP RX PDLV DUTXLYRVIRQWH WUDGXomRGRFyGLJRIRQWHHPTXHRDVVHPEOHUJHUDXPDUTXLYRREMHWRSDUDFDGD DUTXLYRIRQWH HGLomRGHOLJDo}HVRXOLQNDJHPHPTXHXPDIHUUDPHQWDFKDPDGD OLQNHUXQHRV GLYHUVRV DUTXLYRVREMHWR QXP DUTXLYR XWLOL]iYHO SDUD H[HFXomR RX VLPXODomR FULDomR  RX PDQXWHQomR GH ELEOLRWHFDV GH FyGLJRREMHWR RQGH VH DUPD]HQDP VXEURWLQDVSDVVtYHLVGHUHDSURYHLWDPHQWRHPRXWURVSURJUDPDV

([HPSORGHSURJUDPDHP$VVHPEO\
2SURJUDPDDVHJXLUpSUHYLVWRSDUDH[HFXomRQR$EDFXVGHVFULWRQRFDStWXOR  /(7(&/$ H 02675$' VmR VXEURWLQDV VLPXODGDV HP 520 TXH SHUPLWHPUHVSHFWLYDPHQWHOHUXPGtJLWRKH[DGHFLPDOGRWHFODGRHPRVWUDUR FRQWH~GRGRSDUGHUHJLVWUDGRUHV'(QRFDPSRGHHQGHUHoRVGRGLVSOD\6HXV HQGHUHoRVGHIDXOWDSDUHFHPQDILJXUD 2SURJUDPDGHYHHIHWXDUDPXOWLSOLFDomRGHGRLVQ~PHURVKH[DGHFLPDLVGH ELWVHDSUHVHQWDURUHVXOWDGRTXHWHUiQRPi[LPRTXDWURGtJLWRV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

2SURJUDPDSULQFLSDO
2 SURJUDPD SULQFLSDO GHYH VHU HVFULWR GH IRUPD TXH VXD OHLWXUD SHUPLWD FRPSUHHQGHU LPHGLDWDPHQWH R TXH R SURJUDPD WRGR ID] 3RU LVVR VHUYLoRV DX[LOLDUHVFRPRDOHLWXUDGRVGDGRVRXVXDDSUHVHQWDomRQRGLVSOD\GHYHPVHU GHOHJDGRV SDUD VXEURWLQDV SDUD QmR GHVYLDU D DWHQomR GH TXHP WHQWD FRPSUHHQGHU R SURJUDPD 'HVWD IRUPD R GHVHQYROYLPHQWR GR SURJUDPD SULQFLSDOVHUYHWDPEpPGHJXLDSDUDGHWHUPLQDUTXDLVVmRDVGHPDLVVXE URWLQDV TXHFRQVWLWXLUmRRSURJUDPD 2V FRPHQWiULRV VmR HVFULWRV VHP FDUDFWHUHV DFHQWXDGRV SRUTXH HVWHV FULDP SUREOHPDVSDUDRDVVHPEOHU
LETECLA EQU 02E7H MOSTRAD EQU 0363H ORG 2000H INICIO: LXI SP,20C0H LOOP0: CALL LE_DADO MOV B,A CALL LE_DADO MOV C,A CALL MULT CALL MOSTRAD JMP LOOP0 ; ; ; ; ; ; ; ; ; ; ; sinonimos para sub-rotinas em ROM endereco inicial do programa define inicio da pilha leitura de N1 (acumulador) copia N1 para o registrador B leitura de N2 (acumulador) copia N2 para o registrador C DE = C * B apresenta resultado reinicia

$OHLWXUDGHGDGRV
2SURJUDPDSULQFLSDODFLPDSUHFLVDGHXPDVXE URWLQDFKDPDGD/(B'$'2 SDUDID]HUDOHLWXUDGHFDGDXPGRVQ~PHURVKH[DGHFLPDLVGHGRLVGtJLWRV(VWD GHYHOHYDUHPFRQVLGHUDomRRVVHJXLQWHVSRQWRV D VXEURWLQD /(7(&/$ TXH SRGH VHU XWLOL]DGD SDUD OHU R WHFODGR Or XP GtJLWR GH FDGD YH] SRU LVVR SUHFLVD VHU FKDPDGD GXDV YH]HV SDUD OHU XP Q~PHURGHGRLVGtJLWRV R SULPHLUR GRV GRLV GtJLWRV KH[DGHFLPDLV D VHU OLGR p R GtJLWR PDLV VLJQLILFDWLYR(VWHGHYHVHUPXOWLSOLFDGRSRUHWUDQVIHULGRGRDFXPXODGRU SDUD XP RXWUR UHJLVWUDGRU SDUD QmR VHU DSDJDGR QD FKDPDGD VHJXLQWH GH /(7(&/$ RQ~PHURKH[DGHFLPDOGHGRLVGtJLWRVVHUiREWLGRDWUDYpVGHXPDRSHUDomR 28 HQWUH R UHJLVWUDGRU TXH DUPD]HQD R GtJLWR PDLV VLJQLILFDWLYR Mi PXOWLSOLFDGRSRUHRGtJLWRPHQRVVLJQLILFDWLYR RQ~PHURREWLGRGHYHVHUUHWRUQDGRQRDFXPXODGRU &RPLVVRDVXEURWLQDGHOHLWXUDILFDDVVLP

3URJUDPDomRGR
LE_DADO:CALL LETECLA RLC RLC RLC RLC MOV E,A CALL LETECLA ORA E RET ; le o digito mais significativo



; ; ; ; ;

multiplica-o por 16 digito mais significativo em E le digito menos significativo compoe numero de dois digitos retorna com numero em A

$VXEURWLQDGHPXOWLSOLFDomR
$ VXEURWLQD 08/7 GHYH PXOWLSOLFDU GRLV Q~PHURV KH[DGHFLPDLV GH  ELWV FRQWLGRVHP%H&HFRORFDURUHVXOWDGRGHVWDPXOWLSOLFDomRQRSDU'( 3RGHVHFRPHoDUFULDQGRXPDVXE URWLQDTXHPXOWLSOLFDGRLVQ~PHURVGHGRLV GtJLWRV QH QFRPUHVXOWDGRGHGRLVGtJLWRV YiOLGDVRPHQWHSDUDRVFDVRVHP TXHRUHVXOWDGRGDPXOWLSOLFDomRpLQIHULRUD  $ PXOWLSOLFDomR GH Q H Q VHUi HIHWXDGD VRPDQGR VH Q YH]HV R RSHUDQGR Q &RQVLGHUDQGR TXH RV UHJLVWUDGRUHV % H & FRQWrP UHVSHFWLYDPHQWH RV RSHUDQGRV QH QRWUHFKRGHFyGLJRDVHJXLUID]DPXOWLSOLFDomRHDSUHVHQWDR UHVXOWDGRQRUHJLVWUDGRU(
MULT: LOOP1: MVI ADD DCR JNZ MOV RET A,00 B C LOOP1 E,A ; ; ; ; ; ; inicializacao acrescenta valor de N1 ao acumulador decrementa o conteudo de C repete a soma N2 vezes transfere o resultado para E retorno com resultado em E

$VHJXLUHVWDVXEURWLQDGHYHVHUHVWHQGLGDSDUDWUDWDUUHVXOWDGRVFRPGtJLWRV KH[DGHFLPDLV LQFOXLQGR DVVLP D SRVVLELOLGDGH GH R UHVXOWDGR VHU VXSHULRU D 3DUDWDQWREDVWDLQFUHPHQWDURUHJLVWUDGRU' TXHYDLDSUHVHQWDURVGRLV GtJLWRVPDLVVLJQLILFDWLYRV FDGDYH]TXHRUHVXOWDGRGDDGLomRQRDFXPXODGRU XOWUDSDVVDUFRQIRUPHLQGLFDGRSHOR&DUU\)ODJ
MULT: LOOP1: CONT: MVI MVI ADD JNC INR DCR JNZ MOV RET D,00 A,00 B CONT D C LOOP1 E,A ; inicializacoes ; soma N1 ao acumulador ; vai 1? ; incrementa D se a soma passa de FF ; repete a soma N2 vezes ; transfere o resultado para E ; retorno com resultado no par DE

2SURJUDPDFRPSOHWRFRQVLVWHHQWmRGRSURJUDPDSULQFLSDOHGDVVXE URWLQDV 08/7 H /(B'$'2 2 DUTXLYRIRQWH SUHFLVD FRQWHU DLQGD XPD GLUHWLYD (1' QR ILQDO &RQVXOWH R FDStWXOR  SDUD FRQWLQXDU FRP D PRQWDJHP H D H[HFXomRQR$EDFXV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

2XWURVWUHFKRVGHFyGLJR
(VWDVHomRDSUHVHQWDDOJXQVWUHFKRVGHFyGLJRWtSLFRVGHSURJUDPDV$VVHPEO\ 6HX HVWXGR p GH JUDQGH YDOLD SDUD DXPHQWDU DV KDELOLGDGHV GH SURJUDPDomR YLVWR TXH DV WDUHIDV GLVFXWLGDV DSDUHFHP FRP JUDQGH IUHTrQFLD QD SURJUDPDomRGHTXDOTXHUPLFURSURFHVVDGRU2VWUHFKRVDSUHVHQWDGRVGmRXPD LGpLD GH FRPR FRPSLODGRUHV GH OLQJXDJHQV GH DOWR QtYHO LPSOHPHQWDP RV FRPDQGRVGHWRPDGDGHGHFLVmR(if)HGHUHSHWLomR(while, for)

7RPDQGRGHFLV}HV
7RPDUXPDGHFLVmRHP$VVHPEO\pVHPSUHXPSURFHVVRGHGXDVHWDSDVXPD FRPSDUDomR VHJXLGD GH XP GHVYLR FRQGLFLRQDO $ RSHUDomR GH FRPSDUDomR WHP SRU IXQomR SUHSDUDU RV IODJV SDUD D RSHUDomR GH GHVYLR $V GLIHUHQWHV LQVWUXo}HV GH GHVYLR FRQGLFLRQDO SRGHP VHU XWLOL]DGDV SDUD LPSOHPHQWDU GLYHUVRVFULWpULRVGHGHFLVmR 2V H[HPSORV D VHJXLU H[SORUDP HVVDV SRVVLELOLGDGHV (P WRGRV RV H[HPSORV TXHFRPSDUDPGRLVQ~PHURVDVVXPHVHTXHHVWHVVHFKDPDP;H<HTXHVH HQFRQWUDPUHVSHFWLYDPHQWHQRVUHJLVWUDGRUHV$H%

([HFXomRGHXPEORFRGHLQVWUXo}HVVH; <
CMP B JNZ CONT ... CONT: ; seta flags de acordo com X - Y ; salta se X Y ; instrues executadas se X = Y ; ponto de continuao do programa

< ([HFXomRGHXPEORFRGHLQVWUXo}HVVH;
CMP B JZ CONT ... CONT: ; seta flags de acordo com X - Y ; salta se X = Y ; instrues executadas se X Y ; ponto de continuao do programa

< ([HFXomRGHXPEORFRGHLQVWUXo}HVVH;
CMP B JC CONT ... CONT: ; seta flags de acordo com X - Y ; salta se X < Y ; instrues executadas se X Y ; ponto de continuao do programa

3URJUDPDomRGR



([HFXomRGHXPEORFRGHLQVWUXo}HVVH;!<
CMP B JC CONT JZ CONT ... CONT: ; seta flags de acordo com X - Y ; salta se X < Y ; salta se X = Y ; instrues executadas se X > Y ; ponto de continuao do programa

([HFXomRGHXPEORFRGHLQVWUXo}HVVH;<
CMP B JZ OK JNC CONT OK: CONT: ... ; seta flags de acordo com X - Y ; salta se X = Y ; salta se X Y ; instrues executadas se X Y ; ponto de continuao do programa

([HFXomRGHXPEORFRGHLQVWUXo}HVVH;<
CMP B JNC CONT ... CONT: ; seta flags de acordo com X - Y ; salta se X Y ; instrues executadas se X < Y ; ponto de continuao do programa

2 SUy[LPR H[HPSOR LPSOHPHQWD XPD FRQVWUXomR GR WLSR if.. then...


elseFRPXPHPOLQJXDJHQVGHDOWRQtYHO

([HFXomRGHXPEORFRVH; <HGHRXWURVH;<
CMP B JNZ DIFF ... JMP CONT DIFF: CONT: ... ; seta flags de acordo com X - Y ; salta se X Y ; instrues executadas se X = Y ; salto para isolar o bloco seguinte ; instrues executadas se X Y ; ponto de continuao do programa

1RWH R XVR GDV LQVWUXo}HV -& H -1& QRV H[HPSORV HP TXH p SUHFLVR GHWHUPLQDU VH ; p PDLRU RX PHQRU GR TXH < 2 FDUU\ IODJ LQGLFD VH KRXYH HPSUHVWD  QD VXEWUDomR IHLWD SHOD LQVWUXomR GH FRPSDUDomR 6H KRXYH &<  HQWmRRYDORUGRDFXPXODGRUpPHQRUGRTXHRGRUHJLVWUDGRUXVDGR VHQmRKRXYH &<  HQWmRpPDLRURXLJXDO $WHQomR SDUD R FyGLJR D VHJXLU TXH HPSUHJD D LQVWUXomR -0 QR OXJDU GH -& SDUDH[HFXWDUXPEORFRVH; <



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
CMP B JM CONT ... ; seta flags de acordo com X - Y ; desejamos saltar se X < Y ; instrues a executar se X Y ; ponto de continuao do programa

CONT:

(VWH FyGLJR WDPEpP IXQFLRQD PDV DSHQDV HQTXDQWR $  %  + 6H HVWD FRQGLomRQmRHVWLYHUVDWLVIHLWDDLQVWUXomRGHFRPSDUDomRVHWDRVLJQIODJHR FyGLJRSDVVDDVHFRPSRUWDUGHIRUPDFRQWUiULDjHVSHUDGD3RUH[HPSORSDUD $  + H %  + R UHVXOWDGR GD VXEWUDomR LQWHUQD p + TXH p LQWHUSUHWDGR FRPR XP Q~PHUR QHJDWLYR $VVLP R FyGLJR DFLPD FRQVLGHUDULD +PHQRUGRTXH+(VWHSUREOHPDQmRDFRQWHFHDRVHXVDURFDUU\IODJH p SRU LVVR TXH R FRUUHWR p XWLOL]DU DV LQVWUXo}HV -& H -1& SDUD ID]HU DV FRPSDUDo}HV $V LQVWUXo}HV -0 H -3 GHYHP VHU XWLOL]DGDV TXDQGR IRU QHFHVViULRGHWHUPLQDUVHRUHVXOWDGRGHXPDRSHUDomRpXPQ~PHURSRVLWLYR RXQHJDWLYR 2V SUy[LPRV H[HPSORV LPSOHPHQWDP FRQGLo}HV GXSODV GH WHVWH 3DUD WDQWR FRQVLGHUHTXHVHWUDEDOKDDJRUDFRPTXDWURQ~PHURV;<=H:FRQWLGRV UHVSHFWLYDPHQWHQRVUHJLVWUDGRUHV$%&H'

([HFXomRGHXPEORFRGHLQVWUXo}HVVH; <(: =
CMP B JNZ CONT MOV A,C CMP D JNZ CONT ... CONT: ; ; ; ; ; ; seta flags de acordo com X - Y se falhar a primeira condio, no preciso testar a segunda assume-se que X pode ser destrudo seta flags de acordo com W e Z salta se falhar a segunda condio

; instrues executadas se X = Y ; ponto de continuao do programa

([HFXomRGHXPEORFRGHLQVWUXo}HVVH; <28: =
CMP B JZ OK MOV A,C CMP D JNZ CONT OK: CONT: ... ; ; ; ; ; ; seta flags de acordo com X - Y se OK na primeira, no preciso testar a segunda assume-se que X pode ser destrudo seta flags de acordo com W e Z salta se falhar a segunda condio

; instrues executadas se X = Y ; ponto de continuao do programa

3URJUDPDomRGR



5HSHWLo}HV
$V UHSHWLo}HV VmR PXLWR FRPXQV HP WRGRV RV WLSRV GH SURJUDPDV 1DV OLQJXDJHQV GH DOWR QtYHO DV HVWUXWXUDV GH UHSHWLomR LPSOHPHQWDGDV SHORV H[HPSORVDVHJXLUFRUUHVSRQGHPDFRPDQGRVFRPR for

/RRSLQILQLWR
LOOP: ... ; bloco de instrues a repetir indefinidamente JMP LOOP

/RRSUHSHWLGR&YH]HVVH& pH[HFXWDGRYH]HV
LOOP: ... DCR C JNZ LOOP ; bloco de instrues a repetir ; no deve alterar o valor de C ; decrementa C e seta flags;

/RRSUHSHWLGR&YH]HVVH& QmRpH[HFXWDGR
MVI A,00H CMP C JZ CONT ... DCR C JNZ LOOP CONT: ...

LOOP:

; bloco de instrues a repetir ; no deve alterar o valor de C ; decrementa C e seta flags; ; continuao do programa

$V FRQGLo}HV DSUHVHQWDGDV QR LWHP  SRGHP WDPEpP DSDUHFHU FRPR FULWpULRVGHHQFHUUDPHQWRGDVUHSHWLo}HV$VVLPpSRVVtYHOUHSHWLUXPEORFRGH LQVWUXo}HV HQTXDQWR XPD FHUWD FRQGLomR IRU YHUGDGHLUD FRPR SRU H[HPSOR ;!<RX; <eLVVRTXHFULDXPFRPDQGRwhile

&DVRVSDUWLFXODUHVGHPXOWLSOLFDomR
4XDQGR R UHVXOWDGR GD PXOWLSOLFDomR GH GRLV Q~PHURV QmR XOWUDSDVVD R WDPDQKRGRDFXPXODGRU ))+QRFDVRGRVSURFHVVDGRUHVGHELWV pSRVVtYHO HIHWXDU D PXOWLSOLFDomR SRU GHVORFDPHQWR GH ELWV DR LQYpV GH HPSUHJDU D UHSHWLomR GD VRPD 2 PpWRGR EDVHLDVH QR IDWR GH TXH GHQWUR GHVVDV FRQGLo}HV D RSHUDomR 5/& DFUHVFHQWD XP ]HUR j GLUHLWD GR PXOWLSOLFDQGR H SRUWDQWR PXOWLSOLFDR SRU  $SOLFDQGRVH HVWD RSHUDomR YiULDV YH]HV H JXDUGDQGRRVUHVXOWDGRVLQWHUPHGLiULRVGHIRUPDFRQYHQLHQWHSRGHVHHIHWXDU



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

DPXOWLSOLFDomRGHGRLVQ~PHURVTXDLVTXHUFRQIRUPHLOXVWUDPRVH[HPSORVD VHJXLU(PWRGRVHOHVRYDORULQLFLDOGRDFXPXODGRUpUHSUHVHQWDGRSHODOHWUD[

0XOWLSOLFDomRSRU
(VWHpXPGRVFDVRVPDLVVLPSOHVSRLV $VVLPEDVWDDVHTrQFLD
RLC RLC RLC RLC ; ; ; ; A A A A = = = = 2x 4x 8x 16x

SDUDPXOWLSOLFDUSRURFRQWH~GRGRDFXPXODGRU(PJHUDODPXOWLSOLFDomR SRU3VHID]FRPQRSHUDo}HV5/&RXQRSHUDo}HV55&

0XOWLSOLFDomRSRU
$PXOWLSOLFDomRSRUVHID]FRPDX[tOLRGHXPUHJLVWUDGRULQWHUPHGLiULR
RLC MOV B,A RLC RLC ADD B ; ; ; ; ; A B A A A = = = = = 2x 2x 4x 8x 8x + 2x = 10x

0XOWLSOLFDomRSRU
3ULPHLUDVROXomR
MOV B,A RLC ADD B RLC ADD B ; ; ; ; ; B A A A A = = = = = x 2x 3x 6x 7x

6HJXQGDVROXomR VRPHQWHYLiYHOVH[+ 
MOV B,A RLC RLC RLC SUB B ; B = x ; A = 8x ; A = 7x

,QWHUUXSo}HVGR
$V LQWHUUXSo}HV DVVLP FRPR DV VXEURWLQDV FRQVWLWXHP XP PHFDQLVPR GH GHVYLR GRIOX[R GH SURFHVVDPHQWR GH XP SURJUDPD$ UD]mR GDVXDH[LVWrQFLD p XPWLSRGHSUREOHPD TXHDFRQWHFHHPLQ~PHUDVVLWXDo}HVSUiWLFDVRVFDVRV HPTXHXPSURJUDPDGHYHH[HFXWDUXPDFHUWDWDUHIDHPUHVSRVWDjRFRUUrQFLD GHXPHYHQWRH[WHUQR([HPSORVGHHYHQWRVH[WHUQRVVmRRSUHVVLRQDUGHXP ERWmRDUHFHSomRGHXPGDGRQXPDSRUWDVHULDODDWXDomRGHXPVHQVRURXD RFRUUrQFLDGHXPDODUPH

,QWHUUXSo}HV[VXEURWLQDV
$ SULQFtSLR SDUHFH UD]RiYHO HVFUHYHU R FyGLJR TXH GHYH VHU H[HFXWDGR SRU RFDVLmRGDRFRUUrQFLDGRHYHQWRHPTXHVWmRQDIRUPDGHXPDVXEURWLQDTXH VHULD FKDPDGD TXDQGR R HYHQWR DFRQWHFHVVH (P SULQFtSLR D LGpLD p HVVD PHVPRPDVIDOWDXPPHFDQLVPRTXHQRWLILTXHRSURJUDPDGDRFRUUrQFLDGR HYHQWR6HPLVVRRSURJUDPDQmRSRGHVDEHUTXDQGRRVHYHQWRVDFRQWHFHPH SRUWDQWRQmRVDEHTXDQGRGHYHH[HFXWDUDVXEURWLQD ([LVWHP GXDV DERUGDJHQV EiVLFDV SDUD UHVROYHU HVWH SUREOHPD D SULPHLUD GHQRPLQDGDYDUUHGXUD RXHPLQJOrV SROOLQJ SURQXQFLDVHSyOLQJ FRQVLVWH HP YHULILFDU SHULRGLFDPHQWH XPD SRUWD GH HQWUDGD HVSHUDQGR TXH R HYHQWR H[WHUQRVHMDVLQDOL]DGRSDUDHQWmRH[HFXWDUDVXEURWLQDFRUUHVSRQGHQWH(VWH SULQFtSLR p VLPSOHV PDV R IDWR GH D &38 WHU TXH ILFDU ID]HQGR D YDUUHGXUD SHULRGLFDPHQWHpHPJHUDOLQGHVHMiYHO $ VHJXQGD DERUGDJHP TXH p D TXH QRV LQWHUHVVD DTXL p R XVR GH XPD LQWHUUXSomR 3DUD SHUPLWLU D LPSOHPHQWDomR GHVWH PHFDQLVPR R  FRQWD FRP FLQFR HQWUDGDV GH VLQDO TXH SRGHP VHU DWLYDGDV SRU FRPSRQHQWHV SHULIpULFRVSDUDDQRWLILFDomRGHHYHQWRVH[WHUQRV(PUHVSRVWDDXPHVWtPXOR QXPD GHVVDV HQWUDGDV D &38 GHVYLD R SURFHVVDPHQWR GR SURJUDPD SDUD XP WUHFKR GH FyGLJR VHPHOKDQWH D XPD VXEURWLQD GHQRPLQDGR WUDWDGRU GH LQWHUUXSomRTXHH[HFXWDDVWDUHIDVHVSHFLILFDGDVSDUDDRFRUUrQFLDGRHYHQWR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

1HVWH SRQWR p LQWHUHVVDQWH DQDOLVDU DV GLIHUHQoDV HQWUH VXEURWLQDV H LQWHUUXSo}HV3DUDWDQWRFRQYpPOHPEUDUTXHDVVXEURWLQDVWrPDVVHJXLQWHV FDUDFWHUtVWLFDV VmR WUHFKRV GH FyGLJR ORFDOL]DGRV HP HQGHUHoRV GHILQLGRV SHOR SURJUDPDGRU RGHVYLRSDUDRFyGLJRGHXPDVXEURWLQDDFRQWHFHTXDQGRRSURFHVVDGRU H[HFXWDXPD LQVWUXomR GH GHVYLR GD IRUPD &$// HQGHUHoR GH GHVWLQR! HP TXHpIRUQHFLGRRHQGHUHoRGDVXEURWLQDFKDPDGD R PHFDQLVPR GH UHWRUQR FRQVLVWH HP VDOYDU R HQGHUHoR GD LQVWUXomR VHJXLQWHDR&$//QDSLOKDHUHFXSHUiORTXDQGRGDH[HFXomRGDLQVWUXomR 5(7TXHGHWHUPLQDRUHWRUQRGDVXEURWLQD $VLQWHUUXSo}HVSRUVXDYH]QmRSRGHPXWLOL]DURPHVPRWLSRGHPHFDQLVPR GH FKDPDGD 3RU GHILQLomR HODV SRGHP RFRUUHU D TXDOTXHU PRPHQWR QmR LPSRUWDTXDOVHMDDLQVWUXomRHPH[HFXomR,VWRVLJQLILFDTXHGHYHVHUSRVVtYHO ID]HURGHVYLRVHPDSUHVHQoDGHXPDLQVWUXomRGHGHVYLRRTXHLPSOLFDDLQGD TXHQmRVHSRGHIRUQHFHUXPHQGHUHoRGHGHVWLQRGDIRUPDFRPRVHID]QDV FKDPDGDVGHVXEURWLQDV ([LVWHP GLYHUVDV VROXo}HV SDUD HVWH SUREOHPD $ PDLV VLPSOHV FRQVLVWH HP DWULEXLU D FDGD VLQDO GH LQWHUUXSomR XP HQGHUHoR IL[R QR SURMHWR GR SURFHVVDGRU'DVFLQFRHQWUDGDVGHLQWHUUXSomRGRTXDWURWrPHQGHUHoRV IL[RVFRQIRUPHDWDEHOD 6LQDO 75$3 567 567 567 (QGHUHoR + &+ + &+

7DE(QGHUHoRVGHGHVYLRGDVLQWHUUXSo}HVGR $OpP GHVWDV H[LVWHP RV VLQDLV ,175 LQWHUUXSW UHTXHVW  H ,17$ LQWHUUXSW DFNQRZOHGJH  FRQFHELGRV SDUD SHUPLWLU D FRPXQLFDomR GR  FRP R FRQWURODGRUGHLQWHUUXSo}HVGD,QWHO(VWHFRPSRQHQWHWHPRLWRHQWUDGDV GHLQWHUUXSomRjVTXDLVSRGHPVHUFRQHFWDGRVTXDLVTXHUFLUFXLWRVSHULIpULFRV TXH SUHFLVHP LQWHUURPSHU R SURFHVVDGRU $R UHFHEHU XPD VROLFLWDomR GH LQWHUUXSomRHPXPDGHVXDVHQWUDGDVRDWLYDRVLQDO,175GR(VWH WHUPLQDGHH[HFXWDUDLQVWUXomRHPDQGDPHQWRHHQWmRUHVSRQGHFRPRVLQDO ,17$VLQDOL]DQGRDRTXHRSHGLGRLQWHUUXSomRSRGHVHUDWHQGLGR(P VHJXLGDRFRQWURODGRUGHLQWHUUXSomRFRORFDQREDUUDPHQWRGHGDGRVRFyGLJR GH XPD LQVWUXomR TXH R  H[HFXWDUi HP UHVSRVWD j LQWHUUXSomR (VWD

,QWHUUXSo}HVGR



LQVWUXomRSRGHVHUHVFROKLGDSHORSURJUDPDGRUHSRGHVHUTXDOTXHULQVWUXomR GHFRPSULPHQWRLJXDODE\WHGRFRQMXQWRGHLQVWUXo}HVGR$HVFROKDp IHLWDPHGLDQWHSURJUDPDomRGRSHORSUySULRGXUDQWHD LQLFLDOL]DomR GRSURJUDPD'HVWDIRUPDFDGDHQWUDGDGHLQWHUUXSomRGR  SRGHWHUXP HIHLWRGLIHUHQWHVREUHRSURJUDPD*HUDOPHQWHDVLQVWUXo}HVHVFROKLGDVVmRGR WLSR 567 Y VHomR   UHVXOWDQGR QD FKDPDGD GH XP WUDWDGRU SDUD D LQWHUUXSomRHPTXHVWmR 2WUDWDPHQWRGHLQWHUUXSo}HVQRWHPDVVHJXLQWHVFDUDFWHUtVWLFDV RVWUDWDGRUHVDVVRFLDGRVDRVVLQDLV567567567H75$3VmR WUHFKRVGHFyGLJRORFDOL]DGRVHPHQGHUHoRVIL[RVGHILQLGRVQRSURMHWRGR SURFHVVDGRUDSHQDVSDUDDTXHOHVDVVRFLDGRVDRVLQDO,175H[LVWHXPDFHUWD OLEHUGDGH GH HVFROKD FRQIRUPH RV HQGHUHoRV GH GHVYLR GDV LQVWUXo}HV 567D567 R GHVYLR SDUD R WUDWDGRU DFRQWHFH ORJR DSyV R WpUPLQR GD H[HFXomR GD LQVWUXomRHPDQGDPHQWR DLQVWUXomRTXHHVWiVHQGRSURFHVVDGDQRLQVWDQWH HPTXHDLQWHUUXSomRpGHWHFWDGD GHVGH TXHD LQWHUUXSomRVROLFLWDGDHVWHMD KDELOLWDGDGHDFRUGRFRPRPHFDQLVPRGDVHomR R PHFDQLVPR GH UHWRUQR p LGrQWLFR DR GDV VXEURWLQDV R HQGHUHoR GD LQVWUXomR VHJXLQWH j ~OWLPD LQVWUXomR H[HFXWDGD DQWHV GR GHVYLR p DUPD]HQDGRQDSLOKDHRFyGLJRGRWUDWDGRUWHUPLQDQGRSRUXPDLQVWUXomR 5(7

+DELOLWDQGRHLQLELQGRLQWHUUXSo}HV
+iVLWXDo}HVHPTXHDVLQWHUUXSo}HVQmRVmREHPYLQGDV3RUH[HPSORHPXP SURJUDPDTXHFRQWURODXPSURFHVVRHPWHPSRUHDOSRGHKDYHUPRPHQWRVHP TXHWRGDDFDSDFLGDGHGHSURFHVVDPHQWRGHYHHVWDUYROWDGDjREWHQomRGHXP UHVXOWDGRGHQWURGRPHQRUWHPSRSRVVtYHOHQHVWHFDVRTXDOTXHULQWHUUXSomR VHULD SUHMXGLFLDO 2XWUR FDVR FOiVVLFR p D LQWHUUXSomR GR SUySULR WUDWDGRU GH LQWHUUXSomR TXH SRGH DFRQWHFHU VH XPD VHJXQGD LQWHUUXSomR IRU VLQDOL]DGD GXUDQWHRWUDWDPHQWRGHRXWUDRFRUULGDXPSRXFRDQWHV(VWHWUDWDPHQWRGH LQWHUUXSo}HVGHIRUPDUHFXUVLYDpSRVVtYHOPDVHPJHUDOPXLWRFRPSOLFDGRH TXDVHVHPSUHGLVSHQViYHO 2V PLFURSURFHVVDGRUHV WrP SRU LVVR PHFDQLVPRV TXH SHUPLWHP LQLELU DV LQWHUUXSo}HV 1R  HVWH FRQWUROH p IHLWR DWUDYpV GD PiVFDUD GH LQWHUUXSo}HV LQWHUUXSWPDVN XPUHJLVWUDGRUTXHSHUPLWHKDELOLWDURXLQLELULQGLYLGXDOPHQWH DVLQWHUUXSo}HV567 H(VWH UHJLVWUDGRUFRQWpPWDPEpPRVELWVGH FRQWUROHGRVVLQDLVGHFRPXQLFDomRVHULDOGRSURFHVVDGRU ELWVH HPERUD



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

HVWHVQDGDWHQKDPDYHUFRPDVLQWHUUXSo}HV$KDELOLWDomRGDVLQWHUUXSo}HVp IHLWDDWUDYpVGDLQVWUXomR6,0 6HW,QWHUUXSW0DVN TXHWUDQVIHUHSDUDDPiVFDUD XPYDORU SUHYLDPHQWH FRORFDGR QR DFXPXODGRU $ ILJXUD  PRVWUD FRPR R YDORUFRORFDGRQRDFXPXODGRUpLQWHUSUHWDGRSHODLQVWUXomR6,0
 (6 VHULDO  +DELOLWD VHULDO   5HVHW ))  +DELOLWD PiVFDUD  567  567  567

)LJ$PiVFDUDGHLQWHUUXSo}HVYLVWDSHODLQVWUXomR6,0 2V ELWV   H  LQLEHP ELW LJXDO D   RX KDELOLWDP ELW LJXDO D ]HUR  DV LQWHUUXSo}HVHUHVSHFWLYDPHQWHPDVVyWrPHIHLWRVHRELWHVWLYHU VHWDGR (VWH ELW p FRORFDGR HP ]HUR TXDQGR VH GHVHMD PRGLILFDU R YDORU GD PiVFDUD GH LQWHUUXSo}HV DSHQDV SDUD FRQWURODU D SRUWD GH VDtGD VHULDO VHP LQWHUIHULUQRHVWDGRDWXDOGDVLQWHUUXSo}HV 3DUDFRPSUHHQGHURSDSHOGRELWpSUHFLVRVDEHUTXHFDGDXPDGDVHQWUDGDV 567  H  p GRWDGD GH XP IOLSIORS TXH PHPRUL]D XP SHGLGR GH LQWHUUXSomR IHLWR HQTXDQWR D LQWHUUXSomR FRUUHVSRQGHQWH HVWLYHU GHVDELOLWDGD 'HVWD IRUPD R SHGLGR ILFD SHQGHQWH DWp TXH D LQWHUUXSomR YROWH D VHU KDELOLWDGDVYH]HVXPSHGLGRSHQGHQWHSRGHVHWRUQDUREVROHWRH SRU LVVR SRGH VHU SUHIHUtYHO GHVFDUWiOR &RORFDU R ELW  HP  UHVHWD R IOLSIORS GD HQWUDGD567GHVFDUWDQGRDVROLFLWDomRSHQGHQWH$VVROLFLWDo}HVGDVRXWUDV HQWUDGDVQmRSRGHPVHUFDQFHODGDV 2ELWQmRpXWLOL]DGR2ELWKDELOLWDRXLQLEHDHVFULWDQDSRUWDVHULDOTXHVy UHDJHVHHVWH ELW HVWLYHU HP  (VWH ELW p FRORFDGR HP ]HUR TXDQGR VH GHVHMD PRGLILFDU R FRQWH~GR GD PiVFDUD GH LQWHUUXSo}HV DSHQDV SDUD FRQWURODU DV LQWHUUXSo}HVVHPLQWHUIHULUQDSRUWDVHULDOeRGXDOGRELW 2ELWpRGDGR RX HQYLDGRSDUDIRUD GR SURFHVVDGRU DWUDYpV GR SLQR 62'TXDQGRDPiVFDUDGHLQWHUUXSo}HVIRUHVFULWDFRPRELWHP $VHTrQFLD
MVI A,18H SIM

SRU H[HPSOR FDQFHOD XP SHGLGR SHQGHQWH GD LQWHUUXSomR  VH KRXYHU H KDELOLWDDVLQWHUUXSo}HVHVHPLQWHUIHULUQDSRUWDVHULDO $OpPGRVELWVDGDPiVFDUDGHLQWHUUXSo}HVRDSUHVHQWDXPDHVSpFLH GHFKDYHJHUDOTXHSHUPLWHKDELOLWDURXLQLELUWRGDVDVLQWHUUXSo}HVGHXPDVy YH]FRPH[FHomRGDLQWHUUXSomR75$3(VWHFRQWUROHpIHLWRSHODVLQVWUXo}HV (, HQDEOH LQWHUUXSWV  H ', GLVDEOH LQWHUUXSWV  TXH FRQWURODP R IODJ ,( ,QWHUUXSW (QDEOH 2VELWVFRUUHVSRQGHQWHVjVLQWHUUXSo}HVHQDPiVFDUDGH LQWHUUXSo}HV QmR VmR DIHWDGRV SHODV LQVWUXo}HV (, H ', PDV DV LQWHUUXSo}HV

,QWHUUXSo}HVGR



KDELOLWDGDVSHODPiVFDUDVyHVWDUmRGHIDWRKDELOLWDGDVVHRIODJ,(HVWLYHUHP $SULQFLSDOYDQWDJHPGDVLQVWUXo}HV(,H ', HVWi HP SHUPLWLU TXH VH DWLYH H GHVDWLYHRPHFDQLVPRGHLQWHUUXSomRVHPTXHVHMDQHFHVViULRVDOYDUHUHVWDXUDU DFRQILJXUDomRGDPiVFDUD 2IODJ,(pDXWRPDWLFDPHQWHUHVHWDGRQDVVHJXLQWHVFRQGLo}HV DSyVXP5(6(7GRSURFHVVDGRU DSyV DWHQGLPHQWR GH XPD LQWHUUXSomR LVWR HYLWD TXH P~OWLSORV SHGLGRV VHMDPDWHQGLGRVUHFXUVLYDPHQWH  'HVWDIRUPDWRGRWUDWDGRUGHLQWHUUXSomRLQLFLDFRPDVLQWHUUXSo}HVLQLELGDV RTXHFRUUHVSRQGHjQHFHVVLGDGHGDPDLRULDGRVWUDWDGRUHV 6H IRUQHFHVViULR KDELOLWDU DV LQWHUUXSo}HV GXUDQWH R WUDWDPHQWR R WUDWDGRU GHYHUi LQFOXLU XPD LQVWUXomR (, 1RUPDOPHQWH HVWD p D ~OWLPD LQVWUXomR H[HFXWDGD GHQWUR GR WUDWDGRUDQWHVGR5(7SDUDTXHDVLQWHUUXSo}HVYROWHPDVHUKDELOLWDGDVDSyV RWpUPLQRGRSURFHVVDPHQWRGRWUDWDGRU $ PiVFDUD GH LQWHUUXSo}HV WDPEpP SRGH VHU OLGD 3DUD WDQWR XWLOL]DVH D LQVWUXomR 5,0 5HDG ,QWHUUXSW 0DVN  TXH WUDQVIHUH R HVWDGR DWXDO GD PiVFDUD SDUDRDFXPXODGRU$LQWHUSUHWDomRGRVELWVDSyVDOHLWXUDGDPiVFDUDGLIHUHGD GHVFULomRDQWHULRUHpPRVWUDGDQDILJXUD
 (6 VHULDO  567 "  567 "  567 "  ,(  567  567  567

)LJ$PiVFDUDGHLQWHUUXSo}HVYLVWDSHODLQVWUXomR5,0 2VELWVD WrPDPHVPD LQWHUSUHWDomRGDLQVWUXomR6,0RELWpRIODJ,( ,QWHUUXSW(QDEOH FRQWURODGRSHODVLQVWUXo}HV(,H',2VELWV DSHUPLWHP VDEHU R HVWDGR GRV IOLSIORSV GDV LQWHUUXSo}HV  D  GH PRGR TXH XP SURJUDPDHPH[HFXomRWHPFRPRGHVFREULUVHKiSHGLGRVSHQGHQWHVHQTXDQWR DVLQWHUUXSo}HVHVWmRGHVDELOLWDGDV $ PiVFDUDGH LQWHUUXSo}HVQmRID]UHIHUrQFLDjVLQWHUUXSo}HV,175H75$3 1RSULPHLURFDVRR  SRGHFRQWURODUDKDELOLWDomR GH FDGD XPD GDV RLWR LQWHUUXSo}HV GR FRQWURODGRU H[WHUQR SURJUDPDQGRR FRQYHQLHQWHPHQWH $ LQWHUUXSomR 75$3 SRU VXD YH] QmR p PDVFDUiYHO H SRUWDQWR DV VROLFLWDo}HV IHLWDV QHVWD HQWUDGD VmR VHPSUH DWHQGLGDV LPHGLDWDPHQWH 3RU LVVR HOD p QRUPDOPHQWH XWLOL]DGD HP VLWXDo}HV FUtWLFDV 3RU H[HPSOR SRGHVH SURMHWDU XPDIRQWHGHDOLPHQWDomRTXHDYLVHRVLVWHPDDWUDYpVGHVVDLQWHUUXSomRTXHD UHGHGHHQHUJLDHOpWULFDFDLXHTXHDDOLPHQWDomRVySRGHVHUPDQWLGDSRUPDLV DOJXQV LQVWDQWHV HQTXDQWR VH GHVFDUUHJDP RV FDSDFLWRUHV GD IRQWH 4XDOTXHU TXH VHMD D WDUHID HP H[HFXomR HP JHUDO QmR KDYHUi MXVWLILFDWLYD SDUD



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

FRQWLQXiOD e PDLV VHQVDWR GHVYLDU R SURFHVVDPHQWR SDUD R WUDWDGRU GD LQWHUUXSomR 75$3 TXH SRGH DR PHQRV VDOYDU LQIRUPDo}HV YLWDLV RX WRPDU RXWUDVSURYLGrQFLDVTXHHYLWHPGDQRVPDLRUHVDRVLVWHPD

3ULRULGDGHVGDVLQWHUUXSo}HV
2YHULILFDDH[LVWrQFLDGHSHGLGRVGHLQWHUUXSomRXPDYH]DFDGDFLFORGH H[HFXomR 'HVWD IRUPD SRGH DFRQWHFHU TXH HP XP GDGR FLFOR QmR KDMD TXDOTXHULQWHUUXSomRSHQGHQWHPDVTXHKDMDPDLVGHXPSHGLGRDJXDUGDQGR DWHQGLPHQWRQRFLFORVHJXLQWH1HVWHFDVRRSURFHVVDGRUDWHQGHRVSHGLGRVGH DFRUGRFRPDVHJXLQWHSULRULGDGH75$3567567567H,175 $PHVPDSULRULGDGHpXWLOL]DGDFDVRKDMDPDLVGHXPSHGLGRSHQGHQWHTXDQGR DH[HFXomRGHXPDLQVWUXomR(,YROWDDKDELOLWDUDVLQWHUUXSo}HV eLPSRUWDQWHQRWDUTXHDVSULRULGDGHVVmRXWLOL]DGDVDSHQDVQRVFDVRVHPTXH KiPDLVGHXPSHGLGRSHQGHQWHGXUDQWHXPPHVPRFLFORGHH[HFXomRHQmR SDUDGHWHUPLQDUVHXPWUDWDGRUGHLQWHUUXSomRWHPSULRULGDGHVREUHRXWUR

,QWHUUXSo}HVGHKDUGZDUHHGHVRIWZDUH
$VLQWHUUXSo}HVHVWXGDGDVDWpDTXLVmRFRQKHFLGDVFRPRLQWHUUXSo}HVGHKDUGZDUH SRU HVWDUHP DVVRFLDGDV D HYHQWRV GR KDUGZDUH H[WHUQR ([LVWHP DLQGD RXWUDV RLWRLQWHUUXSo}HVQRGHQRPLQDGDV LQWHUUXSo}HVGHVRIWZDUHTXHVmRDWLYDGDV TXDQGR R SURFHVVDGRU H[HFXWD XPD GDV  LQVWUXo}HV 567 Q RQGH Q p XP Q~PHURGHD(VWDVLQVWUXo}HVVHFRPSRUWDPFRPRXP &$//PDVFRPR HQGHUHoR GH GHVWLQR SUpIL[DGR HP Q $ WDEHOD  DSUHVHQWD RV HQGHUHoRV GHVWDVLQWHUUXSo}HVHLQFOXLPDLVXPDYH]DV LQWHUUXSo}HV 567   H  1RWH TXH RV HQGHUHoRV GHVWDV LQWHUUXSo}HV SRGHP VHU FDOFXODGRV PXOWLSOLFDQGRVHHVVHVQ~PHURVSRUIDWRTXHH[SOLFDVXDQRPHQFODWXUD ,QWHUUXSomR 567 567 567 567 567 75$3 (QGHUHoR + + + + + + ,QWHUUXSomR 567 567 567 567 567 567 (QGHUHoR + &+ + + + &+

7DE,QWHUUXSo}HVGHKDUGZDUHHGHVRIWZDUH

,QWHUUXSo}HVGR



(VFUHYHQGRWUDWDGRUHVGHLQWHUUXSomR
2PHFDQLVPRGHWUDWDPHQWRGHLQWHUUXSo}HVGHVFULWRQHVWHFDStWXORH[LJHTXH VH REVHUYHP DOJXQV SRQWRV LPSRUWDQWHV TXDQGR VH HVFUHYH XP WUDWDGRU GH LQWHUUXSomR (PERUD VHMDP DSHQDV FRQVHTrQFLDV GR SULQFtSLR GH IXQFLRQDPHQWR GHVVH PHFDQLVPR RV SRQWRV GLVFXWLGRV D VHJXLU QmR VmR HP JHUDO FRQVLGHUDGRV yEYLRV H VmR IUHTHQWHPHQWH PRWLYR GH HUURV JUDYHV GH SURJUDPDomR 0 ORFDOL]DomR GR WUDWDGRU R SURJUDPDGRU GHYH VH FHUWLILFDU GH TXH R DVVHPEOHU FRORFDUiRWUDWDGRUQRHQGHUHoRFRUUHVSRQGHQWHDRGHVYLRSUHYLVWR,VWRVH ID] HP JHUDO FRORFDQGR XPD GLUHWLYD 25* HQGHUHoR! DQWHV GR LQtFLR GR FyGLJRGRWUDWDGRU $DXVrQFLDGHVWDGLUHWLYDIDUiFRPTXHRDVVHPEOHUHR OLQNDGRUWUDWHPRFyGLJRGRWUDWDGRUFRPRRGHRXWUDVXEURWLQDTXDOTXHU FRORFDQGRRQXPDSRVLomRGLIHUHQWHGRGHVYLRGDLQWHUUXSomR 0 SUHVHUYDomR GH UHJLVWUDGRUHV XP WUDWDGRU GH LQWHUUXSo}HV GHYH VDOYDU QD SLOKD WRGRV RV UHJLVWUDGRUHV GR SURFHVVDGRU TXH XWLOL]D H UHVWDXUiORV DQWHV GH UHWRUQDU 1HJOLJHQFLDU HVWH SDVVR H PRGLILFDU UHJLVWUDGRUHV GR SURFHVVDGRU GHQWUR GR WUDWDGRU p H[WUHPDPHQWH SHULJRVR &RPR D LQWHUUXSomR SRGH DFRQWHFHUWHRULFDPHQWHHPTXDOTXHUSRQWRGRSURJUDPDDPRGLILFDomRGR FRQWH~GR GH XP UHJLVWUDGRU SRGH WHU FRQVHTrQFLDV FDWDVWUyILFDV 2 PDLV JUDYH p TXH HVWD PRGLILFDomR WDPEpP SRGH VHU LQRIHQVLYD TXDQGR D LQWHUUXSomRDFRQWHFHGXUDQWHDH[HFXomRGHXPWUHFKRGHFyGLJRTXHQmR XWLOL]D R UHJLVWUDGRU TXH HVWi VHQGR DOWHUDGR 6H HVWD IRU D VLWXDomR TXH DFRQWHFH GXUDQWH R WHVWH GR SURJUDPD HVWH SRGH YLU D VHU DSURYDGR FRP XPDIDOKDTXHSRGHVHPDQLIHVWDUPDLVWDUGHTXDQGRRVLVWHPDHVWLYHUHP XVR$VFRQVHTrQFLDVVmRLPSUHYLVtYHLVHDFDXVDGRSUREOHPDpHPJHUDO PXLWR GLItFLO GH ORFDOL]DU 0XLWRV SURJUDPDGRUHV VDOYDP VHPSUH WRGRV RV UHJLVWUDGRUHVPHVPRTXHQmRRVXWLOL]HP,VWRHYLWDTXHXPDPRGLILFDomR SRVWHULRU GR WUDWDGRU TXH YHQKD D XWLOL]DU XP UHJLVWUDGRU QRYR LQWURGX]D SUREOHPDV 0 D FRPXQLFDomR FRP R SURJUDPD SULQFLSDO QmR SRGH VHU IHLWD DWUDYpV GRV UHJLVWUDGRUHV XPD YH] TXH RV UHJLVWUDGRUHV SUHFLVDP VHU SUHVHUYDGRV SHODV UD]}HV GHVFULWDV DFLPD D FRPXQLFDomR HQWUH R WUDWDGRU H R SURJUDPD SULQFLSDO TXDQGRQHFHVViULDWHPGHVHUIHLWDGHRXWUDIRUPD2PHLRPDLVFRPXPp GHILQLU XPD YDULiYHO JOREDO TXH p DOWHUDGD SHOR WUDWDGRU 2 SURJUDPD SULQFLSDOSRGHWHVWDUHVWDYDULiYHOSDUDGHVFREULURTXHRWUDWDGRUIH] 0 R WUDWDGRU GHYH VHU FXUWR HP JHUDO DV LQWHUUXSo}HV ILFDP LQLELGDV GXUDQWH R SURFHVVDPHQWRGRWUDWDGRU,VWRWHPDYDQWDJHPGHVLPSOLILFDURVHXFyGLJR XPWUDWDGRUUHFXUVLYRpVHPSUHPDLVFRPSOH[RSRUTXHWHPTXHSUHYHUTXH



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

SRGH VHU LQWHUURPSLGR SRU VL PHVPR D TXDOTXHU PRPHQWR  H GH OLPLWDU D SURIXQGLGDGHGDSLOKD SRLVDFDGDFKDPDGDXPQRYRHQGHUHoRGHUHWRUQR pHPSLOKDGRQRYRVUHJLVWUDGRUHVVmRVDOYRVHWF 3RURXWURODGRDLQLELomR GDVLQWHUUXSo}HVSRUSHUtRGRVORQJRVSRGHSUHMXGLFDUDUHVSRVWDGRVLVWHPD DHYHQWRVH[WHUQRVHSRULVVRpUHFRPHQGiYHOTXHRFyGLJRGRVWUDWDGRUHV VHOLPLWHDID]HURHVVHQFLDOGHL[DQGRSDUDRFRUSRSULQFLSDOGRSURJUDPDDV WDUHIDVTXHSXGHUHPVHUIHLWDVIRUDGRWUDWDGRU 0 DV LQWHUUXSo}HV SUHFLVDP HVWDU KDELOLWDGDV H D SLOKD QmR GHYH FUHVFHU LQGHILQLGDPHQWH VHPSUH TXH XP SURJUDPD SUHWHQGHU XWLOL]DU LQWHUUXSo}HV R FyGLJR H[HFXWDGRQDLQLFLDOL]DomRSUHFLVDKDELOLWiODV QRFDVRGRDWUDYpVGD FRQILJXUDomRGDPiVFDUDGHLQWHUUXSo}HVHGDLQVWUXomR(, 'RFRQWUiULR QHQKXPD LQWHUUXSomR PDVFDUiYHO VHUi DWHQGLGD e LJXDOPHQWH LPSRUWDQWH TXH R SURJUDPDGRU JDUDQWD XP PHLR GH UHDELOLWDU DV LQWHUUXSo}HV GHSRLV TXH R WUDWDGRU FRUUHVSRQGHQWH D FDGD XPD WLYHU VLGR FKDPDGR SRLV R DWHQGLPHQWRGHXPDLQWHUUXSomRLQLEHDVLQWHUUXSo}HV(PJHUDOLVWRVHID] FRORFDQGRXPDLQVWUXomR(,QRILQDOGHFDGDWUDWDGRULPHGLDWDPHQWHDQWHV GR5(71RWHTXHQmRpUHFRPHQGiYHOFRORFDUTXDOTXHULQVWUXomRHQWUHR (, H R 5(7 SRUTXH VH XPD QRYD LQWHUUXSomR DFRQWHFHU GHSRLV GR (, H DQWHVGR5(7DSLOKDUHFHEHUiQRYDPHQWHRHQGHUHoRGHUHWRUQRHRXWURV YDORUHVTXHRWUDWDGRUGHVHMHVDOYDUHVHLVWRVHUHSHWLUPXLWDVYH]HVROLPLWH GD SLOKD SUHYLVWR SHOR SURJUDPDGRU SRGH VHU XOWUDSDVVDGR &RP R (, LPHGLDWDPHQWHDQWHVGR 5(7LVWRMDPDLVDFRQWHFHSRUTXHR(,KDELOLWDDV LQWHUUXSo}HVDSHQDVDSDUWLUGDLQVWUXomRTXHRVHJXH QRFDVRR5(7 H HVWD FRPR YLPRV p H[HFXWDGD DWp R ILQDO DQWHV GR GHVYLR SDUD XPD QRYD LQWHUUXSomR &RPLVVRRHQGHUHoRGHUHWRUQRpUHWLUDGRGDSLOKDHHVWDQmR SRGHFUHVFHULQGHILQLGDPHQWH 0 RWUDWDGRUQmRGHYHVXMDUDSLOKDDVVLPFRPRQRFDVRGDVVXEURWLQDVRUHWRUQR DRSRQWRGHH[HFXomRFRUUHWRVypSRVVtYHOVHQRLQVWDQWHGDH[HFXomRGR 5(7 R 63 HVWLYHU DSRQWDQGR SDUD XPD SRVLomR GD SLOKD TXH FRQWHQKD R HQGHUHoR GH UHWRUQR 3RUWDQWR p UHVSRQVDELOLGDGH GR SURJUDPDGRU FXLGDU SDUDTXHQRLQVWDQWHGDH[HFXomRGR5(7DSLOKDHVWHMDH[DWDPHQWHFRPR HVWDYDTXDQGRRWUDWDGRUIRLFKDPDGR 2FDStWXORWUD]PDLVLQIRUPDo}HVLQWHUHVVDQWHVVREUHRGHVHQYROYLPHQWRGH WUDWDGRUHVGHLQWHUUXSomR

2PLFURSURFHVVDGRU
,QWURGXomR
&RQIRUPH PHQFLRQDGR QR FDStWXOR  R  ID] SDUWH GH XPD OLQKDJHP GH PLFURSURFHVVDGRUHV LQLFLDGD SHOD ,QWHO FRP D SULPHLUD &38 LQWHJUDGD QXP ~QLFR FKLS R  2  VXFHGHX R  H DV SULQFLSDLV PRGLILFDo}HV LQWURGX]LGDVQHVWHQRYRSURGXWRIRUDP DPSOLDomRGDFDSDFLGDGHGHHQGHUHoDPHQWRGHPHPyULDSDUD0% DUTXLWHWXUDGHELWV QRYDVLQVWUXo}HVSDUDDPDQLSXODomRGHVHTrQFLDVGHFDUDFWHUHV VWULQJV  DULWPpWLFDGHFLPDOFRPSOHWD 'HVWHVLWHQVVmRVHPG~YLGDRVGRLVSULPHLURVTXHFDXVDPPDLRULPSDFWRQD XWLOL]DomRGRSURFHVVDGRUHSRULVVRDVFRQVHTrQFLDVGHVVDVPRGLILFDo}HVVmR RSULQFLSDOWHPDGRSUHVHQWHFDStWXOR$VLQVWUXo}HVGHPDQLSXODomRGHVWULQJV VmRWUDWDGDVQRFDStWXORHRDQH[RWUD]DOJXQVGHWDOKHVVREUHDGLYLVmRGH Q~PHURVLQWHLURV2PDWHULDODSUHVHQWDGRVHUYHGHIXQGDPHQWR SDUD H[SORUDU RV WtWXORV UHODFLRQDGRV QD ELEOLRJUDILD TXH WUDWDP R DVVXQWR GH IRUPD PDLV H[WHQVD

[
2 SURFHVVDGRU  WHP R PHVPR FRQMXQWR GH LQVWUXo}HV H D PHVPD DUTXLWHWXUD LQWHUQD GR  H p SRUWDQWR XP SURFHVVDGRU GH  ELWV $ SULQFLSDOGLIHUHQoDHQWUHRVGRLVSURFHVVDGRUHVHVWiQDODUJXUDGREDUUDPHQWR GHGDGRVTXHpGHDSHQDVELWVQRQROXJDUGRVELWVGR 2 ODQoDPHQWR GR  FRP HVWD FDUDFWHUtVWLFD IRL XP SDVVR HVWUDWpJLFR YLVDQGR WRUQDU PDLV FRQYLGDWLYD D PLJUDomR GH VLVWHPDV PDLV DQWLJRV TXH XWLOL]DYDP SURFHVVDGRUHV GH  ELWV SDUD D QRYD DUTXLWHWXUD GH  ELWV 2 EDUUDPHQWR GH GDGRV GR  SHUPLWLD TXH VH DSURYHLWDVVHP DR PHQRV HP



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

SDUWH SURMHWRV GH VLVWHPDV TXH XWLOL]DYDP SURFHVVDGRUHV GH  ELWV FRPR R (VWHHUDXPIDWRULPSRUWDQWHQXPDpSRFDHPTXHRVFXVWRVGHSURMHWR GHKDUGZDUHHQYROYHQGRUHFXUVRVFRPSXWDFLRQDLVHUDPPXLWRVLJQLILFDWLYRV (PERUDRSRVVDHPSULQFtSLRH[HFXWDUTXDOTXHUSURJUDPDHVFULWRSDUDR  H YLFHYHUVD H[LVWHP GLIHUHQoDV GH GHVHPSHQKR HQWUH RV GRLV SURFHVVDGRUHV(QTXDQWRRSRGHDFHVVDUGRLVE\WHVGDPHPyULDGHXPD Vy YH] R  SUHFLVD ID]HU GRLV DFHVVRV SDUD FRQVHJXLU R PHVPR UHVXOWDGR $VVLPSURJUDPDVTXHIDoDPDPSORXVRGDWUDQVIHUrQFLDGHZRUGVGHHSDUDD PHPyULDVHUmRPDLVUiSLGRVQRGRTXHQR eLPSRUWDQWHVDEHUWDPEpPTXHGHYLGRjIRUPDGHFRQH[mRGRVFLUFXLWRVGH PHPyULDDRVHXEDUUDPHQWRRFRQVHJXHDFHVVDUXPZRUGGHXPDVyYH] DSHQDV VH HVWH LQLFLDU QXP HQGHUHoR SDU &DVR FRQWUiULR R SURFHVVDGRU VHUi REULJDGRDH[HFXWDUGRLVFLFORVFRPELQDQGRRVGDGRVGHFDGDXPGHPRGRD IRUPDURZRUGGHVHMDGR(VWHSURFHVVRpDXWRPiWLFRHQmRUHTXHUHVIRUoRGH SURJUDPDomRDGLFLRQDOSRUSDUWHGRXVXiULRPDVpLPSRUWDQWHHVWDUFLHQWHGH TXHRGHVHPSHQKRGR pPHOKRUTXDQGRRVZRUGV VREUHWXGRDSLOKD LQLFLDPHPHQGHUHoRVSDUHV(VWHSRVLFLRQDPHQWRGRVZRUGVUHFHEHHPLQJOrV RQRPHGHZRUGDOLJQPHQW

8PSHTXHQRSUREOHPD
2VHIHLWRVGDDPSOLDomRGRHVSDoRGHHQGHUHoDPHQWRQDDUTXLWHWXUDGHELWV SRGHP VHU FRPSUHHQGLGRV D SDUWLU GD DQiOLVH GD ODUJXUD QHFHVViULD SDUD R EDUUDPHQWRGHHQGHUHoRV &RQVLGHUDQGRTXH 0%  E\WHVYrVHTXHHVVH EDUUDPHQWRGHYHWHUOLQKDVHTXHSRUWDQWRRVHQGHUHoRVTXHRSURFHVVDGRU GHYHIRUQHFHUjPHPyULDVmRQ~PHURVGHELWV e FODUR TXH GXUDQWH R SURFHVVDPHQWR GR SURJUDPD VXUJHP GLYHUVDV RSRUWXQLGDGHV HP TXH R SURFHVVDGRU SUHFLVD DUPD]HQDU HQGHUHoRV GH PHPyULDHGDtVXUJHXPSUREOHPDFRPRDUPD]HQDUHQGHUHoRVGHELWVVHD DUTXLWHWXUD GR SURFHVVDGRU SUHYr UHJLVWUDGRUHV GH  ELWV" &RPR SULPHLUD WHQWDWLYD SRGHUVHLD SHQVDU HP LQFOXLU DOJXQV UHJLVWUDGRUHV HVSHFLDLV GH  ELWVDSHQDVSDUDFRQWHUHQGHUHoRV &RQWXGRHVWDLGpLDORJRVHPRVWUDSRXFR SUiWLFD SRLV RV HQGHUHoRV QmR H[LVWHP DSHQDV SDUD VHUHP FRORFDGRV QR EDUUDPHQWR 0XLWRVSURJUDPDVID]HPFiOFXORVFRPHQGHUHoRVRTXHVLJQLILFD TXH p QHFHVViULR SRGHU PDQLSXOiORV GH IRUPD VHPHOKDQWH D RXWURV GDGRV &RPR FRQVHTrQFLD RV GHPDLV UHJLVWUDGRUHV GR SURFHVVDGRU WDPEpP WHULDP TXH VHU DPSOLDGRV SDUD  ELWV 0DV LVVR WHULD VLGR XP FKRTXH GHPDVLDGR JUDQGHSDUDDFXOWXUDMiHVWDEHOHFLGDTXHKDYLDILUPDGRRE\WHGHELWVFRPR XP SDGUmR (QFDUDU RV QRYRV UHJLVWUDGRUHV GH  ELWV FRPR VH IRVVHP

2PLFURSURFHVVDGRU



UHJLVWUDGRUHV GH  E\WHV SDUHFLD UD]RiYHO PDV FRP  ELWV QmR WHULD VLGR SRVVtYHOFKHJDUDXPUHVXOWDGRTXHSXGHVVHVHUFKDPDGRGHFRPSDWtYHOFRPD WHFQRORJLDDQWHULRU,VVRSRGHULDVLJQLILFDUDQmRDFHLWDomRGRSURGXWRDSHVDU GRVPXLWRVWULXQIRVTXHRPDUNHWLQJMiFRQVHJXLXVREUHD&LrQFLD 2VSURMHWLVWDVVHYLUDPHQWmRGLDQWHGHXPDWDUHIDGLItFLOHQGHUHoDU 0%GH PHPyULDFRPUHJLVWUDGRUHVGHELWV$VROXomRHQFRQWUDGDTXHPDUFDULDQmR Vy R  PDV HP PDLRU RX PHQRU JUDX WRGRV RV VHXV VXFHVVRUHV DWp KRMH FKDPDVHVHJPHQWDomR

6HJPHQWDomR
2SULQFtSLRGDVHJPHQWDomRFRQVLVWHHPFRPELQDUGRLVUHJLVWUDGRUHVGHELWV SDUD JHUDU XP HQGHUHoR GH PHPyULD GH  ELWV 2 SURFHVVDGRU XWLOL]D GRLV WLSRVGLIHUHQWHVGHUHJLVWUDGRUHVQHVVDFRPELQDomRXP UHJLVWUDGRU GH VHJPHQWRH XPUHJLVWUDGRUGHRIIVHWHGHWHUPLQDRHQGHUHoRItVLFRXWLOL]DQGRDUHODomR (QGHUHoRItVLFR UHJGHVHJPHQWR UHJGHRIIVHW  $RREVHUYDUDH[SUHVVmRDFLPDpLPSRUWDQWHSHUFHEHU TXHD PXOWLSOLFDomRSRU HTXLYDOHDDFUHVFHQWDU ]HURVDRQ~PHURELQiULRFRQWLGRQRUHJLVWUDGRUGH VHJPHQWRHTXHSRUWDQWRHVWHpWUDQVIRUPDGRQXPQ~PHURGHELWVeFODUR TXHHVWDRSHUDomRQmRpVXILFLHQWHSDUDJHUDUWRGRVRVQ~PHURVSRVVtYHLVGH ELWVSRLVDWpDTXLRV~OWLPRVELWVVmRLJXDLVD]HUR$VRPDFRPRUHJLVWUDGRU GHRIIVHWSRUpPSHUPLWHREWHUTXDOTXHUQ~PHURGHELWV e LJXDOPHQWH LPSRUWDQWH WHU HP PHQWH TXH R UHJLVWUDGRU GH RIIVHW p XP UHJLVWUDGRUGHELWVHTXHSRUWDQWRRVHJXQGRWHUPRGD VRPD QD HTXDomR  pXPQ~PHURFRQWLGRQRLQWHUYDOR>@RTXHFRUUHVSRQGHDXPD IDL[DGHN% /RJR XPD YH] TXH VH HVFROKD XP YDORU SDUD R UHJLVWUDGRU GH VHJPHQWR GLJDPRV VRVHQGHUHoRVGHELWVTXHSRGHPVHUJHUDGRVFRPRPHFDQLVPR JRYHUQDGR SRU   FREUHP D IDL[D TXH YDL GH V DWp V     E\WHV 'L]VH SRU LVVR TXH FDGD Q~PHUR FRORFDGR QXP UHJLVWUDGRU GH VHJPHQWR UHSUHVHQWDXPVHJPHQWRHTXHFDGDVHJPHQWRWHPN% $ FRPSUHHQVmR GR PHFDQLVPR GHVFULWR DFLPD p IXQGDPHQWDO SDUD R HQWHQGLPHQWRGRUHVWDQWHGRPDWHULDOVREUHR$ILJXUDHQFRQWUDGD FRPYDULDo}HVHPSUDWLFDPHQWHTXDOTXHUWH[WRVREUHR DVVXQWR LOXVWUD R TXH IRLGLWRDWpDTXL



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
0HPyULD

2IIVHW

%\WHHQGHUHoDGR



6HJPHQWR

[

,QtFLRGRVHJPHQWR

)LJ2PHFDQLVPRGHVHJPHQWDomR $ WtWXOR GH H[HPSOR VXSRQKD TXH R UHJLVWUDGRU GH VHJPHQWR GD ILJXUD FRQWHQKD R YDORU + H TXH R UHJLVWUDGRU GH RIIVHW XWLOL]DGR HVWHMD FRP R YDORU+(QWmRRVHJPHQWRHQGHUHoDGRFRPHoDHP+HDSRVLomR GHPHPyULDHQGHUHoDGDVHUiDGHHQGHUHoRItVLFR+ 8PDYH]IL[DGRXPYDORUSDUDRUHJLVWUDGRUGHVHJPHQWRRSURFHVVDGRUSRGH DFHVVDU RV N% FRUUHVSRQGHQWHV YDULDQGR DSHQDV R FRQWH~GR GR UHJLVWUDGRU GHRIIVHW1RFDVRGRH[HPSORDQWHULRURSURFHVVDGRU SRGH DWLQJLU TXDOTXHU E\WH VLWXDGR GH + RIIVHW    DWp ))))+ RIIVHW  ))))+  (VWD SURSULHGDGH VH PRVWUD EDVWDQWH ~WLO XPD YH] TXH D PDLRULD GDV VXEURWLQDV FKDPDGDVHWDPEpPDPDLRULDGDVHVWUXWXUDVGHGDGRVXWLOL]DGDVSRUSURJUDPDV WtSLFRVFDEHQXPHVSDoRPHQRUGRTXHN%'HVWD IRUPD p UHODWLYDPHQWH UDUR TXH XP SURJUDPD SUHFLVH PRGLILFDU RV YDORUHV GRV UHJLVWUDGRUHV GH VHJPHQWRGXUDQWHVXDH[HFXomRRTXHFRQWULEXLSDUDXPPHOKRUGHVHPSHQKR GRSURFHVVDGRU

1RWDomR
(P JHUDO QmR p QHFHVViULR TXH R SURJUDPDGRU VH SUHRFXSH FRP R YDORU GR HQGHUHoRItVLFRGHXPDSRVLomRGHPHPyULDPDVDSHQDVFRPRVYDORUHVGRV UHJLVWUDGRUHV GH VHJPHQWR H RIIVHW XWLOL]DGRV SDUD DFHVViOD ([LVWH XPD FRQYHQomR EDVWDQWH GLIXQGLGD SDUD GHQRWDU HQGHUHoRV GHILQLGRV SHOR SDU GH UHJLVWUDGRUHVDGRWDGRVQDVHJPHQWDomRTXHVHUiDGRWDGDDTXL2VYDORUHVGRV UHJLVWUDGRUHV VmR HVFULWRV QD IRUPD VHJPHQWRRIIVHW FRPR SRU H[HPSOR ++RTXHFRUUHVSRQGHDRHQGHUHoRItVLFR+

2PLFURSURFHVVDGRU



0XOWLSOLFLGDGHGHHQGHUHoRV
8PDVSHFWRGDVHJPHQWDomRTXHPHUHFHDWHQomRHVSHFLDOpDPXOWLSOLFLGDGHGH HQGHUHoRV GH XPD PHVPD SRVLomR GH PHPyULD (VWD GHFRUUH GLUHWDPHQWH GD H[SUHVVmR  $PXOWLSOLFDomRGRFRQWH~GRGRUHJLVWUDGRUGHVHJPHQWRSRU ID]FRPTXHFDGDVHJPHQWRLQLFLHQXPDSRVLomRGHPHPyULDFXMRHQGHUHoR p P~OWLSOR GHVVH Q~PHUR $VVLP D PHQRU GLVWkQFLD SRVVtYHO HQWUH GRLV VHJPHQWRVFRQVHFXWLYRVpGHE\WHVFRPRSRUH[HPSORHQWUHRVVHJPHQWRV TXH FRPHoDP HP + H + H TXH FRUUHVSRQGHP D YDORUHV GH UHJLVWUDGRUGHVHJPHQWRLJXDLVD+H+UHVSHFWLYDPHQWH 8PDYH]TXHFDGDRIIVHWSRGHDWLQJLUN%GHQWURGHXPVHJPHQWRWRUQD VH YLVtYHOTXHH[LVWH XPD VXSHUSRVLomR GRV HVSDoRV GH HQGHUHoDPHQWR 1R FDVR GRVGRLVVHJPHQWRVFLWDGRVRE\WHGRSULPHLURFRUUHVSRQGHDRE\WHGR VHJXQGRHHVWDVXSHUSRVLomR VH HVWHQGH DWp R ILQDO GR SULPHLUR VHJPHQWR $ YHULILFDomRpVLPSOHVEDVWDQGRFDOFXODURVHQGHUHoRVItVLFRV E\WHGRSULPHLURVHJPHQWR ++  +  +  + + E\WHGRVHJXQGRVHJPHQWR ++  +  +  + + 'HVWD IRUPD XPD PHVPD SRVLomR GH PHPyULD SRGH VHU HQGHUHoDGD SRU GLYHUVRV SDUHV VHJPHQWRRIIVHW ,VWR HP JHUDO QmR FDXVD SUREOHPDV PDV p SUHFLVRHVWDUDWHQWRSDUDHVWHIDWRSULQFLSDOPHQWHTXDQGRVHSUHFLVDFRPSDUDU HQGHUHoRV2VLPSOHVIDWRGHGRLVSDUHV VHJPHQWRRIIVHWVHUHPGLIHUHQWHVHQWUH VL QmR JDUDQWH TXH D SRVLomR GH PHPyULD SRU HOHV HQGHUHoDGD QmR VHMD D PHVPD 8P ERP H[HUFtFLR SDUD IDPLOLDUL]DomR FRP R PHFDQLVPR GH VHJPHQWDomR FRQVLVWHHPGHWHUPLQDUTXDQWDVPDQHLUDVGLIHUHQWHVH[LVWHPGHHQGHUHoDUFDGD SRVLomR GH PHPyULD GR HVSDoR GH 0% DOFDQoDGR SHOR  $ UHVSRVWD p 

2VUHJLVWUDGRUHVGHVHJPHQWR
1XPSURJUDPDSDUDRGLVWLQJXHPVHWUrVWLSRVGLIHUHQWHVGHVHJPHQWRV GHGDGRVGHFyGLJRHGHSLOKD 2WHPTXDWURUHJLVWUDGRUHVGHVHJPHQWRXPSDUDHQGHUHoDUVHJPHQWRV GH FyGLJR &6  RXWUR SDUD HQGHUHoDU VHJPHQWRV GH SLOKD 66  H RXWURV GRLV SDUDHQGHUHoDUVHJPHQWRVGHGDGRV '6H(6 



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$VLQVWUXo}HVTXHRSURFHVVDGRUH[HFXWDVmRVHPSUHOLGDVDSDUWLUGRVHJPHQWR HQGHUHoDGR SHOR UHJLVWUDGRU &6  QmR Ki RXWUD RSomR 'H IRUPD DQiORJD LQVWUXo}HV TXH DIHWDP D SLOKD XWLOL]DP VHPSUH R UHJLVWUDGRU 66 2 DFHVVR D GDGRV JHUDOPHQWH p IHLWR DWUDYpV GR UHJLVWUDGRU '6 PDV p SRVVtYHO WDPEpP XWLOL]DU(6HPHVPR&6H66VHKRXYHUQHFHVVLGDGHGHHQGHUHoDUGDGRVQHVVHV VHJPHQWRV $WDEHODDSUHVHQWDRVUHJLVWUDGRUHVGHVHJPHQWRGR 6tPEROR &6 '6 (6 66 1RPH &RGHVHJPHQW 'DWDVHJPHQW ([WUDVHJPHQW 6WDFNVHJPHQW 8WLOL]DomRPDLVFRPXP (QGHUHoDPHQWRGHFyGLJRH[HFXWiYHO $FHVVRDGDGRV $FHVVRDGDGRV $FHVVRjSLOKD

7DE2VUHJLVWUDGRUHVGHVHJPHQWRGR

$YLVmRGRSURFHVVDGRU
'DGRVRVTXDWURUHJLVWUDGRUHVGHVHJPHQWRSRGHVHFRPSUHHQGHUDYLVmRTXH R SURFHVVDGRU WHP GD PHPyULD 8PD YH] TXH R DFHVVR j PHPyULD H[WHUQD VHPSUH H[LJH D SDUWLFLSDomR GH XP UHJLVWUDGRU GH VHJPHQWR H TXH FDGD VHJPHQWR DEUDQJH  N% WRUQDVH FODUR TXH R SURFHVVDGRU Vy HQ[HUJD D PHPyULD DWUDYpV GH TXDWUR MDQHODV GHVVH WDPDQKR H QXQFD HVWi SURQWR SDUD DFHVVDU WRGDV DV SRVLo}HV GD PHPyULD GLUHWDPHQWH $ ILJXUD  LOXVWUD XPD VLWXDomRKLSRWpWLFDHPTXHRVTXDWURUHJLVWUDGRUHVGHVHJPHQWRDSRQWDPSDUD GLIHUHQWHVUHJL}HVGDPHPyULD 1DGD LPSHGH SRUpP TXH KDMD VXSHUSRVLomR SDUFLDO RX PHVPR WRWDO GRV VHJPHQWRV 2 SURFHVVDGRU QmR LPS}H TXDOTXHU WLSR GH UHVWULomR DRV YDORUHV TXH SRGHP VHU FRORFDGRV QRV UHJLVWUDGRUHV GH VHJPHQWR GH PRGR TXH R SURJUDPDGRU SRGH GLVWULEXtORV FRQIRUPH OKH FRQYLHU $ VXSHUSRVLomR GH VHJPHQWRV p FRPXP HP SURJUDPDV SHTXHQRV SRLV QHP VHPSUH VmR QHFHVViULRV WRGRV RV  N% GLVSRQtYHLV HP FDGD VHJPHQWR 1R HQWDQWR LVWR WRUQDSRVVtYHOTXHXPRIIVHWHUUDGRDSDUWLUGHXPVHJPHQWRYHQKDDLQYDGLU RXWURGDQLILFDQGRGDGRVOiFRQWLGRV3RUH[HPSORVHH[LVWLUVXSHUSRVLomRGRV VHJPHQWRV GH FyGLJR H GH GDGRV XP HUUR QR RIIVHW GHQWUR GR VHJPHQWR GH GDGRVSRGHFRUURPSHURFyGLJRGRSURJUDPD$UHVSRQVDELOLGDGHSRUHVWHWLSR GHHUURFDEHH[FOXVLYDPHQWHDRSURJUDPDGRU

2PLFURSURFHVVDGRU
2IIVHW



N%

&6

N%
'6

N%
(6

N%
66

)LJ(QGHUHoDPHQWRGHPHPyULDFRP

2PRGHORGHSURJUDPDomR
2XVXiULRYrRGHDFRUGRFRPRPRGHORDSUHVHQWDGRQDILJXUDTXH DSUHVHQWDRVUHJLVWUDGRUHVGRSURFHVVDGRU


$+ %+ &+ '+

$/ %/ &/ '/

$; %; &; '; 63 %3 6, ',



&6 '6 66 (6 ,3





 2)

 ')

 ,)

 7)

 6)

 =)

 $)

 3)

 &) )ODJV

)LJ2PRGHORGHSURJUDPDomRGR 6mR DR WRGR  UHJLVWUDGRUHV GH  ELWV LQFOXLQGR RV Mi PHQFLRQDGRV UHJLVWUDGRUHVGHVHJPHQWR&6'666H(6 $OpPGHVVHVDSDUHFHPRVDVVLP



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

FKDPDGRV UHJLVWUDGRUHV GH XVR JHUDO $;  ', R SRQWHLUR GH LQVWUXo}HV ,3 LQVWUXFWLRQSRLQWHUTXHID]RSDSHOGR3&GR HRVIODJV 2V UHJLVWUDGRUHV $;  '; SRGHP WHU FDGD XP GH VHXV E\WHV HQGHUHoDGRV VHSDUDGDPHQWH3DUDLVWRDVLQVWUXo}HVXWLOL]DPRVQRPHV$+'+SDUDRV E\WHV PDLV VLJQLILFDWLYRV H RV QRPHV $/  '/ SDUD RV E\WHV PHQRV VLJQLILFDWLYRVGHVVHVUHJLVWUDGRUHV(PERUDVHMDPFODVVLILFDGRVSHOD,QWHOFRPR UHJLVWUDGRUHV GH XVR JHUDO HVVHV UHJLVWUDGRUHV QmR VmR FRPSOHWDPHQWH HTXLYDOHQWHVHQWUHVL3RUH[HPSORDVRSHUDo}HVPDLVFRPSOH[DVUHTXHUHPHP JHUDO TXH VH XVH R UHJLVWUDGRU $; TXH UHIOHWH DOJXPDV GDV FDUDFWHUtVWLFDV GR DFXPXODGRU GR VHX DQWHFHVVRU R  2 UHJLVWUDGRU '; p QHFHVViULR QDV RSHUDo}HV GH PXOWLSOLFDomR H GLYLVmR GH  ELWV H HP DOJXPDV RSHUDo}HV GH ,2 H R UHJLVWUDGRU &; WHP R SDSHO GH FRQWDGRU QDV LQVWUXo}HV TXH GmR VXSRUWHjFRQVWUXomRGHORRSV 2VRXWURVUHJLVWUDGRUHVGHXVRJHUDO63',VmRUHJLVWUDGRUHVGHHQGHUHoRH SRU LVVR SRGHP VHU DFHVVDGRV DSHQDV FRPR UHJLVWUDGRUHV GH  ELWV 2V UHJLVWUDGRU63pRSRQWHLURGDSLOKD%3SRGHVHUYLUFRPRUHJLVWUDGRUGHXVR JHUDO PDV GHVHPSHQKD WDPEpP XP SDSHO LPSRUWDQWH UHODFLRQDGR j SLOKD QD SDVVDJHPGHSDUkPHWURVHQDFULDomRGHYDULiYHLVORFDLV YFDStWXOR 6,H', WrP DSOLFDo}HV GH XVR JHUDO H VmR WDPEpP HPSUHJDGRV SHODV LQVWUXo}HV GH PDQLSXODomRGHVWULQJV

&RQVLGHUDo}HVVREUHDOLQJXDJHP$60
$OLQJXDJHPDVVHPEO\GHVHQYROYLGDSHOD,QWHOSDUDRFKDPDVH$60 'HWDOKDU WRGDV DV FDUDFWHUtVWLFDV GHVWD OLQJXDJHP HVWi DOpP GR REMHWLYR GHVWH WH[WR PDV H[LVWHP DOJXPDV FDUDFWHUtVWLFDV TXH VmR HVVHQFLDLV SDUD D FRPSUHHQVmR GRV SURJUDPDV TXH VHUmR HVWXGDGRV H TXH SRU LVVR PHUHFHP DWHQomRHVSHFLDO 2 FRQFHLWR PDLV LPSRUWDQWH H GLIHUHQWH GH RXWUDV OLQJXDJHQV DVVHPEO\ p R FRQFHLWRGH WLSR&DGDVtPERORGHXPSURJUDPD$60VHMDRQRPHGHXPD YDULiYHOXPVLQ{QLPRSDUDXPHQGHUHoRRXXPVLQ{QLPRSDUDXPDFRQVWDQWH WHP XP GHWHUPLQDGR WLSR 0XLWDV YH]HV R DVVHPEOHU QmR SUHFLVD TXH R SURJUDPDGRU GLJD H[SOLFLWDPHQWH TXDO R WLSR GH XP VtPEROR SRLV SRGH GHGX]LORSRUFRQWDSUySULD3RUH[HPSORHP
MOV AX,[BX] ; copia o word endereado por BX para AX

R DVVHPEOHU SRGH GHGX]LU TXH R FRQWH~GR D VHU FRSLDGR GD PHPyULD p XP ZRUGSRLVRUHJLVWUDGRU$;pGHELWV0DVQRFDVRGDLQVWUXomR
INC [BX] ; incrementar byte ou word ???

2PLFURSURFHVVDGRU



R DVVHPEOHU QmR WHP FRPR VDEHU VH GHYH LQFUHPHQWDU R E\WH TXH UHVLGH QR RIIVHW%;RXVHGHYHLQFUHPHQWDURZRUGTXHUHVLGHHP%;%; 1HVWH FDVR RDVVHPEOHUJHUDULDXPDPHQVDJHPGHHUURREULJDQGRRSURJUDPDGRUD GHFLGLUTXDOGRVGRLVHIHLWRVGHVHMDTXHDLQVWUXomRWHQKD2SURJUDPDGRUWHP TXHGL]HUTXDORWLSRGDYDULiYHOHQGHUHoDGDLQGLUHWDPHQWHSRU%;HVFUHYHQGR
INC BYTE PTR [BX] ; incrementa o byte de offset BX

SDUDLQFUHPHQWDURE\WHFXMRRIIVHWpRYDORUFRQWLGRHP%;RX
INC WORD PTR [BX] ; incrementa o word de offset BX

SDUDLQFUHPHQWDURZRUGTXHVHHQFRQWUDQRVHQGHUHoRV%;H%; 2VWLSRVGHILQLGRVQDOLQJXDJHP$60VmRRVVHJXLQWHV
%<7(375 :25'375

':25'375 1($5 375

 WLSRQHDU  LGHPSDUDGHVYLRVGRWLSRIDU  R YDORU GR VtPEROR FRP HVWH WLSR TXH UDUDPHQWH SUHFLVD VHU XWLOL]DGRpXPVLQ{QLPRSDUDXPDFRQVWDQWHGHELWV
)$5 375 180%(5

UHIHUHQFLDXPDYDULiYHOGHE\WH UHIHUHQFLDXPDYDULiYHOGHZRUG UHIHUHQFLDXPDYDULiYHOGHZRUGV UHIHUHQFLDRHQGHUHoRGHGHVWLQRGHXPDLQVWUXomRGHGHVYLRGR

)RUPDWRGDVLQVWUXo}HVGR
2 IRUPDWR HVFROKLGR SHORV SURMHWLVWDV SDUD DV LQVWUXo}HV GH XP PLFURSURFHVVDGRUpXPDVROXomRGHFRPSURPLVVRHQWUHHOHJkQFLDRFXSDomRGH PHPyULD H GHVHPSHQKR 3RU H[HPSOR SDUD SULYLOHJLDU D HVWpWLFD SRGHUVHLD UHVHUYDU XP SHGDoR GH FDGD LQVWUXomR SDUD FRQWHU R FyGLJR TXH D LGHQWLILFD DVVLP FRPR DFRQWHFH FRP R SULPHLUR E\WH GDV LQVWUXo}HV GR   1R HQWDQWRSRGHULDKDYHULQVWUXo}HVTXHQmRQHFHVVLWDVVHPGHWRGRHVWHHVSDoRH FRP LVVR KDYHULD GHVSHUGtFLR HP DOJXQV FDVRV (VWH GHVSHUGtFLR DIHWDULD QHJDWLYDPHQWHDHFRQRPLDGHPHPyULDHRGHVHPSHQKR 1RFDVRGRRTXHVHIH]IRLSURFXUDUDSURYHLWDUFDGDELWGLVSRQtYHOGH PRGRDFRPSDFWDUDRPi[LPRDVLQVWUXo}HVHRWLPL]DUDXWLOL]DomRGDPHPyULD H D YHORFLGDGH GH OHLWXUD GDV LQVWUXo}HV (P FRQWUDSDUWLGD VXD FRGLILFDomR p PXLWRPDLVFRPSOH[DGRTXHQRSRLVDJRUDRFyGLJRGHXPDLQVWUXomR QmR SUHFLVD RFXSDU H[DWDPHQWH  E\WH H RV ELWV QmR RFXSDGRV VmR XWLOL]DGRV FRP RXWUDV ILQDOLGDGHV 2 FRPSULPHQWR GDV LQVWUXo}HV SRGH YDULDU GH  D  E\WHV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$ WtWXOR GH H[HPSOR D ILJXUD  WUD] R IRUPDWR GDV LQVWUXo}HV GH PRYLPHQWDomR GH GDGRV LPHGLDWRV SDUD PHPyULD RX HQWUH UHJLVWUDGRUHV 2 FyGLJR GD LQVWUXomR RFXSD RV  ELWV PDLV VLJQLILFDWLYRV GR SULPHLUR E\WH HQTXDQWR RV ELWV  H  LQIOXHQFLDP R UHVWDQWH GD LQVWUXomR 2 ELW Z SRU H[HPSORVHUYHSDUDGLVWLQJXLUDVLQVWUXo}HVTXHPDQLSXODPE\WHV Z  GDV LQVWUXo}HVDQiORJDVTXHPDQLSXODPZRUGV Z  


RSFRGH

SRVWE\WH

GDWD

GDWDLIVZ 

)LJ([HPSORGHIRUPDWRGHLQVWUXomRGR 2SRVWE\WHpGLYLGLGRHPWUrVFDPSRVFRQIRUPHDILJXUD6HRFDPSR PRG FRQWpP R YDORU ELQiULR  HQWmR R RSHUDQGR GD LQVWUXomR p XP UHJLVWUDGRU LGHQWLILFDGRSRUXPFyGLJRGHELWVFRORFDGRQRFDPSR UP,QVWUXo}HVTXH UHIHUHQFLDP GRLV UHJLVWUDGRUHV SRGHP XWLOL]DU R FDPSR UHJ SDUD LGHQWLILFDU R VHJXQGR UHJLVWUDGRU 2XWURV YDORUHV FRORFDGRV QR FDPSR PRG VLJQLILFDP TXH HVWHGHYHVHUGHFRGLILFDGRHPFRQMXQWRFRP UPSDUDGHWHUPLQDURPRGRGH HQGHUHoDPHQWRDVHUXWLOL]DGR


PRG

UHJ

UP

)LJ'HWDOKDPHQWRGRSRVWE\WH 2SDSHOGRH[HPSORDFLPDpDSHQDVRGHSURSRUFLRQDUDROHLWRUXPDLGpLDGH FRPRDFRGLILFDomRpIHLWDeLPSRUWDQWHQRWDUFRPRVHFRQVHJXHDSURYHLWDURV ELWV GLVSRQtYHLV PDV QmR VH SUHRFXSDU FRP D PHPRUL]DomR GH GHWDOKHV TXH VmR H[FOXVLYRV GR  H SRUWDQWR GH SRXFD XWLOLGDGH SDUD D DVVLPLODomR GRV FRQFHLWRVFRQVLGHUDGRVLPSRUWDQWHVQHVWHWH[WR

0RGRVGHHQGHUHoDPHQWR
(VWD VHomR GHVFUHYH RV GLYHUVRV PRGRV GH HQGHUHoDPHQWR GR  (PERUD WUDWHPHVSHFLILFDPHQWHGHVWHFRPSRQHQWHDVLQIRUPDo}HVDSUHVHQWDGDVVmRGH XWLOLGDGHJHUDOXPDYH]TXHPXLWRVPRGRVGHHQGHUHoDPHQWRHQFRQWUDGRVHP RXWURVPLFURSURFHVVDGRUHVHPLFURFRQWURODGRUHVVmRVHPHOKDQWHVDRVGHVFULWRV DTXL 2VPRGRVGHHQGHUHoDPHQWRVmRDVGLIHUHQWHVPDQHLUDVTXHDVLQVWUXo}HVGR SURFHVVDGRU WrP SDUD HVSHFLILFDU D ORFDOL]DomR GH VHXV RSHUDQGRV 8P RSHUDQGR SRGH ID]HU SDUWH GH XPD LQVWUXomR RX HQWmR SRGH HVWDU ORFDOL]DGR HPXPUHJLVWUDGRURXQDPHPyULD'HSHQGHQGRGRFDVRGLIHUHQWHVPRGRVVmR

2PLFURSURFHVVDGRU



QHFHVViULRV3RUH[HPSORSDUDLQLFLDOL]DUXPUHJLVWUDGRUFRPXPYDORUIL[RH FRQKHFLGR HP WHPSR GH PRQWDJHP HP JHUDO VHUi FRQYHQLHQWH XWLOL]DU R PRGRLPHGLDWRTXHDFHLWDXPDFRQVWDQWHSDUDYDUUHUXPDWDEHODHPEXVFDGH DOJXPDLQIRUPDomRVHUiQHFHVViULRDOJXPWLSRGHHQGHUHoDPHQWRTXHSHUPLWD YDULDURtQGLFHGRHOHPHQWRHQGHUHoDGRHPWHPSRGHH[HFXomR

(QGHUHoDPHQWRYLDUHJLVWUDGRU
1HVWH PRGR GH HQGHUHoDPHQWR R RSHUDQGR D VHU XWLOL]DGR VH HQFRQWUD QXP UHJLVWUDGRUUHIHUHQFLDGRSHODLQVWUXomR3RGHPVHUXWLOL]DGRVRV UHJLVWUDGRUHV $;',RXDLQGDRVUHJLVWUDGRUHVGHELWV$+'/ 3RUH[HPSORDLQVWUXomR
MOV AX,BX ; copia o contedo de BX para AX

ID]UHIHUrQFLDDRUHJLVWUDGRU%;SRUTXHpOiTXHHVWiFRQWLGRRRSHUDQGRDVHU FRSLDGRSDUDRUHJLVWUDGRU$; 'DPHVPDIRUPDHP


CMP AL,DL ; seta os flags de acordo com o ; resultado da subtrao AL-DL

RGDGRDVHUFRPSDUDGRFRPRYDORUGH$/HVWiORFDOL]DGRHP'/

(QGHUHoDPHQWRLPHGLDWR
$TXL R RSHUDQGR ID] SDUWH GD SUySULD LQVWUXomR (VWH PRGR p XWLOL]DGR SDUD DWULEXLU YDORUHV FRQVWDQWHV GH  RX GH  ELWV D UHJLVWUDGRUHV RX SRVLo}HV GH PHPyULDFRPRHP
MOV AX,1000H ; AX = 1000H ; seta os flags de acordo com o ; resultado da subtrao SI-0000H.

RX
CMP SI,0000H

2PRGRLPHGLDWRGRWHPGXDVSHTXHQDVOLPLWDo}HVQmRHVWiGLVSRQtYHO SDUDDWULEXLomRGHYDORUHVDRVUHJLVWUDGRUHVGHVHJPHQWRQHPSDUDDLQVWUXomR 386+ 3RGHVHSHUJXQWDUDJRUDVHDVLQVWUXo}HVXWLOL]DGDVQRVH[HPSORVQmRXWLOL]DP WDPEpP R PRGR YLD UHJLVWUDGRU XPD YH] TXH Ki UHJLVWUDGRUHV HVSHFLILFDGRV
7HPSRGHPRQWDJHPUHIHUHVHjHWDSDGHGHVHQYROYLPHQWRGRSURJUDPD9DORUHV
FRQKHFLGRVHPWHPSRGHPRQWDJHPVmRFRQVWDQWHVGHWHUPLQDGDVGHDQWHPmRSHOR SURJUDPDGRURXFDOFXODGDVSHORDVVHPEOHUHQmRSRGHPVHUPRGLILFDGRVGXUDQWHDH[HFXomR

7HPSRGHH[HFXomRUHIHUHVHDRSURJUDPDHPH[HFXomR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

,VWRpYHUGDGHHDSUHVHQoDGHGRLVPRGRVGHHQGHUHoDPHQWRSRGHDFRQWHFHU HPWRGDVDVLQVWUXo}HVGHGRLVRSHUDQGRV$TXLpFODURTXHRPRGRLPHGLDWR VHUHIHUHDRRSHUDQGRGHRULJHP(PRXWURVSRQWRVGRWH[WRRRSHUDQGRGH TXHVHWUDWDVHUiFLWDGRH[SOLFLWDPHQWHVHKRXYHUSRVVLELOLGDGHGHFRQIXVmR

(QGHUHoDPHQWRDEVROXWRRXGLUHWR
1HVWH PRGR R RSHUDQGR TXH VH GHVHMD HQGHUHoDU UHVLGH QD PHPyULD H D LQVWUXomR FRQWpP R HQGHUHoR GR RSHUDQGR $ ILJXUD  LOXVWUD R IXQFLRQDPHQWRGDLQVWUXomR
MOV AX,[1000H] ; copia para AX o word localizado ; nos offsets 1000H e 1001H.

(QGHUHoR + + + 

'DGR + + + 

$; +

)LJ(QGHUHoDPHQWRDEVROXWR029$;>+@ ([LVWHWDPEpPXPPRGRGHHQGHUHoDPHQWRDEVROXWRORQJRXWLOL]DGRDSHQDV HPLQVWUXo}HVGHGHVYLRGRWLSRIDURQGHVmRIRUQHFLGRVVHJPHQWRHRIIVHWGR GHVWLQRGRGHVYLR


JMP 1234H:5678H; salto incondicional para 1234H:5678H

(QGHUHoDPHQWRLQGLUHWR
7DOFRPRQRFDVRDQWHULRURRSHUDQGRUHVLGHQDPHPyULD$LQVWUXomRSRUpP QmR HVSHFLILFD R RIIVHW GR RSHUDQGR PDV XP UHJLVWUDGRU GH  ELWV TXH FRQWpPHVVHRIIVHW3RGHPVHUXWLOL]DGRVRVUHJLVWUDGRUHV%;%3',H6, $ILJXUDLOXVWUDRIXQFLRQDPHQWRGDLQVWUXomR
MOV AX,[BX] ; AX recebe o word de offset BX.

'HIRUPDDQiORJDDLQVWUXomR
INC BYTE PTR [DI]

LQFUHPHQWDRE\WHFXMRRIIVHWHVWiFRQWLGRHP',1RWHDXWLOL]DomRH[SOtFLWD GRWLSR%<7(375QHVWHFDVRQHFHVViULRSDUDTXHRDVVHPEOHUSRVVDGHFLGLU VHRSURJUDPDGHYHLQFUHPHQWDURE\WHTXHUHVLGHQRHQGHUHoR',RXRZRUG TXHUHVLGHHP',',1RH[HPSORDQWHULRURDVVHPEOHUSRGHGHGX]LUTXH

2PLFURSURFHVVDGRU



RRSHUDQGRGHRULJHPpGRWLSR:25'375SRUTXHRRSHUDQGRGHGHVWLQR $; p XPUHJLVWUDGRUGH ELWV3RULVVRQDTXHOHFDVRRWLSRQmRSUHFLVDVHU H[SOLFLWDGR %; + (QGHUHoR + + +  'DGR + + +  $; +

)LJ(QGHUHoDPHQWRLQGLUHWR029$;>%;@ 2 HQGHUHoDPHQWR LQGLUHWR p PXLWR XWLOL]DGR SDUD WUDEDOKDU FRP WDEHODV 2 WUHFKR GH FyGLJR D VHJXLU SRU H[HPSOR YDUUH XPD WDEHOD GH 1 E\WHV FXMR RIIVHWLQLFLDOp GDGR SHOR VtPEROR 7$%(/$ 2 ORRS GH YDUUHGXUD VH HQFHUUD DVVLPTXHIRUHQFRQWUDGRXPHOHPHQWRGLIHUHQWHGH]HURRXTXDQGRRILQDOGD WDEHODpDWLQJLGRVHPTXHDEXVFDWHQKDWLGRVXFHVVR
LOOP: LEA MOV CMP JNZ INC DEC JNZ ... ... BX,TABELA ; CX,N ; BYTE PTR [BX],00H ACHEI BX CX LOOP ; ; BX = offset inicial CX = tamanho da tabela

ACHEI:

busca terminou sem sucesso busca terminou com sucesso

1RFDVRHPTXHDEXVFDWHUPLQDFRPVXFHVVR%;DSRQWDSDUDRSULPHLURE\WH QmRQXORGDWDEHOD

(QGHUHoDPHQWRLQGH[DGR
$ LQVWUXomR HVSHFLILFD XPD FRQVWDQWH GHQRPLQDGD EDVH H XP UHJLVWUDGRU GH tQGLFHFXMRFRQWH~GRpVRPDGRjEDVHSDUDIRUPDURHQGHUHoRGRRSHUDQGR 3RGHPVHUXWLOL]DGRVRVUHJLVWUDGRUHV%3%;6,H', $ILJXUDLOXVWUDRIXQFLRQDPHQWRGDLQVWUXomR
MOV AX,0100H[DI] ; compara AX com word em 100+DI, ; idem, outra notao.

TXHWDPEpPSRGHVHUHVFULWDFRPR
MOV AX,[0100H+DI]



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV (QGHUHoR + + + +  + +  'DGR + + + +  ))+ + 

', +

',

$; ))+

)LJ(QGHUHoDPHQWRLQGH[DGR029$;>+',@ 2HQGHUHoDPHQWRLQGH[DGRSHUPLWHSHUFRUUHUXPDWDEHODXWLOL]DQGRXPRIIVHW ORFDO LVWR p XP RIIVHW TXH YDOH  SDUD R SULPHLUR E\WH GD WDEHOD  SDUD R VHJXQGR E\WH H DVVLP SRU GLDQWH e ~WLO SDUD DFHVVDU HOHPHQWRV GH WDEHODV TXDQGR D SRVLomR LQLFLDO GD WDEHOD D EDVH  p FRQKHFLGD HP WHPSR GH PRQWDJHPPDVRRIIVHWGRHOHPHQWRDDFHVVDUYDULDHPWHPSRGHH[HFXomR2 H[HPSORGDVHomRSRGHVHUUHHVFULWRGDVHJXLQWHIRUPD
LOOP: MOV CMP JNZ INC CMP JNZ ... ... BX,0000H ; BX = offset local inicial BYTE PTR [TABELA + BX],00H ACHEI BX BX,N LOOP ; busca terminou sem sucesso ; busca terminou com sucesso

ACHEI:

1RFDVRHPTXHDEXVFDWHUPLQDFRP VXFHVVR %; FRQWpP R RIIVHW ORFDO GR SULPHLURE\WHQmRQXORGDWDEHOD

(QGHUHoDPHQWREDVHDGR
(VWHPRGRWDPEpPXWLOL]DXPDEDVHHXPGHVORFDPHQWRPDVDRFRQWUiULRGR TXHDFRQWHFHQRHQGHUHoDPHQWRLQGH[DGRDTXLDEDVHpYDULiYHOHRtQGLFHp FRQVWDQWH 3RU LVVR D LQVWUXomR HVSHFLILFD XP UHJLVWUDGRU GH EDVH H XPD FRQVWDQWHTXHVHUYHFRPRGHVORFDPHQWRHPUHODomRDHVVDEDVH2HQGHUHoR GRRSHUDQGRpGDGRSHODVRPDGDEDVHFRPDFRQVWDQWH3RGHPVHUXWLOL]DGRV FRPREDVHRVUHJLVWUDGRUHV%3%;6,H',HPERUDQRUPDOPHQWHVHXWLOL]HP %;H%3$ILJXUDLOXVWUDRIXQFLRQDPHQWRGDLQVWUXomR
MOV [BX+0005H],CX ; copia CX para o offset BX+5

2PLFURSURFHVVDGRU %; + (QGHUHoR + + + + + + +  'DGR + + + +  + + 



BX+5

&; +

)LJ(QGHUHoDPHQWREDVHDGR029>%;+@&; 2HQGHUHoDPHQWREDVHDGRp~WLOSDUDDFHVVDUHOHPHQWRVGHWDEHODVFXMRRIIVHW ORFDOpFRQKHFLGRHPWHPSRGHPRQWDJHPHQTXDQWRDSRVLomRLQLFLDOGDWDEHOD YDULDHPWHPSRGHH[HFXomR $ WtWXOR GH H[HPSOR SRGHVH LPDJLQDU XP SURJUDPD HP TXH H[LVWDP YiULDV WDEHODV GH PHVPD HVWUXWXUD FRQWHQGR GDGRV FRPR R QRPH H D LGDGH GRV DOXQRVGHXPDVDODGHDXODHTXHDLGDGHGHFDGDXPVHHQFRQWUHVHPSUHQR RIIVHW  GD WDEHOD TXH OKH FRUUHVSRQGH $V WDEHODV WrP WRGDV R PHVPR WDPDQKRGDGRSHODFRQVWDQWH6,=(HILFDPGLVSRVWDVXPDDSyVDRXWUDVHP HOHPHQWRVHVWUDQKRVHQWUHHODV2SURJUDPDSRGHULDHQWmRGHWHUPLQDUTXHPp RDOXQRPDLVYHOKRYDUUHQGRRFRQMXQWRGHWDEHODV3DUDLVWRFRORFDULDHP%; RRIIVHWLQLFLDOGHFDGDXPDHOHULDGH%;DLGDGHGHFDGDXP
LEA BX,ALUNOS MOV DI,BX MOV AL,00H MOV CX,N CMP AL,[BX+5] JB OK MOV AL,[BX+5] MOV DI,BX ADD BX,SIZE DEC CX JNZ LOOP ; ; ; ; ; ; ; ; ; offset da primeira tabela inicializa aluno mais velho valor inicial da idade nmero de alunos compara maior idade encontrada at agora com o valor em [BX+5] AL contm a idade mais alta DI aponta para o aluno mais velho BX -> tabela seguinte

LOOP:

OK:

$R ILQDO GR ORRS ', DSRQWD SDUD R DOXQR PDLV YHOKR GD FODVVH RX SDUD SULPHLURDOXQRGDOLVWDTXHWHPDLGDGHPDLVDOWDFDVRKDMDPDLVDOXQRVFRPD PHVPDLGDGH  2HQGHUHoDPHQWREDVHDGRGiDLQGDVXSRUWHDDOJXPDVDSOLFDo}HVLPSRUWDQWHV GDSLOKDHVWXGDGDVQRFDStWXOR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

(QGHUHoDPHQWREDVHDGRLQGH[DGR
(VWH PRGR p XPD FRPELQDomR GRV GRLV DQWHULRUHV $ LQVWUXomR HVSHFLILFD UHJLVWUDGRUHV WDQWR SDUD D EDVH TXDQWR SDUD R tQGLFH R HQGHUHoR HIHWLYR GR RSHUDQGRpIRUPDGRSHODVRPDGHDPERVHVHRSURJUDPDGRUGHVHMDUGHPDLV XPDFRQVWDQWHRSFLRQDO2VUHJLVWUDGRUHVGHEDVHSRGHPVHU%3RX%;HRV UHJLVWUDGRUHVGHtQGLFHSRGHPVHU6,RX', $ILJXUDLOXVWUDRIXQFLRQDPHQWRGDLQVWUXomR
MOV AX,[BX+SI] ; AX recebe word em BX + SI

%; 6, + +
BX+SI

(QGHUHoR + + + + + + + 

'DGR + + + +  + + 

$; +

)LJ(QGHUHoDPHQWREDVHDGRLQGH[DGR029$;>%;6,@ 2XVRGDFRQVWDQWHRSFLRQDOpLOXVWUDGRSHODLQVWUXomR
CMP CL,[100H+BX+DI] ; seta flags de acordo com o ; resultado subtrao CL-byte

2PRGREDVHDGRLQGH[DGRpXWLOL]DGRSDUDDFHVVDUWDEHODVRQGHWDQWRDEDVH TXDQWR R tQGLFH YDULDP HP WHPSR GH H[HFXomR 8P H[HPSOR GH DSOLFDomR SRGH VHU HQFRQWUDGR QR FDStWXOR  TXH R HPSUHJD SDUD WUDEDOKDU FRP HVWUXWXUDVPDWULFLDLV

(QGHUHoDPHQWRUHODWLYR
(VWHPRGRGHHQGHUHoDPHQWRpXWLOL]DGRQDVLQVWUXo}HV-03H&$//GRVWLSRV QHDUHVKRUWHHPWRGRVRVGHVYLRVFRQGLFLRQDLV3DUDIDFLOLWDUDFRPSUHHQVmR GHVWHPRGRpLQWHUHVVDQWHOHPEUDUSULPHLURFRPRVHGiDFRGLILFDomRGHXPD LQVWUXomR GH GHVYLR QR FDVR GR PLFURSURFHVVDGRU  3RU H[HPSOR FRQVLGHUH D LQVWUXomR -& + FRGLILFDGD QR HQGHUHoR + GH XP SURJUDPD
2010H DA 15 20 JC 2015H

2PLFURSURFHVVDGRU



$TXL '$+ p R RSFRGH GD LQVWUXomR -& H R HQGHUHoR GH GHVWLQR + p GHWHUPLQDGR SHOR SURFHVVDGRU DWUDYpV GD OHLWXUD GRV GRLV E\WHV VHJXLQWHV GD LQVWUXomR &RPR D LQVWUXomR FRQWpP XP HQGHUHoR HVWH p XP FDVR GH HQGHUHoDPHQWRDEVROXWR 1R FDVR GR  SRUpP D FRGLILFDomR p EHP GLIHUHQWH FRQIRUPH LOXVWUD R WUHFKR GH FyGLJR DEDL[R TXH VXEWUDL '; GH $; H OLPLWD R UHVXOWDGR D ]HUR FDVRQmRVHMDSRVLWLYR
1CD7:0100 1CD7:0102 1CD7:0104 1CD7:0107 29 D0 73 03 B8 00 00 ... SUB AX,DX JNC 0107 MOV AX,0000

1RWHDJRUDDFRGLILFDomRGDLQVWUXomR-1&RRSFRGH+pVHJXLGRDSHQDV GRQ~PHUR+HRRIIVHWGHGHVWLQR +QmRDSDUHFHQDFRGLILFDomR(P YH] GLVVR R VHJXQGR E\WH GD LQVWUXomR p XWLOL]DGR SHOR SURFHVVDGRU SDUD GHWHUPLQDURHQGHUHoRGHGHVWLQR $ H[HFXomRGDLQVWUXomR-1=FRQVLVWHHP VRPDU R YDORU + DR FRQWH~GR GR UHJLVWUDGRU ,3 1R LQVWDQWH HP TXH D LQVWUXomR p SURSULDPHQWH H[HFXWDGD ,3 Mi IRL DWXDOL]DGR SDUD DSRQWDU SDUD D LQVWUXomRVHJXLQWHGHPRGRTXHDFRQWDTXHRSURFHVVDGRUID]p 2IIVHWGHGHVWLQR RIIVHWGDLQVWUXomRVHJXLQWHGHVORFDPHQWR 2IIVHWGHGHVWLQR ++ + $VVHJXLQWHVREVHUYDo}HVVmRLPSRUWDQWHVRH[HPSORLOXVWUDXPDLQVWUXomRGH GHVYLR GR WLSR VKRUW TXH XWLOL]D DSHQDV XP E\WH SDUD LQGLFDU R HQGHUHoR GH GHVWLQR,VWRVLJQLILFDTXHRRIIVHWGHGHVWLQRWHPTXHHVWDUQRPi[LPR  E\WHVDQWHV RX E\WHVGHSRLVGRRIIVHWGDLQVWUXomRVHJXLQWHSRUTXHHVVHV VmR UHVSHFWLYDPHQWH R PHQRU H R PDLRU Q~PHUR FRP VLQDO TXH SRGHP VHU UHSUHVHQWDGRV FRP  E\WH 6H R HQGHUHoR GH GHVWLQR FDLU IRUD GHVWD IDL[D R DVVHPEOHUHVFROKHUiRPRGRQHDUTXHXVDGHVORFDPHQWRVGHELWVHSHUPLWH FRPLVVRDWLQJLUTXDOTXHUSRQWRGHQWURGRVHJPHQWR1RHQWDQWRDSHQDVRV GHVYLRVLQFRQGLFLRQDLVSRGHPVHUGRWLSRQHDUHSRULVVRSRGHVHUQHFHVViULR FRPELQDUXPGHVYLRFRQGLFLRQDOFRPXPGHVYLRLQFRQGLFLRQDOFDVRRGHVWLQR ILTXHIRUDGDIDL[DDOFDQoiYHOSHORVGHVYLRVGRWLSRVKRUW $OpP GLVVR FRQYpP VDEHU TXH QR FDVR GRV GHVYLRV GR WLSR VKRUW R SURFHVVDGRU WUDQVIRUPD DXWRPDWLFDPHQWH R Q~PHUR D VHU VRPDGR DR UHJLVWUDGRU,3HPXPQ~PHURGHELWVGHDFRUGRFRPRVHXVLQDO1~PHURV SRVLWLYRV VmR HVWHQGLGRV DQWHSRQGRVH ]HURV  YLUD   H Q~PHURV QHJDWLYRVVmRHVWHQGLGRVDQWHSRQGRVHV )+YLUD)))+ ,VWRSHUPLWHTXH RSURFHVVDGRUVRPHVHPSUHRYDORUFRUUHWRD,3SDUDHQFRQWUDURHQGHUHoRGH GHVWLQR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

(PTXDOTXHUFDVRRYDORUFRQWLGRQDLQVWUXomRQmRpRHQGHUHoRGHGHVWLQR PDVVLPDGLIHUHQoDHPE\WHVHQWUHRYDORUDWXDOGRUHJLVWUDGRU,3HRYDORU TXH HVWH GHYHUi DVVXPLU SDUD UHDOL]DU R GHVYLR 'HVWD IRUPD R HQGHUHoR GH GHVWLQR QmR p PDLV DEVROXWR PDV VLP GDGR HP UHODomR D ,3 H SRU LVVR VH FKDPDHQGHUHoRUHODWLYR $ JUDQGH YDQWDJHP GR HQGHUHoDPHQWR UHODWLYR DSDUHFH TXDQGR WUHFKRV GH FyGLJR FRPR RV PRVWUDGRV QRV H[HPSORV SUHFLVDP VHU PXGDGRV GH OXJDU QD PHPyULD GXUDQWH D H[HFXomR GR SURJUDPD WDUHID TXH ID] SDUWH GR JHUHQFLDPHQWRGHPHPyULDGRVVLVWHPDVRSHUDFLRQDLVPDLVVRILVWLFDGRV 6HIRVVHQHFHVViULRPRYHURSURJUDPDGDGRFRPRH[HPSORSDUDRSDUD XP HQGHUHoR + E\WHV DGLDQWH D LQVWUXomR -&+ WHULD TXH VHU UHFRGLILFDGD SDUD -&+ YDOHQGR R PHVPR SDUD WRGDV DV LQVWUXo}HV GH GHVYLR SUHVHQWHV QR SURJUDPD 1R FDVR GR  D XWLOL]DomR GR HQGHUHoDPHQWRUHODWLYRSHUPLWHTXHRFyGLJRSRVVDVHUPRYLGRVHPTXDOTXHU DOWHUDomRSRLVDGLIHUHQoDHQWUHRGHVWLQRHDRULJHPGRGHVYLRQmRVHDOWHUD TXDQGRVHPXGDRSURJUDPDGHOXJDU

'HWHUPLQDomRGRVHJPHQWRXWLOL]DGR
'LYHUVRVPRGRVGHHQGHUHoDPHQWRHVWXGDGRVQDVVHo}HVDQWHULRUHVHQYROYHP R XVR GH HQGHUHoRV GH  ELWV SDUD ORFDOL]DU XP RSHUDQGR (P WRGRV HVVHV FDVRV R HQGHUHoR HP TXHVWmR p R RIIVHW GD SRVLomR GH PHPyULD RQGH R RSHUDQGR VH HQFRQWUD PDV p FODUR TXH D ORFDOL]DomR GHILQLWLYD GH TXDOTXHU SRVLomRVySRGHVHUIHLWDVHIRUHVSHFLILFDGRGHDOJXPDIRUPDRUHJLVWUDGRUGH VHJPHQWRTXHGHYHVHUXWLOL]DGRHPFRQMXQWRFRPHVVHRIIVHW 1D PDLRULD GRV FDVRV D HVSHFLILFDomR GR UHJLVWUDGRU GH VHJPHQWR p IHLWD GH IRUPDLPSOtFLWDSRLVSDUDFDGDLQVWUXomRH[LVWHXPUHJLVWUDGRUGHIDXOW$WDEHOD DSUHVHQWDHVVHVUHJLVWUDGRUHVGHDFRUGRFRPRWLSRGHRSHUDomRUHDOL]DGD EHP FRPR DV DOWHUQDWLYDV SRVVtYHLV TXDQGR VH GHVHMD PXGDU HVVH GHIDXOW DSDUHFHPDLQGDRVUHJLVWUDGRUHVTXHSRGHPVHUXWLOL]DGRVFRPRRIIVHWV

2PLFURSURFHVVDGRU 2SHUDomR %XVFDGHLQVWUXo}HV $FHVVRjSLOKD 0RYLPHQWDomRGHGDGRV H[FHWRFRP%3 0RYLPHQWDomRGHGDGRV FRP%3 HQGEDVHDGR 2ULJHPGHGDGRVQD PDQLSXODomRGHVWULQJV 'HVWLQRGHGDGRVQD PDQLSXODomRGHVWULQJV 'HIDXOW &6 66 '6 66 '6 (6 $OWHUQDWLYDV 1HQKXPD 1HQKXPD &6(666 &6(6'6 &6(666 1HQKXPD 2IIVHW ,3 63 5HJGHXVRJHUDO HQGHUHoRDEVROXWR %3RX%3 FRQVWDQWH 6, ',



7DE6HJPHQWRVGHIDXOWHDOWHUQDWLYDV 5HVWD DLQGD H[SOLFDU FRPR VH HVSHFLILFD XP VHJPHQWR DOWHUQDWLYR TXDQGR VH GHVHMDPXGDURGHIDXOW(VWDPXGDQoDpIHLWDPHGLDQWHXWLOL]DomRGRFKDPDGR VHJPHQWRYHUULGHSUHIL[RXSUHIL[RGHPRGLILFDomRGHVHJPHQWRQDLQVWUXomRHP TXHVWmR (VWH SUHIL[R p FRQVWLWXtGR GR QRPH GR VHJPHQWR VHJXLGR SRU XP VLQDOGH3RUH[HPSORDLQVWUXomR
MOV AX,ES:BX

FRSLDSDUD$;RZRUGFXMRRIIVHWHVWiHP%;PDVGHGHQWURGRVHJPHQWR(6 HQmRPDLVGRVHJPHQWR'6TXHVHULDXWLOL]DGRQDDXVrQFLDGRSUHIL[R(6 (P DOJXQV FDVRV R XVR GRV SUHIL[RV GH PRGLILFDomR GH VHJPHQWR SRGH VHU DXWRPDWL]DGRFRPDGLUHWLYD$6680(FRQIRUPHH[SOLFDRDQH[R



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

3DUkPHWURVHYDULiYHLVORFDLV
,QWURGXomR
&RPR YLPRV HP FDStWXORV DQWHULRUHV D SLOKD WHP XP SDSHO LPSRUWDQWH QR PHFDQLVPR GH FKDPDGD GH VXEURWLQDV H GH WUDWDGRUHV GH LQWHUUXSomR DVVLP FRPRQRDUPD]HQDPHQWRWHPSRUiULRGHYDORUHVFRQWLGRVQRVUHJLVWUDGRUHVGR SURFHVVDGRU (VWH FDStWXOR WUDWD GH PDLV GRLV XVRV LPSRUWDQWHV GD SLOKD D SDVVDJHP GH SDUkPHWURVSDUDVXEURWLQDVHDFULDomRGHYDULiYHLVORFDLV

3DVVDJHPGHSDUkPHWURVSDUDVXEURWLQDV
eFRPXPTXHXPDVXEURWLQDDFHLWHXPRXPDLVSDUkPHWURVRVTXDLVXWLOL]D SDUD UHDOL]DU VHX SURFHVVDPHQWR 3RU H[HPSOR XPD VXEURWLQD FDSD] GH FRPSDUDUGXDVVWULQJVSUHFLVDVDEHURQGHVHHQFRQWUDPHVWDVVWULQJVSDUDID]HU D FRPSDUDomR H XPD VXEURWLQD TXH FDOFXOH XPD IXQomR I [  SUHFLVD VHU LQIRUPDGD GR YDORU GH [ SDUD SRGHU ID]HU R FiOFXOR 2V YDORUHV QHFHVVLWDGRV SHODVVXEURWLQDVGHYHPVHUIRUQHFLGRVSHODSDUWHGRSURJUDPDTXHDVFKDPD RSHUDomRHVWDFRQKHFLGDFRPR SDVVDJHPGHSDUkPHWURV $SDVVDJHPGHSDUkPHWURVSRGHVHUIHLWDGHGLYHUVDVIRUPDV6mRDSUHVHQWDGDV D VHJXLU WUrV IRUPDV GH SDVVDJHP GH SDUkPHWURV DV GXDV SULPHLUDV VHUYLQGR SULQFLSDOPHQWHSDUDFRPSDUDomRFRPDWHUFHLUDTXHpRSULQFLSDOREMHWRGHVWH HVWXGR

3DVVDJHPDWUDYpVGHUHJLVWUDGRUHV
$IRUPDPDLVVLPSOHVpD SDVVDJHPGHSDUkPHWURVDWUDYpVGHUHJLVWUDGRUHV1HVWHFDVR RVYDORUHVGRVSDUkPHWURVVmRFRORFDGRVSHORSURJUDPDFKDPDGRUHPDOJXQV GRVUHJLVWUDGRUHVGRSURFHVVDGRUGHDFRUGRFRPXPDFRQYHQomRHVWDEHOHFLGD



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

SHOR SURJUDPDGRU GD VXEURWLQD 3RU H[HPSOR XPD VXEURWLQD TXH LPSULPD XPDPHQVDJHPQDWHODSRGHFRQVLGHUDUTXHRUHJLVWUDGRU';FRQWpPRRIIVHW GHVWD PHQVDJHP QR VHJPHQWR GH GDGRV DWXDO &DEH HQWmR DR SURJUDPD FKDPDGRU FRORFDU HVWH RIIVHW QR UHJLVWUDGRU '; DQWHV GH HIHWXDU D FKDPDGD SDUDDVXEURWLQD$OLVWDJHPDVHJXLULOXVWUDRHPSUHJRGHVWHPHFDQLVPR
CODIGO SEGMENT ... INICIO: MOV AX,DADOS MOV DS,AX LEA DX,MSG1 CALL SHOW LEA DX,MSG2 CALL SHOW ... SHOW PROC NEAR MOV AH,09H INT 21H RET SHOW ENDP CODIGO ENDS DADOS MSG1 MSG2 DADOS SEGMENT DB MENSAGEM 1$ DB MENSAGEM 2$ ENDS

; DX CONTM OFFSET DE MSG1 ; DX CONTM OFFSET DE MSG2 ; APRESENTA MSG DE OFFSET DS:DX ; WRITE STRING

3DVVDJHPDWUDYpVGHYDULiYHLVJOREDLV
(VWH PHFDQLVPR p VHPHOKDQWH DR GD SDVVDJHP DWUDYpV GH UHJLVWUDGRUHV $ GLIHUHQoD HVWi DSHQDV QR IDWR GH VH XWLOL]DUHP YDULiYHLV DR LQYpV GH UHJLVWUDGRUHVGRSURFHVVDGRUSDUDSDVVDURVSDUkPHWURV2SURJUDPDFKDPDGRU GHYH FRORFDU RV SDUkPHWURV QHVWDV YDULiYHLV DQWHV GD FKDPDGD GD VXEURWLQD TXHLUiEXVFiORVSDUDHIHWXDUVHXSURFHVVDPHQWR$OLVWDJHPVHJXLQWHPRVWUD FRPR ILFDULD R SURJUDPD GR H[HPSOR DQWHULRU XWLOL]DQGR D YDULiYHO JOREDO 6B375 VWULQJSRLQWHU GHILQLGDQRVHJPHQWRGHGDGRV
CODIGO SEGMENT ... INICIO: MOV AX,DADOS MOV DS,AX LEA S_PTR,MSG1 CALL SHOW LEA S_PTR,MSG2 CALL SHOW ...

; ENDEREO DA MSG1 EM S_PTR ; ENDEREO DA MSG2 EM S_PTR

3DUkPHWURVHYDULiYHLVORFDLV
SHOW PROC NEAR MOV AH,09H MOV DX,S_PTR INT 21H RET ENDP ENDS SEGMENT DB MENSAGEM 1$ DB MENSAGEM 2$ DW ? ENDS



; APRESENTA MSG EM S_PTR ; WRITE STRING ; DX APONTA P/ MSG A APRESENTAR

SHOW CODIGO DADOS MSG1 MSG2 S_PTR DADOS

3DVVDJHPDWUDYpVGDSLOKD
(VWH PHFDQLVPR FRQVLVWH HP FRORFDU RV SDUkPHWURV D VHUHP SDVVDGRV SDUD D VXEURWLQDQDSLOKDDQWHVGDFKDPDGD$VXEURWLQDEXVFDHQWmRRVSDUkPHWURV QDSLOKDSDUDUHDOL]DUVHXSURFHVVDPHQWR (PERUD R SULQFtSLR GH IXQFLRQDPHQWR VHMD VLPSOHV Ki DOJXQV IDWRUHV D FRQVLGHUDUTXHVHLJQRUDGRVSRGHPOHYDURSURJUDPDDVHSHUGHU6mRHOHV XPD YH] SURQWD D VXEURWLQD D RUGHP HP TXH RV SDUkPHWURV GHYHP VHU SDVVDGRVILFDIL[DHGHYHVHUUHVSHLWDGDSHORSURJUDPDGRUTXHDFKDPD SDUDHQFRQWUDURVSDUkPHWURVQDSLOKDDVXEURWLQDSUHFLVDOHYDUHPFRQWD TXH DOpP GHVWHV D SLOKD FRQWHUi WDPEpP R HQGHUHoR GH UHWRUQR GD VXEURWLQD RSURJUDPDFKDPDGRUTXHFRORFRXRVSDUkPHWURV QD SLOKD p UHVSRQViYHO WDPEpPSRUUHPRYrORVGHOiDSyVDFKDPDGD (QTXDQWR D SULPHLUD FRQVLGHUDomR GLVSHQVD H[SOLFDo}HV DGLFLRQDLV DV RXWUDV GXDV PHUHFHP PDLRU DWHQomR $ ILJXUD  LOXVWUD R HVWDGR GD SLOKD GH XP SURJUDPDKLSRWpWLFRDSyVDFKDPDGDGHXPDVXEURWLQD QHDUTXHUHFHEHGRLV SDUkPHWURVDWUDYpVGDSLOKD $QWLJRWRSRGDSLOKD 3DUkPHWUR 3DUkPHWUR 63 2IIVHWGRHQGGHUHWRUQR

&UHVFLPHQWRGDSLOKD

)LJ$SLOKDFRPGRLVSDUkPHWURV (VWDILJXUDLQGLFDTXHDVXEURWLQDWHPTXHVHEDVHDUQRYDORUGH63SDUDWHU DFHVVRDRVYDORUHVGRVSDUkPHWURVUHFHELGRV2EVHUYDQGRVHDILJXUDSRGHVH



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

FRQFOXLUTXHLPHGLDWDPHQWHDSyVDFKDPDGDGDVXEURWLQDR~OWLPRSDUkPHWUR SDVVDGRHVWDUiQRHQGHUHoR63RSHQ~OWLPRHP63HDVVLPSRUGLDQWH 1R HQWDQWR D XWLOL]DomR GR UHJLVWUDGRU 63 SDUD HQGHUHoDU RV SDUkPHWURV p H[WUHPDPHQWHLQFRQYHQLHQWHXPDYH]TXHDSUySULDVXEURWLQDID]HPJHUDO XVRGDSLOKD&RPLVVRRYDORUGH63YDULDULDGXUDQWHDH[HFXomRGDVXEURWLQD R TXH VLJQLILFD SRU H[HPSOR TXH R ~OWLPR SDUkPHWUR SUHFLVDULD VHU UHIHUHQFLDGR FRPR 63 Q  RQGH Q p R Q~PHUR GH ZRUGV FRORFDGRV QD SLOKDSHODVXEURWLQDHDLQGDQmRUHWLUDGRV eSRVVtYHOHYLWDUHVWHWUDQVWRUQRDWUDYpVGDFULDomRGHXPSRQWHLURIL[RSDUDD UHJLmR GD SLOKD TXH FRQWpP RV SDUkPHWURV H TXH p HQWmR XWLOL]DGR SHOD VXE URWLQD SDUD HQGHUHoiORV 2 UHJLVWUDGRU %3 GR PLFURSURFHVVDGRU  IRL FRQFHELGRFRPHVWDILQDOLGDGHHpXWLOL]DGRGDVHJXLQWHIRUPD DVXEURWLQDLQLFLDVDOYDQGRRYDORUGH%3QDSLOKDSDUDSRGHUUHVWDXUiOR DQWHVGHUHWRUQDU FRSLDHQWmRRYDORUDWXDOGH63SDUD%3'HVWDIRUPD%3YLUDXPSRQWHLUR IL[RSDUDDSRVLomRGDSLOKDTXHFRQWpPRYDORUGH%3TXDQGRGDHQWUDGD QDVXEURWLQD RHQGHUHoR%3FRQWpPRRIIVHWGRHQGHUHoRGHUHWRUQR QRFDVRGHVXEURWLQDVGRWLSRIDURHQGHUHoR%3FRQWpPRVHJPHQWRGR HQGHUHoRGHUHWRUQRQRFDVRGHVXEURWLQDVGRWLSR QHDUFRQWpPR~OWLPR SDUkPHWURSDVVDGR RVHQGHUHoRVVHJXLQWHV %3%3 FRQWrPRVGHPDLVSDUkPHWURV 3DUD LPSOHPHQWDU HVWH PHFDQLVPR DV VXEURWLQDV LQLFLDP VHPSUH FRP D VHTrQFLD
PUSH BP MOV BP,SP

$ILJXUDPRVWUDDSLOKDSDUDVXEURWLQDVGRWLSRQHDUDSyVDH[HFXomRGHVWDV LQVWUXo}HV$SDUWLUGHVWHSRQWRDVXEURWLQDPDQWpPRYDORUGH%3LQDOWHUDGR HSDVVDDHQGHUHoDURVSDUkPHWURVHSRU%3H%3UHVSHFWLYDPHQWH$ SLOKDSRGHVHUXWLOL]DGDFRPRHPTXDOTXHURXWURSRQWRGRSURJUDPDSRLVDV DOWHUDo}HVQRYDORUGH63QmRDIHWDPPDLVDIRUPDGHHQGHUHoDURVSDUkPHWURV

(PERUDVHMDSRVVtYHOLPDJLQDUGLYHUVDVIRUPDVGHXWLOL]DURUHJLVWUDGRU%3SDUDUHVROYHUR
SUREOHPDDIRUPDDSUHVHQWDGDVHGHVWDFDSRUVHUDDGRWDGDSHORVSULQFLSDLVFRPSLODGRUHVGD OLQJXDJHP&FRPRRVGD%RUODQGHGD0LFURVRIW3RULVVRRFRQKHFLPHQWRGRPDWHULDO H[SRVWRDTXLVHUi~WLOjTXHOHVTXHSUHFLVDUHPWUDEDOKDUFRPGHWDOKHVHP$VVHPEO\TXDQGR HQYROYLGRVFRPSURJUDPDomRGHPDLVDOWRQtYHO

3DUkPHWURVHYDULiYHLVORFDLV $QWLJRWRSRGDSLOKD 3DUkPHWUR 3DUkPHWUR 2IIVHWGRHQGGHUHWRUQR 63%3 $QWLJRYDORUGH%3



&UHVFLPHQWRGDSLOKD

)LJ$SLOKDDSyVRDUPD]HQDPHQWRGRYDORUGH%3 1RFDVRGDVVXEURWLQDV IDURVHQGHUHoRVGRVSDUkPHWURVVmR%3H%3 UHVSHFWLYDPHQWHSRUTXHRHQGHUHoRGHUHWRUQRpFRPSRVWRGHGXDVSDODYUDV FRQIRUPHLOXVWUDDILJXUD $QWLJRWRSRGDSLOKD 3DUkPHWUR 3DUkPHWUR 6HJPHQWRGRHQGGHUHWRUQR 2IIVHWGRHQGGHUHWRUQR 63%3 $QWLJRYDORUGH%3

&UHVFLPHQWRGDSLOKD

)LJ$SLOKDHPXPDVXEURWLQD)$5 1RWH DLQGD TXH DV LQVWUXo}HV GH PRYLPHQWDomR GH GDGRV TXH XWLOL]DP R UHJLVWUDGRU%3XVDPSRUGHIDXOWRUHJLVWUDGRUGHVHJPHQWR 66GH PRGR TXH LQVWUXo}HV FRPR 029 $;>%3@ QmR SUHFLVDP GH TXDOTXHU DOWHUDomR SDUD EXVFDURGDGRGRVHJPHQWRFRUUHWR 2ILQDOGHXPDVXEURWLQDpWLSLFDPHQWH
POP BP RET

&RQYpPOHPEUDUTXHH[LVWHPGRLVWLSRVGHLQVWUXo}HV DPEDVXWLOL]DQGRR PHVPR PQHP{QLFR $ SULPHLUD GHQRPLQDGD  ID] FRP TXH R SURFHVVDGRUUHWLUHDSHQDVXPDSDODYUDGRWRSRGDSLOKDTXHFRQVLGHUDFRPRR RIIVHWGRHQGHUHoRGHUHWRUQRHFRORFDQRUHJLVWUDGRU,3 $ VHJXQGD  ID] FRP TXH VHMDP UHFXSHUDGDV GXDV SDODYUDV TXH R SURFHVVDGRU FRQVLGHUD FRPR RIIVHW H VHJPHQWR GR HQGHUHoR GH UHWRUQR QHVWD RUGHP H FRORFD QRV UHJLVWUDGRUHV ,3 H &6 4XDOTXHU TXH VHMD R FDVR VH D URWLQD IRL FKDPDGD FRUUHWDPHQWHLVWRpGHDFRUGRFRPRWLSRGH TXHGHWHUPLQDVHXWLSR QHDU RXIDU DVLWXDomRGDSLOKDDSyVRWpUPLQRGDVXEURWLQDVHUiDGDILJXUD
#% #% # #% # #%



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV $QWLJRWRSRGDSLOKD 3DUkPHWUR 63 3DUkPHWUR

&UHVFLPHQWRGDSLOKD

)LJ$SLOKDDSyVRUHWRUQRGDVXEURWLQD 2SUy[LPRSRQWRDWUDWDUpDUHPRomRGRVSDUkPHWURVGDSLOKDSHORSURJUDPD FKDPDGRU 3DUD WDQWR R SURJUDPD FKDPDGRU SRGHULD FRORFDU LPHGLDWDPHQWH DSyV D LQVWUXomR &$// GXDV QHVWH FDVR  LQVWUXo}HV 323 SDUD XP UHJLVWUDGRU TXDOTXHU R TXH HOLPLQDULD RV SDUkPHWURV (PERUD IXQFLRQH HVWH PpWRGR JHUDOPHQWHQmRpXWLOL]DGRSHORVVHJXLQWHVPRWLYRV SRGHQmRKDYHUQHQKXPUHJLVWUDGRUGLVSRQtYHOSDUDVHID]HURV323V RPpWRGRpLQHILFLHQWHTXDQGRRQ~PHURGHSDUkPHWURVDHOLPLQDUpPXLWR JUDQGH (POXJDUGLVVRRTXHVHID]pVLPSOHVPHQWHDGLFLRQDURYDORUQDRUHJLVWUDGRU 63 RQGH Q p R Q~PHUR GH ZRUGV HPSLOKDGRV FRPR SDUkPHWURV DQWHV GD FKDPDGD2FyGLJRFRPSOHWRGDFKDPDGDGHXPDVXEURWLQD68%TXHDFHLWH GRLVSDUkPHWURVFRPRQRH[HPSORDFLPDILFDULDHQWmRDVVLP
MOV AX,PARAM1 PUSH AX MOV AX,PARAM2 PUSH AX CALL SUB ADD SP,4

; REMOVE OS PARMETROS APS O USO

$QLQKDPHQWRGHVXEURWLQDV QHVWLQJ
e FRPXP TXH SURJUDPDV VHMDP HVWUXWXUDGRV GH IRUPD TXH XPD VXEURWLQD FKDPH RXWUDV VXEURWLQDV $ DQiOLVH D VHJXLU PRVWUD TXH R PHFDQLVPR GH SDVVDJHPGHSDUkPHWURVDWUDYpVGDSLOKDIXQFLRQDWDPEpPQHVWHVFDVRVJUDoDV DRIDWRGHTXHRUHJLVWUDGRU%3pVHPSUHVDOYRQDSLOKDQRLQtFLRGHFDGDVXE URWLQDHUHVWDXUDGRDQWHVGRUHWRUQR 6XSRQKD XP SURJUDPD SULQFLSDO TXH FKDPH XPD VXEURWLQD QHDU GH QRPH 68%SDVVDQGROKHGRLVSDUkPHWURV36H36
MOV AX,P1S1 PUSH AX MOV AX,P2S1 PUSH AX CALL SUB1 ADD SP,4 ; PRIMEIRO PARMETRO NA PILHA ; SEGUNDO PARMETRO NA PILHA ; PARMETROS REMOVIDOS

3DUkPHWURVHYDULiYHLVORFDLV



6XSRQKD DLQGD TXH D VXEURWLQD 68% FKDPH XPD VHJXQGD VXEURWLQD IDU GH QRPH68%TXHUHFHEHWUrVSDUkPHWURV3636H36
SUB1 PROC NEAR PUSH BP MOV BP,SP ... MOV AX,P1S2 PUSH AX MOV AX,P2S2 PUSH AX MOV AX,P3S2 PUSH AX CALL SUB2 ADD SP,6 ... POP BP RET ENDP

; ACESSO A P1S1 E P2S1 ; PRIMEIRO PARMETRO NA PILHA ; SEGUNDO PARMETRO NA PILHA ; TERCEIRO PARMETRO NA PILHA ; PARMETROS REMOVIDOS ; ACESSO A P1S1 E P2S1 ; CONTINUA FUNCIONANDO!

SUB1

'HSRLV GR UHWRUQR GD VXEURWLQD 68% D VXEURWLQD 68% SRGH YROWDU D DFHVVDU RV SDUkPHWURV 36 HP >%3  @  H 36 HP >%3  @  ,VWR p SRVVtYHO SRUTXH 68% HPERUD PRGLILTXH R YDORU GH %3 UHVWDXUD HVVH UHJLVWUDGRUDQWHVGHUHWRUQDU
SUB2 PROC FAR PUSH BP MOV BP,SP ... POP BP RET ENDP

; ACESSO A P1S2, P2S2 e P3S2 ; BP VOLTA AO VALOR NECESSRIO EM SUB1

SUB2

$ VLWXDomR GD SLOKD LPHGLDWDPHQWH DQWHV GH D VXEURWLQD 68% FRPHoDU D HPSLOKDURVSDUkPHWURVSDUDDFKDPDGDGH68%pDPHVPDGDILJXUD$ ILJXUDPRVWUDFRPRILFDDSLOKDGHQWURGDVXEURWLQD68%GHSRLVTXHHVWD H[HFXWD DV GXDV SULPHLUDV LQVWUXo}HV SRVLFLRQDQGR %3 SDUD DFHVVDU VHXV SDUkPHWURV 'HSRLVGDLQVWUXomR323%3QRILQDOGH68%%3YROWDDWHURYDORUTXHOKH WLQKDVLGRDWULEXtGRHP68%'HVWDIRUPDDVXEURWLQD68%SRGHYROWDUD DFHVVDUVHXVSDUkPHWURVGDPHVPDIRUPDFRPRYLQKDID]HQGRDQWHVGHFKDPDU 68% *HQHUDOL]DQGR HQTXDQWR KRXYHU HVSDoR QD SLOKD R PHFDQLVPR GH SDVVDJHP GH SDUkPHWURV FRQWLQXD IXQFLRQDQGR LQGHSHQGHQWHPHQWH GR Q~PHURGHVXEURWLQDVDQLQKDGDV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV $QWLJRWRSRGDSLOKD 36 36 2IIVHWGRHQGGHUHWRUQR $QWLJRYDORUGH%3 36 36 36 6HJPHQWRGRHQGGHUHWRUQR 2IIVHWGRHQGGHUHWRUQR %3XWLOL]DGRHP6 63%3 &UHVFLPHQWRGDSLOKD )LJ3DVVDJHPGHSDUkPHWURVHPVXEURWLQDVDQLQKDGDV

&RPSDUDomRHQWUHRVPpWRGRV
$SULQFLSDOYDQWDJHPGRPpWRGRGHSDVVDJHPSRUUHJLVWUDGRUHVpDYHORFLGDGH XPDYH]QmRH[LJHDFHVVRjPHPyULDH[WHUQD1RHQWDQWRVRIUHGDVVHJXLQWHV GHVYDQWDJHQV QHP VHPSUH Ki UHJLVWUDGRUHV OLYUHV HP Q~PHUR VXILFLHQWH SDUD DFRPRGDU WRGRVRVSDUkPHWURV p GLItFLO HVWDEHOHFHU XPD FRQYHQomR VREUH HP TXH RUGHP RV UHJLVWUDGRUHV GHYHPVHUXWLOL]DGRVjPHGLGDTXHDXPHQWDRQ~PHURGHSDUkPHWURV HP FRQVHTrQFLD DXPHQWDP D FRPSOH[LGDGH GD GRFXPHQWDomR GD VXE URWLQDHRULVFRGHVHFRPHWHUHPHUURVQDVXDFKDPDGD $ SDVVDJHP SRU YDULiYHLV JOREDLV HOLPLQD D SULPHLUD GDV GHVYDQWDJHQV DFLPD PDV SHUGH HP YHORFLGDGH $OpP GLVVR VRIUH GH SUREOHPDV VHPHOKDQWHV DRV GRLV~OWLPRVSRLVpGLItFLOHVWDEHOHFHUXPDFRQYHQomRXQLYHUVDOSDUDDDORFDomR HDRUGHPGHXWLOL]DomRGHYDULiYHLVFULDGDVHVSHFLDOPHQWHSDUDDSDVVDJHPGRV SDUkPHWURV $GPLQLVWUDU RV QRPHV GHVVDV YDULiYHLV WDPEpP FULD GLILFXOGDGHV )LQDOPHQWHDVYDULiYHLVJOREDLVILFDPRFXSDQGRHVSDoRRWHPSRWRGRPDVVy VmRXWLOL]DGDVGHQWURGDVVXEURWLQDV $ SDVVDJHP SHOD SLOKD HPERUD WDPEpP VHMD PDLV OHQWD SRU H[LJLU DFHVVR j PHPyULDH[WHUQDpRPpWRGRSUHIHULGRGHYLGRjXQLIRUPLGDGHGHWUDWDPHQWR TXHVHFRQVHJXHHWDPEpPSRUSHUPLWLUQDWXUDOPHQWHDFKDPDGDGHXPDVXE URWLQDGHQWURGHRXWUDHQTXDQWRKRXYHUHVSDoRQDSLOKD

3DUkPHWURVHYDULiYHLVORFDLV



&ULDomRGHYDULiYHLVORFDLV
$VHJXQGDIRUPDGHXWLOL]DomRGDSLOKDDVHUGLVFXWLGDQHVWHFDStWXORpDFULDomR GDVDVVLPFKDPDGDV YDULiYHLV ORFDLVRX YDULiYHLV DXWRPiWLFDV 6mR YDULiYHLV FULDGDV SRU XPD VXEURWLQD HP WHPSR GH H[HFXomR SDUD DUPD]HQDU UHVXOWDGRV WHPSRUiULRVHGHVWUXtGDVDQWHVGRUHWRUQR &RPR H[HPSOR VXSRQKD TXH D VXEURWLQD 6KRZ XWLOL]DGD QRV H[HPSORV DQWHULRUHVSDUDHVFUHYHUPHQVDJHQVQDWHODVHMDDOWHUDGDGHPRGRDLQFOXLUXPD FRQWDJHP GR Q~PHUR GH FDUDFWHUHV HVFULWRV UHWRUQDQGR HVWH Q~PHUR SDUD R SURJUDPD FKDPDGRU QR UHJLVWUDGRU $; 6XSRQKD DLQGD TXH VH GHVHMD ID]HU D FRQWDJHP GR Q~PHUR GH FDUDFWHUHV VHP XWLOL]DU XP GRV UHJLVWUDGRUHV SDUD DUPD]HQiOD PDV VLP XPD SRVLomR GH PHPyULD 8PD VROXomR SRVVtYHO VHULD FULDU XPD YDULiYHO JOREDO DSHQDV SDUD HVWD ILQDOLGDGH (QWUHWDQWR HVWD QmR p XPDVROXomRUD]RiYHOSRUTXHDYDULiYHOVyVHULD~WLOHQTXDQWRVHH[HFXWDVVHD VXEURWLQDPDVRFXSDULDHVSDoRRWHPSRWRGR2XVRGHXPDYDULiYHOORFDOp PDLVLQGLFDGRQHVWHFDVR $ FULDomR GH YDULiYHLV ORFDLV FRQVLVWH HP DEULU XPD EUHFKD QD SLOKD FRUUHVSRQGHQWH DR HVSDoR RFXSDGR SHODV YDULiYHLV TXH VH SUHWHQGH XWLOL]DU 3DUDWDQWRVXEWUDLVHGRYDORUGH63RQ~PHURGHE\WHVQHFHVViULRVORJRDSyV DSUHSDUDomRGRUHJLVWUDGRU%3SDUDDSRQWDUSDUDRVSDUkPHWURVSDVVDGRV3RU H[HPSORSDUDFULDUHVSDoRSDUDXPD~QLFDYDULiYHOGRWLSR ZRUGRFyGLJRGD VXEURWLQDp
PUSH BP MOV BP,SP SUB SP,2 ; Abre espao para um word

2 DVSHFWR GD SLOKD DSyV D H[HFXomR GHVWD VHTrQFLD SRU XPD VXEURWLQD QHDU TXHUHFHEHGRLVSDUkPHWURVpRDSUHVHQWDGRQDILJXUD $QWLJRWRSRGDSLOKD 3DUkPHWUR 3DUkPHWUR 2IIVHWGRHQGGHUHWRUQR %3 $QWLJRYDORUGH%3 63 (VSDoRSDUDYDULiYHOORFDO

&UHVFLPHQWRGDSLOKD

)LJ&ULDomRGHXPDYDULDYHOORFDO $SyV LVVR D SLOKD SRGH VHU XWLOL]DGD QRUPDOPHQWH ILFDQGR R HVSDoR FULDGR GLVSRQtYHOSDUDDUPD]HQDUYDORUHVWHPSRUiULRVeLPSRUWDQWHQRWDUTXH



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

DYDULiYHOORFDOVHULDHQGHUHoDGDSRU%36HIRVVHPFULDGDVPDLVYDULiYHLV VHXVHQGHUHoRVVHULDP%3%3HDVVLPSRUGLDQWH HVWHVHQGHUHoRVVmRRVPHVPRVSDUDVXEURWLQDVQHDUHIDU DV YDULiYHLV ORFDLV WrP VHPSUH GHVORFDPHQWRV QHJDWLYRV HP UHODomR D %3 HQTXDQWRRVSDUkPHWURVWrPVHPSUHGHVORFDPHQWRVSRVLWLYRV QR ILQDO GD VXEURWLQD D EUHFKD DEHUWD QD SLOKD SUHFLVD VHU IHFKDGD DQWHV TXHVHSRVVDUHFXSHUDURYDORUGH%3VDOYRQDHQWUDGD3DUDWDQWRVRPDVH QRYDPHQWH D 63 R YDORU VXEWUDtGR QD FULDomR GDV YDULiYHLV 2 ILQDO GD VXEURWLQDILFDULDDVVLP
ADD SP,2 POP BP RET

$ OLVWDJHP D VHJXLU PRVWUD XP SURJUDPD FRP XPD VXEURWLQD FKDPDGD 6+2:TXHXWLOL]DXPDYDULiYHOORFDO5HFHEHGRLVSDUkPHWURV HQGHUHoRVGH GXDVVWULQJVDHVFUHYHUQDWHOD FRQWDRQ~PHURGHFDUDFWHUHVHVFULWRVHUHWRUQD HVWH YDORU HP $; 2 YDORU UHWRUQDGR p HQWmR FRQYHUWLGR SDUD R VLVWHPD GHFLPDOHDSUHVHQWDGRQDWHOD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;VarLoc.asm - Variaveis locais ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PILHA SEGMENT STACK DW 40H DUP(?) PILHA ENDS DADOS MSG1 MSG2 MSG3 MSG4 N DADOS CODE SEGMENT DB 'ESTE PROGRAMA JUNTA DUAS MENASGENS $' DB 'EM UMA UNICA.$' DB 0DH,0AH,'A LINHA ACIMA TEM $' DB ' CARACTERES.$' DB 00H,00H,'$' ENDS

SEGMENT ASSUME CS:CODE, DS:DADOS, SS:PILHA INICIO: MOV AX,DADOS MOV DS,AX MOV AX,OFFSET MSG1 ; ENDERECO DA MSG1 PUSH AX MOV AX,OFFSET MSG2 ; ENDERECO DA MSG2 PUSH AX CALL SHOW ADD SP,4 ; ELIMINA PARAMETROS DA PILHA MOV BL,10 ; DIV BL ; CONVERTE AX PARA DECIMAL OR AH,30H ; ASCII

3DUkPHWURVHYDULiYHLVORFDLV
MOV N+1,AH OR AL,30H MOV N,AL MOV AH,09H LEA DX,MSG3 INT 21H MOV AH,09H LEA DX,N INT 21H MOV AH,09H LEA DX,MSG4 INT 21H MOV AH,4CH INT 21H SHOW ; ; ; ; ; ; UNIDADE ASCII DEZENA ESCREVE MSG3



; ESCREVE VALOR DE N ; ESCREVE MSG4 ; TERMINA PROGRAMA

LOOP1:

OK1:

LOOP2:

OK2:

SHOW CODE

PROC NEAR PUSH BP MOV BP,SP SUB SP,2 ; VAR DE CONTAGEM TEMPORARIA MOV WORD PTR [BP-2],00H MOV BX,[BP+6] ; PRIMEIRA STRING CMP BYTE PTR [BX],'$' JZ OK1 INC WORD PTR [BP-2] ; CONTANDO CARACTERES DA MSG1 INC BX JMP LOOP1 MOV AH,09H MOV DX,[BP+6] INT 21H ; ESCREVE MSG1 MOV BX,[BP+4] ; SEGUNDA STRING CMP BYTE PTR [BX],'$' JZ OK2 INC WORD PTR [BP-2] ; CONTANDO CARACTERES DA MSG2 INC BX JMP LOOP2 MOV AH,09H MOV DX,[BP+4] INT 21H ; ESCREVE MSG2 MOV AX,[BP-2] ; VALOR A RETORNAR ADD SP,2 ; DESTROI VARIAVEL LOCAL POP BP RET ENDP ENDS END INICIO



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

9DULiYHLVORFDLVFRPLQLFLDOL]DomR
8PD IRUPD DOWHUQDWLYD GH FULDU YDULiYHLV ORFDLV FRP LQLFLDOL]DomR XWLOL]D D LQVWUXomR386+TXHFRORFDRYDORUFRUUHWRQDSLOKD&RPRHVWDLQVWUXomRQmR WUDEDOKD FRP HQGHUHoDPHQWR LPHGLDWR QR  VmR QHFHVViULRV GRLV SDVVRV SDUDFULDUDYDULiYHO
MOV AX,0000H PUSH AX ; CRIA VARIVEL LOCAL ; INICIALIZADA COM 0000H

,QWHUUXSo}HVGR
,QWHUUXSo}HV
$V UD]}HV SDUD D H[LVWrQFLD GH XP PHFDQLVPR TXH SHUPLWD LQWHUURPSHU R SURFHVVDPHQWR QRUPDO GH XP SURJUDPD H[SRVWDV QR FDStWXOR  DSOLFDPVH WDPEpP QR FDVR GR  3RU LVVRRWH[WR DVVXPH TXHR OHLWRUHVWHMDD SDU GD LPSRUWkQFLDH GD XWLOLGDGH GHVVH PHFDQLVPRH SDVVD GLUHWDPHQWHj H[SOLFDomR GRVGHWDOKHVGHVXDLPSOHPHQWDomRSDUDHVWHSURFHVVDGRU

&DUDFWHUtVWLFDVJHUDLV
2  SRGHWUDWDU DWp  LQWHUUXSo}HV GLIHUHQWHV QXPHUDGDV GH D))+ &RPR HVWH Q~PHUR p VLJQLILFDWLYDPHQWH PDLRU GR TXH DV FLQFR LQWHUUXSo}HV SRVVtYHLVQR  pFRPSUHHQVtYHO TXHKDMD GLIHUHQoDV QD LPSOHPHQWDomR GR PHFDQLVPR GH LQWHUUXSomR GR  (VWDV GLIHUHQoDV DSDUHFHP QRV VHJXLQWHV SRQWRV QRVHQGHUHoRVRQGHVHORFDOL]DPRVWUDWDGRUHVGHLQWHUUXSomR QRQ~PHURGHSLQRVGHGLFDGRVjVLQDOL]DomRGHLQWHUUXSo}HVGHKDUGZDUH QRPHFDQLVPRGHKDELOLWDomRGHVDELOLWDomRGDVLQWHUUXSo}HV QRVPHFDQLVPRVGHFKDPDGDHUHWRUQR

$WDEHODGHYHWRUHVGHLQWHUUXSomR
$R FRQWUiULR GR TXH DFRQWHFH QR  D ORFDOL]DomR GRV WUDWDGRUHV GH LQWHUUXSomR GR  QmR p SUpIL[DGD QR SURMHWR GR SURFHVVDGRU (P YH] GLVVR R  ID] XVR GD DVVLP FKDPDGD WDEHOD GH YHWRUHV GH LQWHUUXSomR (VWD FRQWpP  SRQWHLURV GR WLSR IDU RV YHWRUHV  FDGD XP FRUUHVSRQGHQGR DR HQGHUHoR LQLFLDO GH XP WUDWDGRU &RP LVVR RV WUDWDGRUHV SRGHP UHVLGLU HP TXDOTXHU SDUWH GD PHPyULD HQGHUHoiYHO 3DUD HQFRQWUDU R WUDWDGRU FRUUHWR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

TXDQGRRFRUUHDLQWHUUXSomRGHQ~PHUR LRSURFHVVDGRUOrR LpVLPRYHWRUGD WDEHODHFRORFDHVWHYDORUQRSDU &6,3GHVYLDQGRDVVLPRSURFHVVDPHQWRGR SURJUDPD SDUD R WUDWDGRU e LPSRUWDQWH QRWDU TXH D WDEHOD QmR FRQWpP R WUDWDGRUPDVDSHQDVGL]RQGHHOHFRPHoD 3DUD TXH LVWR IXQFLRQH R SURFHVVDGRU SUHFLVD VDEHU RQGH ILFD D WDEHOD $ VROXomR DGRWDGD SDUD HVWH SUREOHPD p VLPSOHV D WDEHOD GH YHWRUHV GH LQWHUUXSomRLQLFLDVHPSUHQRHQGHUHoRIL[R ++(QWmRRVSULPHLURV E\WHV ++D++ FRQWrPRHQGHUHoRLQLFLDOGRWUDWDGRU GDLQWHUUXSomRRVE\WHVVHJXLQWHVFRQWrPRHQGHUHoRLQLFLDOGRWUDWDGRUGD LQWHUUXSomR  H DVVLP SRU GLDQWH $ ILJXUD  PRVWUD D WtWXOR GH H[HPSOR FRPRILFDULDRFRQWH~GRGRVSULPHLURVE\WHVGDPHPyULDVHRVWUDWDGRUHVGDV LQWHUUXSo}HVHLQLFLDVVHPUHVSHFWLYDPHQWHQRVHQGHUHoRV++H ++ (QGHUHoR ++ ++ ++ ++ ++ ++ ++ ++ &RQWH~GR + + + + + + + +

)LJ$WDEHODGHYHWRUHVGHLQWHUUXSomRGR $GLVSRVLomRGRVYDORUHVDSUHVHQWDGRVVHH[SOLFDDWUDYpVGDVVHJXLQWHVUHJUDV YiOLGDVSDUDWRGRVRVSURFHVVDGRUHVGDOLQKD[ TXDQGR D PHPyULD FRQWpP XP GDGR TXH RFXSD PDLV GH XP E\WH R E\WH PHQRV VLJQLILFDWLYR p DUPD]HQDGR QR HQGHUHoR PHQRU H R PDLV VLJQLILFDWLYRQRHQGHUHoRPDLRU R ZRUG FRUUHVSRQGHQWH DR VHJPHQWR p FRQVLGHUDGR PDLV VLJQLILFDWLYR GR TXHRFRUUHVSRQGHQWHDRRIIVHW 'HVWDIRUPDRVRIIVHWV+H+GDWDEHODFRQWrPRYDORUGRRIIVHWGR WUDWDGRU GD LQWHUUXSomR  TXH p + 2 E\WH PHQRV VLJQLILFDWLYR + p DUPD]HQDGR SULPHLUR VHJXLGR GR E\WH PDLV VLJQLILFDWLYR + (P VHJXLGD YrPRVGRLVE\WHVTXHFRPS}HPRYDORUGRVHJPHQWR2HQGHUHoRGHLQtFLR GRWUDWDGRUGDLQWHUUXSomRpDUPD]HQDGRGHIRUPDDQiORJD $ILPGHIDFLOLWDUDOHLWXUDGRVSRQWHLURVpFRPXPDSUHVHQWDUDWDEHODFRPRQD ILJXUDHPTXHRVE\WHVGDPHPyULDHVWmRDJUXSDGRVGHTXDWURHPTXDWUR

,QWHUUXSo}HVGR



(PERUDHVWDVHMDD UHSUHVHQWDomRPDLVXVDGDpLPSRUWDQWHVDEHUFRPRVHGi GH IDWR R DUPD]HQDPHQWR $ ILJXUD PRVWUD WDPEpP TXH QR FDVR JHUDO R HQGHUHoRWUDWDGRUGDLpVLPDLQWHUUXSomRVHORFDOL]DQRRIIVHWLGDWDEHODHTXH R HQGHUHoR GR ~OWLPR WUDWDGRU UHVLGH QRV RIIVHWV )&+ D ))+ 2 FRPSULPHQWRWRWDOGDWDEHODpGH[ E\WHV N% (QGHUHoR ++ ++  +L  +)&+ &RQWH~GR ++ ++  (QGHUHoRLQLFLDOGRWUDWDGRUGDLQWHUUXSomRL  (QGHUHoRLQLFLDOGRWUDWDGRUGDLQWHUUXSomR))+

)LJ$WDEHODGHYHWRUHVGHLQWHUUXSomRGR

$VLQDOL]DomRGDVLQWHUUXSo}HV
$VLQDOL]DomRGHHYHQWRVH[WHUQRVUHVSRQViYHLVSHODLQWHUUXSomRGRSURJUDPDp IHLWD DWUDYpV GH GRLV SLQRV GR SURFHVVDGRU GHQRPLQDGRV 10, QRQPDVNDEOH LQWHUUXSW  H ,17 2 SULPHLUR FRUUHVSRQGH DR SLQR 75$3 GR  H p GH XVR H[FOXVLYRSDUDDFKDPDGDGDLQWHUUXSomRTXHQmRSRGHVHUGHVDELOLWDGDHp XWLOL]DGDHPJHUDOSDUDVLQDOL]DUDRFRUUrQFLDGHXPHYHQWRFUtWLFRFRPRSRU H[HPSOR D TXHGD LPLQHQWH GD DOLPHQWDomR 7RGDV DV GHPDLV LQWHUUXSo}HV VmR VLQDOL]DGDVDWUDYpVGRSLQR,17DRTXDOVHOLJDQRUPDOPHQWHXPFRQWURODGRU GHLQWHUUXSo}HVGHIRUPDVHPHOKDQWHjGHVFULWDQRFDStWXOReR TXHUHFHEHDVLQDOL]DomRGDVLQWHUUXSo}HVSURSULDPHQWHGLWDVHSDVVDDRR Q~PHUR GD VROLFLWDomR UHFHELGD 'H SRVVH GHVWD LQIRUPDomR R SURFHVVDGRU EXVFD R HQGHUHoR GR WUDWDGRU FRUUHVSRQGHQWH QD WDEHOD GH YHWRUHV GH LQWHUUXSomR

+DELOLWDQGRHGHVDELOLWDQGR
$ KDELOLWDomR GDV LQWHUUXSo}HV p IHLWD DWUDYpV GR IODJ ,) LQWHUUXSW IODJ  TXH UHVLGHQDSDODYUDGHIODJVGRSURFHVVDGRU(VWHIODJSRGHVHUVHWDGRHUHVHWDGR SHODVLQVWUXo}HV67,H&/,UHVSHFWLYDPHQWHHKDELOLWDGHVDELOLWDGHXPDVy YH] WRGDV DV LQWHUUXSo}HV FRP H[FHomR GD LQWHUUXSomR  10,  TXH SHUPDQHFH VHPSUH KDELOLWDGD 2 FRQWUROH LQGLYLGXDO GDV LQWHUUXSo}HV QmR p



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

IHLWRDWUDYpVPDVVLPPHGLDQWHSURJUDPDomRDGHTXDGDGRFRQWURODGRUGH LQWHUUXSomRH[WHUQR  

2GHVYLRSDUDRWUDWDGRU
2 SHGLGR GH XPD LQWHUUXSomR KDELOLWDGD p DWHQGLGR DVVLP TXH WHUPLQD D H[HFXomRGDLQVWUXomRHPFXUVRQRPRPHQWR GD VROLFLWDomR $ ILP GH TXH R SURFHVVDPHQWRGRSURJUDPDSRVVDVHUUHWRPDGRDSyVDH[HFXomRGRWUDWDGRU p QHFHVViULR TXH R SURFHVVDGRU DUPD]HQH DXWRPDWLFDPHQWH R HQGHUHoR GH UHWRUQRTXHpRHQGHUHoRGDLQVWUXomRVHJXLQWHjTXHHVWDYDVHQGRH[HFXWDGD QRPRPHQWRGDVROLFLWDomR&RPRRGHVYLRDVHUUHDOL]DGRDOWHUDRYDORU GH &6,3p QHFHVViULR DUPD]HQDU RV YDORUHV GR VHJPHQWR &6 DWXDO  H GR RIIVHW ,3MiFRUULJLGRSDUDDSRQWDUSDUDDLQVWUXomRVHJXLQWH GHVVHHQGHUHoR$OpP GLVVRRVDOYDWDPEpPRYDORUDWXDOGRVIODJV2DUPD]HQDPHQWRVHGiQD SLOKDHRVYDORUHVVmRDUPD]HQDGRVQHVWDRUGHPIODJV&6,3(PVHJXLGDR SURFHVVDGRUUHVHWDR IODJ ,) H H[HFXWD R GHVYLR 'HVWD IRUPD D H[HFXomR GR WUDWDGRU LQLFLD FRP DV LQWHUUXSo}HV GHVDELOLWDGDV R TXH HYLWD TXH R PHVPR WUDWDGRUVHMDFKDPDGRYiULDVYH]HVGHIRUPDUHFXUVLYDSRUXP~QLFRSHGLGR GHLQWHUUXSomR 2 UHWRUQR p IHLWR PHGLDQWH D LQVWUXomR ,5(7 TXH ILQDOL]D R WUDWDGRU UHFXSHUDQGRRVYDORUHVVDOYRVQDSLOKDSRURFDVLmRGRGHVYLR 2 DUPD]HQDPHQWR GRV IODJV WHP XPD FRQVHTrQFLD GLJQD GH QRWD QmR p QHFHVViULRKDELOLWDUDVLQWHUUXSo}HVGHQWURGRWUDWDGRUDPHQRVTXHVHGHVHMH DWHQGHU D RXWURV SHGLGRV GH LQWHUUXSomR GXUDQWH VXD H[HFXomR 1mR H[LVWH R ULVFRGHTXHDVLQWHUUXSo}HVILTXHPGHVDELOLWDGDVSDUDVHPSUHSRUTXHRVIODJV VDOYRVQDSLOKDLQFOXHPRYDORUTXHRIODJ,)WLQKDDQWHVGRGHVYLR&RPRRV IODJV VmR UHFXSHUDGRV SHOD LQVWUXomR ,5(7 R HVWDGR DQWHULRU VH UHVWDEHOHFH DXWRPDWLFDPHQWHDSyVRUHWRUQR

,QWHUUXSo}HVGHVRIWZDUH
$ LQVWUXomR ,17 L RQGH L p XP Q~PHUR GH  D ))+ ID] FRP TXH R SURFHVVDGRUSURFHGDH[DWDPHQWHFRPRVHWLYHVVHUHFHELGRXPDVROLFLWDomRGD LQWHUUXSomRL3RULVVRHVWDLQVWUXomRUHFHEHRQRPHGHLQWHUUXSomRGHVRIWZDUH$ PHQRVGRDUPD]HQDPHQWRGRVIODJVQDSLOKDH[HFXWDUDLQVWUXomR,17LWHPR PHVPR HIHLWR GH FKDPDU R WUDWDGRU GHVVD LQWHUUXSomR FRPR XPD VXEURWLQD


Uma exceo a esta regra so as instrues de manipulao de strings, discutidas mais adiante.

,QWHUUXSo}HVGR



PDVFRPXPDLPSRUWDQWHGLIHUHQoDRHQGHUHoRGDVXEURWLQDQmRpGDGRGH IRUPDH[SOtFLWDHLVWRFULDXPPHFDQLVPRGHFKDPDGDLQGLUHWDGHVXEURWLQDV PXLWR ~WLO HP VLWXDo}HV HP TXH D VXEURWLQD D VHU FKDPDGD SRGH PXGDU GH HQGHUHoRVHPTXHVHTXHLUDUHFRPSLODURSURJUDPDFKDPDGRUSRUFDXVDGLVVR 8PH[HPSORGHDSOLFDomRGHVVHPHFDQLVPRVmRRVVHUYLoRVGR'26 YDQH[R   $ XWLOL]DomR GDV LQWHUUXSo}HV GH VRIWZDUH SHUPLWH TXH DV VXEURWLQDV GH VHUYLoR RV WUDWDGRUHV GDV LQWHUUXSo}HV FKDPDGDV  SRVVDP PXGDU GH OXJDU GH XPD YHUVmR SDUD RXWUD GR VLVWHPD RSHUDFLRQDO VHP TXH LVVR LPSOLTXH QD UHFRPSLODomRGRVDSOLFDWLYRVGRXVXiULR3DUDPDQWHURVHUYLoRIXQFLRQDQGRR '26VySUHFLVDDWXDOL]DUDWDEHODGHYHWRUHVGHLQWHUUXSomR

,QWHUUXSo}HVUHVHUYDGDV
$OJXPDV LQWHUUXSo}HV WrP ILQDOLGDGHV HVSHFLDLV SDUD R  H SRU LVVR VmR FRQVLGHUDGDV UHVHUYDGDV $ SULPHLUD GHODV p D LQWHUUXSomR  TXH p JHUDGD DXWRPDWLFDPHQWHTXDQGRRGLYLVRUSDVVDGRSDUDXPDLQVWUXomRGHGLYLVmRIRU LJXDOD]HUR'HVWDIRUPDRWUDWDGRUGDLQWHUUXSomRSRGHVHUYLVWRFRPRXP WUDWDGRUGHH[FHomRSDUDHVWHHUURFKDPDGRDXWRPDWLFDPHQWH 2WUDWDGRUGDLQWHUUXSomRpFKDPDGRDXWRPDWLFDPHQWHVHPSUHTXHRIODJ7) WUDS IODJ  HVWLYHU VHWDGR (VWH PHFDQLVPR IRL FULDGR SDUD IDFLOLWDU D LPSOHPHQWDomRGHGHSXUDGRUHVTXHSHUPLWHPTXH VH H[HFXWHP DV LQVWUXo}HV GHXPSURJUDPDSDVVRDSDVVRSDUDQGRDSyVFDGDXPDGHODV2SULQFtSLRGH XWLOL]DomRFRQVLVWHHPVHWDUHVVHIODJLPHGLDWDPHQWHDQWHVGDLQVWUXomRTXHVH SUHWHQGHH[HFXWDUGHVWDIRUPD$VVLPTXHDLQVWUXomRpH[HFXWDGDRWUDWDGRU GD LQWHUUXSomR  p FKDPDGR H SRGH HQWmR DSUHVHQWDU LQIRUPDo}HV VREUH R HVWDGRDWXDOGRSURFHVVDGRU3DUDTXHRWUDWDGRUQmRVHMDHOHSUySULRWUDQFDGR SHODH[HFXomRRSURFHVVDGRUUHVHWDRIODJ7)DQWHVGHGHVYLDUSDUDRWUDWDGRU $ LQWHUUXSomR  p XPD LQWHUUXSomR FXMD FRGLILFDomR RFXSD DSHQDV  E\WH HP YH] GRV GRLV E\WHV RFXSDGRV QRUPDOPHQWH SHOD LQVWUXomR ,17 L ,VWR VHUYH QRYDPHQWH DRV GHSXUDGRUHV TXH D XWLOL]DP QD FULDomR GH EUHDNSRLQWV VXEVWLWXLQGR R E\WH TXH HVWi QXP GHWHUPLQDGR HQGHUHoR SHOR RSFRGH GD LQWHUUXSomR8PDYH]DOFDQoDGRHVWHHQGHUHoRRSURJUDPDpGHVYLDGRSDUDR WUDWDGRUFRUUHVSRQGHQWHTXHH[HFXWDDVDo}HVQHFHVViULDV )LQDOPHQWH R WUDWDGRU GD LQWHUUXSomR  p FKDPDGR SHOD LQVWUXomR ,172 LQWHUUXSWLIRYHUIORZ VHPSUHTXHHVWDIRUH[HFXWDGDFRPRIODJ2) RYHUIORZIODJ


Um breakpoint um recurso de depurao que permite executar o programa sob teste at um endereo especificado e ento par-lo, a fim de examinar em detalhe o que est acontecendo nesse ponto da execuo.



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

VHWDGR ,VWR SHUPLWH DR SURJUDPD UHDJLU GH IRUPD FRQYHQLHQWH D HUURV GH RYHUIORZGHGLYLVmR RVFDVRVHPTXHRUHVXOWDGRGHXPDGLYLVmRpILQLWRPDV QmRFDEHQRUHJLVWUDGRUGHGHVWLQR  $OpP GDV LQWHUUXSo}HV GHVFULWDV D ,QWHO FRQVLGHUD UHVHUYDGDV DV LQWHUUXSo}HV +D)+(PERUDHVWDVQmRVHMDPHVSHFLDLVQRQmRVHGHYHXWLOL]iODV SRLV HODV WrP IXQFLRQDOLGDGH HVSHFtILFD QRV GHPDLV SURFHVVDGRUHV GD IDPtOLD [ 8WLOL]iODV SDUD ILQV SDUWLFXODUHV SRGH LPSOLFDU HP SHUGD GH FRPSDWLELOLGDGHGRVRIWZDUHFRPHVWHVSURFHVVDGRUHV $WDEHODUHVXPHDVLQWHUUXSo}HVHVSHFLDLVGR 1~PHUR      )+ 2IIVHWGRYHWRU + + + &+ + +&+ 8VR 'HWHFomRGHGLYLVmRSRU]HUR ([HFXomRSDVVRDSDVVR ,QWHUUXSomRQmRPDVFDUiYHO %UHDNSRLQWV 2YHUIORZ 5HVHUYDGR

7DE,QWHUUXSo}HVUHVHUYDGDVGR

0DQLSXODomRGHVWULQJV
,QWURGXomR
2  FRQWD FRP XP JUXSR GH LQVWUXo}HV TXH GmR VXSRUWH j UHDOL]DomR GH WDUHIDV TXH DSDUHFHP FRP IUHTrQFLD TXDQGR VH PDQLSXODP FDGHLDV GH FDUDFWHUHV VWULQJV 8PDYH]TXHDUHSUHVHQWDomRGHXPDFDGHLDGHFDUDFWHUHVQD PHPyULD p D PHVPD GH XPD WDEHOD HVWDV LQVWUXo}HV VmR LJXDOPHQWH ~WHLV QD PDQLSXODomRGHWDEHODVJHQpULFDV $ SULQFLSDO YDQWDJHP GR HPSUHJR GDV LQVWUXo}HV GH PDQLSXODomR GH VWULQJV HVWiQRJDQKRGHYHORFLGDGHTXHSURSRUFLRQDP([LVWHWDPEpPXPDSHTXHQD UHGXomR QR WDPDQKR GR SURJUDPD PDV HVWD YDQWDJHP p JHUDOPHQWH LQVLJQLILFDQWHTXDQGRFRPSDUDGDDRDXPHQWRGHGHVHPSHQKR 2REMHWLYRGHVWHFDStWXORpRGHDSUHVHQWDUHVVDVLQVWUXo}HVH[HPSOLILFDUVHX XVRHPRVWUDUGHRQGHYHPHVVHJDQKRGHGHVHPSHQKR

$VLQVWUXo}HV
$VLQVWUXo}HVGLVSRQtYHLVGmRVXSRUWHjVVHJXLQWHVRSHUDo}HV FySLDGHXPDUHJLmRGDPHPyULDSDUDRXWUD FRPSDUDomR GH GXDV VWULQJV  WDEHODV ORFDOL]DomR GR SULPHLUR HOHPHQWR LJXDORXGLIHUHQWH  YDUUHGXUD EXVFDGRSULPHLURFDUDFWHULJXDORXGLIHUHQWHGHXPFDUDFWHUGH FRPSDUDomR  OHLWXUDGRVHOHPHQWRVGHXPDVWULQJXPSRUYH] LQLFLDOL]DomRGHWDEHODV $ WDEHOD  DSUHVHQWD DV LQVWUXo}HV GH PDQLSXODomR GH VWULQJV H[LVWHQWHV QR VXDDSOLFDomRHDFODVVLILFDomRGRVDUJXPHQWRVQHFHVViULRV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV 0QHP{QLFR 02960296%0296: &036&036%&036: 6&$66&$6%6&$6: /2'6/2'6%/2'6: 67266726%6726: $SOLFDomR &ySLD &RPSDUDomR 9DUUHGXUD /HLWXUD ,QLFLDOL]DomR $UJXPHQWRV 'HVWLQRRULJHP 'HVWLQRRULJHP 'HVWLQR 2ULJHP 'HVWLQR

7DE$VLQVWUXo}HVGHPDQLSXODomRGHVWULQJV 1RWH TXH DV LQVWUXo}HV GH FySLD H GH FRPSDUDomR DWXDP VREUH GXDV VWULQJV GLIHUHQWHVHQTXDQWRDVGHPDLVDWXDP VREUH XPD ~QLFD VWULQJ 7RGDV WrP HP FRPXPDVVHJXLQWHVFDUDFWHUtVWLFDV RDUJXPHQWRGHRULJHPHVWiORFDOL]DGRVHPSUHHP'6>6,@ R DUJXPHQWR GH GHVWLQR HVWi ORFDOL]DGR SRU GHIDXOW HP (6>',@ R VHJPHQWR SRGH VHU PXGDGR SDUD &6 '6 RX 66 FRP XP SUHIL[R GH PRGLILFDomRGHVHJPHQWRRRIIVHWpVHPSUHGDGRSRU', SRGHPDJLUWDQWRVREUHE\WHVTXDQWRVREUHZRUGV GHSHQGHQGRGRYDORUGRIODJGHGLUHomR ') DVVWULQJVVmRPDQLSXODGDVGR LQtFLRSDUDRILP ')  RXGRILPSDUDRFRPHoR ')   TXDQGR XPD LQVWUXomR GH PDQLSXODomR GH VWULQJV p H[HFXWDGD RV UHJLVWUDGRUHV 6, H ', VH XWLOL]DGRV VmR DMXVWDGRV SDUD DSRQWDUHP SDUD R SUy[LPR HOHPHQWR GD VWULQJ HP TXHVWmR (VWH DMXVWH SRGH VHU XP LQFUHPHQWR ')  RXGHFUHPHQWR ')  GHXPDXQLGDGH TXDQGRD LQVWUXomRDJHVREUHE\WHV RXGHGXDVXQLGDGHV LGHPZRUGV  WRGDV DV LQVWUXo}HV RFXSDP DSHQDV XP E\WH SUHFHGLGR GH XP SUHIL[R GH PRGLILFDomRGHVHJPHQWRGHGHVWLQRTXDQGRIRURFDVR $WDEHODPRVWUDTXHH[LVWHPWUrVPQHP{QLFRVGLIHUHQWHVSDUDFDGDXPDGDV DSOLFDo}HVSRVVtYHLV2SULPHLURPQHP{QLFRWHUPLQDVHPSUHSHODOHWUD6TXH GHQRWD VWULQJ(VWDIRUPDGRVPQHP{QLFRVH[LJHDUJXPHQWRVTXHSHUPLWDPDR DVVHPEOHUFRQFOXLUVHDLQVWUXomRVHUHIHUHjPDQLSXODomRGHE\WHVRXGHZRUGV 3RUH[HPSORDLQVWUXomR0296SRGHVHUXWLOL]DGDGDVVHJXLQWHVIRUPDV
MOVS BYTE PTR ES:[DI],[SI]

RX
MOVS WORD PTR ES:[DI],[SI]

VLJQLILFDQGRTXHDRSHUDomRDVHUUHDOL]DGDpDFySLDGRE\WH QRSULPHLURFDVR RXGRZRUG QRVHJXQGRFDVR HP'6>6,@SDUD (6>',@ e LPSRUWDQWH QRWDU TXH HPERUD D LQVWUXomR VHMD HVFULWD FRP GRLV DUJXPHQWRV VXD FRGLILFDomR FRQWLQXDVHQGRIHLWDHPXP~QLFRE\WHRVDUJXPHQWRVVHUYHPDSHQDVSDUDR TXHDVVHPEOHUSRVVDGHFLGLUVHDLQVWUXomRGHYHDJLUVREUHE\WHVRXZRUGVHVH

0DQLSXODomRGHVWULQJV



KiQHFHVVLGDGHGHDOJXPSUHIL[RGHPRGLILFDomRGRVHJPHQWRGHGHVWLQR1RV FDVRVDFLPDTXHXWLOL]DPRVHJPHQWRGHIDXOWSRGHVHHVFUHYHUVLPSOHVPHQWH
MOVSB

RX
MOVSW

UHVSHFWLYDPHQWH FRP R PHVPR UHVXOWDGR $ IRUPD ORQJD FRP DUJXPHQWRV H[SOtFLWRVVypREULJDWyULDTXDQGRVHTXHUPXGDURVHJPHQWRGHGHVWLQRFRPR HP


MOVS BYTE PTR DS:[DI],[SI]

RX
MOVS WORD PTR DS:[DI],[SI]

1HVWHVH[HPSORVDFySLDVHID]GHQWURGHXPPHVPRVHJPHQWR

8PH[HPSORFySLDGHWDEHODV
6HMDDWDUHIDGHFRSLDURFRQWH~GRGHXPDWDEHODGH N% ORFDOL]DGDQRRIIVHW 7$%GR VHJPHQWR'$7$SDUD XPDWDEHODGH LJXDOWDPDQKRORFDOL]DGDQR RIIVHW7$%GH XPVHJPHQWRFKDPDGR '$7$ 2 SURJUDPD DEDL[R PRVWUD FRPR HVWD FySLD SRGHULD VHU IHLWD SULPHLUDPHQWH VHP D XWLOL]DomR GDV LQVWUXo}HVGHPDQLSXODomRGHVWULQJV
TABSIZE EQU 400H PILHA SEGMENT STACK DB 128 DUP(?) PILHA ENDS DATA1 SEGMENT TAB1 DB TABSIZE DUP(55H) DATA1 ENDS DATA2 SEGMENT TAB2 DB TABSIZE DUP(00H) DATA2 ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA1,ES:DATA2 START: MOV AX,DATA1 MOV DS,AX MOV AX,DATA2 MOV ES,AX LEA SI,TAB1 LEA DI,TAB2 MOV CX,TABSIZE LOOP: MOV AL,[SI] MOV ES:[DI],AL


INC INC DEC JNZ ...

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
SI DI CX LOOP

2 FyGLJR DSUHVHQWDGR SRGH VHU PHOKRUDGR PHGLDQWH XWLOL]DomR GD LQVWUXomR 0296%TXHGHDFRUGRFRPDVHomRVXEVWLWXLDVTXDWURSULPHLUDVOLQKDV GRORRS3DUDWHUFHUWH]DGHTXHDFySLDVHGrQDGLUHomRFHUWD LQFUHPHQWRGH 6,H', pSUHFLVRFRORFDUDQWHVXPDLQVWUXomR&/'2FyGLJRILFDDVVLP
START: MOV AX,DATA1 MOV DS,AX MOV AX,DATA2 MOV ES,AX LEA SI,TAB1 LEA DI,TAB2 MOV CX,TABSIZE CLD MOVSB DEC CX JNZ LOOP ...

LOOP:

1HVWH SRQWR p SRVVtYHO FRPHoDU D YHU FRPR D XWLOL]DomR GDV LQVWUXo}HV GH PDQLSXODomR GH VWULQJV DIHWD R WDPDQKR GR SURJUDPD H VHX GHVHPSHQKR $ UHGXomRQRWDPDQKRGRSURJUDPDVHGiSRUTXHXPDLQVWUXomRGHPDQLSXODomR GHVWULQJVVXEVWLWXLYiULDVLQVWUXo}HVFRQYHQFLRQDLV 2JDQKRGHGHVHPSHQKRPHUHFHXPDDQiOLVHPDLVGHWDOKDGD(OHQmRYHPGH DOJXPUHFXUVRHVSHFLDOGDLQVWUXomRGHPDQLSXODomRGHVWULQJVHPVLSRLVHVWD SUHFLVD OHU R E\WH D VHU FRSLDGR GD VXD SRVLomR GH RULJHP HVFUHYrOR QD VXD SRVLomR GH GHVWLQR H LQFUHPHQWDU RV UHJLVWUDGRUHV 6, H ', GD PHVPD IRUPD TXH R FyGLJR VHP D LQVWUXomR GH PDQLSXODomR GH VWULQJV (VWDV RSHUDo}HV SULQFLSDOPHQWH RV DFHVVRV j PHPyULD H[LJHP XP WHPSR TXH QmR Ki FRPR UHGX]LU 2 JDQKR GH GHVHPSHQKR YHP GR IDWR GH TXH HP JHUDO DV LQVWUXo}HV TXH ID]HPDPDQLSXODomRVmRH[HFXWDGDVXPJUDQGHQ~PHURGHYH]HV1RFDVRGR H[HPSOR DFLPD DV OLQKDV TXH FRPS}HP R ORRS VmR H[HFXWDGDV WDQWDV YH]HV TXDQWRV IRUHP RV E\WHV FRSLDGRV + RX   e SUHFLVR OHPEUDU DJRUD TXH TXDQGR H[HFXWD XP ORRS R SURFHVVDGRU WHP GH OHU H GHFRGLILFDU HVVDV LQVWUXo}HVDFDGDYH]TXHVmRH[HFXWDGDVHLVVRVLJQLILFDTXHQRSULPHLURFDVR SUHFLVD H[HFXWDU  [    LQVWUXo}HV HQTXDQWR TXH QR VHJXQGR VmR H[HFXWDGDV  [    &DGD LQVWUXomR GHVVDV H[LJH D OHLWXUD GH SHOR PHQRVE\WHGDPHPyULDHSRUWDQWRKiPDLVWHPSRVHQGRJDVWRQDOHLWXUDGH LQVWUXo}HVGRTXHQDFySLDGDVWDEHODV &RPDUHGXomRGHVVHWHPSRjPHWDGH QRVHJXQGRFDVRFRPHoDDDSDUHFHUDYDQWDJHPGDVLQVWUXo}HVGHPDQLSXODomR

0DQLSXODomRGHVWULQJV



GHVWULQJV(VWHWHPSRSRGHVHUUHGX]LGRDLQGDPDLVDWUDYpVGRHPSUHJRGRV DVVLPFKDPDGRVSUHIL[RVGHUHSHWLomRDQDOLVDGRVDVHJXLU

2VSUHIL[RVGHUHSHWLomR
$ ILP GH IDFLOLWDU D UHSHWLomR GH XPD LQVWUXomR GH PDQLSXODomR GH VWULQJV R  RIHUHFH RV SUHIL[RV GH UHSHWLomR TXH VmR FyGLJRV FRORFDGRV LPHGLDWDPHQWH DQWHVGHVVDVLQVWUXo}HVHTXHFDXVDPVXDUHSHWLomRDWpTXHXPDGDGDFRQGLomR GHSDUDGDVHMDDWLQJLGD 7RGRV RV SUHIL[RV GH UHSHWLomR WHVWDP &; DQWHV GH H[HFXWDU D LQVWUXomR TXH VHJXH 6H &; IRU ]HUR D LQVWUXomR QmR p H[HFXWDGD &DVR FRQWUiULR &; p GHFUHPHQWDGR GH XPD XQLGDGH H D LQVWUXomR p H[HFXWDGD 6H D LQVWUXomR HP TXHVWmR IRU XPD LQVWUXomR GH FRPSDUDomR &036 RX 6&$6  RV IODJV VmR DIHWDGRVGHDFRUGRFRPRUHVXOWDGRGDFRPSDUDomRIHLWD $ WDEHODDSUHVHQWD RVSUHIL[RVGHUHSHWLomRGLVSRQtYHLVHDVFRQGLo}HVGH SDUDGDFRUUHVSRQGHQWHV 3UHIL[R 5(3 5(3(5(3= 5(31(5(31= &RQGLomRGHSDUDGD &;  &; RX=)  &; RX=) 

7DE3UHIL[RVGHUHSHWLomRGR 2SUHIL[RPDLVVLPSOHVp5(3 UHSHDW TXHVLPSOHVPHQWHUHSHWHDLQVWUXomRHP TXHVWmR&;YH]HV2SUHIL[R5(3(HVHXVLQ{QLPR5(3= UHSHDWZKLOHHTXDO ]HUR UHSHWHPDLQVWUXomRHPTXHVWmRHQTXDQWRR ]HUR IODJ SHUPDQHFHU VHWDGR 6H D LQVWUXomR IRU GH FRPSDUDomR D UHSHWLomR FRQWLQXDUi HQTXDQWR KRXYHU LJXDOGDGH HQWUH RV HOHPHQWRV FRPSDUDGRV $ UHSHWLomR FHVVD TXDQGR R IODJ GHL[DUGHVHUVHWDGRRXHQWmRTXDQGR&;FKHJDD]HUR(VWHSUHIL[RSRGHVHU XVDGRFRPDLQVWUXomR&036SDUDID]HUFRPTXHRSURFHVVDGRUFRPSDUHGXDV WDEHODV H SDUH DVVLP TXH HQFRQWUDU D SULPHLUD GHVLJXDOGDGH HQWUH HODV &RQVLGHUDQGR TXH R GLUHFWLRQ IODJ HVWHMD HP ]HUR RV RIIVHWV GRV HOHPHQWRV GHVLJXDLVVHUmRHQWmR6,H', VHRVHOHPHQWRVIRUHPE\WHV RX6,H', VH IRUHP ZRUGV  $ VXEWUDomR GH  RX  p QHFHVViULD SRUTXH 6, H ', VmR DXWRPDWLFDPHQWH DMXVWDGRV SDUD DSRQWDU SDUD R HOHPHQWR VHJXLQWH LQGHSHQGHQWHPHQWH GR UHVXOWDGR GD FRPSDUDomR 6H ') HVWLYHU VHWDGR p QHFHVViULRVRPDUHPYH]GHVXEWUDLU 2SUHIL[R5(31(RXVHXVLQ{QLPR5(31= UHSHDWZKLOHQRWHTXDOQRW]HUR pR GXDO GR DQWHULRU H UHSHWH D LQVWUXomR HP TXHVWmR HQTXDQWR R ]HUR IODJ



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

SHUPDQHFHU ]HUDGR (VWH SUHIL[R SRGH VHU XWLOL]DGR SDUD HQFRQWUDU XPD LJXDOGDGHHQWUHGXDVWDEHODV 3RGHPRV DJRUD PHOKRUDU DLQGD PDLV R FyGLJR DSUHVHQWDGR QD H[HPSOR GD VHomRWURFDQGRDVOLQKDVGRORRSGRVHJXQGRFDVRSRUXPD~QLFDOLQKD2 VHJPHQWRGHFyGLJRILFDHQWmRDVVLP
START: MOV AX,DATA1 MOV DS,AX MOV AX,DATA2 MOV ES,AX LEA SI,TAB1 LEA DI,TAB2 MOV CX,TABSIZE CLD MOVSB ...

REP

1RWH TXH DJRUD QmR H[LVWH PDLV R ORRS SDUD ID]HU D UHSHWLomR GD LQVWUXomR 0296%,VVRVLJQLILFDTXHHODpOLGDDSHQDVXPD~QLFDYH] E\WHVDRWRGR FRQVLGHUDQGR R SUHIL[R GH UHSHWLomR  H QmR PDLV  RX  YH]HV FRPR QRV FDVRV GLVFXWLGRV QD VHomR  $JRUD R WHPSR GH H[HFXomR GD LQVWUXomR FRUUHVSRQGH SUDWLFDPHQWH WRGR j UHDOL]DomR GH WUDEDOKR ~WLO SRLV R WHPSR JDVWRQDOHLWXUDHGHFRGLILFDomRGDLQVWUXomRpGHVSUH]tYHOTXDQGRFRPSDUDGR DR WHPSR QHFHVViULR SDUD D FySLD GD WDEHOD e DVVLP TXH DV LQVWUXo}HV GH PDQLSXODomR GH VWULQJV FRQVHJXHP SURSRUFLRQDU XP JDQKR GH YHORFLGDGH FRQVLGHUiYHODRSURFHVVDGRU

2FRUUrQFLDGHLQWHUUXSo}HV
(PJHUDOTXDQGRDFRQWHFHXPSHGLGRGHLQWHUUXSomRRSURFHVVDGRUWHUPLQD GH H[HFXWDU D LQVWUXomR HP DQGDPHQWR H Vy GHSRLV DWHQGH HVVH SHGLGR $ H[HFXomR GDV LQVWUXo}HV GH PDQLSXODomR GH VWULQJV SRUpP SRGH VHU PXLWR PDLVGHPRUDGDGRTXHDGDVLQVWUXo}HVFRPXQV3RULVVRHVVDVLQVWUXo}HVVmR LQWHUURPStYHLV 4XDQGR DFRQWHFH XPD LQWHUUXSomR GXUDQWH R SURFHVVDPHQWR GH XPD LQVWUXomR GH PDQLSXODomR GH VWULQJV SURFHVVDGRU WHUPLQD GH ID]HU D RSHUDomR TXH HVWi HP DQGDPHQWR FySLD FRPSDUDomR HWF  H LQWHUURPSH R ORRS GHWHUPLQDGR SHOD FRQWDJHP HP &; SDUD DWHQGHU R SHGLGR GH LQWHUUXSomR'HSRLVGHDWHQGLGRRSHGLGRRSURFHVVDGRUUHWRUQDDRSRQWRHP TXH KDYLD LQWHUURPSLGR R SURFHVVDPHQWR GD LQVWUXomR GH PDQLSXODomR GH VWULQJV'HVWDIRUPDDSUHVHQoDGHVVDVLQVWUXo}HVQmRDWUDSDOKDRDWHQGLPHQWR GHSHGLGRVGHLQWHUUXSomR

0DQLSXODomRGHVWULQJV



([HPSORVGHDSOLFDomR
(VWD VHomR DSUHVHQWD DOJXQV H[HPSORV GH DSOLFDomR GDV LQVWUXo}HV GH PDQLSXODomR GH VWULQJV FRPSOHPHQWDQGR R H[HPSOR GH FySLD GH WDEHODV GLVFXWLGR QDV VHo}HV DQWHULRUHV 2XWURV H[HPSORV SRGHP VHU HQFRQWUDGRV QR FDStWXOR

&RPSDUDomRGHWDEHODV
$FRPSDUDomRGHGXDVWDEHODVSRGHVHUIHLWDFRPDX[tOLRGDLQVWUXomR&036 RXGHVXDVIRUPDVDEUHYLDGDV&036%H&036:(VWDVLQVWUXo}HVFRPSDUDP DVWDEHODVVXEWUDLQGRRE\WHRXZRUGHQGHUHoDGRSHORUHJLVWUDGRUTXHYDUUHD WDEHOD GH RULJHP GR E\WH RX ZRUG HQGHUHoDGR SHOR UHJLVWUDGRU TXH YDUUH D WDEHOD GH GHVWLQR UHVSHFWLYDPHQWH 2V UHJLVWUDGRUHV VmR DMXVWDGRV LQFUHPHQWDGRV RX GHFUHPHQWDGRV GHSHQGHQGR GR YDORU GR GLUHFWLRQ IODJ  GH DFRUGR FRP R WDPDQKR GR HOHPHQWR FRPSDUDGR $ VXEWUDomR p XWLOL]DGD DSHQDVSDUDVHWDURVIODJVRUHVXOWDGRpGHVFDUWDGR 2WUHFKRGHFyGLJRDVHJXLUFRPSDUDGXDVWDEHODV7$% H7$%ORFDOL]DGDV QXP PHVPR VHJPHQWR HQGHUHoDGR SHOR UHJLVWUDGRU '6 $ FRPSDUDomR WHUPLQDTXDQGRVHHQFRQWUD XPD LJXDOGDGH HQWUH E\WHV GH PHVPR RIIVHW HP UHODomRDRLQtFLRGDVWDEHODV  RXHQWmRTXDQGRVHFKHJDDRILQDOGDVWDEHODV2 ]HUR IODJ p WHVWDGR DSyV D LQVWUXomR GH FRPSDUDomR SDUD VDEHU VH KRXYH LJXDOGDGHRXQmReLQWHUHVVDQWHQRWDUTXHRWHVWHGHVWHIODJpYiOLGRPHVPR TXDQGR &; FKHJD D ]HUR SRUTXH &; p VHPSUH GHFUHPHQWDGR DQWHV GD H[HFXomRGDLQVWUXomRGHPRGRTXHRHVWDGRGRIODJFRUUHVSRQGHVHPSUHDR UHVXOWDGRGDFRPSDUDomR 4XDQGR XPD LJXDOGDGH p HQFRQWUDGD R UHJLVWUDGRU 6, p GHFUHPHQWDGR GH XPD XQLGDGH SDUD TXH YROWH D FRQWHU R RIIVHW GR E\WH TXHFDXVRXDSDUDGDGDUHSHWLomR
START: MOV AX,DADOS MOV DS,AX LEA SI,TAB1 LEA DI,TAB2 CLD CMPSB JZ IGUAL JMP DIFERENTE DEC SI ...

REPE IGUAL:



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

9DUUHGXUDGHWDEHODV
$YDUUHGXUDGHXPDWDEHODHPEXVFDGHXPGHWHUPLQDGRE\WHRXZRUGSRGH VHU IHLWD FRP R DX[tOLR GD LQVWUXomR 6&$6 RX GH VXDV IRUPDV DEUHYLDGDV 6&$6% H 6&$6: (VWDV LQVWUXo}HV FRPSDUDP R HOHPHQWR HQGHUHoDGR SHOR UHJLVWUDGRU TXH YDUUH D WDEHOD ',  FRP R UHJLVWUDGRU $/ RX $; UHVSHFWLYDPHQWH H DMXVWDP ', GH XPD RX GXDV XQLGDGHV FRQIRUPH R FDVR 1RWH TXH GH DFRUGR FRP D WDEHOD  D WDEHOD p HQGHUHoDGD FRPR XP RSHUDQGRGHGHVWLQR H TXH SRU LVVR R UHJLVWUDGRU GH VHJPHQWR GHIDXOW p (6 PDV SRGH VHU PXGDGR FRP XP SUHIL[R GH PRGLILFDomR GH VHJPHQWR 2 UHJLVWUDGRUGHRIIVHWpREULJDWRULDPHQWH', 2 WUHFKR GH FyGLJR DEDL[R YDUUH D WDEHOD 7$% HP EXVFD GR ZRUG + &DVRRHQFRQWUHRUHJLVWUDGRU',pGHFUHPHQWDGRGHGXDVXQLGDGHVSDUDTXH DSRQWHSDUDRZRUGHQFRQWUDGR
START: MOV AX,DADOS MOV ES,AX LEA DI,TAB1 CLD MOV AX,1234H SCASW JZ IGUAL JMP DIFERENTE SUB DI,2 ...

REPNE IGUAL:

/HLWXUDGHWDEHODV
$OHLWXUDGHXPDWDEHODSRGHVHUDJLOL]DGDFRPDLQVWUXomR/2'6RXGHVXDV IRUPDVDEUHYLDGDV/2'6%H/2'6:(VWDVLQVWUXo}HVOrHPXPE\WHRXXP ZRUGSDUDRUHJLVWUDGRU$/RX$;UHVSHFWLYDPHQWHGRHQGHUHoRFRQWLGRHP 6, H DMXVWDP HVWH UHJLVWUDGRU HP XPD RX GXDV XQLGDGHV FRQIRUPH R FDVR 'LILFLOPHQWHVmRXWLOL]DGDVHPFRQMXQWRFRPDOJXPSUHIL[RGHUHSHWLomRSRLV HPJHUDOpQHFHVViULRSURFHVVDUGHDOJXPDIRUPDFDGDHOHPHQWROLGRDQWHVGH OHURSUy[LPR0HVPRDVVLPH[LVWHRJDQKRGHVHFRQVHJXLUQXPDLQVWUXomR Vy OHU R E\WH RX ZRUG H DLQGD LQFUHPHQWDU R UHJLVWUDGRU R TXH GLPLQXL R Q~PHUR GH LQVWUXo}HV QXP ORRS 1RWH TXH GH DFRUGR FRP D WDEHOD  R DUJXPHQWR p FRQVLGHUDGR GH RULJHP H SRU LVVR R VHJPHQWR H R RIIVHW VmR VHPSUH'6H6,UHVSHFWLYDPHQWH 2WUHFKRGHFyGLJRDEDL[RXWLOL]DDLQVWUXomR/2'6%SDUDID]HUHP%/DVRPD GRV E\WHV GH XPD FDGHLD GH FDUDFWHUHV 675 VHP FRQVLGHUDU R YDL  (VWD

0DQLSXODomRGHVWULQJV



RSHUDomRSRGHVHU~WLOQRFiOFXORGR FKHFNVXPGHXPDVWULQJDSyVVXDUHFHSomR SRUXPPHLRGHWUDQVPLVVmR


... LEA SI,STR1 CLD MOV BL,00H MOV CX,STRSIZE LODSB ADD BL,AL LOOP

; COMPRIMENTO DA STRING

LOOP: LOOPNZ

$TXLDSDUHFHXPRXWURSUHIL[RGHUHSHWLomRGR/2231=(VWHDVVLP FRPRVHXVLQ{QLPR/2231(VXEVWLWXLDVOLQKDV
DEC CX JNZ LOOP

ID]HQGRDVVLPFRPTXHRSURFHVVDGRUWHQKDXPDLQVWUXomRD PHQRV SDUD OHU QRORRS

,QLFLDOL]DomRGHWDEHODV
$ LQVWUXomR 6726 DVVLP FRPR VXDV IRUPDV DEUHYLDGDV 6726% H 6726: SRGH VHU XWLOL]DGD SDUD LQLFLDOL]DU XPD WDEHOD FRP XP GDGR YDORU (VWDV LQVWUXo}HVHVFUHYHPRE\WHRXZRUGFRQWLGRHP$/RX$;UHVSHFWLYDPHQWH QR HQGHUHoR FRQWLGR QR UHJLVWUDGRU TXH YDUUH D WDEHOD H DMXVWDP  HVWH UHJLVWUDGRUHPXPDRXGXDVXQLGDGHVFRQIRUPHRFDVR 1RWH TXH GH DFRUGR FRP D WDEHOD  D WDEHOD p HQGHUHoDGD FRPR XP RSHUDQGRGHGHVWLQR H TXH SRU LVVR R UHJLVWUDGRU GH VHJPHQWR GHIDXOW p (6 PDV SRGH VHU PXGDGR FRP XP SUHIL[R GH PRGLILFDomR GH VHJPHQWR 2 UHJLVWUDGRUGHRIIVHWpREULJDWRULDPHQWH', 2 WUHFKR GH FyGLJR D VHJXLU XWLOL]D D LQVWUXomR 6726: SDUD LQLFLDOL]DU XPD WDEHODGHN% +E\WHVRX+ZRUGV FRPRYDORU+
... LEA DI,STR1 CLD MOV CX,200H MOV AX,3535H STOSW

REP



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

3DUWH,,/DERUDWyULR

2$EDFXV
2VLPXODGRUHRDVVHPEOHU
2 $EDFXV p XP VLPXODGRU H DVVHPEOHU SDUD R PLFURSURFHVVDGRU  GHVHQYROYLGR HVSHFLDOPHQWH SDUD DFRPSDQKDU HVWH OLYUR 6XD LQWHUIDFH p PRVWUDGDQDILJXUD

)LJ2$EDFXV &RPR$EDFXVpSRVVtYHOH[HFXWDUSUDWLFDPHQWHTXDOTXHUSURJUDPDTXHFDLED GHQWURGDUHJLmRGH5$0VLPXODGDHDFRPSDQKDUDVPXGDQoDVQRSURFHVVDGRU HQDPHPyULDGXUDQWHDH[HFXomReSRVVtYHOYLVXDOL]DURFRPSRUWDPHQWRGD SLOKD H D YDUUHGXUD GH WDEHODV FULDU EUHDNSRLQWV SDUD LQWHUURPSHU D H[HFXomR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

HP TXDOTXHU SRQWR DOWHUDU R HVWDGR GR SURFHVVDGRU H GD PHPyULD H[HFXWDU LQVWUXo}HVSDVVRDSDVVRHJHUDULQWHUUXSo}HV &RPR GLVSRVLWLYRV GH HQWUDGD SRGHP VHU XWLOL]DGRV R SUySULR WHFODGR GR FRPSXWDGRURXXPFRQMXQWRGHFKDYHVVLPXODGDVSHORVRIWZDUHDVDtGDSRGH VHUIHLWDHPXPGLVSOD\QXPpULFRRXHPXPFRQMXQWRGHOHGV 2$EDFXVSRGHWDPEpPVHUXWLOL]DGRQRPRGRDVVHPEOHUHPTXHpSRVVtYHO FULDUSURJUDPDVSDUDR DSDUWLUGHXPDWDEHODGHPQHP{QLFRV$VHomR WUD]PDLVGHWDOKHVVREUHHVWHPRGR &RPHVWHVHOHPHQWRVpSRVVtYHOUHVROYHUWRGRVRVH[HUFtFLRVSURSRVWRVSDUDR HDLQGDGHVHQYROYHUPXLWRVRXWURVTXHLOXVWUDPQmRVyRIXQFLRQDPHQWR GHVWH PLFURSURFHVVDGRU PDV SULQFLSDOPHQWH FRQFHLWRV JHUDLV GD GLVFLSOLQD GH 0LFURSURFHVVDGRUHV

$PHPyULD
2 $EDFXV VLPXOD SDUD R SURFHVVDGRU  XPD UHJLmR GH  N% GH PHPyULD 5$0 TXH VH HVWHQGH GR HQGHUHoR + DR HQGHUHoR ))+ 4XDOTXHU SURJUDPD D VHU H[HFXWDGR GHYH VHU FRORFDGR QHVWD UHJLmR GH PHPyULD 7HQWDWLYDV GH DFHVVR D HQGHUHoRV LQYiOLGRV SiUDP D H[HFXomR GR SURJUDPD H JHUDPXPDPHQVDJHPGHDYLVR $UHJLmRTXHYDLGH+D)))+pFRQVLGHUDGDPHPyULD520HQmRSRGH VHU YLVXDOL]DGD QR VLPXODGRU $SHVDU GLVVR R $EDFXV VH FRPSRUWD FRPR VH KRXYHVVHHPDOJXQVHQGHUHoRVVXEURWLQDVTXHRXVXiULRSRGHFKDPDUHHP RXWURVLQVWUXo}HVGHGHVYLRSDUDDUHJLmRGH5$0 YVHomR 

$VMDQHODV
$ LQWHUIDFH GR $EDFXV FRQVLVWH GDV VHJXLQWHV MDQHODV SULQFLSDLV TXH VmR GHVFULWDVHPGHWDOKHQHVWDVHomR 3URJUDPD 3URFHVVDGRU 0HPyULD 'LVSOD\ /HGV &KDYHV $VVHPEOHU

2$EDFXV



$MDQHOD3URJUDPD
(VWDMDQHODPRVWUDGDQDILJXUD SHUPLWHYLVXDOL]DURSURJUDPDFDUUHJDGR QDPHPyULD5$0VLPXODGDGR$EDFXV$MDQHODpGLYLGLGDHPWUrVFROXQDV$ SULPHLUDFROXQDPRVWUDRVHQGHUHoRVHPTXHLQLFLDPDVLQVWUXo}HVSUHVHQWHVQD PHPyULD D VHJXQGD FROXQD RV FyGLJRV KH[DGHFLPDLV GHVVDV LQVWUXo}HV H D WHUFHLUDRVPQHP{QLFRVFRUUHVSRQGHQWHV

)LJ'HWDOKHGDMDQHOD3URJUDPD

2FXUVRU
$MDQHOD3URJUDPDWHPWDPEpPXPFXUVRUXPDOLQKDD]XO FODUDTXHGHVWDFDR HQGHUHoRFRQWLGRQRUHJLVWUDGRU3&HTXHFRUUHVSRQGHjSUy[LPDLQVWUXomRD VHUH[HFXWDGD V YH]HV p QHFHVViULR PRGLILFDU R SRQWR GH FRQWLQXDomR GD H[HFXomR GH XP SURJUDPD GXUDQWH XP WHVWH ,VWR FRUUHVSRQGH D XPD PXGDQoD GD SRVLomR GR FXUVRUHSRGHVHUFRQVHJXLGRFRPXPGXSORFOLTXHVREUHRHQGHUHoRGHVHMDGR QDMDQHOD3URJUDPD

%UHDNSRLQWV
8P FOLTXH FRP R ERWmR HVTXHUGR GR PRXVH j HVTXHUGD GH XPD OLQKD GH SURJUDPDFULDXPEUHDNSRLQWQHVVDOLQKD$FRUGDOLQKDPXGDSDUDYHUPHOKR SDUD LQGLFDU D SUHVHQoD GR EUHDNSRLQW $ SDVVDJHP SRU XP EUHDNSRLQW LQWHUURPSH D H[HFXomR GR SURJUDPD ,VWR SHUPLWH H[HFXWDU XP SURJUDPD DWp TXHVHDWLQMDXPGHWHUPLQDGRSRQWRHHQWmRSDUDUSDUDH[DPLQDUHPGHWDOKHR TXH DFRQWHFH 3RU LVVR RV EUHDNSRLQWV VmR GH JUDQGH XWLOLGDGH QR WHVWH H QD GHSXUDomR 3RGH KDYHU DWp  EUHDNSRLQWV DWLYRV VLPXOWDQHDPHQWH 3DUD UHPRYHU XP EUHDNSRLQW EDVWD FOLFDU QRYDPHQWH j HVTXHUGD GD OLQKD 3DUD UHPRYHUWRGRVRVEUHDNSRLQWVVLPXOWDQHDPHQWHFOLTXHQRERWmR 5HPRYHUEUHDNSRLQWV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

([HFXomRGHXPSURJUDPD
2FRQWUROHGDH[HFXomRGHXPSURJUDPDpIHLWRDWUDYpVGRVVHJXLQWHVERW}HV ([HFXWDUH[HFXWDRSURJUDPDDSDUWLUGDSRVLomRGRFXUVRU 3DUDULQWHUURPSHDH[HFXomRH ([HFXWDUSDVVRDSDVVRH[HFXWDXPDLQVWUXomRGHFDGDYH]

$WXDOL]DomRGDMDQHOD
$H[HFXomRGHXPSURJUDPDSRGHPRGLILFDURFRQWH~GRGDPHPyULD4XDQGR DFRQWHFHXPDPRGLILFDomRHPXPHQGHUHoRTXHHVWiVHQGRPRVWUDGRQDMDQHOD GH SURJUDPD D GHFRGLILFDomR GDV LQVWUXo}HV DIHWDGDV SUHFLVD VHU DWXDOL]DGD (VWD DWXDOL]DomR p IHLWD DXWRPDWLFDPHQWH FDGD YH] TXH D H[HFXomR SiUD H QRUPDOPHQWHQmRpIHLWDGXUDQWHDH[HFXomR1RHQWDQWRpSRVVtYHOID]HUFRP TXHHVWDDWXDOL]DomRDFRQWHoDWDPEpPGXUDQWHDH[HFXomRFOLFDQGRHP $WXDOL]DUGXUDQWHH[HFXomR

2FDPSR0RVWUDUDWp
(PSULQFtSLRDMDQHOD3URJUDPDSRGHULDPRVWUDUVHPSUHWRGDDPHPyULD5$0 VLPXODGD,VWRFULDULDSRUpPXPFHUWRGHVFRQIRUWRQDXWLOL]DomRGDVXDEDUUD GHURODJHPSRLVEDVWDULDXPSHTXHQRGHVORFDPHQWRGRFXUVRUSDUDFDXVDUXP VDOWR GH XP JUDQGH Q~PHUR GH OLQKDV GH SURJUDPD $R PHVPR WHPSR JHUDOPHQWHVHWUDEDOKDFRPSURJUDPDVFXUWRVGHPDQHLUDTXHTXDVHQXQFDp LPSRUWDQWHYLVXDOL]DUDPHPyULDWRGDDWUDYpVGHVWDMDQHOD $ILPGHHYLWDUHVVHGHVFRQIRUWRDMDQHOD3URJUDPDPRVWUDSRUGHIDXOWDSHQDV RV HQGHUHoRV FRUUHVSRQGHQWHV DR DUTXLYR FDUUHJDGR 2 ~OWLPR HQGHUHoR TXH SRGH VHU YLVXDOL]DGR QHVWD MDQHOD DSDUHFH QR FDPSR 0RVWUDU DWp TXH SRGH VHUDOWHUDGRSHORXVXiULRSDUDPRGLILFDURWDPDQKRGD UHJLmR PRVWUDGD 6H R HQGHUHoRFRORFDGRHP0RVWUDUDWpQmRFRUUHVSRQGHUDR~OWLPRE\WHGHXPD LQVWUXomRHQWmRDYLVXDOL]DomRSiUDQD~OWLPDLQVWUXomRTXHSRGHVHUPRVWUDGD SRULQWHLUR (QTXDQWRQmRKiSURJUDPDFDUUHJDGRVmRPRVWUDGRVRVSULPHLURVE\WHVGD PHPyULD

2$EDFXV



$MDQHOD3URJUDPDHPPRGRDVVHPEOHU
$ H[HFXomR GH SURJUDPDV QmR p SHUPLWLGD QR PRGR DVVHPEOHU 3RU LVVR RV ERW}HVGHVFULWRVDFLPDQmRVmRYLVtYHLV1ROXJDUGHOHVDSDUHFHPGRLVRXWURV ~WHLVSDUDDMXGDUQDHGLomRGHSURJUDPDV ,QVHULUXPE\WHLQVHUHXPE\WHLJXDODQDSRVLomRGRFXUVRU 5HPRYHUXPE\WHUHPRYHRSULPHLURE\WHGDOLQKDGRFXUVRU

$MDQHOD3URFHVVDGRU
(VWDMDQHODPRVWUDGDQDILJXUDSHUPLWHYLVXDOL]DURHVWDGRGRSURFHVVDGRU  (VWmR SUHVHQWHV RV UHJLVWUDGRUHV H IODJV DOpP GRV ELWV GD PiVFDUD GH LQWHUUXSo}HV2VYDORUHVGHWRGRVRVUHJLVWUDGRUHVVmR KH[DGHFLPDLV 2 YDORU GHFLPDO FRUUHVSRQGHQWH DRV UHJLVWUDGRUHV GH $ DWp / SRGH VHU YLVXDOL]DGR UDSLGDPHQWH EDVWDQGR SDUD LVVR PDQWHU R FXUVRU GR PRXVH HP UHSRXVR SRU DOJXQVLQVWDQWHVVREUHRYDORUKH[DGHFLPDO

)LJ$MDQHOD3URFHVVDGRU $MDQHODFRQWDDLQGDFRPRVVHJXLQWHVERW}HV 5HVHWFDXVDXPUHVHWGRSURFHVVDGRU 567VROLFLWDomRGDLQWHUUXSomR 567VROLFLWDomRGDLQWHUUXSomR 567VROLFLWDomRGDLQWHUUXSomR 75$3VROLFLWDomRGDLQWHUUXSomRWUDS



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

3DUDHVFODUHFHUG~YLGDVVREUHRVHOHPHQWRVGHVWDMDQHODFRQVXOWHRVFDStWXORV GDSDUWHWHyULFDTXHWUDWDPGR2VUHJLVWUDGRUHVHIODJVTXHDSDUHFHPQD MDQHOD FRUUHVSRQGHP DR PRGHOR GH SURJUDPDomR 2 FDStWXOR  WUD] DLQGD DOJXQVGHWDOKHVDGLFLRQDLVVREUHRIXQFLRQDPHQWR GRV ERW}HV UHODFLRQDGRV jV LQWHUUXSo}HV

$MDQHOD0HPyULD
(VWDMDQHODPRVWUDGDQDILJXUDSHUPLWHYLVXDOL]DUHPRGLILFDURFRQWH~GR GHTXDOTXHUE\WHGDPHPyULD5$0VLPXODGDSHOR$EDFXV

)LJ$MDQHOD0HPyULD

6HJXLGRUHVGHSRQWHLURV
2V ERW}HV GD EDUUD GH IHUUDPHQWDV GHVWD MDQHOD DWLYDP XP PHFDQLVPR TXH SHUPLWH DFRPSDQKDU SURJUDPDV TXH WUDEDOKDP FRP HQGHUHoDPHQWR LQGLUHWR SRUH[HPSORFRPYDUUHGXUDGHWDEHODV1HVWHVFDVRVXPSDUGHUHJLVWUDGRUHV FRQWpPXPHQGHUHoRGHPHPyULDHGL]VHHQWmRTXHHVWHSDUGHUHJLVWUDGRUHV DSRQWDSDUDRE\WHTXHHVWiQHVVHHQGHUHoR4XDQGRXPGRVERW}HV 6HJXLU%& 6HJXLU'(RX 6HJXLU+/ pDWLYDGRRE\WHHQGHUHoDGRpGHVWDFDGR'HVWDIRUPDXPSURJUDPDTXHYDULH XPGHVVHVHQGHUHoRVSDUDDFHVVDUWDEHODVGDGRVGHIRUPDLQGLUHWDSURGX]XP HIHLWRGHDQLPDomRTXHSHUPLWHFRPSUHHQGHUPHOKRUVHXIXQFLRQDPHQWR

2$EDFXV 'HIRUPDDQiORJDRERWmR 6HJXLU63



GHVWDFD R E\WH TXH HVWi QR WRSR GD SLOKD 2V E\WHV VmR GHVWDFDGRV HP FRUHV GLIHUHQWHVSDUDHYLWDUFRQIXVmRTXDQGRPDLVGHXPERWmRHVWiDWLYR

$MDQHOD'LVSOD\
2$EDFXVLQFOXLXPGLVSOD\TXHSRGHVHUXWLOL]DGRFRPRGLVSRVLWLYRGHVDtGDH p PRVWUDGR QD ILJXUD  6XD XWLOL]DomR p IHLWD DWUDYpV GH VXEURWLQDV VLPXODGDVHP520H[SOLFDGDVQRFDStWXOR

)LJ$MDQHOD'LVSOD\

$MDQHOD/HGV
(VWD MDQHOD VLPXOD XP FRQMXQWR GH RLWR OHGV GLVSRVWRV KRUL]RQWDOPHQWH FRQIRUPH D ILJXUD  2 OHG PDLV j HVTXHUGD FRUUHVSRQGH DR ELW PDLV VLJQLILFDWLYR GH XPD SRUWD GH VDtGD TXH TXDQGR UHFHEH XP E\WH GH XP SURJUDPDID]DFHQGHURVOHGVQDVSRVLo}HVFXMRVELWVIRUHPLJXDLVD 2FDStWXORGiPDLVGHWDOKHVVREUHFRPRWUDEDOKDUFRPRVOHGV

)LJ$MDQHOD/HGV

$MDQHOD&KDYHV
(VWD MDQHOD VLPXOD XP FRQMXQWR GH FKDYHV PRVWUDGDV QD ILJXUD  (VWDV FKDYHVSRGHPVHUOLGDVDSDUWLUGHXPDSRUWDGHHQWUDGD2SURFHVVDGRUOrXP E\WH GHVVD SRUWD FXMRV ELWV HVWDUmR HP  RX  FRQIRUPH DV FKDYHV HVWHMDP DEHUWDVRXIHFKDGDVUHVSHFWLYDPHQWH$FKDYHPDLVjHVTXHUGDFRUUHVSRQGHDR ELWPDLVVLJQLILFDWLYR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

'HWDOKHVVREUHFRPRWUDEDOKDUFRPDVFKDYHVVmRGDGRVQRFDStWXOR

)LJ$MDQHOD&KDYHV

$MDQHOD$VVHPEOHU
2PRGRDVVHPEOHUpDWLYDGRDWUDYpVGRERWmR ([LELUDVVHPEOHU GDEDUUDGHIHUUDPHQWDVGDMDQHODSULQFLSDOGR$EDFXV1HVWHPRGRDVMDQHODV 3URFHVVDGRU /HGV 'LVSOD\ H &KDYHV GmR OXJDU j MDQHOD $EDFXV $VVHPEOHU PRVWUDGDQDILJXUD

)LJ2$VVHPEOHUGR$EDFXV $HGLomRGHSURJUDPDVSRGHHQWmRVHUIHLWDVHOHFLRQDQGRVHFRPRPRXVHDV LQVWUXo}HV GHVHMDGDV 4XDQGR VH VHOHFLRQD XPD LQVWUXomR R RSFRGH FRUUHVSRQGHQWHpFRORFDGRQDPHPyULDHDVMDQHODV3URJUDPDH0HPyULDVmR DWXDOL]DGDVGHDFRUGR ,QVWUXo}HV HP TXH p SUHFLVR HVFROKHU XP UHJLVWUDGRU FRPR SRU H[HPSOR $1$UHJ!DEUHPDXWRPDWLFDPHQWHXPSHTXHQRPHQXFRPRRTXHDSDUHFH QD ILJXUD DQWHULRU ,QVWUXo}HV TXH SUHFLVDP GH DUJXPHQWRV QXPpULFRV FRPR SRUH[HPSOR-03HQGHUHoR!FRORFDPQDPHPyULDDSHQDVRRSFRGHRVE\WHV TXHIRUPDPRHQGHUHoRSRGHPHQWmRVHULQWURGX]LGRVDWUDYpVGRWHFODGR 3URJUDPDVHGLWDGRVGHVWDIRUPDSRGHPVHUVDOYRVHPGLVFRFRQIRUPHGHVFULWR QDVHomR

2$EDFXV



2VPHQXV
$ LQWHUIDFH GR $EDFXV FRQWD DLQGD FRP RV VHJXLQWHV PHQXV GHVFULWRV HP GHWDOKHDVHJXLU $UTXLYR )HUUDPHQWDV 2So}HV $MXGD

2PHQX$UTXLYR
2PHQX$UTXLYRGR$EDFXVDEULJDRVVHJXLQWHVLWHQV

$EULU
3HUPLWHDEULUDUTXLYRVH[LVWHQWHV2VDUTXLYRVXWLOL]DGRVGHYHPWHUDH[WHQVmR KH[HRIRUPDWRGHVFULWRQDVHomR2QRPHGRSURJUDPDDEHUWRDSDUHFH QD EDUUD GH WtWXOR GD MDQHOD 3URJUDPD 2 PHVPR HIHLWR SRGH VHU FRQVHJXLGR FOLFDQGRVHRERWmR $EULUDUTXLYR GDEDUUDGHIHUUDPHQWDVSULQFLSDOGR$EDFXV

5HFDUUHJDU
&DUUHJDQRYDPHQWHR~OWLPRDUTXLYRDEHUWR(VWDRSomRpEDVWDQWH~WLOGXUDQWH R WHVWH H D GHSXUDomR GH SURJUDPDV HP TXH PXLWDV YH]HV VH FKHJD D XPD VLWXDomR HP TXH VH GHVHMD UHFRPHoDU R WHVWH GR LQtFLR GLVSHQVDQGR TXDOTXHU PRGLILFDomRIHLWD$PDQHLUDPDLVVHJXUDGHID]HULVWRpUHFDUUHJDURSURJUDPD 2PHVPRHIHLWRSRGHVHUFRQVHJXLGRFOLFDQGRVHRERWmR 5HFDUUHJDUDUTXLYR GDEDUUDGHIHUUDPHQWDVSULQFLSDOGR$EDFXV

6DOYDU
6DOYD R SURJUDPD DWXDO FRP R PHVPR QRPH FRP R TXDO IRL FDUUHJDGR 3RU SURJUDPD DWXDO HQWHQGHVH R FRQWH~GR GD IDL[D GH PHPyULD YLVtYHO QD MDQHOD 3URJUDPD GR LQtFLR GD 5$0 DWp R HQGHUHoR FRQWLGR HP 0RVWUDU DWp  2 PHVPRHIHLWRSRGHVHUFRQVHJXLGRFOLFDQGRVHRERWmR

 6DOYDU

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV GDEDUUDGHIHUUDPHQWDVSULQFLSDOGR$EDFXV

6DOYDUFRPR
6HPHOKDQWHDRLWHPDQWHULRU6DOYDRSURJUDPDDWXDOFRPXPQRPHTXHSRGH VHUHVFROKLGRSHORXVXiULR2PHVPRHIHLWRSRGHVHUFRQVHJXLGRFOLFDQGRVHR ERWmR 6DOYDUFRPR GDEDUUDGHIHUUDPHQWDVSULQFLSDOGR$EDFXV

6DLU
(QFHUUDR$EDFXV

2PHQX)HUUDPHQWDV
(VWHPHQXWHPDSHQDVRLWHP

$VVHPEOHU
TXHWHPDPHVPDIXQFLRQDOLGDGHGRERWmR ([LELUDVVHPEOHU GHVFULWRQDVHomR

2PHQX2So}HV
(VWHPHQXDEULJDRVVHJXLQWHVLWHQV

6XEURWLQDVHP520
(VWHLWHPOHYDjFDL[DGHGLiORJRPRVWUDGDQDILJXUD

2$EDFXV



)LJ$FDL[DGHGLiORJR6XEURWLQDV 2 $EDFXV LQFOXL DOJXPDV VXEURWLQDV VLPXODGDV HP 520 FXMRV HQGHUHoRV LQLFLDLV SRGHP VHU PRGLILFDGRV SHOR XVXiULR $ IDFLOLGDGH GH PRGLILFDU HVWHV HQGHUHoRVH[LVWHDSHQDVSDUDRVFDVRVHPTXHVHGHVHMHXWLOL]DUR $EDFXVSDUD VLPXODUDH[HFXomRGHSURJUDPDVHPXPKDUGZDUHHVSHFtILFRFRPVXEURWLQDV DQiORJDVPDVORFDOL]DGDVHPHQGHUHoRVGLIHUHQWHV $V OLVWDJHQV FRQWLGDV QHVWH OLYUR XWLOL]DP VHPSUH RV HQGHUHoRV GHIDXOW H SRU LVVR QmR p QHFHVViULR PRGLILFDU HVWDV FRQILJXUDo}HV &DVR LVVR VHMD IHLWR RV YDORUHVGHIDXOWSRGHPVHUUHFXSHUDGRVDWUDYpVGRERWmR5HVWDXUDU

'HVYLRVGHWUDWDGRUHVSDUD5$0
(VWHLWHPOHYDjFDL[DGHGLiORJRPRVWUDGDQDILJXUD

)LJ$FDL[DGHGLiORJR7UDWDGRUHV 2V HQGHUHoRV GH GHVYLR GDV LQWHUUXSo}HV GR SURFHVVDGRU  QmR FRUUHVSRQGHPjUHJLmRGHPHPyULD5$0VLPXODGDSHOR $EDFXV,VWR p SRXFR SUiWLFRSRLVSDUDXWLOL]DUDVLQWHUUXSo}HVpSUHFLVRSRGHUPRGLILFDURFRQWH~GR GDPHPyULDQHVVHVHQGHUHoRV3DUDFRQWRUQDUHVWHSUREOHPDR$EDFXVSHUPLWH UHSURJUDPDU RV GHVYLRV 2 SURJUDPD VH FRPSRUWD HQWmR FRPR VH KRXYHVVH QRV HQGHUHoRV GH GHVYLR GR SURFHVVDGRU LQVWUXo}HV -03 SDUD RV QRYRV HQGHUHoRVHP5$0



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

2VYDORUHVGHIDXOWVmRXWLOL]DGRVDRORQJRGROLYURHQmRSUHFLVDPVHUDOWHUDGRV SDUDDUHDOL]DomRGRVH[HUFtFLRV &DVRVHMDPSRGHPVHPSUHVHUUHFXSHUDGRVD SDUWLUGRERWmR5HVWDXUDU

'HVYLRVGDVLQVWUXo}HV567
(VWHLWHPOHYDjFDL[DGHGLiORJRPRVWUDGDQDILJXUD

)LJ'HVYLRVGDVLQVWUXo}HV567 'D PHVPD IRUPD FRPR QR FDVR GDV LQWHUUXSo}HV DFLPD DV LQVWUXo}HV 567 GHVYLDP R SURFHVVDPHQWR GR SURJUDPD SDUD IRUD GD UHJLmR GH PHPyULD VLPXODGDSHOR$EDFXV3DUDFRQWRUQDUHVWHSUREOHPDHVVHVGHVYLRVSRGHPVHU UHSURJUDPDGRV 2 SURJUDPD VH FRPSRUWD HQWmR FRPR VH KRXYHVVH QDTXHOHV HQGHUHoRVLQVWUXo}HV-03SDUDRVQRYRVHQGHUHoRVHP5$0 2V YDORUHV GHIDXOW SRGHP VHU VHPSUH UHFXSHUDGRV D SDUWLU GR ERWmR 5HVWDXUDU

2PHQX$MXGD
(VWHPHQXWHPRVVHJXLQWHVLWHQV

'HVFULomRGR$EDFXV
'iXPDSHTXHQDGHVFULomRGRSURJUDPDHH[SOLFDVXDUHODomRFRPHVWHOLYUR

6REUHR$EDFXV
7HPLQIRUPDo}HVVREUHDYHUVmRGRSURJUDPDHDHTXLSHTXHWUDEDOKRXQRVHX GHVHQYROYLPHQWR

2$EDFXV



&RGLILFDomRGHLQVWUXo}HVGR
2SULPHLURSDVVRQRGHVHQYROYLPHQWRGHXPSURJUDPDGHYHVHUVHPSUHXPD HWDSDGHSODQHMDPHQWRFXMRREMHWLYRpHVFODUHFHURTXHRSURJUDPDGHYHID]HU 6RPHQWHGHSRLVGHYHVHSDVVDUDRGHWDOKDPHQWRHWDSDHPTXHVHGHFLGH FRPR DVFRLVDVVHUmRIHLWDV(VWDHWDSDLQFOXLDHODERUDomRGRFyGLJRTXHFRQVLVWHHP HVFROKHUDVLQVWUXo}HVDVHUHPXWLOL]DGDVHGLVS{ODVHPXPDVHTrQFLDWDOTXH SURGX]DPRUHVXOWDGRGHVHMDGR 3DUDRSURFHVVDGRUFDGDLQVWUXomRFRQVLVWHGHXPRXPDLVQ~PHURVELQiULRV TXHVmROLGRVLQWHUSUHWDGRVHH[HFXWDGRV1RHQWDQWRSDUDRVVHUHVKXPDQRV p GLItFLO SHQVDU HP WHUPRV GHVVHV Q~PHURV 3RU LVVR RV IDEULFDQWHV GH PLFURSURFHVVDGRUHV DVVRFLDP D FDGD LQVWUXomR XP PQHP{QLFR TXH p XPD HVSpFLH GH DEUHYLDWXUD GR TXH D LQVWUXomR ID] 3RGHVH HQWmR XWLOL]DU RV PQHP{QLFRVSDUDHVFUHYHUXPSURJUDPDHPYH]GHWHUTXHOLGDUGLUHWDPHQWH FRPRVQ~PHURVELQiULRV 6XSRQKD SRU H[HPSOR TXH XP FHUWR SURJUDPD DUPD]HQD QD SRVLomR + GD PHPyULD XP YDORU TXH GHVHMDPRV LQFUHPHQWDU 3RGHUtDPRV XVDU D VHTrQFLD
LDA 2015H INR A STA 2015H ; Traz o contedo do byte 2015H para A ; A = A + 1 ; Escreve A no byte de endereo 2015H

3DUD TXH R SURFHVVDGRU SRVVD HQWHQGHU R SURJUDPD DFLPD DV LQVWUXo}HV GHYHPVHUWUDGX]LGDVSDUDRFyGLJRELQiULRTXHOKHVFRUUHVSRQGH$WUDGXomRp IHLWD GH DFRUGR FRP DV HVSHFLILFDo}HV GR IDEULFDQWH GDGDV SHOD WDEHOD GH LQVWUXo}HVGRPLFURSURFHVVDGRU YDQH[RH>,17(@  2VFyGLJRVFRUUHVSRQGHQWHVjVLQVWUXo}HVGRH[HPSORHPKH[DGHFLPDOVmR
3A 15 20 3C 32 15 20 ; Codificao de LDA 2015H ; Idem, INR A ; Idem, STA 2015H

e LQWHUHVVDQWH QRWDU TXH RV E\WHV GR HQGHUHoR + VmR FRGLILFDGRV HP RUGHPLQYHUVD SULPHLUR+GHSRLV+ (VWDpXPDFRQYHQomRVHJXLGDSRU WRGRVRVSURFHVVDGRUHVGD,QWHORDUPD]HQDPHQWRGHYDORUHVGHPDLVGHXP E\WHpIHLWRGHPRGRTXHRE\WHPHQRVVLJQLILFDWLYRILTXHQRHQGHUHoRPHQRU HRE\WHPDLVVLJQLILFDWLYRQRPDLRU 7HUPLQDGD D WUDGXomR SRGHPRV WRPDU RV FyGLJRV KH[DGHFLPDLV REWLGRV H FRORFiORV QD PHPyULD GR FRPSXWDGRU SDUD TXH R SURJUDPD SRVVD VHU H[HFXWDGR1HVWHSRQWRpQHFHVViULRHVFROKHURHQGHUHoRDSDUWLUGRTXDOHVVHV E\WHVVHUmRHVFULWRVQDPHPyULDGHSURJUDPD3RUH[HPSORVHGHVHMDUPRVTXH



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

RSURJUDPDLQLFLHQDSRVLomRGHPHPyULD+HQWmRRVHQGHUHoRVILFDUmR DVVLP
2000H 2003H 2004H 3A 15 20 3C 32 15 20 ; Codificao de LDA 2015H ; Idem, INR A ; Idem, STA 2015H

2 SURJUDPD WHUi DR WRGR  E\WHV H RFXSDUi DV SRVLo}HV GH + D + LQFOXVLYH e LPSRUWDQWH QRWDU TXH QmR VH GHYH FKHJDU DWp D SRVLomR + SRLVHVWDpXWLOL]DGDFRPRDYDULiYHOTXHHVWiVHQGRLQFUHPHQWDGD )LQDOPHQWHDSRVLomR+WHULDTXHVHULQLFLDOL]DGDFRPDOJXPYDORUSDUD SRGHUPRV WHVWDU R SURJUDPD (VWH YDORU SRGHULD VHU SRU H[HPSOR + H VH GHSRLVGHH[HFXWDURSURJUDPDYHULILFDUPRVQRYDPHQWHRYDORUGHVVDSRVLomR GHYHUtDPRVHQFRQWUDU+ 2VRSFRGHVDFLPDSRGHPVHUFRORFDGRVQDPHPyULDGR$EDFXVSDUDH[HFXWDU RSURJUDPD YHMDRH[HUFtFLRGDVHomR 

2DVVHPEOHUGR$EDFXV
1RH[HPSORDQWHULRUTXHWHPDSHQDVWUrVLQVWUXo}HVpSHUIHLWDPHQWHSRVVtYHO ID]HUDWUDGXomRGRVPQHP{QLFRVSDUDRV RSFRGHV PDQXDOPHQWH 7DPEpP D LQLFLDOL]DomRGDYDULiYHOXWLOL]DGDpXPDWDUHIDVLPSOHVSRLVWUDWDVHGHDSHQDV XP E\WH 1R HQWDQWR SDUD SURJUDPDV PDLRUHV HVWH PpWRGR VHULD PXLWR LQHILFLHQWH 2DVVHPEOHUGR$EDFXVSRGHDMXGDUDUHVROYHUHVWHSUREOHPDPDVDSHQDVVH RV SURJUDPDV IRUHP SHTXHQRV (PERUD HVWH DVVHPEOHU SHUPLWD FULDU HP SULQFtSLR TXDOTXHU SURJUDPD TXH FDLED QD PHPyULD HOH WHP OLPLWDo}HV TXH WRUQDPVHXXVRSRXFR LQWHUHVVDQWH SDUD GHVHQYROYHU SURJUDPDV JUDQGHV 8P GRV SUREOHPDV p TXH HPERUD RV SURJUDPDV FULDGRV QR $EDFXV SRVVDP VHU VDOYRVHPIRUPDWRKH[QmRH[LVWHXPDOLVWDJHPFRPFRPHQWiULRVTXHSRVVD VHULPSUHVVDJXDUGDGDRXDQDOLVDGD,VVRWHPXPLPSDFWRLQDFHLWiYHOVREUHD GRFXPHQWDomR TXH p HVVHQFLDO HP SURMHWRV PDLRUHV 2XWUD GHVYDQWDJHP LPSRUWDQWH p TXH QmR p SRVVtYHO GLYLGLU XP SURJUDPD HP YiULRV PyGXORV R TXHpHVVHQFLDOSDUDTXHVHSRVVDWUDEDOKDUHPHTXLSH 3DUD VXSHUDU HVWH WLSR GH OLPLWDomR WUDEDOKDVH HP SURMHWRV PDLRUHV FRP IHUUDPHQWDV GH VRIWZDUH TXH GmR VXSRUWH DR GHVHQYROYLPHQWR GH QRYRV SURJUDPDVFRPRDVDSUHVHQWDGDVQRFDStWXOR2DVVHPEOHUGR$EDFXVGHYH VHU YLVWR SRUWDQWR FRPR XPD IHUUDPHQWD ~WLO SDUD HVWXGDU H ID]HU SHTXHQRV WHVWHVFRPDJLOLGDGHPDVQmRFRPRXPDDOWHUQDWLYDSDUDRVUHFXUVRVGHVFULWRV DGLDQWH

2$EDFXV



([HUFtFLRV
 ,QWURGX]D RVYDORUHVKH[DGHFLPDLVGRSURJUDPDGDVHomR QD PHPyULD GR $EDFXV D SDUWLU GR HQGHUHoR + ([HFXWH DV LQVWUXo}HV SDVVR D SDVVRDFRPSDQKDQGRRTXHDFRQWHFHQRSURFHVVDGRUHQDPHPyULD  ,QLFLHR$EDFXVHDWLYHDMDQHOD$EDFXV$VVHPEOHUFOLFDQGRQRERWmR ([LELUDVVHPEOHU ,QWURGX]DQRYDPHQWHRSURJUDPDGDVHomRVHOHFLRQDQGRDVLQVWUXo}HV QDMDQHODGHPQHP{QLFRV1RWHTXHDJRUDQmRpSUHFLVRUHFRUUHUjWDEHODGH LQVWUXo}HV SDUD GHVFREULU RV RSFRGHV GH FDGD LQVWUXomR (VWD WDUHID IRL UHVROYLGDSHOR$EDFXVHYRFrS{GHVHFRQFHQWUDUDSHQDVQRVPQHP{QLFRV  0RGLILTXHRSURJUDPDDQWHULRUSDUDTXHRFRQWH~GRGDSRVLomRGHPHPyULD VHMDGHFUHPHQWDGRGHXPDXQLGDGH  (VFUHYD XP SURJUDPD TXH VRPH RV E\WHV + H + GD PHPyULD H DUPD]HQHRUHVXOWDGRGHVVDVRPDQRHQGHUHoR+ 'LFDOHLDRSULPHLURE\WHDVHUVRPDGRSDUDRDFXPXODGRUFRPR QRV H[HUFtFLRV DQWHULRUHV 'HSRLV JXDUGH HVWH YDORU QXP RXWUR UHJLVWUDGRUXWLOL]DQGRDLQVWUXomR029 YDQH[RH>,17(@  (PVHJXLGDOHLDRVHJXQGRRSHUDQGRGDVRPDUHDOL]HDRSHUDomR FRPDLQVWUXomR$''HJXDUGHRUHVXOWDGR  2SURJUDPDGRH[HUFtFLRVyIXQFLRQDFRUUHWDPHQWHVHDVRPDQmRSDVVDU GH))+6HKRXYHUXPYDLHVWHQmRpUHJLVWUDGR&RUULMDHVWDVLWXDomR DOWHUDQGR R SURJUDPD GH IRUPD TXH R UHVXOWDGR SDVVH D RFXSDU RV E\WHV + H + /HPEUHVH GH TXH R E\WH PDLV VLJQLILFDWLYR GR UHVXOWDGR GHYHVHURGHHQGHUHoRPDLVDOWRHIDoDRLJXDOD]HURVHQmRKRXYHYDL HLJXDODHPFDVRFRQWUiULR3DUDGHVFREULU VH Ki YDL  RX QmR YHMD D GHVFULomRGDVLQVWUXo}HV-&H-1&



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

)HUUDPHQWDVGH GHVHQYROYLPHQWR
(VWHFDStWXORDSUHVHQWDIHUUDPHQWDVVLPSOHVGHGHVHQYROYLPHQWRGHSURJUDPDV SDUD R  TXH SRGHP VHU XWLOL]DGDV SDUD FULDU RV SURJUDPDV XWLOL]DGRV HP WRGRVRVH[HPSORVGROLYURSDUDHVWHSURFHVVDGRU0DLVLPSRUWDQWHSRUpP GR TXH DSUHQGHU RV GHWDOKHV GH XWLOL]DomR GHVVDV IHUUDPHQWDV p FRPSUHHQGHU DV UD]}HV GDVXDH[LVWrQFLDHRVHXSDSHO QR SURFHVVR GH GHVHQYROYLPHQWR SRLV HVWHFRQKHFLPHQWRpGHFDUiWHUJHUDOHYiOLGRSDUDWRGRVRVSURFHVVDGRUHV

2SDSHOGRDVVHPEOHU
&RQIRUPH H[SRVWR QR FDStWXOR  H[LVWHP IHUUDPHQWDV GH VRIWZDUH RV DVVHPEOHUVTXHID]HPRWUDEDOKRGHWUDGXomRGHXPDUTXLYRWH[WRFRQWHQGR PQHP{QLFRV SDUD XP DUTXLYRREMHWR FRQWHQGR RSFRGHV 3DUD TXH LVVR VHMD SRVVtYHO R DUTXLYRIRQWH WHP TXH REHGHFHU D FHUWDV FRQYHQo}HV TXH GHWHUPLQDP D HVWUXWXUD GRV SURJUDPDV HVFULWRV HP OLQJXDJHP $VVHPEO\ 2 REMHWLYRGHVWDVHomRpDSUHVHQWDUDOJXQVGHWDOKHVVREUHHVVDHVWUXWXUDHOHYDU FRPLVVRDXPDPHOKRUFRPSUHHQVmRGRSDSHOGRDVVHPEOHU $OLVWDJHPDVHJXLUPRVWUDFRPRILFDULDRSURJUDPDGRH[HPSORGDVHomR  TXDQGRHVFULWRFRPRDUTXLYRIRQWHSDUDRDVVHPEOHUGR
ORG 2000H LDA COUNT INR A STA COUNT ORG 2015H DB 00H END ; ; ; ; ; ; Codificar a partir de 2000H Codificao de LDA 2015H Idem, INR A Idem, STA 2015H Codificar a partir de 2015H Cria varivel com valor inicial 00H

COUNT



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$SULPHLUDOLQKDLQGLFDDRDVVHPEOHUTXHRFyGLJRLQLFLDQRHQGHUHoR+ &RP LVVR R DVVHPEOHU WHP FRPR GHWHUPLQDU RV HQGHUHoRV GH WRGDV DV LQVWUXo}HVVHJXLQWHV $VOLQKDVVHJXLQWHVFRQWrPRVPQHP{QLFRVHJHUDPRFyGLJRFRUUHVSRQGHQWH D FDGD XP GHOHV 0DLV DGLDQWH YHP XPD VHJXQGD GLUHWLYD 25* TXH GL] DR DVVHPEOHU TXH WXGR TXH IRU JHUDGR GDOL HP GLDQWH GHYH LQLFLDU QD SRVLomR +eRFDVRGDGLUHWLYD
COUNT DB 00H,

TXHGL]DRDVVHPEOHUSDUDUHVHUYDUE\WH QR HQGHUHoR GH PHPyULD + H HVWDEHOHFHDRPHVPRWHPSRXPVLQ{QLPRSDUDHVWHHQGHUHoR TXH SRGH VHU XWLOL]DGRQRSURJUDPD FRPRQDVOLQKDVLDA COUNTHSTA COUNT  2VtPEROR COUNT,QRH[HPSORDFLPDpRTXHVHFKDPDGHXP ODEHO HWLTXHWD UyWXOR 2VODEHOVH[LVWHPFRPDILQDOLGDGHGHSRXSDURSURJUDPDGRUGRFiOFXOR GH HQGHUHoRV SDUD FRORFDU QDV LQVWUXo}HV 3RU H[HPSOR VH GHSRLV GR E\WH COUNTIRVVHPGHILQLGRVRXWURVDVVLP
TABELA FLAG DB 00H, 01H, 02H, 03H, 04H, 05H DB 01H

HQWmR R VtPEROR TABELA VHULD XP VLQ{QLPR SDUD RV YDORUHV + TXH p R HQGHUHoR GR SULPHLUR E\WH GD WDEHOD &RQVHTHQWHPHQWH RV GHPDLV E\WHV GD WDEHOD RFXSDULDP DV SRVLo}HV + D %+ H R VtPEROR FLAG VHULD XP VLQ{QLPRSDUDRYDORU&+,VVRpPXLWR~WLOSULQFLSDOPHQWHQRVFDVRVHP TXH VH GHFLGH PXGDU DOJXPD FRLVD GH OXJDU QR SURJUDPD 6H DR LQYpV GH FRORFDU DV YDULiYHLV D SDUWLU GR HQGHUHoR + FRPR QR H[HPSOR DFLPD GHFLGtVVHPRVSDVViODVSDUDXPRXWUROXJDU PXGDQGRRDUJXPHQWRGDGLUHWLYD ORG HQWmRRVODEHOVVHULDPDWXDOL]DGRVDXWRPDWLFDPHQWHSHORDVVHPEOHU &DVR XViVVHPRV RV HQGHUHoRV GLUHWDPHQWH GHQWUR GDV LQVWUXo}HV WRGR R SURJUDPD WHULDTXHVHUUHYLVDGRSDUDVHDGDSWDUDRVQRYRVHQGHUHoRV2PHVPRYDOHSDUD RFDVRGHVHGHFLGLUPXGDURFRPSULPHQWRGDWDEHOD 2V YDORUHV FRORFDGRV DSyV D GLUHWLYD '% VmR LQLFLDOL]DP DV YDULiYHLV (VVHV YDORUHV VmR FRORFDGRV QR DUTXLYRREMHWR H TXDQGR R SURJUDPD p FDUUHJDGR SDUDH[HFXomRVmRWUDQVIHULGRVSDUDDPHPyULDMXQWDPHQWHFRPRVFyGLJRVGDV LQVWUXo}HV1RFDVRGRH[HPSORDFLPDLVWRSRXSDRSURJUDPDGRUGHWHUTXH LQLFLDOL]DU D YDULiYHO COUNT DQWHV GH WHVWDU R SURJUDPD 1RWH SRUpP TXH DV YDULiYHLVHPTXHVWmRVyVmRLQLFLDOL]DGDVFDGDYH]TXHRSURJUDPDpWUDQVIHULGR GRGLVFRSDUDDPHPyULD6HRSURJUDPDIRUH[HFXWDGRDWpXPSRQWRHPTXH HVVDVYDULiYHLVWHQKDPVLGRDOWHUDGDVHHQWmRH[HFXWDGRQRYDPHQWHGRLQtFLR RVYDORUHVGDVYDULiYHLVQmRFRUUHVSRQGHUmRPDLVDRVGDLQLFLDOL]DomR3RULVVR DRHVFUHYHUSURJUDPDVTXHQmRVHMDPDSHQDVH[HPSORVGLGiWLFRVpERDSUiWLFD LQFOXLUQRLQtFLRLQVWUXo}HVSDUDLQLFLDOL]DUWRGDVDVYDULiYHLV

)HUUDPHQWDVGHGHVHQYROYLPHQWR



4XDOTXHU OLQKD LQFOXVLYH DV GH FyGLJR SRGH LQLFLDU SRU XP ODEHO TXH VHUYH HQWmRSDUDTXHVHSRVVDUHIHUHQFLiODHPRXWURVSRQWRVGRSURJUDPDFRPRQR WUHFKRGHFyGLJRVHJXLQWH
LOOP: MVI ADD DCR JNZ B,00H B C LOOP

(VWH WUHFKR GH FyGLJR SRGH VHUYLU SDUD ID]HU D PXOWLSOLFDomR GR Q~PHUR FRQWLGRQRDFXPXODGRUSHORQ~PHURFRQWLGRQRUHJLVWUDGRU&2UHVXOWDGRp REWLGRHP%TXHUHFHEH&YH]HVRQ~PHURFRQWLGRHP $ 3DUD LVWR R ORRS IRUPDGR SHODV WUrV ~OWLPDV LQVWUXo}HV WHP TXH VHU UHSHWLGR & YH]HV H D LQVWUXomR JNZ LOOP GHVYLD R SURFHVVDPHQWR GR SURJUDPD GH YROWD SDUD D LQVWUXomR ADD BHQTXDQWRRUHJLVWUDGRU&QmRFKHJDUD]HUR3DUDSRGHUID]HU HVWH GHVYLR D LQVWUXomR SUHFLVD UHFHEHU FRPR DUJXPHQWR R HQGHUHoR GHVVD LQVWUXomR2XVRGRODEHOLOOPGLVSHQVDRSURJUDPDGRUGHVHSUHRFXSDUFRPR YDORUGRHQGHUHoR )LQDOPHQWH R FDUDFWHU  SRQWR H YtUJXOD  VHUYH SDUD LQLFLDU XP FRPHQWiULR TXHVHHQFHUUDDXWRPDWLFDPHQWHQRILQDOGDOLQKD4XDOTXHUWH[WRHVFULWRFRPR FRPHQWiULR QmR WHP LQIOXrQFLD VREUH R FyGLJR JHUDGR H VHUYH DSHQDV FRPR GRFXPHQWDomR2XVRGHFRPHQWiULRVGHYHVHUIHLWRFRPFXLGDGRSDUDHYLWDUD SROXLomR YLVXDO GD OLVWDJHP (P JHUDO XP FRPHQWiULR QmR GHYH GL]HU RTXH D LQVWUXomRID]SRUTXHLVVRpXPDFRLVDTXHQRUPDOPHQWHRSURJUDPDGRUMiVDEH RXSRGHGHVFREULUPHGLDQWHFRQVXOWDjWDEHODGHLQVWUXo}HVPDVVLP SDUDTXH HOD HVWi VHUYLQGR QR SRQWR GR SURJUDPD RQGH VH HQFRQWUD 3RU H[HPSOR HVFUHYHU
LDA 2015H ; carrega acumulador com contedo da ; posio 2015H da memria ; l contagem de peas na esteira

pGLIHUHQWHGH
LDA 2015H

8PDH[FHomRSDUDHVWDUHJUDVmRRVSULPHLURVSURJUDPDVHPTXHFRPHQWiULRV FRPR R SULPHLUR DFLPD H RV GD VHomR   SRGHP DMXGDU D IL[DU DOJXQV FRQKHFLPHQWRV

8WLOL]DomRGDVIHUUDPHQWDVGHVRIWZDUH
(VWD VHomR DSUHVHQWD DV IHUUDPHQWDV XWLOL]DGDV QDV GLYHUVDV HWDSDV GR GHVHQYROYLPHQWRGHXPSURJUDPD



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

(GLomR
1HVWD HWDSD SRGHVH XWLOL]DU TXDOTXHU HGLWRU TXH SHUPLWD JUDYDU DUTXLYRV HP IRUPDWR WH[WR $6&,,  e LPSRUWDQWH OHPEUDU TXH RV HGLWRUHV TXH SHUPLWHP DFUHVFHQWDU IRUPDWDomR DR WH[WR JHUDOPHQWH DUPD]HQDP HVWD LQIRUPDomR QD IRUPDGHFDUDFWHUHVQmRYLVtYHLVTXHDWUDSDOKDPRDVVHPEOHUQDKRUDGHOHUR DUTXLYR3RULVVRpLPSRUWDQWHWHUFHUWH]DGHTXHRDUTXLYRpVDOYRUHDOPHQWH DSHQDVFRPRWH[WR 2V ODEHOV GHYHP VHPSUH LQLFLDU QD SULPHLUD FROXQD GR DUTXLYRIRQWH H DV LQVWUXo}HV H GLUHWLYDV QXQFD QD SULPHLUD FROXQD 5HFRPHQGDVH FRORFiODV D SDUWLUGDFROXQD3DUDWDQWRFRQYpPFRQILJXUDURHGLWRUSDUDTXHXP7$% FRUUHVSRQGDDHVSDoRV 2DUTXLYRGHYHWHUXPQRPHGHDWpRLWROHWUDVHH[WHQVmRDVP SRUH[HPSOR /DEDVP 

0RQWDJHP
2 DVVHPEOHU XWLOL]DGR QHVWH WH[WR p R ; XP SURJUDPD SDUD R VLVWHPD RSHUDFLRQDO06'26TXHXVDRDUTXLYRDVPFRPRHQWUDGDHJHUDRVDUTXLYRV OVWHREMFRQIRUPHPRVWUDDILJXUD 2DUTXLYRFRPH[WHQVmRREMFRQWpPRVFyGLJRVKH[DGHFLPDLVHVHGHVWLQD j JHUDomRGRDUTXLYRTXH VHUi OLGR SHOR SURFHVVDGRU HQTXDQWR R DUTXLYR OVW p XPD OLVWDJHP GHVWLQDGD DR SURJUDPDGRU (VWD FRQWpP LQIRUPDo}HV LPSRUWDQWHV WDLV FRPR RV HQGHUHoRV HP TXH IRUDP FRORFDGDV DV LQVWUXo}HV YDORUHVGRVVtPERORVHFyGLJRVKH[DGHFLPDLVJHUDGRV
LAB01.LST LAB01.ASM X8085 LAB01.OBJ

)LJ2SURFHVVRGHPRQWDJHP DVVHPEO\

)HUUDPHQWDVGHGHVHQYROYLPHQWR



2; SRGHVHUFKDPDGRGHGXDVIRUPDV $SULPHLUDPDLVH[WHQVDVROLFLWD RVSDUkPHWURVQHFHVViULRVGHDFRUGRFRPRTXHVHJXH &?((/![


&5266$66(0%/(5&23<5,*+7%<$'62)7:$5(,1& 9(56,21D6(5,$/ /,67,1*'(67,1$7,21" 7,/3''1/'/(2 

$TXLH[LVWHPDVVHJXLQWHVRSo}HV 7, 7HUPLQDO '' 'LVN'ULYH /3 /LQH3ULQWHU 1/ 1R/LVWLQJ '/ 'LUHFWLYH/LVWLQJ (2 (UURU2QO\ PRVWUDOLVWDJHPQDWHOD JHUDOLVWDJHPQXPDUTXLYRHPGLVFR JHUDOLVWDJHPQDLPSUHVVRUD VHPOLVWDJHP RSomRGHIDXOW OLVWDDSHQDVDVGLUHWLYDVGRDVVHPEOHU JHUDOLVWDJHPDSHQDVVHKRXYHUHUURV
6$0($6287387),/(

/,67,1*'5,9(" &5!

2EVHVWDSHUJXQWDQmRDSDUHFHVHQmRIRLVROLFLWDGDDOLVWDJHPHPGLVFR
*(1(5$7(&52665()(5(1&(" <1&5! 12

*HUDOLVWDGHUHIHUrQFLDVFUX]DGDV~WLOSDUDGHSXUDUSURJUDPDVJUDQGHV
,1387),/(1$0("QRPHGRDUTXLYRVHPDH[WHQVmRDVP!(QWHU! 287387),/(1$0("(QWHU!

$VHJXQGDIRUPDGHFKDPDUR;pSDVVDUOKHRVSDUkPHWURVQDOLQKDGH FRPDQGRSRUH[HPSORFRP
&?((/!;''/$%

TXHGL]TXHDR;GHYHSURFXUDURDUTXLYR/DEDVPQRGLUHWyULRDWXDOH JHUDU D SDUWLU GHVWH R DUTXLYRREMHWR /DEREM H D OLVWDJHP /DEOVW (VWD GHYH VHU FRORFDGD QR GLVFR QR PHVPR GLUHWyULR RQGH VH HQFRQWUD R SURJUDPDIRQWH (P TXDOTXHU GRV FDVRV VH KRXYHU HUURV GH PRQWDJHP p QHFHVViULR YROWDU j HWDSDGHHGLomRHFRUULJLURSURJUDPD

/LQNDJHP
2 FyGLJR REMHWR SUHFLVD VHU FRORFDGR QXP IRUPDWR TXH SRVVD VHU OLGR SHOR VLPXODGRU3DUDLVWRXWLOL]DVHXPOLQNHUQRQRVVRFDVRR/,1.TXHWRPDXP RXPDLVDUTXLYRVREMFRPRHQWUDGDHJHUDXPDUTXLYRKH[
LAB01.OBJ LINK2 LAB01.HEX

)LJ2SURFHVVRGHOLQNDJHP



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

2 DUTXLYR KH[ p GR WLSR WH[WR H VHX IRUPDWR p LOXVWUDGR GH DFRUGR FRP R H[HPSORDVHJXLU
:08 2000 00 3A15203C32152076 50

&KHFNVXP &yGLJRGRSURJUDPD H[FHWRQD~OWLPDOLQKD (QGHUHoRGHFDUJDQDPHPyULD 1~PHUR GH E\WHV GH SURJUDPD FRQWLGRVQHVWDOLQKD  + /LQKDILQDOGRDUTXLYR $RFRQWUiULRGR;R/,1.QmRSRGHVHUFKDPDGRFRPSDUkPHWURVQD OLQKDGHFRPDQGR2VGDGRVGHHQWUDGDGR/,1.SDUDRFDVRGHXP~QLFR DUTXLYRREMHWRVmR
:00000001FF
,1387),/(1$0(QRPHGRDUTXLYRVHPDH[WHQVmRREM! /2$'$''5(66 2))6(7 (QWHU! ,1387),/(1$0((QWHU! 287387),/(1$0((QWHU!

([HFXomR
2V DUTXLYRV KH[ JHUDGRV SHOR /,1. SRGHP VHU OLGRV H H[HFXWDGRV QR $EDFXVFRQIRUPHGHVFULWRQRFDStWXOR

([HPSOR
6HMD D WDUHID GH GHVHQYROYHU XP SURJUDPD TXH LQLFLH OHQGR GD SRVLomR GH PHPyULD+XPQ~PHURLQWHLUR 12V 1E\WHVDUPD]HQDGRVDSDUWLUGD SRVLomR + GHYHP HQWmR VHU VRPDGRV H R UHVXOWDGR GD VRPD TXH SRGH H[FHGHU ))+ GHYH VHU FRORFDGR QRV HQGHUHoRV + H + VHJXLQGR D FRQYHQomRGD,QWHOGHDUPD]HQDURE\WHPHQRVVLJQLILFDWLYRQRHQGHUHoRPDLV EDL[R'HYHVHDLQGDFULDUGDGRVGHWHVWHQRILQDO GR SURJUDPD SDUD IDFLOLWDU VXDYHULILFDomR 8PLQtFLRGHVROXomRDLQGDFRPSUREOHPDVpGDGRDVHJXLU

)HUUDPHQWDVGHGHVHQYROYLPHQWR



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Soma.asm - soma de numeros em hexadecimal ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ORG 2000H LDA N ; traz para A o valor de N MOV C,A ; guarda este valor em C LXI H,DADOS ; aponta par HL p/ inicio da tabela MVI B,00H ; inicializa soma LOOP: MOV A,M ; le dado apontado por HL ADD B ; soma acumulada em A MOV B,A ; e guardada em B INX H ; par HL aponta para o dado seguinte DCR C ; um a menos para fazer JNZ LOOP ; repete ate que C = 0 LXI H,RESULT ; aponta HL p/ inicio do resultado MOV M,B ; guarda B na memoria JMP $ ; loop infinito, fica parado aqui ORG 2020H RESULT DB 00H,00H N DB 03H DADOS DB 01H,02H,03H,04H,65H,76H,87H,98H,A9H END

1RWHTXHHVWHSURJUDPDDLQGDDSUHVHQWDRVVHJXLQWHVSUREOHPDV VH1 VmRVRPDGRVYDORUHV RUHVXOWDGRHVWiVHQGRFDOFXODGRHPDSHQDVE\WHHILFDLQFRUUHWRVHSDVVDU GH))+ VH DXPHQWDUPRV R WDPDQKR GR SURJUDPD FRUUHPRV R ULVFR GH XVDU RV HQGHUHoRVGHPHPyULDGHVWLQDGRVDRVGDGRV

([HUFtFLRV
 0RQWHHWHVWHRSURJUDPDDSUHVHQWDGRQRVLPXODGRUFHUWLILFDQGRVHGHTXH IXQFLRQD $OWHUH R YDORU LQLFLDO GH 1 H YHULILTXH DV PXGDQoDV QR FRPSRUWDPHQWRGRSURJUDPD  0RGLILTXHRGHPRGRTXHQmRIDoDDVRPDFDVR1VHMDQXOR 'LFDHVWXGHDVLQVWUXo}HV&3,H-=HP>,17(@8VHDLQVWUXomR &3, DSyV OHU 1 SDUD R DFXPXODGRU D ILP GH GHWHUPLQDU VH VHX YDORUp]HURHFRORTXHXPDLQVWUXomRGH GHVYLR FRQGLFLRQDO -= SDUD GHVYLDU SDUD R ILQDO GR SURJUDPD FDVR VHMD 3DUD ID]HU R GHVYLR XVH XP ODEHO QD OLQKD SDUD D TXDO TXHU GHVYLDU GH IRUPD DQiORJDDRFDVRGDLQVWUXomR-1=/223



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

 0RGLILTXH R SURJUDPD GH PRGR TXH RV GRLV E\WHV SUHYLVWRV SDUD R DUPD]HQDPHQWRGRUHVXOWDGRVHMDPXWLOL]DGRV 'LFDHVWXGHDVLQVWUXo}HV-&H-1&HP>,17(@8WLOL]HXPD GHODV SDUD GHWHUPLQDU VH KRXYH YDL  QD VRPD H FDVR WHQKD KDYLGRLQFUHPHQWHXPRXWURUHJLVWUDGRU SUHYLDPHQWHLQLFLDOL]DGR HP ]HUR  SDUD DUPD]HQDU D SDUWH PDLV VLJQLILFDWLYD GD VRPD 1R ILQDODUPD]HQHHVWHUHJLVWUDGRUQRHQGHUHoR5(68/7
LOOP: ... MOV ADD MOV JNC ... DCR JNZ LXI MOV INX ... ; Inicializa regs para armazenar a soma A,M B B,A OK ; MOV no afeta os flags ; Se no houve vai 1, est tudo bem ; Instruo a executar se houve vai 1

OK:

C LOOP H,RESULT M,B H ; Aponta para o byte mais significativo ; Armazena o byte mais significativo da ; soma

'LFD  QRWH TXH GHSRLV GDV PRGLILFDo}HV R SURJUDPD SRGH WHU DXPHQWDGRGHIRUPDDRFXSDURVHQGHUHoRV+HVHJXLQWHV6H LVVRDFRQWHFHUQmRVHUiPDLVSRVVtYHOJXDUGDURVGDGRVDSDUWLUGR HQGHUHoR + SRLV LVVR GHVWUXLULD R SUySULR SURJUDPD 9RFr SRGH YHULILFDU FRPR DV FRLVDV HVWmR DQDOLVDQGR RV HQGHUHoRV QR DUTXLYR OVW JHUDGR SHOR ; ([SHULPHQWH UHWLUDU D GLUHWLYD 25* + GR SURJUDPD ,VVR IDUi FRP TXH RV GDGRV LQLFLHP LPHGLDWDPHQWHDSyVRFyGLJR1RWHTXHJUDoDVDRXVRGRVODEHOV QmRpSUHFLVRPRGLILFDURSURJUDPDIRQWHHPSRQWRDOJXP

6XEURWLQDVVLPXODGDVHP 520
2 WUDEDOKR FRP SHTXHQRV FRPSXWDGRUHV WDO FRPR R VLPXODGR SHOR $EDFXV HQYROYH WDUHIDV FRPR D OHLWXUD GR WHFODGR H D DSUHVHQWDomR GH UHVXOWDGRV QR GLVSOD\ &RQVLGHUDQGR D HOHYDGD IUHTrQFLD FRP TXH WDLV WDUHIDV SUHFLVDP VHU H[HFXWDGDV HVVH WLSR GH FRPSXWDGRU GLGiWLFR QRUPDOPHQWH LQFOXL DOJXPDV VXEURWLQDV GH VHUYLoR TXH IDFLOLWDP R DFHVVR DR KDUGZDUH DUPD]HQDGDV HP PHPyULD 520 2 PHVPR YDOH SDUD R $EDFXV TXH VLPXOD D SUHVHQoD GHVVH WLSR GH VXEURWLQD 2 REMHWLYR GHVWH FDStWXOR p DSUHVHQWDU HVVDV VXEURWLQDV H LOXVWUDUVXD XWLOL]DomR5HFRPHQGD VHDOHLWXUD GDVVHo}HV HGRFDStWXOR VREUHRSDUDXPDPHOKRUFRPSUHHQVmRGRPDWHULDOTXHVHJXH

$VVXEURWLQDV
$ WDEHOD  DSUHVHQWD DV VXEURWLQDV GR $EDFXV VHXV HQGHUHoRV H RV UHJLVWUDGRUHVTXHVmRDOWHUDGRVTXDQGRVmRFKDPDGDV 1RPH 02675$$ 02675$' /(7(&/$ '(/$< (QGHUHoR (+ + (+ )+ )LQDOLGDGH 0RVWUDU$QRFDPSRGHGDGRV 3DU'(QRFDPSRGHHQGHUHoRV 7HFOD)QRDFXPXODGRU (VSHUDSURSRUFLRQDOD' 5HJV 7RGRV 7RGRV $+H/ $'H(

7DE6XEURWLQDVVLPXODGDVHP520



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

([HPSOR
/HUDSDUWLUGRWHFODGRGRLVQ~PHURVKH[DGHFLPDLVGHXPGtJLWR([LELUHVWHV Q~PHURVQRFDPSRGHHQGHUHoRVHVXDVRPDQRFDPSRGHGDGRV 2EVHUYDomR D OHLWXUD GR WHFODGR GR NLW 7HOHPiWLFD QR TXDO IRL EDVHDGR R $EDFXV XWLOL]D D LQWHUUXSomR 567 3URJUDPDV H[HFXWDGRV QHVWH NLW SUHFLVDP SRU LVVR KDELOLWDU HVVD LQWHUUXSomR SDUD TXH R WHFODGR IXQFLRQH LQFOXLQGRDVOLQKDV
MVI A,18H SIM

QR LQtFLR GR SURJUDPD FRQIRUPH DV H[SOLFDo}HV GR FDStWXOR  $V OLVWDJHQV DSUHVHQWDGDVQHVWHOLYURQmRLQFOXHPHVWDVOLQKDVSRUTXHQR$EDFXVDOHLWXUD GRWHFODGRpLQGHSHQGHQWHGDVLQWHUUXSo}HV
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Teclado.asm - leitura de numeros do teclado ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LETECLA EQU 02E7H ; Sinonimos utilizados abaixo MOSTRAD EQU 0363H ; MOSTRAA EQU 036EH ; ORG 2000H LOOP: LXI SP,20C0H CALL LETECLA MOV D,A MVI E,0H PUSH D CALL MOSTRAD POP D CALL LETECLA MOV E,A ADD D PUSH PSW CALL MOSTRAD POP PSW CALL MOSTRAA JMP LOOP END ; Inicializa pilha ; Le primeiro numero

; Apresenta primeiro numero ; Le segundo numero ; Resultado em A ; Apresenta os dois numeros ; Apresenta resultado

6XEURWLQDVVLPXODGDVHP520



([HUFtFLRV
 0RGLILTXH R H[HPSOR DFLPD SDUD SHUPLWLU D HQWUDGD GH Q~PHURV KH[DGHFLPDLVGHGRLVGtJLWRV 'LFD HVWXGH D LQVWUXomR 5/& HP >,17(@ 1RWH TXH VH R DFXPXODGRUFRQWLYHUXPGtJLWRHQWUHH)HIRUURWDFLRQDGRFRP 5/&LVWRHTXLYDOHDPXOWLSOLFDURGtJLWRSRU  3RUWDQWR ID]HQGR HVWD RSHUDomR  YH]HV R FRQWH~GR GR DFXPXODGRU VHUi PXOWLSOLFDGR SRU    (P KH[DGHFLPDO LVWR HTXLYDOH D DFUHVFHQWDUXP]HURDRILQDOGRQ~PHURSRUH[HPSOR+WRUQD VH+,VWRSHUPLWHOHUQ~PHURVGHGRLVGtJLWRV
CALL LETECLA RLC RLC RLC RLC MOV D,A CALL LETECLA ADD D ; L dgito mais significativo

; ; ; ;

Multiplica por 16 e guarda isso em D L dgito menos significativo Nmero de dois dgitos em A

 0RGLILTXH R H[HPSOR DFLPD GH PRGR D VH WHU XP VRPDGRU GHFLPDO HYLWDQGR LQFOXVLYH TXH R XVXiULR HQWUH FRP GtJLWRV KH[DGHFLPDLV QQmR GHYHVHUPDLRUGRTXH  'LFD  HVWXGH DV LQVWUXo}HV &3, H -3 HP >,17(@ H XWLOL]HDV SDUDHYLWDUDHQWUDGDGHGtJLWRVVXSHULRUHVD
LOOP1: CALL LETECLA CPI 0AH JP LOOP1 ; L dgito mais significativo ; Volta a ler dgito se era > 9

'LFDHVWXGHDLQVWUXomR'$$HP>,17(@(VWDLPSOHPHQWDR DOJRULWPRGHFRUUHomRGDVRPDGHGRLVQ~PHURV%&'1RWHTXH RVQ~PHURVTXHYRFrHVWiDUPD]HQDQGRDJRUDVmRQ~PHURV%&' SRLV RV GtJLWRV $) QXQFD DSDUHFHP 3DUD ID]HU D VRPD GH GRLV Q~PHURV%&'EDVWDSURFHGHUFRPRQRFDVRDQWHULRUHFRUULJLUR UHVXOWDGRFRP'$$
... ... CALL LETECLA ADD E ADD D DAA ; ; ; ; ; ; primeiro nmero (2 dgitos) -> D 1 dgito do 2 nmero, x 16 -> E 2 dgito do 2 nmero em A 2 nmero de dois dgitos em A soma em A, ainda sem correo A contm soma BCD corrigida



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

 (VFUHYD XP SURJUDPD TXH UHFHED GRLV Q~PHURV KH[DGHFLPDLV D H E SHOR WHFODGRHHIHWXHDRSHUDomR \ DE2YDORUGH \GHYHVHUPRVWUDGRQR FDPSRGHHQGHUHoRV 'LFDXWLOL]HQRYDPHQWHDLQVWUXomR5/& YH[HUFtFLR HHVWXGHD LQVWUXomR68%  5HSLWDRH[HUFtFLRDQWHULRUSDUDQ~PHURVGHFLPDLV 'LFD WUDEDOKH FRP RV Q~PHURV HP %&' H XWLOL]H QRYDPHQWH D LQVWUXomR 5/& SDUD ID]HU D PXOWLSOLFDomR SRU  $JRUD QmR p SRVVtYHOXVDU68%SRUTXHQmRH[LVWHXPDLQVWUXomRHTXLYDOHQWHDR '$$SDUDDVXEWUDomR(PYH]GLVVRIDoDDVXEWUDomRDWUDYpVGD VRPDFRQIRUPHH[SOLFDGRQDVHomR  (VFUHYDXPSURJUDPDTXHUHFHEDXPQ~PHUR DHQWUHHLQFOXVLYHSHOR , WHFODGR H HIHWXH D RSHUDomR \    2 YDORU GH \ GHYH VHU PRVWUDGR QR FDPSRGHGDGRV 'LFD XWLOL]H QRYDPHQWH D LQVWUXomR 5/& SDUD URWDFLRQDU R DFXPXODGRUDYH]HV  (VFUHYDXPSURJUDPDTXHUHFHEDXPQ~PHURKH[DGHFLPDOGHGRLVGtJLWRV SHORWHFODGRHTXHFRQWHRQ~PHURGH ELWV  FRQWLGRV QHVWH Q~PHUR 2 Q~PHURGLJLWDGRGHYHVHUPRVWUDGRQRFDPSRGHGDGRVGRPRVWUDGRUHR UHVXOWDGRGDFRQWDJHPQRPRVWUDGRUGHHQGHUHoRV 'LFDXWLOL]HQRYDPHQWHDLQVWUXomR5/&SDUDSURYRFDUDSDVVDJHP GH FDGD XP GRV  ELWV SHOR FDUU\ IODJ  PHGLGD TXH RV ELWV YmR SDVVDQGRXWLOL]HXPDGDVLQVWUXo}HV-&RX-1&SDUDGHWHUPLQDUVH DFRQWDJHPGHVGHYHVHULQFUHPHQWDGDRXQmR  (VFUHYD XPD VXEURWLQD TXH IDoD D GLYLVmR GH XP Q~PHUR GH  ELWV FRORFDGRQRSDU'(SRUXPQ~PHURGHELWVFRORFDGRQRUHJLVWUDGRU & $SyVRUHWRUQRRTXRFLHQWHGDGLYLVmRGHYHHVWDUQRSDU'(HRUHVWRQR UHJLVWUDGRU/$VXEURWLQDQmRGHYHDOWHUDURUHJLVWUDGRU%8WLOL]HHVWDVXE URWLQDQXPSURJUDPDTXHOHLDGRLVQ~PHURVGRWHFODGRIDoDVXDGLYLVmRH DSUHVHQWHRUHVXOWDGR 'LFD GLYLGLU;SRU<VLJQLILFDFDOFXODUTXDQWDVYH]HV<FDEHHP ;3RUWDQWRRTXRFLHQWHGDGLYLVmRUHSUHVHQWDRQ~PHURGHYH]HV TXHpSRVVtYHOVXEWUDLU<GH;VHPTXHRUHVXOWDGRVHMDQHJDWLYR 'LFD  D VROXomR GHVWH H[HUFtFLR p SDUWH GR SURJUDPD GD VHomR  &RQVXOWHR VH DFKDU QHFHVViULR PDV SURFXUH UHVROYHU R SUREOHPDVHPDMXGDDQWHV

6XEURWLQDVVLPXODGDVHP520



 (VFUHYD XP SURJUDPD TXH DFHLWH GtJLWRV KH[DGHFLPDLV GR WHFODGR H RV PRVWUH QR FDPSR GH HQGHUHoRV GR PRVWUDGRU 2V GtJLWRV GHYHP VHU PRVWUDGRV XP D XP SDVVDQGR GD GLUHLWD SDUD HVTXHUGD D FDGD GLJLWDomR FRPRQRH[HPSORDVHJXLU &DPSRGHHQGHUHoRV [ ][ ][ ][3] [ ][ ][3][F] [ ][3][F][D] [3][F][D][0] [F][D][0][4] 'tJLWRVWHFODGRV 3 F D 0 4

'LFD  HVWXGH D LQVWUXomR 5$/ H XWLOL]H R FDUU\ IODJ SDUD WUDQVSRUWDURVELWVGH XP UHJLVWUDGRU D RXWUR $ SDVVDJHP GR ELW PDLV VLJQLILFDWLYR GR UHJLVWUDGRU ( SDUD R ELW PHQRV VLJQLILFDWLYR GRUHJLVWUDGRU'SRUH[HPSORSRGHVHUIHLWDFRP
MOV RAL MOV MOV RAL MOV A,E E,A A,D D,A

'LFD  XWLOL]HDLQVWUXomR25$$SDUD]HUDU RFDUU\ IODJ TXDQGR SUHFLVDU



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

'DWDMXOLDQD
2EMHWLYR
2V H[HUFtFLRV GHVWH FDStWXOR WrP SRU REMHWLYR D IL[DomR GRV VHJXLQWHV FRQKHFLPHQWRV HQGHUHoDPHQWRLQGLUHWRGDPHPyULD XWLOL]DomRGHODoRVGHUHSHWLomR SHUFHSomRGDQHFHVVLGDGHGHXWLOL]DUQ~PHURVKH[DGHFLPDLVH%&'

([HUFtFLRSURSRVWR
(P  R IUDQFrV -XOLXV -RVHSK 6FDOLJHU   LQWURGX]LX R DVVLP FKDPDGRFDOHQGiULRMXOLDQRTXHQmRFRQWDPHVHVHDQRVPDVDSHQDVRVGLDV TXHVHSDVVDUDPGHVGHRPHLRGLDGRGLDGHMDQHLURGHD&$VVLPSRU H[HPSORRGLDGHMDQHLURGHpRGLD$VGDWDVMXOLDQDVVmR ~WHLVSDUDUHJLVWUDUHYHQWRVTXDQGRpQHFHVViULRFDOFXODURQ~PHURGHGLDVTXH RVVHSDUDPEDVWDQGRSDUDLVVRXPDVLPSOHVVXEWUDomR 0DLVUHFHQWHPHQWHLQWURGX]LXVHWDPEpPDGDWDMXOLDQDPRGLILFDGDTXHGLIHUH GD DQWHULRU DSHQDV SHOD HVFROKD GD RULJHP TXH p D PHLDQRLWH GR GLD  GH QRYHPEURGH 3DUDHVWHH[HUFtFLRYDPRVGHILQLUXPQRYRWLSRGHGDWDMXOLDQDFXMDRULJHPpR GLDGHMDQHLURGRDQRHPTXHHVWLYHUPRVHVHPFRQVLGHUDUDQRVELVVH[WRV SDUDVLPSOLILFDU2GLDGHMXQKRSRUH[HPSORpRGLDGRDQRHSRU LVVRDGDWDMXOLDQDFRUUHVSRQGHQWHDHVVHGLDp 6XDWDUHIDpLPSOHPHQWDUXPFRQYHUVRUGHGDWDVGDIRUPDGGPPSDUDDQRYD GDWDMXOLDQD8PDYH]LQLFLDGRRSURJUDPDGHYHVHUH[HFXWDGRGHDFRUGRFRP RVVHJXLQWHVSDVVRV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

 R XVXiULR GHYH SRGHU GLJLWDU GRLV Q~PHURV GH GRLV GtJLWRV FDGD FRUUHVSRQGHQGRDRGLD GG HDRPrV PP QHVWDRUGHP QmR p QHFHVViULR YHULILFDU VH D GDWD p YiOLGD SRU H[HPSOR HYLWDU TXHVHGLJLWHXPQ~PHURPDLRUGRTXHSDUDXPGLDGRPrVGH MXQKR EDVWDHYLWDUTXHRXVXiULRHQWUHFRPGtJLWRVKH[DGHFLPDLV  DVVLP TXH IRU LQWURGX]LGR R VHJXQGR GtJLWR FRUUHVSRQGHQWH DR PrV R SURJUDPDGHYHUiLQLFLDURFiOFXORGDGDWDMXOLDQDFRUUHVSRQGHQWH GLFD XWLOL]H XPD WDEHOD FRP RV Q~PHURV GH GLDV GH FDGD PrV GR DQRSURFXUHDYDOLDUDVYDQWDJHQVHGHVYDQWDJHQVGHXWLOL]DUYDORUHV GHFLPDLVRXKH[DGHFLPDLV %&' QHVVDWDEHOD  RUHVXOWDGRGHYHUiDSDUHFHUHPIRUPDGHFLPDO XPQ~PHURHQWUH H LQFOXVLYH QRGLVSOD\GHHQGHUHoRV  R SURJUDPD GHYHUi HQWmR YROWDU DR SDVVR  SDUD TXH VH SRVVD FRQYHUWHU RXWUDGDWD , $VHomRFRQWpPXPDVROXomRSDUD HVWH H[HUFtFLR 3URFXUH FRQVXOWiOD VRPHQWHGHSRLVTXHWLYHUFKHJDGRDXPSURJUDPDVHX

'DWDMXOLDQD



6ROXomR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Juliana.asm - conversor de datas ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LETECLA EQU 02E7H MOSTRAD EQU 0363H ORG 2000H LXI SP,20C0H LE1: CALL LETECLA ; 1. digito do dia CPI 0AH JP LE1 RLC RLC RLC RLC MOV E,A LE2: CALL LETECLA ; 2. digito do dia CPI 0AH JP LE2 ORA E MOV E,A MVI D,00H ; E contem dia em BCD e D = 0 LE3: CALL LETECLA ; 1. digito do mes CPI 0AH JP LE3 MVI C,00H CPI 00 JZ LE4 MVI C,10D LE4: CALL LETECLA ; 2. digito do mes CPI 0AH JP LE4 ADD C SUI 01H MOV C,A ; C = mes-1 = numero de meses a somar CPI 00H JZ MOSTRA ; se mes = janeiro, esta pronto LXI H,DIAS MOV A,E ; A inicia com o dia... SOMA: ADD M ; ... e recebe os dias de cada mes DAA JNC CONT INR D ; "vai 1" CONT: INX H DCR C JNZ SOMA MOV E,A MOSTRA: CALL MOSTRAD ; resultado no campo de enderecos


DIAS

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
JMP LE1 ; volta ao passo 1 do enunciado DB 31H,28H,31H,30H,31H,30H DB 31H,31H,30H,31H,30H,31H END

([HUFtFLRVFRPSOHPHQWDUHV
2V H[HUFtFLRV DEDL[R H[SORUDP D XWLOL]DomR GR HQGHUHoDPHQWR LQGLUHWR QR WUDEDOKRFRPWDEHODV  (VFUHYD XP SURJUDPD TXH HIHWXH D YDUUHGXUD GR EORFR GH PHPyULD HQWUH $+H$)+HLQGLTXHDTXDQWLGDGHGHQ~PHURVtPSDUHVSUHVHQWHVQR EORFR &ULHXPDWDEHODSDUDLQLFLDOL]DU R FRQWH~GR GR EORFR GH PDQHLUD D IDFLOLWDURVWHVWHV2SFLRQDOPHQWHFRPSOHPHQWHRSURJUDPDGHPRGRTXH VHMDSRVVtYHOGLJLWDUQXPDSULPHLUDHWDSDGDGRVSDUDDUPD]HQDUQDWDEHODH GHSRLVFRQWDUTXDQWRVGDGRVHUDPtPSDUHV 'LFD XP Q~PHUR p tPSDU TXDQGR VHX ELW PHQRV VLJQLILFDWLYR p LJXDOD,VVROHPEUDPDQLSXODomRGHELWV YVHomR   (VFUHYD XP SURJUDPD TXH WUDQVILUD HP RUGHP LQYHUVD RV FRQWH~GRV GDV SRVLo}HVGHPHPyULDGREORFRHQWUH$+H$)+SDUDREORFRHQWUH +H)+ 'LFDSRGHVHULQWHUHVVDQWHHVWXGDUDVLQVWUXo}HV;&+*/'$;H 67$;  (VFUHYD XP SURJUDPD TXH SHUPLWD HQWUDU FRP XP Q~PHUR YLD WHFODGR H SURFXUDU SRU HVWH YDORU QD UHJLmR GH PHPyULD HQWUH %+ H %)+ 6H HQFRQWUDGRRHQGHUHoRQRTXDOHVWHVHHQFRQWUDYDGHYHDSDUHFHUQRFDPSR GH HQGHUHoRV &DVR FRQWUiULR R FDPSR GH HQGHUHoRV GHYH DSUHVHQWDU R FRQWH~GR ))))+ (P DPERV RV FDVRV R Q~PHUR SURFXUDGR GHYH VHU PRVWUDGR QR FDPSR GH GDGRV GR PRVWUDGRU 3DUD IDFLOLWDU RV WHVWHV FULH XPDWDEHODFRPYDORUHVFRQKHFLGRVQDUHJLmR%+D%)+  (VFUHYDXPSURJUDPDTXHPRVWUHDVLPHVPR2VHQGHUHoRVGRVE\WHVTXH R FRPS}HP GHYHP DSDUHFHU QR FDPSR GH HQGHUHoRV H VHXV FyGLJRV KH[DGHFLPDLV QR FDPSR GH GDGRV 'HSRLV TXH R SURJUDPD WLYHU VH PRVWUDGRSRULQWHLURGHYHUHFRPHoDUGRSULPHLURE\WH

&RQYHUVmRGHEDVH
2 REMHWLYR GHVWH FDStWXOR p D DQiOLVH GRLV SURJUDPDV TXH LPSOHPHQWDP R DOJRULWPR GH FRQYHUVmR GH EDVH DSUHVHQWDGR QR FDStWXOR  (VWH WLSR GH FRQYHUVmR p PXLWR ~WLO HP SURJUDPDV TXH SUHFLVDP DSUHVHQWDU UHVXOWDGRV HP VLVWHPDVGHQXPHUDomRGLIHUHQWHVGRVLVWHPDKH[DGHFLPDO5HYLVHDWHRULDDQWHV GHFRQWLQXDUVHDFKDUQHFHVViULR 2 SULPHLUR SURJUDPD DSUHVHQWDGR QD VHomR  p GHQRPLQDGR +H[&RQYDVP 5HFHEHGR WHFODGRXP Q~PHURKH[DGHFLPDO GH GtJLWRVHXPD EDVHGHVDtGD XPQ~PHUR GHFLPDO GHGRLV GtJLWRV (VWD GHYHHVWDUHQWUHH GRFRQWUiULRRVUHVXOWDGRVGRSURJUDPDQmRID]HPVHQWLGR 2 VHJXQGR SURJUDPD FXMD OLVWDJHP LQLFLD QD SiJLQD  VH GLVWLQJXH GR SULPHLURSRUSHUPLWLUDFRQYHUVmRHQWUHQ~PHURVHPTXDLVTXHUEDVHVHQWUHH $VVLPUHFHEHGRWHFODGRSULPHLUDPHQWHXPDEDVHGHHQWUDGD XPQ~PHUR GHFLPDOGHGRLVGtJLWRV GHSRLVXPQ~PHURGHTXDWURGtJLWRVDVHUFRQYHUWLGR H SRU ~OWLPR XPD EDVH GH VDtGD QRYDPHQWH XP Q~PHUR GHFLPDO GH GRLV GtJLWRV  $PERV RV SURJUDPDV LQLFLDP R FiOFXOR GR UHVXOWDGR DVVLP TXH WHUPLQD D HQWUDGD GRV GDGRV H R DSUHVHQWDP QR GLVSOD\ $ HVWUDWpJLD DGRWDGD SDUD D DSUHVHQWDomR GR UHVXOWDGR WDPEpP p LQWHUHVVDQWH SDUD PRVWUDU R PDLRU Q~PHUR SRVVtYHO GH GtJLWRV RV FDPSRV GH HQGHUHoRV H GH GDGRV IRUDP FRQVLGHUDGRV FRPR XP ~QLFR Q~PHUR GH VHLV DOJDULVPRV (VWHV FDPSRV VmR SUHHQFKLGRV ID]HQGR FRP TXH RV GtJLWRV HQWUHP SHOD GLUHLWD SDUWH PHQRV VLJQLILFDWLYDGRFDPSRGHGDGRV HVHGHVORTXHPSDUDDHVTXHUGDjPHGLGDTXH PDLV GtJLWRV VmR LQWURGX]LGRV e LQWHUHVVDQWH TXH YRFr WHQKD UHVROYLGR RV H[HUFtFLRVLQGLFDGRVQDVHomRDQWHVGHHVWXGDUHVWDSDUWHGRVSURJUDPDV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

/LVWDJHPGH+H[&RQYDVP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;HexConv.asm - conversao de base para numeros hexadecimais ;Recebe do teclado um numero hexadecimal de 4 digitos ;Recebe a base de saida (um numero decimal de 2 digitos) ;A base de saida deve estar entre 2 e 16, inclusive ;Converte o numero para essa base; resultado no display ;Campos de enderecos e dados formam um numero de 6 digitos ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LETECLA EQU 02E7H MOSTRAD EQU 0363H MOSTRAA EQU 036EH ORG 2000H LXI SP,2100H CALL LENUM16 MOV D,A CALL LENUM16 MOV E,A PUSH D CALL MOSTRAD POP D CALL LENUM10 MOV C,A CALL HEXCONV PUSH PSW CALL MOSTRAD POP PSW CALL MOSTRAA JMP LOOP

LOOP:

; DOIS DIGITOS MAIS SIGNIFICATIVOS ; DOIS DIGITOS MENOS SIGNIFICATIVOS ; APRESENTA NUMERO A SER CONVERTIDO ; BASE DE SAIDA ; CONVERTE. RESULTADO EM D, E e A

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;HEXCONV - converte numero hexa para a base de saida ;Recebe numero no par DE e base de saida em C ;Retorna resultado como numero de 6 digitos em D, E e A ;Utiliza todos os regs ;Chama a sub-rotina DIV HEXCONV: MVI B,00H ; CONTADOR DE DIGITOS DO RESULTADO MORE: CALL DIV ; QUOCIENTE EM DE E RESTO EM L PUSH H ; L CONTEM DIGITO DO RESULTADO INR B ; CONTA DIGITOS MOV A,D CPI 00H ; SE D <> 0, TEM MAIS JNZ MORE MOV A,E CPI 00H ; SE D == 0 MAS E <> 0, TEM MAIS JNZ MORE

&RQYHUVmRGHEDVH
MVI A,00H GETDIG: MVI H,04H ROTATE: ORA A RAL MOV L,A MOV A,E RAL MOV E,A MOV A,D RAL MOV D,A MOV A,L DCR H JNZ ROTATE POP H ORA L DCR B JNZ GETDIG RET ; ; ; ;



TRIPLA DEA CONTEM 0 PARA COMECAR RESGATE DOS DIGITOS DA PILHA ZERA CARRY FLAG BIT MAIS SIGNIFICATIVO DE A EM CY

; ROTACIONA DIGITOS DA TRIPLA DEA ; BIT MAIS SIGNIFICATIVO DE A EM E ; BIT MAIS SIGNIFICATIVO DE E EM D

; L CONTEM DIGITO PARA A TRIPLA DEA ; INTRODUZ DIGITO RESGATADO DA PILHA ; TEM MAIS DIGITOS? ; NUMERO CONVERTIDO EM DEA

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;DIV - sub-rotina para divisao ;Recebe dividendo em DE e divisor em C ;Retorna quociente em DE e resto em L ;Utiliza regs A, C, D, E, H e L DIV: LXI H,0000H MOV A,E TEST1: CMP C JC TEST2 BACK: SUB C INX H JMP TEST1 TEST2: MOV E,A MOV A,D CPI 00H JZ DONE DCR D MOV A,E JMP BACK DONE: XCHG RET



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;LENUM10 - le numero decimal de dois digitos ;Retorna valor hexa do numero lido no acumulador ;Utiliza os regs A, B, H e L ;Chama LETECLA LENUM10: CALL LETECLA RLC MOV B,A RLC RLC ADD B MOV B,A CALL LETECLA ADD B RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;LENUM16 - le um numero hexadecimal de dois digitos ;Retorna valor do numero lido no acumulador ;Utiliza os regs A, B, H e L ;Chama LETECLA LENUM16: CALL LETECLA RLC RLC RLC RLC MOV B,A CALL LETECLA ADD B RET END

&RQYHUVmRGHEDVH



/LVWDJHPGH%DVH&RQYDVP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;BaseConv.asm - programa de conversao de base ;Recebe a base de entrada (numero decimal de 2 digitos) ;Recebe um numero de 4 digitos nessa base, sem verifica-lo ;Recebe a base de saida (um numero decimal de 2 digitos) ;Ambas as bases devem estar entre 2 e 16, inclusive ;Converte o numero da base de entrada para a base de saida ;Apresenta o resultado no display ;Campos de enderecos e dados formam um numero de 6 digitos ;Prof. Roberto m. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LETECLA EQU 02E7H MOSTRAD EQU 0363H MOSTRAA EQU 036EH ORG 2000H LXI SP,2100H CALL LENUM10 MOV C,A CALL LENUM PUSH D CALL MOSTRAD POP D CALL LENUM10 MOV C,A CALL HEXCONV PUSH PSW CALL MOSTRAD POP PSW CALL MOSTRAA JMP LOOP

LOOP:

; BASE DE ENTRADA LIDA (DECIMAL) ; LE NUMERO DE 4 DIGS, CONVERTE P/ HEXA ; APRESENTA NUMERO A CONVERTER EM HEXA ; BASE DE SAIDA ; CONVERTE. RESULTADO EM D, E e A

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;HEXCONV - converte numero hexa para a base de saida ;Recebe numero no par DE e base de saida em C ;Retorna resultado como numero de 6 digitos em D, E e A ;Utiliza todos os regs ;Chama a sub-rotina DIV HEXCONV: MVI B,00H ; CONTADOR DE DIGITOS DO RESULTADO MORE: CALL DIV ; QUOCIENTE EM DE E RESTO EM L PUSH H ; L CONTEM DIGITO DO RESULTADO INR B ; CONTA DIGITOS MOV A,D CPI 00H ; SE D <> 0, TEM MAIS JNZ MORE MOV A,E CPI 00H ; SE D == 0 MAS E <> 0, TEM MAIS JNZ MORE



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
; ; ; ; TRIPLA DEA CONTEM 0 PARA COMECAR RESGATE DOS DIGITOS DA PILHA ZERA CARRY FLAG BIT MAIS SIGNIFICATIVO DE A EM CY

MVI A,00H GETDIG: MVI H,04H ROTATE: ORA A RAL MOV L,A MOV A,E RAL MOV E,A MOV A,D RAL MOV D,A MOV A,L DCR H JNZ ROTATE POP H ORA L DCR B JNZ GETDIG RET

; ROTACIONA DIGITOS DA TRIPLA DEA ; BIT MAIS SIGNIFICATIVO DE A EM E ; BIT MAIS SIGNIFICATIVO DE E EM D

; L CONTEM DIGITO PARA A TRIPLA DEA ; INTRODUZ DIGITO RESGATADO DA PILHA ; TEM MAIS DIGITOS? ; NUMERO CONVERTIDO EM DEA

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;DIV - sub-rotina para divisao ;Recebe dividendo em DE e divisor em C ;Retorna quociente em DE e resto em L ;Utiliza regs A, C, D, E, H e L DIV: LXI H,0000H MOV A,E TEST1: CMP C JC TEST2 BACK: SUB C INX H JMP TEST1 TEST2: MOV E,A MOV A,D CPI 00H JZ DONE DCR D MOV A,E JMP BACK DONE: XCHG RET

&RQYHUVmRGHEDVH



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;MULT - sub-rotina para multiplicacao ;Recebe multiplicando em DE e multiplicador em C ;Retorna resultado em DE, preservando o multiplicador em C ;Utiliza regs A, C, D, E, H e L MULT: XCHG LXI D,0000H MOV A,C CPI 00H RZ PUSH B MUL: MOV A,E ADD L MOV E,A MOV A,D ADC H MOV D,A DCR C JNZ MUL POP B RET ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;LENUM ;Le numero de 4 digitos na base contida em C ;Converte p/ hexa e retorna esse valor no par DE ;Utiliza todos os regs ;Chama MULT LENUM: LXI D,0000H MVI B,04H MULBAS: CALL MULT ; MULTIPLICA PAR DE PELA BASE EM C CALL LETECLA ADD E MOV E,A JNC CONT INR D CONT: DCR B JNZ MULBAS RET



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;LENUM10 - le um numero decimal de dois digitos ;Retorna valor hexa do numero lido no acumulador ;Utiliza os regs A, B, H e L ;Chama LETECLA LENUM10: CALL LETECLA RLC MOV B,A RLC RLC ADD B MOV B,A CALL LETECLA ADD B RET END

([HUFtFLRVFRPSOHPHQWDUHV
2V H[HUFtFLRV DEDL[R HQYROYHP WRPDGD GH GHFLV}HV FRQIRUPH RV SULQFtSLRV DSUHVHQWDGRV QD VHomR  (PERUD QmR WHQKDP UHODomR FRP R DVVXQWR SULQFLSDOGRFDStWXORIRUDPFRORFDGRVDTXLSRUTXHVHXQtYHOGHGLILFXOGDGHp VHPHOKDQWHDRGRVSURJUDPDVGHFRQYHUVmRGHEDVH  (VFUHYDXPSURJUDPDTXHUHFHEDWUrVQ~PHURVKH[DGHFLPDLVGHGRLVGtJLWRV SHORWHFODGRHPRVWUHQRFDPSR GH GDGRV R PDLRU GHQWUH HOHV 2V RXWURV GRLVQ~PHURVGHYHPVHUPRVWUDGRVQRFDPSRGHHQGHUHoRVGRPRVWUDGRU RPHQRUjHVTXHUGDHRGRPHLRjGLUHLWD  (VFUHYDXPSURJUDPDTXHUHFHEDWUrVQ~PHURVKH[DGHFLPDLVGHGRLVGtJLWRV SHORWHFODGRHPRVWUHQRFDPSRGHGDGRVRPHQRUGHQWUHHOHV2VRXWURV GRLVQ~PHURVGHYHPVHUPRVWUDGRVQRFDPSRGHHQGHUHoRVGRPRVWUDGRU RPDLRUjHVTXHUGDHRGRPHLRjGLUHLWD  (VFUHYDXPSURJUDPDTXHFRORTXHHPRUGHPFUHVFHQWHRVGDGRVFRQWLGRV QD UHJLmR GH %+ D %)+ 'HSRLV GH ID]HU D RUGHQDomR R SURJUDPD GHYH HQWUDU HP XP ORRS TXH PRVWUH RV HQGHUHoRV H GDGRV QR PRVWUDGRU XPGHFDGDYH]YROWDQGRDRHQGHUHoR%+DSyVPRVWUDUDWDEHODWRGD 2DYDQoRGHXPHQGHUHoRSDUDRVHJXLQWHGHYHDFRQWHFHUDFDGDWRTXHGH TXDOTXHUGDVWHFODVGHD) 'LFDFULHXPDWDEHODFRPGDGRVFRQKHFLGRVQRILQDOGRSURJUDPD SDUDIDFLOLWDURVWHVWHV  5HSLWDRH[HUFtFLRDQWHULRUPDVFRORFDQGRRVGDGRVHPRUGHPGHFUHVFHQWH

,QWHUUXSo}HVQDSUiWLFD
8WLOL]DomRGDVWHFODVGHLQWHUUXSomRGR$EDFXV
3DUD D XWLOL]DomR GDV LQWHUUXSo}HV QR $EDFXV p SUHFLVR OHYDU HP FRQWD DV VHJXLQWHVFDUDFWHUtVWLFDV DV WHFODV 567 567 567 H 7UDS VH FRPSRUWDP FRPR VH HVWLYHVVHP OLJDGDV DR PLFURSURFHVVDGRU  GD IRUPD LOXVWUDGD QD ILJXUD SDUDDWHFOD

9  567

)LJ&LUFXLWRHOpWULFRVLPXODGRGDWHFOD567 TXDQGR DWHQGH XPD GHVVDV LQWHUUXSo}HV R SURFHVVDGRU GHVYLD R SURFHVVDPHQWR GR SURJUDPD SDUD R HQGHUHoR FRUUHVSRQGHQWH GH DFRUGR FRPDWDEHODRQGHFRPHoDPDULJRURVWUDWDGRUHVeSUHFLVROHPEUDU SRUpPTXHHVWHVHQGHUHoRVQmRFRUUHVSRQGHPjUHJLmRGHPHPyULD5$0 GR$EDFXVHTXHSRULVVRHVWH VH FRPSRUWD FRPR VH Oi H[LVWLVVHP GHVYLRV SDUDHQGHUHoRVGH5$0GHDFRUGRFRPRH[SRVWRQDVHomR HPERUD VHMD SRVVtYHO FRORFDU RV WUDWDGRUHV QRV HQGHUHoRV GHILQLGRV QR $EDFXVLVWRQHPVHPSUHpLQWHUHVVDQWHSRLVHPJHUDOHVVHVHQGHUHoRVVmR HVFROKLGRV GH IRUPD D ILFDUHP SUy[LPRV XQV GRV RXWURV GHL[DQGR SRXFR OXJDU SDUD RV WUDWDGRUHV 2 TXH VH ID] HQWmR p HVFUHYHU R WUDWDGRU DSyV R FyGLJR GR SURJUDPD SULQFLSDO H LGHQWLILFDU VHX SRQWR GH HQWUDGD FRP XP ODEHO SRU H[HPSOR +1'/5 GR LQJOrV KDQGOHU WUDWDGRU  1D SRVLomR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

FRUUHVSRQGHQWH DR GHVYLR SURJUDPDGR QR $EDFXV FRORFDVH HQWmR XPD LQVWUXomR-03+1'/5TXHGHVYLDRSURFHVVDPHQWRSDUDROXJDUFRUUHWR

7UDWDGRUHVGHLQWHUUXSomRQDSUiWLFD
&RQWDGRUGHFLPDOFRPLQLELGRUSRULQWHUUXSomR
2SURJUDPDDVHJXLUGHPRQVWUDDRFRUUrQFLDGRGHVYLRSDUDRWUDWDGRUTXDQGR GR ERWmR GD 567 p DFLRQDGR 1HVWH H[HPSOR QmR H[LVWH XP WUDWDGRU GH LQWHUUXSomR SURSULDPHQWH GLWR PDV DSHQDV XPD LQVWUXomR +/7 TXH SiUD R SURFHVVDGRULPHGLDWDPHQWHDSyVRWRTXHGRERWmR567 1RWHTXHRFyGLJRFKDPDDVXEURWLQD'(/$<TXHID]SDUWHGDVVXEURWLQDV VLPXODGDVHP5206XDIXQomRpLQWURGX]LUXPDWUDVRQRSURFHVVDPHQWRGR SURJUDPDQHFHVViULRSDUDTXHVHSRVVDYLVXDOL]DURTXHDFRQWHFHQRGLVSOD\2 YDORU GR DWUDVR LQWURGX]LGR SHOR $EDFXV QD H[HFXomR GR SURJUDPD HP PLOLVVHJXQGRVpLJXDODYH]HVRYDORUFRORFDGRQRUHJLVWUDGRU'DQWHVGD FKDPDGDGH'(/$<
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Ints85a.asm - Interrupcoes do 8085 ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MOSTRAA EQU 036EH DELAY EQU 05F1H RST7.5 EQU 20CEH ORG 2000H LXI SP,20C0H ; Inicializa pilha MVI A,18H ; Habilita 5.5, 6.5 e 7.5 SIM MVI A,00H EI LOOP: ADI 01H ; INR A nao serve, nao atualiza CY DAA ; utiliza CY flag na correcao PUSH PSW ; Salva contagem CALL MOSTRAA MVI D,05H ; Atraso de 500ms CALL DELAY POP PSW ; Recupera contagem JMP LOOP ORG RST7.5 ; Desvio da RST 7.5 HLT RET END

,QWHUUXSo}HVQDSUiWLFD



&RPRQmRID]HU
$WtWXORGHH[HUFtFLRYRFrGHYHPRGLILFDURSURJUDPDDQWHULRUGHPRGRTXHD FRQWDJHP UHLQLFLH GR YDORU  D FDGD RFRUUrQFLD GD LQWHUUXSomR 567  2 SURSyVLWR GHVWD VHomR p R GH DSUHVHQWDU DOJXQV HUURV FRPXQV FRPHWLGRV QD VROXomRGHVWHSUREOHPDHDOHUWDUSDUDRVSHULJRVTXHUHSUHVHQWDP

$SULPHLUDWHQWDWLYD
(P JHUDO D SULPHLUD UHDomR SDUD HVFUHYHU R WUDWDGRU p VLPSOHVPHQWH ]HUDU R DFXPXODGRU$OLVWDJHPILFDULDDVVLP
ORG RST7.5 MVI A,01H RET ; Desvio da RST 7.5

(VWD DERUGDJHP SRUpP FRQWUDULD YiULDV GDV UHJUDV EiVLFDV SDUD HVFUHYHU WUDWDGRUHVGHLQWHUUXSomRDSUHVHQWDGDVQDVHomR 2WUDWDGRUQmRSUHVHUYDR YDORU GR UHJLVWUDGRU $ TXH HVWi VHQGR XWLOL]DGR SDUD WHQWDU HVWDEHOHFHU XPD FRPXQLFDomR FRP R SURJUDPD SULQFLSDO 1R SUHVHQWH FDVR R WUDWDGRU IXQFLRQDULDVHDLQWHUUXSomRDFRQWHFHVVHSRUH[HPSORGXUDQWHDH[HFXomRGD LQVWUXomR'$$(VWDVHULDFRQFOXtGDHPVHJXLGDRDFXPXODGRUVHULDDOWHUDGRH DFRQWDJHPUHFRPHoDULDGH6XSRQKDSRUpPTXHDLQWHUUXSomRDFRQWHFHVVH GXUDQWHDH[HFXomRGDLQVWUXomR386+36:1HVWHFDVRR386+VHULDIHLWR RDFXPXODGRUVHULDDOWHUDGRHDFRQWDJHP+GHIDWRFKHJDULDDDSDUHFHUQR GLVSOD\0DVORJRHPVHJXLGD323 36: UHVWDXUDULD R YDORU TXH $ FRQWLQKD DQWHVGDLQWHUUXSomRHDFRQWDJHPVDOWDULDGHYROWDSDUDRYDORUDQWLJR 6HRSURJUDPDIRUH[HFXWDGRQXPKDUGZDUHUHDODLQWHUUXSomRSRGHDFRQWHFHU GXUDQWHDH[HFXomRGDVXEURWLQD02675$$6HDLQWHUUXSomRDFRQWHFHUQXP SRQWRHPTXHHVWDVXEURWLQDDFDEDGHSUHSDUDUSRUH[HPSORXPYDORUHP$ SDUDLQLFLDOL]DURKDUGZDUHGRGLVSOD\HHVWHIRUDOWHUDGRSHODLQWHUUXSomRHQWmR RGLVSOD\QmRIXQFLRQDUiFRPRHVSHUDGR (PJHUDODDOWHUDomRGHTXDOTXHUUHJLVWUDGRU SRU XP WUDWDGRU GH LQWHUUXSomR SRGHWHUFRQVHTrQFLDVFDWDVWUyILFDV $OpPGLVVRRWUDWDGRUDSUHVHQWDGRWHPXPRXWURSUREOHPDTXHDFRQWHFHFRP IUHTrQFLDTXDQGRVHHVWiDSUHQGHQGRDHVFUHYHUWUDWDGRUHVGHLQWHUUXSomRGH DFRUGRFRPDVUHJUDVGDVHomR  p SUHFLVR FXLGDU SDUD TXH DV LQWHUUXSo}HV HVWHMDP KDELOLWDGDV TXDQGR IRUHP QHFHVViULDV 2  GHVDELOLWD DXWRPDWLFDPHQWH DV LQWHUUXSo}HV DVVLP TXH HQWUD QR WUDWDGRU H SRU LVVR R SURJUDPDDFLPDVyDFHLWDULDDSULPHLUDLQWHUUXSomRXPDYH]TXHQmRKiFyGLJR TXHYROWHDKDELOLWiODV2ILQDOGHXPWUDWDGRUpSRULVVRWLSLFDPHQWH


EI RET

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

(VWDILQDOL]DomRVHUiDGRWDGDGHVWHSRQWRHPGLDQWH

+DELOLWDQGRHGHVDELOLWDQGR
8PDVXJHVWmRTXHWDPEpPDSDUHFHFRPFHUWDIUHTrQFLDpDGHGHVDELOLWDUDV LQWHUUXSo}HVHPSRQWRVFUtWLFRVPHGLDQWHDLQVHUomRGHLQVWUXo}HV', GLVDEOH LQWHUUXSWV H(, HQDEOHLQWHUUXSWV QRFRUSRGRSURJUDPDSULQFLSDOGHPRGR TXH HVWH Vy SRVVD VHU LQWHUURPSLGR TXDQGR IRU FRQYHQLHQWH (VWD VROXomR p XWLOL]DGDHPDOJXQVFDVRVPXLWRHVSHFLDLVPDVHPJHUDOpGHVDFRQVHOKDGDSRLV VRIUHGHVpULDVGHVYDQWDJHQV pGLItFLOSUHYHUWRGDVDVVLWXDo}HVHPTXHDVLQWHUUXSo}HVGHYHPVHULQLELGDV PHVPR HP SURJUDPDV SHTXHQRV SRGH KDYHU YiULRV SRQWRV RQGH LVVR p QHFHVViULR R SURJUDPD SDVVD D VHU LQFDSD] GH UHDJLU jV LQWHUUXSo}HV GXUDQWH YiULRV LQWHUYDORVTXDQGRpMXVWDPHQWHRFRQWUiULRTXHVHGHVHMD D PDQXWHQomR GR SURJUDPD ILFD H[WUHPDPHQWH GLItFLO SRLV FDGD DOWHUDomR H[LJHXPDQRYDDQiOLVHGRVSRQWRVGHLQLELomRGDVLQWHUUXSo}HVHpSRUWDQWR IRQWHGHSHULJRVRVHUURV

6XEVWLWXLQGRRUHJLVWUDGRUSRUXPDYDULiYHOJOREDO
2XWUDWHQWDWLYDpVXEVWLWXLURDFXPXODGRUSRUXPDYDULiYHOJOREDOSDUDID]HUD FRQWDJHPFRPRQDOLVWDJHPDVHJXLU1RWHTXHDJRUDRWUDWDGRUIRLPXGDGRGH OXJDUGHDFRUGRFRPRH[SRVWRQDVHomR
ORG 2000H LXI SP,20C0H MVI A,18H SIM MVI A,00H STA COUNT EI LDA COUNT ADI 01H DAA STA COUNT CALL MOSTRAA MVI D,05H CALL DELAY JMP LOOP PUSH PSW MVI A,01H STA COUNT ; Inicializa pilha ; Habilita 5.5, 6.5 e 7.5

LOOP:

; INR A no serve, no atualiza CY ; Utiliza CY flag na correo ; Atraso de 500ms

HNDLR:

,QWHUUXSo}HVQDSUiWLFD
POP PSW EI RET ORG RST7.5 JMP HNDLR DB 00H END



; Volta a habilitar as interrupes ; Desvio da RST 7.5 ; Varivel global, armazena contagem

COUNT

$TXL QmR H[LVWH PDLV D FRPXQLFDomR YLD UHJLVWUDGRU HQWUH R WUDWDGRU GH LQWHUUXSomRHRSURJUDPDSULQFLSDO $JRUDVHD LQWHUUXSomRDFRQWHFHUGHQWUR GD VXEURWLQD 02675$$ WXGR IXQFLRQD EHP R YDORU GR DFXPXODGRU p JXDUGDGRQDSLOKDQRLQtFLRGRWUDWDGRUHUHVWDXUDGRQRILQDOGHPRGRTXHD VXEURWLQD LQWHUURPSLGD QmR SHUFHEH TXDOTXHU DOWHUDomR QHVVH UHJLVWUDGRU TXDQGR R VHX SURFHVVDPHQWR p UHWRPDGR 0DV XPD DQiOLVH PDLV FXLGDGRVD PRVWUDTXHVXUJHXPSUREOHPDVHDLQWHUUXSomRDFRQWHFHUGXUDQWHDH[HFXomR GDV LQVWUXo}HV /'$ &2817 $', + RX '$$ LQLFLDOPHQWH R WUDWDGRU JXDUGDRFRQWH~GRGH$QDSLOKDID]FRPTXHRYDORUGDFRQWDJHPYROWHDH UHVWDXUD R YDORU GH $ /RJR HP VHJXLGD SRUpP R SURJUDPD SULQFLSDO p UHWRPDGRFRPRYDORUGH $SUHVHUYDGRHD LQVWUXomR67$&2817 ID]FRP TXHDFRQWDJHPDVVXPDRYDORUTXHWHULDVHDLQWHUUXSomRQmRWLYHVVHRFRUULGR 2UHVXOWDGRpXPSURJUDPDGHFRPSRUWDPHQWRHUUiWLFRTXHIXQFLRQDTXDQGR R XVXiULR SUHVVLRQD R ERWmR TXH DFLRQD D LQWHUUXSomR HQTXDQWR R SURJUDPD HVWiIRUDGHVVHWUHFKRPDVTXHGHYH]HPTXDQGRSDUHFHQmRIXQFLRQDU1R FDVR GH H[HFXomR HP XP VLVWHPD UHDO R PDX IXQFLRQDPHQWR SRGH VHU DWULEXtGRHUURQHDPHQWHDXPPDXFRQWDWRGRERWmR(VWHWLSRGHHUURSRGH SDVVDUGHVSHUFHELGRQRVWHVWHVHWHUFRQVHTrQFLDVJUDYHV

6XMDQGRDSLOKD
7DPEpP SRGHDSDUHFHUDLGpLDGHID]HURSURJUDPDVDOWDUGRWUDWDGRUGHYROWD SDUDRLQtFLR
LXI SP,20C0H MVI A,18H SIM MVI A,00H STA COUNT EI LDA COUNT ADI 01H DAA STA COUNT CALL MOSTRAA MVI D,05H CALL DELAY JMP LOOP ; Inicializa pilha ; Habilita 5.5, 6.5 e 7.5

START: LOOP:

; INR A no serve, no atualiza CY ; utiliza CY flag na correo ; Atraso de 500ms


HNDLR:

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
EI JMP START ORG RST7.5 JMP HNDLR DB 00H END ; Volta a habilitar as interrupes ; Desvio da RST 7.5 ; Varivel global, armazena contagem

COUNT

(VWD DERUGDJHP p GDV SLRUHV SRLV YLROD GLUHWDPHQWH D UHJUD TXH GL] TXH R WUDWDGRU QmR GHYH VXMDU D SLOKD 2 TXH DFRQWHFH DTXL p TXH R HQGHUHoR GH UHWRUQR GD LQWHUUXSomR ILFD DUPD]HQDGR QD SLOKD SRLV QmR VH H[HFXWD D LQVWUXomR5(7$FDGDLQWHUUXSomRDSLOKDUHFHEHPDLVXPZRUGTXHQXQFDp UHWLUDGR3DUDFRQWRUQDUHVWHSUREOHPDKiTXHPVXJLUDUHWLUDU R HQGHUHoR GH UHWRUQRFRPXPDLQVWUXomR323FRPRVHJXH
HNDLR: POP B EI JMP START ORG RST7.5 JMP HNDLR DB 00H END ; Par BC recebe endereo de retorno ; Volta a habilitar as interrupes ; Desvio da RST 7.5 ; Varivel global, armazena contagem

COUNT

0DVHVWDVROXomRUHWLUDDSHQDVRHQGHUHoRGHUHWRUQRGDSLOKDHGHSHQGHQGR GRSRQWRHPTXHDLQWHUUXSomRRFRUUHXDSLOKDSRGHFRQWHUPDLVZRUGV3RU H[HPSORVHDLQWHUUXSomRDFRQWHFHGHQWURGDVXEURWLQD02675$$HQWmRD SLOKDFRQWpPRHQGHUHoRGHUHWRUQRSDUDHVWDVXEURWLQDPDLVDVSDODYUDVTXH HODSRVVDWHUFRORFDGRQDSLOKDHVyGHSRLVGLVVRYHPRHQGHUHoRGHUHWRUQR GD LQWHUUXSomR 3RU LVVR HP JHUDO R Q~PHUR GH ZRUGV TXH GHYHULDP VHU UHWLUDGRV GD SLOKD GHSHQGH GR LQVWDQWH HP TXH RFRUUH D LQWHUUXSomR R TXH LQYLDELOL]DDVROXomRSURSRVWD$OpPGLVVRHVWDDERUGDJHPUHFDLQRSULPHLUR HUURSRLVRSDU%& HVWi VHQGR DOWHUDGR SHOR WUDWDGRU H KDYHUi SUREOHPDV VH HVVHVUHJLVWUDGRUHVIRUHPQHFHVViULRVHPDOJXPSRQWRGRSURJUDPD LQFOXLQGR DVVXEURWLQDVFKDPDGDV  )LQDOPHQWH Ki TXHP VXJLUD VLPSOHVPHQWH IRUoDU D SLOKD D YROWDU DR HVWDGR LQLFLDOGHPRGRTXHQmRSRVVDILFDUVXMD
HNDLR: LXI SP,20C0H EI JMP START ; Limpa a pilha completamente ; Volta a habilitar as interrupes

(VWD DERUGDJHP SRGH VHU DSOLFiYHO HP DOJXQV FDVRV PDV DLQGD DVVLP p H[WUHPDPHQWHGHVDFRQVHOKiYHOSRUTXH HVWH PpWRGR DERUWD TXDOTXHU VXEURWLQD TXH HVWHMD HP H[HFXomR H HP SURJUDPDV PDLV FRPSOH[RV LVVR SRGH VHU FDWDVWUyILFR 6XSRQKD SRU H[HPSOR XPD VXEURWLQD TXH OLJD XP FHUWR HTXLSDPHQWR HQYLD DOJXQV FRPDQGRVDHOHHSUHFLVDGHVOLJiORFRUUHWDPHQWHGHSRLVGLVVRVRESHQDGH

,QWHUUXSo}HVQDSUiWLFD



GDQLILFiOR 6H HVWD VXEURWLQD IRU DERUWDGD SHOD LQWHUUXSomR R SURFHGLPHQWRFRUUHWRQmRVHUiUHDOL]DGR R SURJUDPD QmR XWLOL]D TXDOTXHU ILORVRILD GH RUJDQL]DomR GH WUDWDGRUHV GH LQWHUUXSomRFRPRDDSUHVHQWDGDDVHJXLU

&RPRID]HU
$ OLVWDJHP D VHJXLU DSUHVHQWD XPD VROXomR HOHJDQWH SDUD R SUREOHPD TXH REHGHFHDWRGDVDVUHJUDVSDUDHVFUHYHUWUDWDGRUHVGHLQWHUUXSomR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Ints85b.asm - Interrupcoes do 8085 ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MOSTRAA EQU 036EH DELAY EQU 05F1H RST7.5 EQU 20CEH ORG 2000H LXI SP,20C0H ; Inicializa pilha MVI A,18H SIM ; Habilita 5.5, 6.5 e 7.5 MVI A,00H STA STATE ; Flag de reset da contagem STA COUNT ; Inicializa contagem EI LOOP: LDA COUNT ADI 01H ; INR A no serve, no atualiza CY DAA ; Utiliza CY na correo STA COUNT CALL MOSTRAA MVI D,05H ; Atraso de 500ms CALL DELAY LDA STATE CPI 00H ; Testa critrio de reinicializao JZ LOOP ; Continua contando se STATE = 0 MVI A,00H STA COUNT ; Caso contrrio, zera a contagem STA STATE ; Reinicializa flag JMP LOOP HNDLR: PUSH PSW MVI A,01H STA STATE EI POP PSW RET STATE DB 00H ; Flag global alterado pelo tratador COUNT DB 00H ; Contagem



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
ORG RST7.5 JMP HNDLR END ; Desvio da RST 7.5

$ HOHJkQFLD GHVWD VROXomR YHP GD VHSDUDomR FODUD GDV WDUHIDV GR SURJUDPD SULQFLSDO H GR WUDWDGRU GH LQWHUUXSomR )RL GHILQLGD XPD YDULiYHO JOREDO 67$7( TXH IXQFLRQD FRPR PHFDQLVPR GH FRPXQLFDomR HQWUH DPERV 2 WUDWDGRUVHOLPLWDDID]HU67$7( HRSURJUDPDSULQFLSDOWHVWDHVVDYDULiYHO TXDQGROKHIRUFRQYHQLHQWH ,03257$17(RWUDWDGRUQmRWHQWDPRGLILFDURYDORUGDFRQWDJHP &DGDYH]TXHFKHJDDRILQDOGRORRSRSURJUDPDSULQFLSDOFRQVXOWDRYDORUGD YDULiYHO 67$7( H GHFLGH VH GHYH YROWDU GLUHWDPHQWH DR LQtFLR H PRVWUDU R SUy[LPRYDORUGDFRQWDJHP 67$7(  RXUHLQLFLDOL]DUDFRQWDJHPDQWHVGH YROWDU 67$7(   1HVWHFDVR ]HUDWDPEpPDYDULiYHO67$7(SDUDTXHR SHGLGRGHUHLQLFLDOL]DomRQmRILTXHSHQGHQWH &RPLVVRDFRQWDJHPQmRSRGHVHUPRGLILFDGDGHIRUPDLQHVSHUDGDSRLVpR SUySULR SURJUDPD SULQFLSDO TXH ID] D PRGLILFDomR $ WDUHID GR WUDWDGRU p VLPSOHVPHQWH D GH VLQDOL]DU DR SURJUDPD SULQFLSDO TXH R XVXiULR DFLRQRX D LQWHUUXSomR2SURJUDPDSULQFLSDOpTXHGHFLGHTXDQGRHRQGHGHYHSURFHVVDU HVWD LQIRUPDomR 2 SULQFtSLR DSOLFDGR DTXL GHYH VHU XWLOL]DGR VHPSUH TXH SRVVtYHO SDUD HVFUHYHU WUDWDGRUHV GH LQWHUUXSomR SRLV R LVRODPHQWR HQWUH WUDWDGRU H SURJUDPD SULQFLSDO OHYD QDWXUDOPHQWH D XP SURJUDPD GH ERD TXDOLGDGH

([HUFtFLRV
 0RGLILTXH R SURJUDPD GD VHomR  GH PRGR TXH DOWHUQDGDPHQWH H D FDGDWRTXHGRERWmR567DFRQWDJHPSDUHHFRQWLQXHGHRQGHSDURX 'LFDPRGLILTXHRWUDWDGRUGHLQWHUUXSomRGHPRGRTXHHVWHIDoD GH 67$7( XP FRQWDGRU PyGXOR  TXH DYDQoD D FDGD WRTXH GR ERWmR5672SURJUDPDSULQFLSDOVySUHFLVDWHVWDURYDORUGH 67$7( TXHVHUiDOWHUQDGDPHQWHRX  HGHFLGLUVHILFDSUHVR HPXPORRS GH HVSHUD 67$7(    RX VH FRQWLQXD D FRQWDJHP QRUPDOPHQWH 67$7(    ,PSOHPHQWHXP FRQWDGRU GH GXDV YHORFLGDGHV TXH DOWHUQH HQWUH DPEDV DR WRTXHGRERWmR567 'LFD XWLOL]H R WUDWDGRU GH LQWHUUXSomR GR H[HUFtFLR DFLPD VHP PRGLILFDo}HV 2 SURJUDPD SULQFLSDO GHYH GHFLGLU FRP EDVH QR YDORUGH67$7(VHRYDORUFDUUHJDGRQRSDU'(SDUDRDWUDVRQD

,QWHUUXSo}HVQDSUiWLFD



FRQWDJHP GHYH VHU JUDQGH 67$7(   YHORFLGDGH EDL[D  RX SHTXHQR 67$7( YHORFLGDGHDOWD   ([LVWHXPDJHQHUDOL]DomRVLPSOHVGRWUDWDGRUGHILQLGRQR H[HUFtFLR  TXH FRQVLVWHHPWUDQVIRUPDUDYDULiYHO67$7(QXPFRQWDGRUPyGXOR Q&RP LVVR p SRVVtYHO LPSOHPHQWDU SURJUDPDV TXH DOWHUQHP FLFOLFDPHQWH HQWUH Q FRPSRUWDPHQWRVGLIHUHQWHV (VFUHYD XP SURJUDPD TXH LPSOHPHQWH XP FRQWDGRU TXH DOWHUQH FLFOLFDPHQWHHQWUHRVVHJXLQWHVPRGRVGHFRQWDJHPGHFLPDOWRGDVPyGXOR  DVFHQGHQWHPRVWUDGDQRFDPSRGHGDGRV GHVFHQGHQWHPRVWUDGDQRFDPSRGHGDGRV DVFHQGHQWHPRVWUDGDQRFDPSRGHHQGHUHoRV GHVFHQGHQWHPRVWUDGDQRFDPSRGHHQGHUHoRV  ,PSOHPHQWH XP SURJUDPD FRP GRLV FRQWDGRUHV KH[DGHFLPDLV GH GRLV GtJLWRV TXH HYROXHP MXQWRV 2 SULPHLUR GHYH DSDUHFHU QR FDPSR GH HQGHUHoRV H LQLFLDU D FRQWDJHP QR VHQWLGR DVFHQGHQWH R VHJXQGR GHYH DSDUHFHUQRFDPSRGHGDGRVHFRQWDUQRVHQWLGRGHVFHQGHQWH$WRTXHGR ERWmR 567 RV VHQWLGRV GH FRQWDJHP GRV GRLV FRQWDGRUHV GHYHUmR VH LQYHUWHU



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

3RUWDVGHHQWUDGDHVDtGD
$VSRUWDVGH(6GR$EDFXV
2pXPGLVSRVLWLYRSHULIpULFRSURMHWDGRSDUDRSHUDUHPFRQMXQWRFRPR 2IHUHFHWUrVSRUWDVSDUDOHODVGHHQWUDGDHVDtGDGHQRPLQDGDV$%H& GRLVWHPSRUL]DGRUHVHE\WHVGHPHPyULD5$0FRQIRUPHDILJXUD
PORTA A

IO/M AD 0-7 CE ALE RD WR


256 x 8 RAM ESTTICA

PA0-7

BARRAMENTO DE DADOS INTERNO - 8 bits

PORTA B

PB0-7

controle estado

PA

PB

PC

timer timer MSB LSB Modo Timer

PORTA C TIMER

8 PC0-5

TIMER CLK TIMER OUT

Vcc (+5 v) Vss (0 v)

)LJ5HSUHVHQWDomRGRFRPSRQHQWH 2$EDFXVVLPXODDH[LVWrQFLDGDVSRUWDV$H%FDGDXPDGHELWVDVVLPFRPR GRUHJLVWUDGRUGHFRPDQGR TXH SHUPLWH FRQILJXUDU HVVDV SRUWDV FRPR VHQGR GHHQWUDGDRXGHVDtGDSRUWD$HVWiOLJDGRRFRQMXQWRGHFKDYHVGHVFULWRQD VHomR  H j SRUWD % R FRQMXQWR GH OHGV GHVFULWR QD VHomR  $V OLJDo}HVVmRPRVWUDGDVQDILJXUD
%LW 9 %LW

3RUWD$
%LW

3RUWD%
%LW

)LJ/LJDomRGDVFKDYHVHGRVOHGVDR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$VSRUWDVHRUHJLVWUDGRUGHFRPDQGRWrPHQGHUHoRVIL[RVGDGRVSHODWDEHOD  5HJLVWUDGRU COMMAND PORT A PORT B (QG + + &+$9(6 + /('6

7DE(QGHUHoRVGDVSRUWDVQR$EDFXV 2 REMHWLYR GR SUHVHQWH FDStWXOR p GHPRQVWUDU D XWLOL]DomR GDV SRUWDV $ H % SDUDID]HUDOHLWXUDGDVFKDYHVHRDFHQGHURVOHGV

$OLJDomRGRDR
eEDVWDQWHLQVWUXWLYRH[DPLQDUDOLJDomRGRDRPLFURSURFHVVDGRU&RPR PRVWUD D ILJXUD  DOJXQV SLQRV GR  WrP QRPHV TXH WDPEpP VmR HQFRQWUDGRV QR  $/( 5' :5 $'$' H ,20 $OpP GHVWHV VmR LPSRUWDQWHV&( FKLSHQDEOH HDVSRUWDVGH(6 3$3%H3&  $FRLQFLGrQFLDGHQRPHVGHSLQRVHQWUHRVGRLVFKLSVpSURSRVLWDOHDOLJDomR HQWUHHOHVGHIDWRVHID]SHODLQWHUFRQH[mRGRVSLQRVGHPHVPRQRPH'HVWD IRUPD R EDUUDPHQWR TXH PXOWLSOH[D GDGRV H GH HQGHUHoRV GR  p OLJDGR GLUHWDPHQWH DR  DWUDYpV GDV OLQKDV $' 2  p FDSD] GH ID]HU D VHSDUDomRHQWUHGDGRVHHQGHUHoRVSRLVUHFHEHWDPEpPRVLQDO$/( $OpPGRVGDGRVHHQGHUHoRVRUHFHEHRVVLQDLV5':5H,20 TXH SHUPLWHP LGHQWLILFDU RSHUDo}HV GH OHLWXUD H HVFULWD HP PHPyULD QR FDVR RV  E\WHV GH 5$0  RX QRV SHULIpULFRV DV SRUWDV H R WHPSRUL]DGRU  2 VLQDO &( ILQDOPHQWH p DWLYDGR SHOD VDtGD GH XP GHFRGLILFDGRU GH HQGHUHoRV GH PRGRTXHRUHVSRQGHVRPHQWHHPXPDGHWHUPLQDGDIDL[DGHHQGHUHoRV SDUDHYLWDUFRQIOLWRVFRPRXWURVSHULIpULFRV 1RWHDLQGDTXHRVHQGHUHoRVGDWDEHODQmRVmRGHWHUPLQDGRVSHOR PDVVLPSHORSURMHWLVWDGRKDUGZDUHRQGHRFRPSRQHQWHpXWLOL]DGR

&RQILJXUDomRGR
8PD YH] TXH R  SRGH VHU RSHUDGR GH GLYHUVDV IRUPDV p QHFHVViULR FRQILJXUiORGHDFRUGRFRPRVREMHWLYRVTXHVHWHPHPPHQWH3DUDWDQWRp QHFHVViULR HVFUHYHU XPD SDODYUD GH FRQILJXUDomR QXP UHJLVWUDGRU GHVWH

3RUWDVGHHQWUDGDHVDtGD



FRPSRQHQWH FKDPDGR UHJLVWUDGRU GH FRPDQGR FRPPDQG UHJLVWHU  (VWH UHJLVWUDGRU WHPRLWRELWVDIXQomRGHFDGDELWHVWiGHVFULWDQDILJXUD
7 6 5 4 3 2 1 0 TM2 TM1 IEB IEA PC2 PC1 PB PA PA PB PC controle do timer Interrupo PA Interrupo PB
0 - entrada 1 - sada 00 11 01 10 - ALT1 - ALT2 - ALT3 - ALT4

0 - desabilita 1 - habilita

)LJ2UHJLVWUDGRUGHFRPDQGRGR 2VELWVHFRQILJXUDPDVSRUWDV$H%FRPRVHQGRGHHQWUDGDRXGHVDtGDH QRFDVRGR$EDFXVpLQWHUHVVDQWHFRQILJXUDUDSRUWD$FRPRHQWUDGDHDSRUWD %FRPRVDtGDSRUFDXVDGDVFKDYHVHGRVOHGV $ SRUWD&QmRpVLPXODGDQR $EDFXVHSRULVVRVHXIXQFLRQDPHQWRQmRVHUiGHWDOKDGRDTXL

([HPSORHH[HUFtFLRV
 2 SURJUDPD DEDL[R DFHQGH VHTHQFLDOPHQWH RV OHGV FRQHFWDGRV j SRUWD % GR  1RWH R XVR GD VXEURWLQD '(/$< TXH ID] FRP TXH FDGD OHG SHUPDQHoDDFHVRGXUDQWHDOJXQVLQVWDQWHVSDUDTXHVHWHQKDRHIHLWRYLVXDO GHVHMDGR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Leds.asm - Utilizacao de perifericos ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; COMMAND EQU 20H LEDS EQU 22H DELAY EQU 05F1H ORG 2000H LXI SP,20C0H ; Inicializa pilha MVI A,02H ; Porta B como saida OUT COMMAND MVI A,01H LOOP: OUT LEDS ; Acende o LED correspondente a A RLC ; Rotaciona LED a acender PUSH PSW MVI D,02H ; Atraso de 200ms CALL DELAY ; Espera para ver LED aceso POP PSW JMP LOOP RET END



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

 &RPSOHWHRSURJUDPDGRLWHPGHIRUPDTXHRYDORUFRORFDGRQDSRUWDGH VDtGDDSDUHoDWDPEpPQRFDPSRGHGDGRVGRPRVWUDGRU  (VFUHYDXPSURJUDPDVHPHOKDQWHPDVTXHIDoDURWDFLRQDUXPOHGDSDJDGR  ,QYHUWDRVHQWLGRGHURWDomRGRVOHGV  ,PSOHPHQWHXPFRQWDGRUFXMRYDORUDSDUHoDHPIRUPDELQiULDQRVOHGV  (VFUHYDXPSURJUDPDTXHOHLDXPQ~PHUR QGRWHFODGR   Q  HTXH DFHQGDHQWmRRVQOHGVPHQRVVLJQLILFDWLYRV SRUH[HPSORVHQ GHYHP DFHQGHURVOHGVFRUUHVSRQGHQWHVDRVELWV  H  2SURJUDPDGHYH HQWmRYROWDUDRLQtFLRDFHLWDQGRQRYRYDORUSDUDQ 'LFDQRWHTXHRQ~PHURTXHGHYHVHUFRORFDGRQDSRUWDGHVDtGD SDUD DFHQGHU RV OHGV FRUUHVSRQGH D 3 (VWH YDORU SRGH VHU FDOFXODGRHPXP ORRS XWLOL]DQGR DV LQVWUXo}HV 5/& H 25,+ 8PDRXWUDVROXomRSRVVtYHOpXWLOL]DU67&H5$/  2 SURJUDPD DEDL[R FRQWUROD RV OHGV GH DFRUGR FRP DV FKDYHV OLJDGDV j SRUWD$GR$
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Chaves.asm - Utilizacao de perifericos ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; COMMAND EQU 20H CHAVES EQU 21H LEDS EQU 22H ORG 2000H MVI A,02H ; Porta A como entrada, B como saida OUT COMMAND LOOP: IN CHAVES ; Le chaves para o acumulador OUT LEDS ; Acende os LEDs correspondentes JMP LOOP RET END

(VFUHYDXPSURJUDPDTXHFRQWUROHRVOHGVGH DDSDUWLUGDVFKDYHVGH PHVPRQ~PHUR$FKDYHGHYHVHUXPDFKDYHGHFRQWUROHTXHGHWHUPLQD FRPRRVGHPDLVOHGVGHYHPUHDJLUjVFKDYHVFRPDFKDYHDEHUWDRVOHGV HDVFKDYHVGHDGHYHPVHFRPSRUWDUGHIRUPDTXHDXPDFKDYHIHFKDGD FRUUHVSRQGD XP OHG DFHVR H D XPD FKDYH DEHUWD XP OHG DSDJDGR FRP D FKDYHIHFKDGDHVWDUHODomRGHYHVHLQYHUWHU2OHGGHYHILFDUDSDJDGR TXDQGRDFKDYHHVWLYHUDEHUWDHDFHQGHUTXDQGRHVWDIRUIHFKDGD  (VFUHYDXPSURJUDPDTXHOHLDDVWUrVFKDYHVPHQRVVLJQLILFDWLYDVDWUDYpVGD SRUWD$HDVVRFLHDFDGDFRPELQDomRGDVFKDYHVXPQ~PHURELQiULR QGH  FKDYHV DEHUWDV  D  FKDYHV IHFKDGDV  $ TXDOTXHU LQVWDQWH GHYHP ILFDUDFHVRVVHPSUHRVQOHGVPHQRVVLJQLILFDWLYRV

$VVHPEO\SDUDR3&
(VWHFDStWXORDSUHVHQWDDVIHUUDPHQWDV GHGHVHQYROYLPHQWR DVVHPEOHU OLQNHU GHEXJJHU  SDUD SURJUDPDV HP DVVHPEO\ HVFULWRV SDUD 3&V FRP VLVWHPD RSHUDFLRQDO:LQGRZVRX06'26

2DVVHPEOHU
2 DVVHPEOHU XWLOL]DGR SDUD RV H[HPSORV p R 0$60 $ SDUWLU GR SURJUDPDIRQWH TXH GHYH HVWDU HP XP DUTXLYRWH[WR GH H[WHQVmR DVP VmR JHUDGRVRDUTXLYRFRPRVFyGLJRV REM HDOLVWDJHP OVW  $V SULQFLSDLV GLUHWLYDV XWLOL]DGDV SDUD HVFUHYHU SURJUDPDV HP $60 VmR DSUHVHQWDGDVQDWDEHOD 120( $6680( (1' (48 25* 6(*0(17 (1'6 '% ': 352& (1'3 38%/,& (;751 )81d2 $VVRFLDUHJLVWUDGRUGHVHJPHQWRDXPQRPHGHVHJPHQWR ,QGLFDILQDOGDOLVWDJHPHSRQWRGHHQWUDGD 'HILQHXPVLQ{QLPR (VWDEHOHFHRHQGHUHoRGDSUy[LPDLQVWUXomRRXYDUJOREDO ,QGLFDLQtFLRGHVHJPHQWR ,QGLFDILQDOGHVHJPHQWR 5HVHUYDHLQLFLDOL]DiUHDGHXPRXPDLVE\WHV ,GHPXPRXPDLVZRUGV ,QGLFDLQtFLRGHVXEURWLQD ,QGLFDILQDOGHVXEURWLQD 7RUQDXPVtPERORYLVtYHODSDUWLUGHRXWURVPyGXORV ,QIRUPDR0$60GHTXHXPVtPERORpGHILQLGRIRUDGR PyGXORTXHHVWiVHQGRPRQWDGR 7DE3ULQFLSDLVGLUHWLYDVGR$60



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

20$60SRGHVHUFKDPDGRVHPSDUkPHWURVFDVRHPTXHSDVVDDVROLFLWDUDV LQIRUPDo}HVGHTXHQHFHVVLWD2XWUDIRUPDPDLVUiSLGDGHFKDPiORp 0$60QRPHGRDUTXLYRIRQWH! (VWD IRUPD JHUD RV DUTXLYRV REM H OVW DOpP GH XP DUTXLYR GH UHIHUrQFLDV FUX]DGDV FUI TXHQmRpGHLQWHUHVVHSUiWLFRSDUDSURJUDPDVSHTXHQRV

2OLQNHU
2 OLQNHU /,1.  UHFHEH FRPR HQWUDGD XP RX PDLV DUTXLYRVREMHWR REM  H JHUDRVVHJXLQWHVDUTXLYRV SURJUDPDH[HFXWiYHO H[H  PDSDGHOLQNDJHP PDS  WDEHODGHVtPERORV V\P  $VVLPFRPRR0$60R/,1.SRGHVHUFKDPDGRVHPSDUkPHWURVSDUDTXH VROLFLWHDVLQIRUPDo}HVGHTXHSUHFLVD$VLQWD[HDOWHUQDWLYDp /,1.QRPHGRDUTXLYRREMHWRSULQFLSDO!>QRPHGHRXWURDUTXLYRREMHWR!@ (VWDJHUDRVDUTXLYRVPDSHH[H

2GHEXJJHU
26\PGHEpXPDIHUUDPHQWDXWLOL]DGDQDDQiOLVHHQDGHSXUDomRGHSURJUDPDV H[HFXWiYHLV2GRPtQLRGDVVXDVIXQo}HVpGHJUDQGHLPSRUWkQFLDSDUDRERP DSURYHLWDPHQWR GRV FDStWXORV VHJXLQWHV 3RU LVVR YDOH D SHQD LQYHVWLU XP SRXFRGHWHPSRQRHVWXGRGRVVHXVSULQFLSDLVFRPDQGRV $VLQWD[HSDUDDFKDPDGDGR6\PGHEp 6<0'(%RSo}HV>GULYH!@QRPH!H[WHQVmR! 6mRDFHLWRVDUTXLYRVFRPH[WHQVmRFRPELQH[HHKH[ $VRSo}HVVmR .KDELOLWDDWHFODVFUROOORFNFRPREUHDN 6KDELOLWDFKDYHDPHQWRHQWUHDWHODGHVDtGDGRVGDGRVGRSURJUDPDHGR 6\PGHE ,LPLWDR,%03& 'HVWDVDRSomR6pDPDLVXWLOL]DGD


O caso de programas com mltiplos arquivos tratado no Anexo 7.

$VVHPEO\SDUDR3&



2 VLVWHPD GH QXPHUDomR DGRWDGR SRU GHIDXOW HP WRGRV RV FRPDQGRV GR 6\PGHEpRVLVWHPDKH[DGHFLPDO1~PHURVELQiULRV VmR DFHLWRV FRPR WDLV VH VHJXLGRV GR VXIL[R % %  H Q~PHURV GHFLPDLV GHYHP VHU VHJXLGRV GR VXIL[R7 7 

&RPDQGRV
2VFRPDQGRVPDLVXWLOL]DGRVTXHFRQYpPPHPRUL]DUVmR5'%':'' 8$73H42VH[HPSORVDEDL[RLOXVWUDPDVXDDSOLFDomR 5PRVWUDRVUHJLVWUDGRUHVHRVIODJVGRSURFHVVDGRU '%'6/PRVWUDRV + SULPHLURVE\WHVGRVHJPHQWRGHGDGRV HQGHUHoDGRSRU'6 ':'6/PRVWUDRVPHVPRVE\WHVGLVSRVWRVQDIRUPDGHZRUGV '''6/ PRVWUD RV PHVPRVE\WHVGLVSRVWRVQDIRUPDGHGRXEOH ZRUGV ':6663/PRVWUDRV~OWLPRVZRUGVFRORFDGRVQDSLOKD 8 &6,3 /   PRVWUD DR WRGR  +  LQVWUXo}HV D SDUWLU GD SUy[LPD LQVWUXomRDVHUH[HFXWDGD $ >DGGU!@  HQWUD HP PRGR DVVHPEOHU HP TXH p SRVVtYHO HVFUHYHU SHTXHQRVSURJUDPDV 7H[HFXomRSDVVRDSDVVR 3  H[HFXomR GH XPD VXEURWLQD RX WUDWDGRU GH LQWHUUXSomR QXP ~QLFR SDVVR 44XLW HQFHUUDRSURJUDPD  2 DQH[R  DSUHVHQWD XPD UHODomR FRPSOHWD GRV FRPDQGRV GR 6\PGHE TXH WDPEpPSRGHVHUYLVXDOL]DGDDWUDYpVGRSUySULRSURJUDPDFRPRFRPDQGR"

([HUFtFLRV
 8WLOL]HRFRPDQGR$ DVVHPEOH GR6\PGHESDUDFULDURSURJUDPDDEDL[R
MOV MOV INC INC AX,00FFH BX,AX AL BX

(PVHJXLGDH[HFXWHRSURJUDPDSDVVRDSDVVRFRPRFRPDQGR7 WUDFH  REVHUYDQGRRTXHDFRQWHFHQRVUHJLVWUDGRUHV(VWHSURFHGLPHQWRp~WLOSDUD WLUDU SHTXHQDV G~YLGDV TXH SRVVDP VXUJLU GXUDQWH RV HVWXGRV 6H SUHFLVDU



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

VDEHURTXHDFRQWHFHQXPDFHUWDVLWXDomRLPDJLQHXPSHTXHQRH[HPSORH H[HFXWHReXPDGDVPHOKRUHVIRUPDVGHHVWXGDUHDSUHQGHU  0RQWHRSURJUDPDDEDL[RHFDUUHJXHRQR6\PGHE


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Mensagem.asm - Escrevendo uma mensagem na tela ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PILHA SEGMENT STACK DB 128 DUP(?) PILHA ENDS DADOS SEGMENT MSG1 DB 'AGORA SEI ESCREVER MENSAGENS NA TELA DO COMPUTADOR: $' MSG2 DB 'MICROPROCESSADORES' DADOS ENDS CODIGO SEGMENT ASSUME CS:CODIGO, DS:DADOS, SS:PILHA INICIO: MOV AX,DADOS MOV DS,AX ; INICIALIZACAO DE DS MOV AH,09H ; SERVICO DO DOS MOV DX,OFFSET MSG1 ; APONTA PARA O TEXTO INT 21H ; EXECUTA FUNCAO DO DOS P/ MSG1 MOV DX,OFFSET MSG2 INT 21H ; IDEM, MSG2 MOV AH,4CH ; TERMINA E RETORNA AO DOS INT 21H ; SERVICO DO DOS CODIGO ENDS END INICIO

([HFXWHR SDVVR D SDVVR DFRPSDQKDQGR D HYROXomR GRV UHJLVWUDGRUHV H D VDtGDQDWHOD FRPDQGR? $VOLQKDV
MOV AH,09H LEA DX,MSG1 INT 21H ; FUNO DO DOS ; APONTA PARA O TEXTO ; SERVIO DO DOS

FKDPDPRWUDWDGRUGDLQWHUUXSomR+UHVSRQViYHOSRUXPJUDQGHQ~PHUR GHVHUYLoRVRIHUHFLGRVSHORVLVWHPDRSHUDFLRQDO'26 2 WUDWDGRU GD LQWHUUXSomR + EXVFD LQLFLDOPHQWH HP $+ R Q~PHUR GD IXQomR GHVHMDGD &RP LVVR HVWH WUDWDGRU SRGH RIHUHFHU DWp  IXQo}HV GLIHUHQWHV $OJXPDV GHVVDV IXQo}HV WrP VXEIXQo}HV TXH R XVXiULR HVSHFLILFDDWUDYpVGHRXWURUHJLVWUDGRURTXHDXPHQWDROLPLWHGRQ~PHUR GH VHUYLoRV SRVVtYHLV SDUD  2 Q~PHUR GH VHUYLoRV H[LVWHQWHV p GH DOJXPDVFHQWHQDV2DQH[RGHVFUHYHDOJXQVGHVVHVVHUYLoRVHPRVWUDRQGH FRQVHJXLUPDLVLQIRUPDo}HV

$VVHPEO\SDUDR3&



$ IXQomR  XWLOL]DGD QR H[HPSOR SRUTXH $+ + VHUYHSDUDHVFUHYHU XPDVWULQJQDWHODGRFRPSXWDGRU3DUDWDQWRpSUHFLVRREHGHFHUjVHJXLQWH FRQYHQomRGHFKDPDGD $+GHYHFRQWHURYDORU+ RSDU'6';GHYH DSRQWDU SDUD R SULPHLUR E\WH GD PHQVDJHP D VHUHVFULWD DPHQVDJHPGHYHWHUPLQDUSRUXPFDUDFWHUTXHQmRpHVFULWR  ,GHQWLILTXHHFRUULMDRHUURQRSURJUDPDDQWHULRU  (VFUHYD XP SURJUDPD TXH OHLD FDUDFWHUHV GR WHFODGR H TXH HVFUHYD HVVHV FDUDFWHUHVQDWHOD 'LFDFRQVXOWHDQH[RSDUDYHURTXHID]HPDVIXQo}HV++ H+GDLQWHUUXSomR+  0RGLILTXHRSURJUDPDDQWHULRUGHPRGRTXHWRGDVDVOHWUDVDSDUHoDPFRPR PDL~VFXODVLQGHSHQGHQWHPHQWHGHFRPRIRUDPGLJLWDGDV 'LFDOHPEUHVHGRVFRQFHLWRVEiVLFRVVREUHPDQLSXODomRGHELWV  0HOKRUH R SURJUDPD GR LWHP DQWHULRU SDUD TXH VHMD SRVVtYHO OHU VWULQJV H HVFUHYrODVQDWHOD(QFHUUHRSURJUDPDVHRFDUDFWHUGLJLWDGRIRU(QWHU 'LFD  SDUD GHVFREULU R FyGLJR JHUDGR TXDQGR VH GLJLWD (QWHU IDoD XP SHTXHQR SURJUDPD QR 6\PGHE TXH OHLD XPD WHFOD H H[HFXWHR SDVVR D SDVVR $FRPSDQKH R UHJLVWUDGRU TXH UHFHEH R FDUDFWHU GLJLWDGR SDUD GHVFREULU R YDORU UHFHELGR 2 PHVPR SURFHGLPHQWR SRGH VHU XVDGR SDUD OHYDQWDU R YDORU DVVRFLDGR D TXDOTXHUWHFOD 'LFD  DV WHFODV GH IXQo}HV HVSHFLDLV FRPR SRU H[HPSOR ) JHUDP FyGLJRV GH  E\WHV 1HVWH FDVR R SULPHLUR E\WH p VHPSUH +$VVLPVHYSUHFLVDUGHVVDVWHFODVQRVHXSURJUDPDHVWHGHYH OHU R WHFODGR H SHUJXQWDU VH R E\WH OLGR p QXOR &DVR VHMD GHYH LPHGLDWDPHQWH OHU R WHFODGR PDLV XPD YH] SDUD WHU R FyGLJR FRPSOHWR  (VFUHYD XP SURJUDPD TXH XWLOL]H D IXQomR + GD LQWHUUXSomR + TXH RIHUHFH VHUYLoRV GR %,26 GR 3& (VWD LQWHUUXSomR WDPEpP SHUPLWH HVFUHYHUFDUDFWHUHVQDWHODPDVDOpPGHHVSHFLILFDURFDUDFWHUHVFULWRYRFr WDPEpP SRGH HVFROKHU VXD FRU &RQVXOWH R DQH[R  SDUD REWHU PDLRUHV GHWDOKHVVREUHHVWDIXQomR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

7HVWHHGHSXUDomR
6XEURWLQDVQHDUHIDU
2 SUHVHQWH FDStWXOR p XP HVWXGR GLULJLGR SDUD GHVHQYROYHU DV KDELOLGDGHV GH WHVWHHGHEXVFDGHHUURVHPSURJUDPDV 2HVWXGRH[SORUDDVGLIHUHQoDVHQWUHVXEURWLQDVQHDUHIDUTXHGLVWLQJXHPDV FKDPDGDVGHVXEURWLQDVIHLWDVGHQWURGHXPPHVPRVHJPHQWRGDTXHODVIHLWDV GHXPVHJPHQWRSDUDRXWUR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;NearFar.asm - Um estudo sobre sub-rotinas near e far ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PILHA SEGMENT STACK DB 128 DUP(?) PILHA ENDS DADOS SEGMENT MSG1 DB 'FOI CHAMADA UMA SUB-ROTINA NEAR$' MSG2 DB 'FOI CHAMADA UMA SUB-ROTINA FAR$' DADOS ENDS CODIGO SEGMENT ASSUME CS:CODIGO, DS:DADOS, SS:PILHA PUBLIC SHOW1, INICIO, SHOW2, ENTER SHOW1 PROC NEAR ; APRESENTA MSG EM DS:DX COM CRLF MOV AH,09H ; WRITE STRING INT 21H CALL FAR PTR ENTER RET SHOW1 ENDP INICIO: MOV AX,DADOS MOV DS,AX MOV DX,OFFSET MSG1 CALL SHOW1 MOV DX,OFFSET MSG2 CALL FAR PTR SHOW2 MOV AH,4CH ; TERMINATE INT 21H CODIGO ENDS



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

ROTINAS SEGMENT ASSUME CS:ROTINAS SHOW2 PROC FAR ; APRESENTA MSG EM DS:DX COM CRLF MOV AH,09H ; WRITE STRING INT 21H CALL FAR PTR ENTER RET SHOW2 ENDP ENTER PROC FAR MOV AH,02H MOV DL,0DH ; CARRIAGE RETURN (CR) INT 21H MOV AH,02H MOV DL,0AH ; LINE FEED (LF) INT 21H RET ENTER ENDP ROTINAS ENDS END INICIO

([SORUDQGRDVOLVWDJHQV
&ULHXPDUTXLYRFRPRSURJUDPDIRQWHGDGRDFLPD8WLOL]DQGRDOLVWDJHPGR SURJUDPDHRVUHFXUVRVRIHUHFLGRVSHORVSURJUDPDV0$60/,1.H6\PGHE UHVSRQGDDVSHUJXQWDVTXHVHJXHP  4XDQWRVVHJPHQWRVWHPRSURJUDPDHTXDORWLSRGHFDGDXP"  4XDO R ODEHO TXH GHWHUPLQD R SRQWR GH HQWUDGD GR SURJUDPD H HP TXH VHJPHQWRHOHILFD"  4XHOLVWDJHPIRLSUHFLVRFRQVXOWDUSDUDUHVSRQGHUDTXHVWmRDQWHULRU"  4XDO R RIIVHW GR ODEHO RQGH R SURJUDPD LQLFLD" 5HVSRQGD HVWD TXHVWmR XWLOL]DQGRSHORPHQRVGRLVPpWRGRVGLIHUHQWHVHH[SOLTXHFDGDXPGHOHV  *HUH XP DUTXLYR GH OLVWDJHP OVW  FRP R 0$60 QD KRUD GH PRQWDU R SURJUDPD &DUUHJXH R SURJUDPD H[HFXWiYHO QR 6\PGHE H IDoD XP GLVDVVHPEO\ FRP R FRPDQGR 8 &RPSDUH RV RIIVHWV GDV LQVWUXo}HV PRVWUDGDVFRPDVJHUDGDVSHOR0$60QRDUTXLYRGHOLVWDJHP  4XDORYDORULQLFLDOGRSRQWHLURGDSLOKD"5HVSRQGDLQLFLDOPHQWHEDVHDGRQD OLVWDJHPGRSURJUDPDIRQWHHGHSRLVFRQILUPHVXDUHVSRVWDFRPR6\PGHE 'HVFUHYDRSURFHGLPHQWRDGRWDGRHPFDGDXPGRVFDVRV  *HUH XP PDSD GH OLQNDJHP PDS  FRP R /LQN QD KRUD GH OLQNDU R SURJUDPD$QDOLVHDVLQIRUPDo}HVFRQWLGDVQDOLVWDJHPJHUDGD3RUTXHHVWD QmRGL]RQGHUHVLGLUmRRVVHJPHQWRVTXDQGRRSURJUDPDIRUH[HFXWDGR"

7HVWHHGHSXUDomR



([SORUDQGRRVUHFXUVRVGR6\PGHE
&DUUHJXHRSURJUDPDH[HFXWiYHOQR6\PGHEHVLJDRVSDVVRVDEDL[R6HYRFrVH SHUGHU H TXLVHU UHFRPHoDU EDVWD GDU R FRPDQGR / ORDG  SDUD FDUUHJDU QRYDPHQWHRDUTXLYRHUHLQLFLDOL]DURVUHJLVWUDGRUHV  )DoD XP GLVDVVHPEO\ GR SURJUDPD FRP R FRPDQGR 8 FRPSDUH DV LQVWUXo}HV H[LELGDV FRP D OLVWDJHP GR SURJUDPDIRQWH ([SOLTXH GH RQGH YHP R YDORU GR VtPEROR '$'26 QD OLQKD RQGH LQLFLD D H[HFXomR GR SURJUDPD  1RWHTXHRGLVDVVHPEO\GRLWHPDQWHULRUQmRFRPHoRXDVHUIHLWRQRLQtFLR GR VHJPHQWR RIIVHW +  PDV VLP GR SRQWR GH HQWUDGD GR SURJUDPD $+ ([SOLTXHSRUTXHRSRQWRGHHQWUDGDGRSURJUDPDQmRFRLQFLGH FRPRLQtFLRGRVHJPHQWR  )DoD XP GLVDVVHPEO\ D SDUWLU GR LQtFLR GR VHJPHQWR GH FyGLJR FRP R FRPDQGR 8  RX VLPSOHVPHQWH X  ([SOLTXH R VLJQLILFDGR GDV LQVWUXo}HVHQFRQWUDGDV  8WLOL]H R FRPDQGR 8 VHJPHQWR!RIIVHW! SDUD YLVXDOL]DU DV LQVWUXo}HV TXH FRPS}HP DV VXEURWLQDV 6+2: H (17(5 ([SOLTXH FRPR YRFr FRQVHJXHREWHURVYDORUHVGHVHJPHQWRHRIIVHWQHFHVViULRV  0RVWUHRVUHJLVWUDGRUHVHDSULPHLUDLQVWUXomRDVHUH[HFXWDGDXWLOL]DQGRR FRPDQGR5SUHVWHDWHQomRHVSHFLDOQRSDU&6,3TXHDSDUHFHUHSHWLGRQR LQtFLR GD WHUFHLUD OLQKD GDQGR R HQGHUHoR GR SRQWR GH HQWUDGD QR SURJUDPD  &RPEDVHQRGLVDVVHPEO\GRLQtFLRGRSURJUDPD FRPDQGR8VHJXLGRGR RIIVHW GR SRQWR GH HQWUDGD GR SURJUDPD  GHWHUPLQH R YDORU TXH WHUi R VHJPHQWR GH GDGRV 8WLOL]H HVWH YDORU QR FRPDQGR '% VHJPHQWR!RIIVHW! SDUD YLVXDOL]DU DV PHQVDJHQV 06* H 06* H H[SOLTXH FRPR GHWHUPLQDU RV YDORUHV GR RIIVHW SDUD FDGD XPD GDV PHQVDJHQV  2 SURJUDPD XWLOL]D R UHJLVWUDGRU '6 SDUD DSRQWDU SDUD R VHJPHQWR GH GDGRV1RHQWDQWRVHYRFrXWLOL]DURFRPDQGR'%'6RIIVHW!SDUDID]HU DYLVXDOL]DomRGDVPHQVDJHQVDQWHVGHLQLFLDUDH[HFXomRGRSURJUDPDLVVR QmRIXQFLRQD([SOLTXHSRUTXr  &RP R FRPDQGR 7 H[HFXWH DV SULPHLUDV GXDV LQVWUXo}HV GR SURJUDPD H UHSLWDRFRPDQGR'%'6RIIVHW!GRH[HUFtFLRDQWHULRU([SOLTXHSRUTXH DJRUDRFRPDQGRIXQFLRQD  7HQGR H[HFXWDGR DV GXDV SULPHLUDV LQVWUXo}HV H[HFXWH R FRPDQGR 8 ,3 SDUD YHU DV LQVWUXo}HV VHJXLQWHV &RQWLQXH D H[HFXomR SDVVR D SDVVR DWp



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

FKHJDUjDLQVWUXomR&$//2EVHUYHRVYDORUHVGRVUHJLVWUDGRUHV&6 ,3 H 63 DQWHV H GHSRLV GD H[HFXomR GHVWD LQVWUXomR 1RWH TXH HVWD p XPD FKDPDGD GH VXEURWLQD QHDU H TXH R HQGHUHoR GH UHWRUQR p FRQVWLWXtGR VRPHQWH GR RIIVHW &RPR R VHJPHQWR QmR PXGD QmR Ki QHFHVVLGDGH GH DUPD]HQiOR  2EVHUYH R FRQWH~GR GD SLOKD FRP R FRPDQGR ': 6663 / H[SOLTXH R VLJQLILFDGRGDVSDODYUDVPRVWUDGDV  9RFr HVWi DJRUD GHQWUR GD VXEURWLQD 6+2: TXH ILFD QR PHVPR VHJPHQWRTXHRFRUSRSULQFLSDOGRSURJUDPD8WLOL]HRFRPDQGR8,3SDUD YLVXDOL]DU DV LQVWUXo}HV TXH VHJXHP H DYDQFH DWp FRQFOXLU D H[HFXomR GD LQVWUXomR ,17 + 8WLOL]H R FRPDQGR ? SDUD YHU D PHQVDJHP TXH IRL FRORFDGDQDWHODGRXVXiULR  &RQWLQXH D H[HFXomR SDVVR D SDVVR GD VXEURWLQD 6+2: DWp H[HFXWDU D SUy[LPD LQVWUXomR &$// 2EVHUYH QRYDPHQWH R TXH DFRQWHFH FRP RV UHJLVWUDGRUHV &6 ,3 H 63 TXDQGR HVWD LQVWUXomR p H[HFXWDGD H H[SOLTXH D GLIHUHQoDHPUHODomRjVXDREVHUYDomRQRLWHP  2EVHUYH R FRQWH~GR GD SLOKD FRP R FRPDQGR ': 6663 / H[SOLTXH R YDORUGDVWUrVSULPHLUDVSDODYUDVPRVWUDGDV  8WLOL]H R FRPDQGR 8 ,3 SDUD YHU DV LQVWUXo}HV VHJXLQWHV &RQWLQXH D H[HFXomRSDUDQGRDQWHVGDLQVWUXomR,17+2EVHUYHDVDtGDGRXVXiULR FRP R FRPDQGR ? SUHVWDQGR HVSHFLDO DWHQomR j SRVLomR GR FXUVRU 9ROWH HQWmR j WHOD GR 6\PGHE H H[HFXWH D LQVWUXomR ,17 + 2EVHUYH QRYDPHQWHDVDtGDHYHMDRTXHDFRQWHFHXFRPRFXUVRU([SOLTXH  5HSLWDRSURFHGLPHQWRGRLWHPDQWHULRUSDUDDSUy[LPDLQVWUXomR,17+  $ SUy[LPD LQVWUXomR D VHU H[HFXWDGD p 5(7) UHWXUQ IDU  9RFr SRGH FRQILUPDU LVVR FRP R FRPDQGR 8 ,3 ([HFXWH HVWD LQVWUXomR REVHUYDQGR FRP DWHQomR R FRPSRUWDPHQWR GRV UHJLVWUDGRUHV &6 ,3 H 63 0RVWUH R FRQWH~GRGDSLOKDHH[SOLTXHRTXHDFRQWHFHX  1HVWHSRQWRYRFrYROWRXjVXEURWLQD6+2:HHVWiSUHVWHVDH[HFXWDUVXD ~OWLPDLQVWUXomRTXHp5(7 FRQILUPHLVVRFRP8,3 ([HFXWHDHREVHUYH QRYDPHQWHFRPDWHQomRRTXHDFRQWHFHFRPRVUHJLVWUDGRUHV&6,3H63  'LJDRQGHYRFrHVWiDJRUD8WLOL]H8,3SDUDVHORFDOL]DUVHQHFHVViULR  &RQWLQXH D H[HFXomR GR SURJUDPD SULQFLSDO DWp D FKDPDGD GD VXEURWLQD 6+2:7HQWHSUHYHURTXHDFRQWHFHUiFRPRVUHJLVWUDGRUHV&6,3H63 TXDQGRDLQVWUXomR&$//IRUH[HFXWDGDHGHSRLVFRQILUPHVXDVSUHYLV}HV  7HQGR HQWUDGR QD VXEURWLQD 6+2: H[HFXWH R FRPDQGR 8 ,3 SDUD YHU VHX FyGLJR 1RWH TXH HOD FKDPD D VXEURWLQD (17(5 H TXH D FKDPDGD XWLOL]DGD p GR WLSR )$5 HPERUD DPEDV HVWHMDP QR PHVPR VHJPHQWR GH

7HVWHHGHSXUDomR



FyGLJR([SOLTXHSRUTXHHVWDFKDPDGDQmRSRGHVHUGRWLSR1($5 SHQVH QRWLSRGH5(7TXHH[LVWHQRILQDOGDVXEURWLQD(17(5   &RQWLQXH D H[HFXomR GR SURJUDPD SDVVR D SDVVR DWp R ILQDO REVHUYDQGR VHPSUH D VDtGD GR XVXiULR DQWHV H GHSRLV GH FDGD LQVWUXomR ,17 + H R FRPSRUWDPHQWRGDSLOKDDFDGD&$//5(7)RX5(7  6DLDGR6\PGHEFRPRFRPDQGR4 5HSLWD HVWH H[HUFtFLR HP RXWUR GLD 3URFXUH LQWURGX]LU YDULDo}HV H H[SORUDU RXWURV FRPDQGRV GR 6\PGHE FRPR ( HGLW  SDUD PRGLILFDU DV PHQVDJHQV DSUHVHQWDGDV RX %3 %/ %' %( H %& SDUD WUDEDOKDU FRP EUHDNSRLQWV HP FRQMXQWR FRP R FRPDQGR * JR  3DUD PDLRUHV HVFODUHFLPHQWRV XWLOL]H R FRPDQGR"RXRDQH[R

,QWURGX]LQGRHUURV
&DUUHJXH R SURJUDPDIRQWH QXP HGLWRU GH WH[WR H H[SHULPHQWH ID]HU DV VHJXLQWHVPRGLILFDo}HV  7UDQVIRUPHDVXEURWLQD 6+2:QXPD 352&)$5 PDVQmRPRGLILTXHD OLQKD TXHDFKDPD&RPLVVRYRFrHVWDUiID]HQGRXP &$// 1($5 SDUD XPDVXEURWLQD IDU 6DOYH RSURJUDPDFRPXPQRYRQRPHPRQWHRFRPR 0$60HJHUHD OLVWDJHP OVW &RPSDUHD QRYD OLVWDJHPFRP D DQWHULRU H H[SOLTXH DV GLIHUHQoDV HQFRQWUDGDV QD FKDPDGD GD VXEURWLQD H QR FyGLJR GDLQVWUXomR5(7  &ULH R DUTXLYR H[HFXWiYHO FRUUHVSRQGHQWH DR SURJUDPD FULDGR QR LWHP DQWHULRU H FDUUHJXHR QR 6\PGHE ([HFXWHR SDVVR D SDVVR SDUD YHU R FRPSRUWDPHQWRGDSLOKDQDFKDPDGDGDIXQomR6+2:([SOLTXHSRUTXH RSURJUDPDVHSHUGHGHSRLVGHH[HFXWDUHVWDVXEURWLQD  3DUWLQGRGRDUTXLYRRULJLQDOWUDQVIRUPHDJRUDDVXEURWLQD6+2:QXPD 352&1($5PRGLILFDQGRWDPEpPDOLQKDHPTXHHODpFKDPDGD HPYH] GH &$// )$5 375 6+2: XVH VRPHQWH &$// 6+2:  H VDOYH R DUTXLYR FRP XP QRYR QRPH 7HQWH PRQWDU R SURJUDPD FRP R 0$60 H DQDOLVH D PHQVDJHP GH HUUR JHUDGD )DoD D PRQWDJHP FRP JHUDomR GH OLVWDJHP OVW HDQDOLVHHVVDOLVWDJHPQRSRQWRHPTXHIRLJHUDGRRHUUR  0RGLILTXH R DUTXLYR JHUDGR QR LWHP DQWHULRU YROWDQGR D FKDPDU D VXEURWLQD 6+2:FRP&$//)$5 375 6+2: PDVGHL[HDVXEURWLQD GHFODUDGDFRPR1($59RFrHVWDUiDVVLPLQWURGX]LQGRXPHUURJUDYHQR SURJUDPDSRLVDURWLQDVHUiFRQVWUXtGDFRPXP5(7GRWLSRQHDUQRILQDOH FKDPDGDFRP&$//)$5,VVR VLJQLILFDTXHD LQVWUXomR&$//FRORFDUiQD SLOKD RV YDORUHV GH &6 H ,3 PDV TXH QR ILQDO DSHQDV R YDORU GH ,3 VHUi



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

UHFXSHUDGRSHODLQVWUXomR5(7&ULHRDUTXLYRH[HFXWiYHOFRUUHVSRQGHQWHH H[HFXWHR2EVHUYHDVDtGDTXHSRGHFRQWHUUHVXOWDGRVLPSUHYLVtYHLV  6H QHFHVViULR UHLQLFLDOL]H R VHX PLFURFRPSXWDGRU GHSRLV GD H[SHULrQFLD DQWHULRU &DUUHJXH R SURJUDPD TXH FDXVRX R SUREOHPD QR 6\PGHE H H[HFXWHR SDVVR D SDVVR REVHUYDQGR VHPSUH R FRPSRUWDPHQWR GD SLOKD TXHDJRUDILFDUiGHIHLWXRVD&HUWLILTXHVHGHFRPSUHHQGHUH[DWDPHQWHRTXH DFRQWHFH D FDGD &$// RX 5(7 H SURFXUH H[SOLFDU FRPR R SURJUDPD VH SHUGH7HQWHH[SOLFDUDPHQVDJHPTXHDSDUHFHQDWHODTXDQGRYRFrH[HFXWD RSURJUDPD  3DUWLQGRQRYDPHQWHGRSURJUDPDRULJLQDOGDGRQRLQtFLRGRFDStWXORXWLOL]H R HGLWRU GH WH[WR SDUD UHPRYHU D GLUHWLYD $6680( GR VHJPHQWR URWLQDV 6DOYH R SURJUDPD FRP XP QRYR QRPH FULH R H[HFXWiYHO H FDUUHJXHR QR 6\PGHE2EVHUYHRVYDORUHVGRVVHJPHQWRVGHFyGLJRHURWLQDV([SOLTXHR TXHDFRQWHFHX

3DVVDQGRSDUkPHWURV
2V H[HUFtFLRV GHVWD VHomR YLVDP R H[SORUDU R PHFDQLVPR GH SDVVDJHP GH SDUkPHWURVSHODSLOKDDSUHVHQWDGRQRFDStWXOR  3DUWLQGRGRSURJUDPDRULJLQDOGDVHomRLGHQWLILTXHRWLSRGHSDVVDJHP GHSDUkPHWURVXWLOL]DGRQDVVXEURWLQDV6+2:H6+2:  0RGLILTXHDVVXEURWLQDV6+2:H6+2:GHPRGRTXHDSDVVDJHPGH SDUkPHWURV VHMD IHLWD SHOD SLOKD )DoD WDPEpP DV PRGLILFDo}HV QHFHVViULDV QRSURJUDPDSULQFLSDOSDUDFKDPDUDVQRYDVVXEURWLQDV  ([HFXWH R SURJUDPD REWLGR QR LWHP DQWHULRU SDVVR D SDVVR QR 6\PGHE YHULILFDQGRRFRPSRUWDPHQWRGDSLOKD&HUWLILTXHVHGHFRPSUHHQGHUWXGR TXHDFRQWHFH  &RPSOHWH R SURJUDPD DSUHVHQWDGR QR ILQDO GD VHomR  GH PRGR TXH R Q~PHUR GH FDUDFWHUHV GDV GXDV PHQVDJHQV HVFULWDV QD WHOD WDPEpP VHMD LQIRUPDGRDRXVXiULR  ([HFXWH R SURJUDPD FULDGR QR LWHP DQWHULRU SDVVR D SDVVR QR 6\PGHE YHULILFDQGR DV GLIHUHQoDV FRP R SURJUDPD DQWHULRU 2EVHUYH R IXQFLRQDPHQWRGDYDULiYHOORFDOTXHFRQWDRVFDUDFWHUHVHVFULWRVQDWHOD

(QGHUHoDPHQWREDVHDGRH LQGH[DGR
7DEHODVHPDWUL]HV
(VWH FDStWXOR H[SORUD D UHSUHVHQWDomR GH HVWUXWXUDV PDWULFLDLV QD PHPyULD &RPRHVWDpXPDUUDQMROLQHDUHVVDVHVWUXWXUDVQmRSRGHPVHUUHSUHVHQWDGDV VRE IRUPD ELGLPHQVLRQDO e QHFHVViULR WUDQVIRUPiODV HP XP FRQMXQWR GH WDEHODVFDGDXPDGDVTXDLVDUPD]HQDRVGDGRVGHXPDOLQKDRXFROXQD 2REMHWLYRGHVWHFDStWXORpPRVWUDUFRPRVHSRGHXWLOL]DURPRGREDVHDGRH LQGH[DGR SDUD IDFLOLWDU R HQGHUHoDPHQWR GRV HOHPHQWRV GH XPD PDWUL] 2V H[HUFtFLRV GD VHomR  VmR ~WHLV SDUD PHOKRUDU R HQWHQGLPHQWR GR XVR GH ODEHOVHGHFRQVWDQWHVHWDPEpPSDUDHVFODUHFHUDVGLIHUHQoDVTXHH[LVWHPHQWUH HVWUXWXUDVGHGDGRVEDVHDGDVHPE\WHVHHPZRUGV &RQVLGHUHRSURJUDPDDEDL[RTXHGHILQHGXDVPDWUL]HV0H0FDGDXPD HP XP VHJPHQWR GH GDGRV SUySULR H LQLFLDOL]DGDV FRP YDORUHV GLIHUHQWHV 2 SURJUDPD HIHWXD D VRPD GDV GXDV PDWUL]HV VREUHVFUHYHQGR D SULPHLUD GHODV FRPRUHVXOWDGR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Matrix.asm - Matrizes com enderecamento baseado indexado ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; M EQU 10 N EQU 20 PILHA SEGMENT STACK DW 80H DUP(?) PILHA ENDS M1 SEGMENT DB M * N DUP (10H) M1 ENDS M2 SEGMENT DB M * N DUP (25H) M2 ENDS


CODIGO

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

SEGMENT ASSUME CS:CODIGO, SS:PILHA, DS:M1, ES:M2 PUBLIC ROW, COL INICIO: MOV AX,M1 MOV DS,AX MOV AX,M2 MOV ES,AX MOV BX,0 ROW: MOV SI,0 COL: MOV AL,ES:[BX+SI] ADD [BX+SI],AL INC SI CMP SI,N JNZ COL ADD BX,N CMP BX,M*N JNZ ROW MOV AH,4CH INT 21H CODIGO ENDS END INICIO

([HUFtFLRV
 0RQWHRSURJUDPDHH[HFXWHRQR6\PGHE$FRPSDQKHRIXQFLRQDPHQWR GRVUHJLVWUDGRUHV%;H6,HPRQLWRUHDVPDWUL]HV  9RFr SHUFHEHUi ORJR TXH p GHPRUDGR DYDQoDU QHVWH SURJUDPD QR PRGR SDVVRDSDVVRVREUHWXGRVHGHVHMDUYHURUHJLVWUDGRU%;VHUDWXDOL]DGRFDGD YH] TXH 6, WHUPLQD GH SHUFRUUHU XPD OLQKD 3DUD WRUQDU D GHSXUDomR PDLV HILFLHQWHSRGHVHFULDUXPEUHDNSRLQWQRHQGHUHoRGDLQVWUXomRTXHDWXDOL]D %; H GHSRLV XWLOL]DU R FRPDQGR * JR  $ H[HFXomR VHUi UiSLGD SDUDQGR DSHQDVTXDQGRRSURFHVVDGRUHQFRQWUDURHQGHUHoRTXHWHPREUHDNSRLQW 8WLOL]DQGRRFRPDQGR*YiULDVYH]HVVHJXLGDVYRFrSRGHREVHUYDUDPDWUL] VHQGR SURFHVVDGD OLQKD D OLQKD 9HMD RV FRPDQGRV UHODFLRQDGRV DRV EUHDNSRLQWVQRDQH[R  0RGLILTXHRSURJUDPDGHPRGRTXHDPEDVDVPDWUL]HVILTXHPQRPHVPR VHJPHQWR H XWLOL]H D IRUPD GH HQGHUHoDPHQWR EDVHDGR LQGH[DGR FRP FRQVWDQWH DGLFLRQDO SDUD UHIHUHQFLiODV $ FRQVWDQWH DGLFLRQDO GHYH VHU XWLOL]DGDFRPRXPDEDVHFRQKHFLGDHPWHPSRGHPRQWDJHP $WHQomR DTXL H[LVWHP YiULDV PDQHLUDV GH VH FRQVHJXLU XP SURJUDPD TXH IXQFLRQH PDV QHP WRGDV WrP D PHVPD TXDOLGDGH 2V WUHFKRV GH OLVWDJHP DEDL[RGmRH[HPSORVFRPHQWDGRVGRTXHSRGHVHUIHLWR

(QGHUHoDPHQWREDVHDGRHLQGH[DGR
DADOS DADOS SEGMENT DB M*N DUP (?) DB M*N DUP (?) ENDS ... MOV AL,[200+BX+SI] ADD [BX+SI],AL



(VWH PpWRGR IXQFLRQD PDVp UXLPSRUTXHDFRQVWDQWH  DSDUHFHGHQWUR GD LQVWUXomR0296H0H1IRUHPDOWHUDGRVGHPRGRTXH0 1SDVVHD VHU GLIHUHQWH GH  R SURJUDPDGRU WHUi TXH VH OHPEUDU GH DWXDOL]DU HVVH YDORU GHQWUR GD LQVWUXomR &RPR LVVR SRGH VHU IDFLOPHQWH HVTXHFLGR R FyGLJRpYXOQHUiYHOHWHPEDL[DTXDOLGDGH 3DUDHYLWDUHVWHSUREOHPDSRGHUVHLDSHQVDUHPVXEVWLWXLU
MOV AL,[200+BX+SI]

SHODLQVWUXomR
MOV AL,[M*N+BX+SI].

(VWDDERUGDJHPWDPEpPIXQFLRQDHpFHUWDPHQWHPHOKRUGRTXHDDQWHULRU SRUTXHDJRUDRYDORUGDFRQVWDQWHpFRUULJLGRDXWRPDWLFDPHQWH 0DVDLQGDKiXPSUREOHPDTXHSRGHDFRQWHFHUVHDOJXpPGHILQLUXPDQRYD YDULiYHOGHQWURGRVHJPHQWRGHGDGRVDQWHVGDSULPHLUDPDWUL]RXDQWHVGD VHJXQGDRVRIIVHWVGDVPDWUL]HVGHL[DPGHVHUUHVSHFWLYDPHQWHH0 1H DtRSURJUDPDILFDHUUDGRGHQRYR3RULVVRDPHOKRUVROXomRFRQVLVWHHP DGRWDUODEHOVSDUDDVPDWUL]HVFRPRLOXVWUDGRDEDL[R


DADOS M1 M2 DADOS SEGMENT DB M*N DUP (?) DB M*N DUP (?) ENDS ... MOV AL,[M2+BX+SI] ADD [M1+BX+SI],AL

1RWH TXH 0 IRL XWLOL]DGR QD LQVWUXomR $'' HPERUD VHX YDORU QHVWH H[HPSORVHMDLJXDOD]HUR$XWLOL]DomRGDFRQVWDQWHQRHQWDQWRJDUDQWHTXH R SURJUDPD FRQWLQXH IXQFLRQDQGR FRUUHWDPHQWH PHVPR TXH D RUGHP GDV PDWUL]HVGHQWURGRVHJPHQWRGHGDGRVVHMDLQYHUWLGDRXTXHRXWUDVYDULiYHLV VHMDPGHILQLGDVDQWHVGDSULPHLUDPDWUL]2H[HPSORLOXVWUDDXWLOLGDGHGRV ODEHOV TXH GHYHP VHU HPSUHJDGRV VHPSUH TXH IRU QHFHVViULR ID]HU UHIHUrQFLDDXPRIIVHWGHQWURGHTXDOTXHUVHJPHQWR  0RGLILTXHRSURJUDPDFRQVWUXtGRQRLWHPDQWHULRUGHPRGRTXHRVYDORUHV GRV HOHPHQWRV GDV PDWUL]HV VHMDP GH  ELWV ZRUGV HP YH] GH E\WHV  2EVHUYHRSURJUDPDFRPFXLGDGRSRLVH[LVWHPYiULDVPRGLILFDo}HVDID]HU  $FUHVFHQWHDRSURJUDPDXPDWHUFHLUDPDWUL]SDUDUHFHEHURVUHVXOWDGRVGD VRPDSUHVHUYDQGRDVGXDVPDWUL]HVTXHVmRVRPDGDV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

'HVYLDQGRLQWHUUXSo}HV
3URJUDPDVUHVLGHQWHV
2VLVWHPDRSHUDFLRQDO06'26QmRRIHUHFHVXSRUWHjPXOWLSURJUDPDomRGH PRGRTXHQRUPDOPHQWHRXVXiULRVySRGHLQVWDODUQDPHPyULDXPSURJUDPD GH FDGD YH] &RQVWLWXHP H[FHomR D HVVD UHJUD RV SURJUDPDV FKDPDGRV UHVLGHQWHV RX 765V GR LQJOrV WHUPLQDWH DQG VWD\ UHVLGHQW 8P H[HPSOR GH SURJUDPDUHVLGHQWHpR GRVNH\XWLOL]DGRSDUDOHPEUDURVFRPDQGRVGLJLWDGRV SHORXVXiULRHIDFLOLWDUVXDUHSHWLomR2VYtUXVWDPEpPVmR765V 3DUD TXH VH WRUQH DWLYR XP SURJUDPD UHVLGHQWH SUHFLVD VHU FRORFDGR QD PHPyULD SRU XP SURJUDPD LQVWDODGRU (VWH DORFD HVSDoR SDUD R FyGLJR TXH GHYH SHUPDQHFHU UHVLGHQWH HVWDEHOHFH DV FRQGLo}HV SDUD TXH HVWH VHMD H[HFXWDGRHHQWmRUHWRUQDDRSURPSWGRVLVWHPDRSHUDFLRQDO(VVDVFRQGLo}HV GH H[HFXomR SRGHP YDULDU EDVWDQWH GH XP SURJUDPD SDUD RXWUR H p FRPXP TXH LQFOXDP FRQWDJHP GH WHPSR RX GHWHFomR GH FRPELQDo}HV GH WHFODV jV TXDLV R SURJUDPD UHDJH 1R FDVR GR GRVNH\ SRU H[HPSOR FDGD FRPDQGR GLJLWDGRSHORXVXiULRHFRQILUPDGRFRPDWHFOD(QWHUpDUPD]HQDGRHPXPD OLVWD $V WHFODV GH VHWDV  H  SDVVDP D WHU D IXQomR GH SHUFRUUHU HVVD OLVWD FRORFDQGRRVFRPDQGRVMiGLJLWDGRVQRYDPHQWHjGLVSRVLomRGRXVXiULR 2V 765V FRQVHJXHP SURYRFDU HVVH WLSR GH PXGDQoD QR FRPSRUWDPHQWR GR VLVWHPD DWUDYpV GD DOWHUDomR GH XP RX PDLV WUDWDGRUHV GH LQWHUUXSomR 3DUD WDQWRPRGLILFDPDWDEHODGHLQWHUUXSo}HVGHPRGRDGHVYLDURWUDWDPHQWRGD LQWHUUXSomRHPTXHVWmRSDUDXPWUHFKRGHFyGLJRUHVLGHQWHTXHDJHFRPRXP WUDWDGRU DOWHUQDWLYR 8WLOLWiULRV VLPSOHV FRPR FDOFXODGRUDV H DJHQGDV TXH DSDUHFHP DR WRTXH GH XPD FRPELQDomR GH WHFODV FRVWXPDP PRGLILFDU RV WUDWDGRUHVGRUHOyJLRRXGRWHFODGRPDVRPHVPRSULQFtSLRVHDSOLFDWDPEpP DSURJUDPDVPDLVVRILVWLFDGRVFRPRFRPSDFWDGRUHVGHGLVFRHJHUHQFLDGRUHV GHPHPyULDTXHLPSOHPHQWDPDOJRULWPRVPDLVVRILVWLFDGRV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

'26LGOHLQWHUUXSW
([LVWHPFDVRVHPTXHXPSURJUDPDUHVLGHQWHGHYHVHUDWLYDGRDVVLPTXHQmR KRXYHU RXWUD WDUHID D VHU H[HFXWDGD D ILP GH DSURYHLWDU R WHPSR RFLRVR GR SURFHVVDGRU(VWDpDVLWXDomRTXHVHWHPTXDQGRXPSURJUDPDDJXDUGDTXHR XVXiULR GLJLWH DOJXP FRPDQGR RX TXDQGR QmR Ki TXDOTXHU SURJUDPD FDUUHJDGR SDUD H[HFXomR (VWH PHFDQLVPR SRGH VHU ~WLO SRU H[HPSOR SDUD LPSOHPHQWDU765VGHGLDJQyVWLFRTXHSRGHPYHULILFDURKDUGZDUHLQVWDODGR HQTXDQWRQmRKiRXWUDVWDUHIDVSHQGHQWHV 8PD YH] TXH SRU KLSyWHVH QmR Ki TXDOTXHU DomR GR XVXiULR TXH SRVVD VHU GHWHFWDGD SDUD GDU LQtFLR j H[HFXomR GR SURJUDPD UHVLGHQWH p SUHFLVR TXH H[LVWD XPD RXWUD IRUPD GH DWLYiOR TXDQGR R VLVWHPD RSHUDFLRQDO HQWUDU HP UHSRXVReHVWDDIXQomRGDLQWHUUXSomRQ~PHUR+GR'26FRQKHFLGDSRU '26 LGOH LQWHUUXSW LQWHUUXSomR GH UHSRXVR  FXMR WUDWDGRU p FKDPDGR FRQWLQXDPHQWH VHPSUH TXH QmR Ki RXWUDV WDUHIDV SDUD SURFHVVDU 3RU GHIDXOW HVVHWUDWDGRUWHPDSHQDVXPDLQVWUXomR,5(7GHPDQHLUDTXHQDGDDFRQWHFH VHQmRKRXYHUXPSURJUDPD765LQVWDODGRTXHRPRGLILTXH 2SURJUDPDGDVHomRPRGLILFDRWUDWDGRUGDLQWHUUXSomR+SDUDLOXVWUDU RIXQFLRQDPHQWRGRPHFDQLVPRGHLQWHUUXSomRGR

'26LGOHLQWHUUXSWHR:LQGRZV
$ H[LVWrQFLD GD LQWHUUXSomR GH UHSRXVR GR '26 FULRX XP SUREOHPD SDUD R :LQGRZV&RPRHVWHpXPVLVWHPDTXHRIHUHFHVXSRUWHjPXOWLSURJUDPDomRR IDWRGHXPDMDQHODGR06'26HVWDUHP UHSRXVR QmR VLJQLILFD TXH QmR KDMD RXWUDV WDUHIDV D VHUHP H[HFXWDGDV 3RUWDQWR VH SDUD FDGD MDQHOD 06'26 DEHUWD R :LQGRZV WLYHVVH TXH FKDPDU FRQWLQXDPHQWH R WUDWDGRU GD LQWHUUXSomR+ TXHQRUPDOPHQWHH[HFXWDDSHQDVDLQVWUXomRGHUHWRUQR RGHVHPSHQKRGDVRXWUDVDSOLFDo}HVSRGHULDVHUSUHMXGLFDGRVHPQHFHVVLGDGH 3RUFDXVDGLVVRH[LVWHXPDGLIHUHQoDHQWUHDH[HFXomRGR06'26DSDUWLUGR :LQGRZV H R FDVR HP TXH VH LQLFLDOL]D R FRPSXWDGRU DSHQDV QR PRGR 06'26 1R SULPHLUR FDVR DV FKDPDGDV GR WUDWDGRU GD LQWHUUXSomR GH UHSRXVR FHVVDP DSyV DOJXQV LQVWDQWHV GH LQDWLYLGDGH $VVLP R SURJUDPD GD VHomRHQWUDHPUHSRXVRORJRGHSRLVTXHFHVVDDDWLYLGDGHGRWHFODGR,VWR QmR LPSHGH TXH VH REVHUYH VHX IXQFLRQDPHQWR PDV SRGH VHU LQWHUHVVDQWH UHLQLFLDOL]DURFRPSXWDGRUQRPRGR06'26SDUDREVHUYDUDGLIHUHQoD

'HVYLDQGRLQWHUUXSo}HV



2SURJUDPD
2SURJUDPDDVHJXLUGHVYLDRWUDWDGRUGDLQWHUUXSomR +SDUD XPWUHFKRGH FyGLJRSUySULRTXHSHUPDQHFHUHVLGHQWHHLPSOHPHQWDXPFRQWDGRUPyGXOR 6XDFRQWDJHPDSDUHFHQDWHODQDSRVLomRDWXDOGRFXUVRUSHUPLWLQGRDVVLP DFRPSDQKDUDVRFRUUrQFLDVGHVVDLQWHUUXSomR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Ints86.asm - Interrupcoes do 8085 ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PILHA SEGMENT STACK DW 128 DUP (?) PILHA ENDS DADOS SEGMENT CONT DB 0 ; CONTAGEM ATRASO DB 0 ; ATRASO DADOS ENDS CODIGO SEGMENT ASSUME CS:CODIGO, DS:DADOS, SS:PILHA INICIO: MOV AX,CS MOV DS,AX ; DS = CS MOV AH,25H ; FUNCAO SET INT VECTOR MOV AL,28H ; VETOR A MODIFICAR MOV DX,OFFSET CONTA ; OFFSET DO TRATADOR INT 21H ; SERVICO DO DOS MOV AL,3 ; RETURN CODE MOV DX,0FFH ; PARAGRAPHS TO KEEP RESIDENT MOV AH,31H ; TSR INT 21H ; SERVICO DO DOS CONTA: PUSH AX PUSH BX PUSH CX PUSH DS MOV AX,DADOS MOV DS,AX ; DS -> DADOS INC ATRASO CMP ATRASO,00H JNE SAIDA MOV AL,CONT INC AL CMP AL,10 JNE OK XOR AL,AL ; ZERA CONTAGEM OK: MOV CONT,AL OR AL,30H ; TRANSFORMA EM ASCII MOV AH,09 ; FUNCAO "WRITE CHAR" DA INT 10H MOV BH,0 ; PAGINA DE VIDEO MOV BL,7 ; ATRIBUTO


SAIDA:

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
MOV CX,0001H INT 10H POP DS POP CX POP BX POP AX IRET ENDS END INICIO ; NUMERO DE CARACTERES ; SERVICO DO BIOS

CODIGO

([HUFtFLRV
 &RPRDX[tOLRGR6\PGHEIDoDXPOHYDQWDPHQWRGRFyGLJRGRWUDWDGRUGD LQWHUUXSomR+GR'26DQWHVGHFDUUHJDUTXDOTXHUSURJUDPDUHVLGHQWH  ([HFXWH R SURJUDPD DFLPD D SDUWLU GR SURPSW GR '26 9HULILTXH QRYDPHQWHR HQGHUHoR GR WUDWDGRU GD LQWHUUXSomR + H R FyGLJR TXH VH HQFRQWUDOi([SOLTXHRTXHDFRQWHFHX  5HLQLFLDOL]H R FRPSXWDGRU H FDUUHJXH R SURJUDPD QR 6\PGHE ([HFXWHR SDVVR D SDVVR DWp TXH R WUDWDGRU VHMD LQVWDODGR H D FRQWDJHP DSDUHoD QD SRVLomR GR FXUVRU 6HP VDLU GR 6\PGHE HQFRQWUH D SRVLomR GD LQVWUXomR ,17+HVXEVWLWXDHVWDLQVWUXomRSRUGXDVLQVWUXo}HV123([SOLTXH R TXHDFRQWHFHX 'LFDQmRXWLOL]HRVFRPDQGRV$ DVVHPEOH RX( HGLW GR6\PGHE SDUDID]HUDVDOWHUDo}HV6HIL]HULVVRYRFrQmRFRQVHJXLUi DOWHUDU RVGRLVE\WHVTXHFRQVWLWXHPDLQVWUXomR,17+GHXPDVyYH] HGXUDQWHRLQWHUYDORHPTXHRSULPHLURE\WHWLYHUVLGRVXEVWLWXtGR SHORRSFRGHGDLQVWUXomR123 + HRVHJXQGRE\WHDLQGDQmR D LQVWUXomR GHFRGLILFDGD SHOR SURFHVVDGRU IDUi R SURJUDPD VH SHUGHU3DUDID]HUDVXEVWLWXLomRGRVGRLVE\WHVDRPHVPRWHPSR XWLOL]H R FRPDQGR ) ILOO  3RU H[HPSOR VH D LQVWUXomR ,17 + HVWLYHUHP+RFRPDQGRp )  2 TXH DFRQWHFH VH YRFr YROWDU D FRORFDU D LQVWUXomR ,17+ QD SRVLomR GRVGRLV123V" 'LFD DJRUD R FDPLQKR PDLV IiFLO p XWLOL]DU R FRPDQGR $ DVVHPEOH   ([SHULPHQWHYDULDURVYDORUHVGH%/H&;QDFKDPDGDSDUDDLQWHUUXSomR +SDUDFULDUHIHLWRVFRORULGRVGHDFRUGRFRPDVLQIRUPDo}HVGRDQH[R

7UDEDOKDQGRFRPVWULQJV
,QLFLDOL]DomRHFySLDGHWDEHODV
2 REMHWLYR GHVWD VHomR p DQDOLVDU R HPSUHJR GDV LQVWUXo}HV 6726: H 0296:GRSDUDLQLFLDOL]DUXPDiUHDGHPHPyULDHFRSLDUXPDWDEHODGH XPVHJPHQWRSDUDRXWUR 2 SURJUDPD D VHJXLU UHVHUYD XPD iUHD GH WUDEDOKR %8))(5  H XWLOL]D D LQVWUXomR6726:SDUDLQLFLDOL]iOD(PVHJXLGDFRORFDXPDVpULHGHYDORUHVQD SLOKDHFRSLDHVVHVYDORUHVSDUDDiUHDGHWUDEDOKRFRPDLQVWUXomR0296: $ILPGHPDQWHURSURJUDPDVLPSOHVQmRIRUDPLQFOXtGDVHQWUDGDQHPVDtGD GH GDGRV $ DQiOLVH GR IXQFLRQDPHQWR GHYH VHU IHLWD FRP D IHUUDPHQWD 6\PGHE8PH[HPSORFRPSOHWRFRPHQWUDGDSURFHVVDPHQWRHVDtGDSRGHVHU HQFRQWUDGRQDVHomR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Movs.asm - Copia de strings ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; WCOUNT EQU 10H PILHA SEGMENT STACK DW 80H DUP (?) PILHA ENDS DADOS BUFFER DADOS CODE START: SEGMENT DW WCOUNT DUP(?) ENDS SEGMENT ASSUME CS:CODE,SS:PILHA,ES:DADOS PUBLIC SUJAR, START MOV AX,DADOS MOV ES,AX LEA DI,BUFFER MOV CX,WCOUNT MOV AX,1111H ; VALOR INICIAL DOS WORDS DE BUFFER CLD ; STRINGS MOVIDAS COM AUTO-INCREMENTO STOSW

REP


SUJAR: LOOPNE

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
MOV CX,WCOUNT PUSH CX SUJAR MOV AX,SS MOV DS,AX MOV SI,SP MOV CX,WCOUNT LEA DI,BUFFER MOVSW ; COLOCA WCOUNT WORDS NA PILHA ; DS = SS ; SI = TOP OF STACK ; WCOUNT WORDS DO STACK P/ BUFFER

REP

CODE

ADD SP,2*WCOUNT ; LIMPA A PILHA MOV AH,4CH INT 21H ; FIM ENDS END START

([HUFtFLRV
 0RQWHRSURJUDPDDFLPDHFDUUHJXHRQR6\PGHE  (VWXGH D OLVWDJHP H LGHQWLILTXH DV VHo}HV GR SURJUDPD TXH ID]HP D LQLFLDOL]DomRGDiUHDGHWUDEDOKRDFRORFDomRGHYDORUHVQDSLOKDHVXDFySLD SDUDDiUHDGHWUDEDOKR  &RORTXH XP EUHDNSRLQW QR OXJDU GD LQVWUXomR TXH LQLFLDOL]D D iUHD GH WUDEDOKRHYHULILTXHRFRQWH~GRGHVVDiUHDLPHGLDWDPHQWHDQWHVGDH[HFXomR GHVVD LQVWUXomR ([HFXWHD FRP R FRPDQGR 7 H YHULILTXH QRYDPHQWH R FRQWH~GRGDiUHDGHWUDEDOKR  4XDO R FULWpULR GH SDUDGD GR ORRS TXH VXMD D SLOKD" 4XH YDORUHV YRFr HVSHUDTXHVHMDPFRORFDGRVOi"&RQWLQXHDH[HFXomRGRSURJUDPDSDVVRD SDVVRHYHULILTXHVXDVSUHYLV}HV  $YDQFHDWpDH[HFXomRGDLQVWUXomRTXHFRSLDRFRQWH~GRGDSLOKD SDUD D iUHDGHWUDEDOKR7HQWHSUHYHURQRYRFRQWH~GRGHVVDiUHDDSyVDH[HFXomR GDLQVWUXomR0296:HGHSRLVYHULILTXHVXDVSUHYLV}HV  (VFUHYD XP SURJUDPD TXH FRSLH D WDEHOD GH YHWRUHV GH LQWHUUXSomR SDUD XPD iUHD GH WUDEDOKR H TXH YHULILTXH HQWmR VH HVVD iUHD FRQWpP XP YHWRU FRP R YDORU GR RIIVHW LJXDO D + $ EXVFD GHYH VHU IHLWD XWLOL]DQGR D LQVWUXomR6&$6:HQmRGHYHVHUHQFHUUDGDVHKRXYHUDOJXPVHJPHQWRLJXDO D + 2 SURJUDPD GHYH DSUHVHQWDU FRPR UHVXOWDGR R Q~PHUR GR SULPHLURYHWRUHQFRQWUDGRFXMRRIIVHWp]HUR

7UDEDOKDQGRFRPVWULQJV



9DUUHGXUDGHVWULQJV
2 SURJUDPD D VHJXLU VROLFLWD DR XVXiULR TXH GLJLWH XPD VHTrQFLD GH DWp  FDUDFWHUHV H HP VHJXLGD XP FDUDFWHU GH EXVFD $ VHTrQFLD GH FDUDFWHUHV p HQWmRYDUULGDHPEXVFDGDSULPHLUD RFRUUrQFLDGHVVHFDUDFWHUFRPDLQVWUXomR 6&$6% $VVLP TXH IRU HQFRQWUDGR XP FDUDFWHU LJXDO DR FDUDFWHU GH EXVFD R SURJUDPD DSUHVHQWD XPD PHQVDJHP GL]HQGR HP TXH SRVLomR GH  D   R FDUDFWHUIRLHQFRQWUDGR&DVRRFDUDFWHUGHEXVFDQmRIDoDSDUWHGDVHTrQFLD R SURJUDPD DSUHVHQWD XPD PHQVDJHP GL]HQGR TXH R FDUDFWHU QmR IRL HQFRQWUDGR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Scas.asm - Varredura de strings ;Prof. Roberto M. Ziller - 04.01.2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENTER EQU 0DH PILHA SEGMENT STACK DW 100 DUP (?) PILHA ENDS DADOS SEGMENT MSGSTR DB 'ENTRE COM A STRING: $' MSGCHAR DB 'ENTRE COM O CARACTER A PROCURAR: $' MSGFND DB 'O CARACTER FOI ENCONTRADO NA POSICAO $' MSGNOT DB 'O CARACTER NAO FOI ENCONTRADO.' CRLF DB 0DH, 0AH, '$' BUFFER DB 101 DUP (?) DADOS ENDS CODE SEGMENT ASSUME CS:CODE,ES:DADOS,SS:PILHA START: MOV AX,DADOS MOV DS,AX MOV ES,AX LEA AX,MSGSTR PUSH AX CALL SHOW ;SOLICITA STRING ADD SP,2 LEA AX,BUFFER PUSH AX CALL GETSTR ;STRING EM BUFFER E COMPRIMENTO EM CX ADD SP,2 LEA AX,MSGCHAR PUSH AX CALL SHOW ; SOLICITA CARACTER ADD SP,2 CALL GETCHAR ; CARACTER EM AL LEA DI,BUFFER CLD


REPNE

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
SCASB ; VARRE STRING EM BUSCA DO CARACTER JNZ NO LEA AX,MSGFND PUSH AX CALL SHOW ; CARACTER ENCONTRADO ADD SP,2 SUB DI,OFFSET BUFFER DEC DI ; DI = OFFSET DO CARACTER EM BUFFER MOV AX,DI MOV BL,10 DIV BL ; DIVIDE OFFSET DO CARACTER POR 10; MOV DX,AX ; DEZENA EM DL E UNIDADE EM DH ADD DX,3030H ; CONVERTE P/ ASCII MOV AH,02H INT 21H ; APRESENTA DEZENA MOV DL,DH INT 21H ; APRESENTA UNIDADE MOV DL,'.' INT 21H ; PONTO FINAL DA FRASE JMP FIM LEA AX,MSGNOT PUSH AX CALL SHOW ; CARACTER NAO ENCONTRADO ADD SP,2 MOV AH,4CH INT 21H PROC NEAR PUSH BP MOV BP,SP MOV AH,09H LEA DX,CRLF INT 21H MOV DX,[BP+4] INT 21H POP BP RET ENDP PROC NEAR PUSH BP MOV BP,SP MOV BX,[BP+4] MOV CX,00H MOV AH,01H INT 21H CMP AL,ENTER JZ OK MOV [BX],AL INC BX ; OFFSET DO CARACTER EM BUFFER INC CX ; NUMERO DE CARACTERES LIDOS CMP CX,100

NO:

FIM: SHOW

SHOW GETSTR

LOOP:

7UDEDOKDQGRFRPVWULQJV
JB LOOP MOV BYTE PTR [BX],'$' POP BP RET GETSTR ENDP GETCHAR PROC NEAR MOV AH,01H INT 21H RET GETCHAR ENDP CODE ENDS END START OK:



([HUFtFLRV
 0RQWHHH[HFXWH RSURJUDPDDFLPDHYHULILTXHTXHHOHIXQFLRQDFRQIRUPH GHVFULWR  (VWXGHDOLVWDJHPHLGHQWLILTXHDVVHJXLQWHVVHo}HVQRSURJUDPDHQWUDGDGH GDGRVSURFHVVDPHQWRHVDtGD  &DUUHJXHRSURJUDPDQR6\PGHEHFRORTXHXPEUHDNSRLQWQDSRVLomRHP TXHDEXVFDHVWiSUHVWHVDVHLQLFLDU([HFXWHRSURJUDPDDWpHVWHSRQWRH XWLOL]HRFRPDQGRGHYLVXDOL]DomRGRFRQWH~GRGDPHPyULDSDUDREVHUYDUD YDULiYHO%8))(52EVHUYHWDPEpPRVYDORUHVGRVUHJLVWUDGRUHV $/H&; HFHUWLILTXHVHGHFRPSUHHQGHUVHXSDSHOQRSURJUDPD  &RQWLQXH D H[HFXomR GR SURJUDPD SDVVR D SDVVR 2EVHUYH FRPR R UHJLVWUDGRU ', p SUHSDUDGR SDUD DSRQWDU SDUD R LQtFLR GD VWULQJ DQWHV GD H[HFXomRGDOLQKD5(31(6&$6%4XDOD LPSRUWkQFLDGRUHJLVWUDGRU&; QDH[HFXomRGHVVDOLQKD"  &RPR GHYH VHU LQWHUSUHWDGR R FRQWH~GR GR UHJLVWUDGRU ', LPHGLDWDPHQWH DSyV D H[HFXomR GD OLQKD 5(31( 6&$6%" 5HODFLRQH VXD UHVSRVWD FRP R YDORUGR]HURIODJ  ([SOLTXH GH IRUPD VLPSOHV H REMHWLYD FRPR R SURJUDPD ID] SDUD REWHU R Q~PHURGHFLPDOGHD  TXH UHSUHVHQWDD SRVLomRGRFDUDFWHUQDVWULQJ &RPHFH VXD H[SOLFDomR LPHGLDWDPHQWH DSyV D FKDPDGD GD VXEURWLQD 6+2:SDUDDSUHVHQWDUDPHQVDJHP06*)1'  0RGLILTXH R SURJUDPD DFLPD SDUD DSUHVHQWDU WRGDV DV RFRUUrQFLDV GH XP FDUDFWHUQXPDVWULQJHQmRDSHQDVDSULPHLUD  0RGLILTXHRSURJUDPDGHPRGRTXHVHMDSRVVtYHOXWLOL]DUDWHFODEDFNVSDFH SDUDFRUULJLUDVWULQJTXHHVWiVHQGRGLJLWDGD



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$QH[R,QVWUXo}HVGR
$EUHYLDWXUDVXWLOL]DGDVQDWDEHODGHLQVWUXo}HV
Abreviatura dado end p r Z S P CY A -/*/0/1 Significado Constante de 8 bits Endereo de 16 bits Par de registradores (BC, DE ou HL) Registrador (A, B, C, D, E, H ou L) Zero flag Sign flag Parity flag Carry flag Auxiliary Carry flag No afeta/afeta/zera/seta flag

'LUHWLYDV
Nome DB <valor>(,...) END EQU ORG <endereo> Significado Define byte End Equate Origin

$VLQVWUXo}HV
(VWD VHomR DSUHVHQWD R FRQMXQWR GH LQVWUXo}HV GR  $ FROXQD +H[D FRQWpPRFyGLJRKH[DGHFLPDOGHFDGDLQVWUXomRDFROXQD=63&$GL]FRPR FDGDLQVWUXomRDIHWDRVIODJVGHDFRUGRFRPDFRQYHQomRGDGDDFLPD $ ILP GH OLPLWDU R WDPDQKR GD WDEHOD DOJXPDV LQVWUXo}HV IRUDP DJUXSDGDV QXPD PHVPD OLQKD e R FDVR SRU H[HPSOR GD LQVWUXomR &03UHJLVWUDGRU! 3DUD DVVRFLDU RV RSFRGHV DRV UHJLVWUDGRUHV FRUUHWRV p SUHFLVR VDEHU TXH RV RSFRGHV TXH VH UHIHUHP DRV UHJLVWUDGRUHV GH $ DWp / H DR HQGHUHoDPHQWR LQGLUHWRGDPHPyULDILFDPVHPSUHQDVHJXLQWHRUGHP%&'(+/0H$ $VVLP QR FDVR GD LQVWUXomR DFLPD R RSFRGH %+ VLJQLILFD &03% H R RSFRGH%)+VLJQLILFD&03$1RFDVRGRVSDUHVGHUHJLVWUDGRUHVDRUGHPp %&'(+/ H63VHIRURFDVR 


Mnem. ACI ADC ADC ADD ADD ADI ANA ANA ANI CALL CC CM CMA CMC CMP CMP CNC CNZ CP CPE CPI CPO CZ DAA DAD DAD DAD DAD DCR DCR DCR DCR DCR DCR DCR DCR DCX DI EI HLT IN INR INR INR INR INR INR INR INR INX JC JM JMP JNC JNZ JP JPE JPO JZ LDA LDAX LDAX

0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV
Operando dado r M r M dado r M dado end end end Opcode CE 88-8F 8E 80-87 86 C6 A0-A7 A6 E6 CD DC FC 2F 3F B8-BF BE D4 C4 F4 EC FE E4 CC 27 09 19 29 39 3D 05 0D 15 1D 25 2D 35 0B,1B,2B,3B F3 FB 76 DB 3C 04 0C 14 1C 24 2C 34 03,13,23,33 DA FA C3 D2 C2 F2 EA E2 CA 3A 0A 1A ZSPCA ***** ***** ***** ***** ***** ***** ***** ***** ***** -------------------****** ***** ----------------***** --------***** ---*---*---*---****-* ***-* ***-* ***-* ***-* ***-* ***-* ***-* --------------------***-* ***-* ***-* ***-* ***-* ***-* ***-* ***-* ----------------------------------------------------Descrio Soma dado imediato e CY a A Soma registrador e CY a A Soma byte endereado por HL e CY a A Soma registrador a A Soma byte endereado por HL a A Soma dado imediato a A A = AND de A com registrador A = AND de A com byte endereado por HL A = AND de A com dado imediato Chamada de sub-rotina CALL se CY = 1 CALL se S = 1 Complementa A Complementa CY Compara A com registrador Compara A com byte endereado por HL CALL se CY = 0 CALL se Z = 0 CALL se S = 0 CALL se P = 1 (parity even) Compara A com dado imediato CALL se P = 0 (parity odd) CALL se Z = 1 Ajuste de A aps soma BCD Soma o par BC a HL Soma o par DE a HL Soma o par HL a HL Soma SP a HL Decrementa A Decrementa B Decrementa C Decrementa D Decrementa E Decrementa H Decrementa L Decrementa byte endereado por HL Decrementa par de registradores ou SP Desabilita interrupes Habilita interrupes Pra o processamento L byte do end. de I/O fornecido p/ A Incrementa A Incrementa B Incrementa C Incrementa D Incrementa E Incrementa H Incrementa L Incrementa byte endereado por HL Incrementa par de registradores ou SP Desvia se CY = 1 Desvia se S = 1 Desvio incondicional Desvia se CY = 0 Desvia se Z = 0 Desvia se S = 0 Desvia se P = 1 (parity even) Desvia se P = 0 (parity odd) Desvia se Z = 1 L byte do endereo fornecido para A L byte endereado pelo par BC para A L byte endereado pelo par DE para A

r M end end end end dado end end B D H SP A B C D E H L M p

end A B C D E H L M p end end end end end end end end end end B D

,QVWUXo}HVGR
Mnem. LHLD LXI MOV MOV MOV MOV MOV MOV MOV MOV MOV MVI MVI NOP ORA ORA ORI OUT PCHL POP POP PUSH PUSH RAL RAR RC RET RIM RLC RM RNC RNZ RP RPE RPO RRC RST 0 RST 1 RST 2 RST 3 RST 4 RST 5 RST 6 RST 7 RZ SBB SBB SBI SHLD SIM SPHL STA STAX STAX STC SUB SUB SUI XCHG XRA XRA XRI XTHL Operando end p,dado A,r B,r C,r D,r E,r H,r L,r M,r r,M r,dado M,dado r M dado endereo p PSW p PSW Opcode 2A 01,11,21,31 78-7F 40-47 48-4F 50-57 58-5F 60-67 68-6F 70-77 46,4E,...,7E 06,0E,...,3E 36 00 B0-B7 B6 F6 D3 E9 C1-D1-E1 F1 C5-D5-E5 F5 17 1F D8 C9 20 07 F8 D0 C0 F0 E8 E0 0F C7 CF D7 DF E7 EF F7 FF C8 98-9F 9E DE 22 30 F9 32 02 12 37 90-97 96 D6 EB A8-AF AE EE E3 ZSPCA --------------------------------------------------------***00 ***00 ***00 ------------***** -----------*---*---------------*---------------------------*------------------------------------***** ***** ***** ---------------------------1***** ***** ***** ----***00 ***00 ***00 -----



r M dado endereo

endereo B D r M dado r M dado

Descrio L word do endereo fornecido para HL Copia dado imediato para par de regs Copia reg para A Copia reg para B Copia reg para C Copia reg para D Copia reg para E Copia reg para H Copia reg para L Copia reg para o byte endereado por HL Copia byte endereado por HL para reg Copia dado imediato para reg Copia dado para o byte endereado por HL Operao nula A = OU de A com registrador A = OU de A com byte endereado por HL A = OU de A com dado imediato Escreve A no endereo de I/O fornecido Copia HL para PC (causa um desvio) Desempilha um word e coloca no par p Desempilha um word e coloca em PSW Empilha par p Empilha PSW Rotaciona A + CY para a esquerda Rotaciona A + CY para a direita RET se CY = 1 Desempilha word e coloca em PC Copia a mscara de interrupo para A Rotaciona A esquerda; CY = MSB de A RET se S = 1 RET se CY = 0 RET se Z = 0 RET se S = 0 RET se P = 1 (parity even) RET se P = 0 (parity odd) Rotaciona A direita; CY = LSB de A Interrupo de software 0; PC = 0000H Interrupo de software 1; PC = 0008H Interrupo de software 2; PC = 0010H Interrupo de software 3; PC = 0018H Interrupo de software 4; PC = 0020H Interrupo de software 5; PC = 0028H Interrupo de software 6; PC = 0030H Interrupo de software 7; PC = 0038H RET se Z =1 Subtrai r e CY de A Subtrai byte endereado por HL e CY de A Subtrai dado imediato e CY de A Copia par HL para os bytes end e end+1 Copia A para a mscara de interrupo Copia HL para SP (afeta topo da pilha) Copia A para o endereo fornecido Copia A para o byte endereado por BC Copia A para o byte endereado por DE Seta CY Subtrai r de A Subtrai byte endereado por HL de A Subtrai dado imediato de A Permuta pares HL e DE A = XOR de A com r A = XOR de A com byte endereado por HL A = XOR de A com dado imediato Permuta HL com word no topo da pilha



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$QH[R,QVWUXo}HVGR
$EUHYLDWXUDVIODJVHGLUHWLYDV
Short name a c d e p r s sr sy t Flag OF DF IF TF SF ZF AF PF CF Affected? Short O D I T S Z A P C -/*/0/1/? Meaning Address Count Destination Expression or string I/O port Register Source Segment register (CS,DS,SS,ES) Symbol Type of symbol Meaning Overflow Flag (Bit 11) Direction Flag (Bit 10) Interrupt enable Flag (Bit 9) Trap Flag (Bit 8) Sign Flag (Bit 7) Zero Flag (Bit 6) Auxiliary carry Flag (Bit 4) Parity Flag (Bit 2) Carry Flag (Bit 0) Unaffected/affected/reset/set/unknown Function Align to word boundary Assume segment register name(s) Remove all former assumptions Define Byte(s) Define Byte Storage Define Double Word(s) Define Double Word Storage Define Word(s) Define Word Storage End and entry point of program External(s)(t=ABS/BYTE/DWORD/FAR/NEAR/WORD) Label (t=BYTE/DWORD/FAR/NEAR/WORD) Procedure (t=FAR/NEAR, default NEAR)

Name ALIGN ASSUME sr:sy(,...) ASSUME NOTHING DB e(,...) DBS e DD e(,...) DDS e DW e(,...) DWS e END <label> EXT (sr:)sy(t) LABEL t PROC t



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

7LSRV
ABS BYTE DWORD FAR HIGH LENGTH LOW NEAR OFFSET PTR SEGMENTO SHORT SIZE THIS TYPE WORD Absolute value of operand Byte type operation Double Word operation IP and CS registers altered High-order 8 bits of 16-bit value Number of basic units Low-order 8 bit of 16-bit value Only IP register need be altered Offset portion of an address Create a variable or label Segment of address One byte for a JMP operation Number of bytes defined by statement Create a variable/label of specified type Number of bytes in the unit defined Word operation

$V,QVWUXo}HV
Mnemonic AAA AAD AAM S ADC d,s ADD d,s AND d,s CALL a CBW CLC CLD CLI CMC CMP d,s CMPS CWD DAA DAS DEC d DIV s ESC s HLT IDIV s IMUL s IN d,p INC d INT INTO IRET JB/JNAE a JBE/JNA a JCXZ a JE/JZ a JL/JNGE a JLE/JNG a ODITSZAPC ?---??*?* ?---**?*? ?---**?*? ?---??*?* *---***** *---***** *---**?** ------------------------0 -0--------0-------------* *---***** *---***** --------?---***** ?---***** *---****?---????? ----------------?---????? *---????* --------*---****--00------**----********* ------------------------------------------------Description ASCII Adjust for Add in AX ASCII Adjust for Divide in AX ASCII Adjust for Multiply in AX ASCII Adjust for Subtract in AX Add with Carry Add Logical AND Call Convert Byte to Word in AX Clear Carry Clear Direction (increment) Clear Interrupt Complement Carry Compare Compare memory at SI and DI Convert Word to Double in AX,DX Decimal Adjust for Add in AX Decimal Adjust for Subtract in AX Decrement Divide (unsigned) in AX(,DX) Escape (to external device) Halt Divide (signed) in AX(,DX) Multiply (signed) in AX(,DX) Input Increment Interrupt Interrupt on Overflow Interrupt Return Jump on Below/Not Above or Equal Jump on Below or Equal/Not Above Jump on CX Zero Jump on Equal/Zero Jump on Less/Not Greater or Equal Jump on Less or Equal/Not Greater

,QVWUXo}HVGR
Mnemonic JMP a JNB/JAE a JNBE/J a JNL/JGE a JNE/JNZ a JNLE/JG a JNO a JNP/JPO a JNS a JO a JP/JPE a JS a LAHF LDS r,s LEA r,s LES r,s LOCK LODS LOOP a LOOPNZ/LOOPNE a LOOPZ/LOOPE a MOV d,s MOVS MUL s NEG d NOP NOT d OR d,s OUT p,s POP d POPF PUSH s PUSHF RCL d,c RCR d,c REP/REPNE/REPNZ REPE/REPZ RET (s) ROL d,c ROR d,c SAHF SAR d,c SBB d,s SCAS SEG r SHL/SAL d,c SHR d,c STC STD STI STOS SUB d,s TEST d,s WAIT XCHG r(,d) XLAT XOR d,s ODITSZAPC ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*---????* *---***** ----------------*---**?** ----------------********* ----------------*-------* *-------* -------------------------------*-------* ----***** *---**?** *---***** *---***** --------*---**?** *---**?** --------1 -1--------1-------------*---***** *---**?** ------------------------*---**?** Description Unconditional Jump Jump on Not Below/Above or Equal Jump on Not Below or Equal/Above Jump on Not Less/Greater or Equal Jump on Not Equal/Not Zero Jump on Not Less or Equal/Greater Jump on Not Overflow Jump on Not Parity/Parity Odd Jump on Not Sign Jump on Overflow Jump on Parity/Parity Even Jump on Sign Load AH with 8080 Flags Load pointer to DS Load EA to register Load pointer to ES Bus Lock prefix Load memory at SI into AX Loop CX times Loop while Not Zero/Not Equal Loop while Zero/Equal Move Move memory at SI to DI Multiply (unsigned) in AX(,DX) Negate No Operation (= XCHG AX,AX) Logical NOT Logical inclusive OR Output Pop Pop Flags Push Push Flags Rotate through Carry Left Rotate through Carry Right Repeat/Repeat Not Equal/Not Zero Repeat Equal/Zero Return from call Rotate Left Rotate Right Store AH into 8080 Flags Shift Arithmetic Right Subtract with Borrow Scan memory at DI compared to AX Segment register Shift logical/Arithmetic Left Shift logical Right Set Carry flag Set Direction flag (decrement) Set Interrupt flag Store AX into memory at DI Subtract AND function to flags Wait Exchange Translate byte to AL Logical Exclusive OR





0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$QH[R&RPDQGRVGR6\PGHE
$DGGU!$VVHPEOH &RQYHUWHPQHP{QLFRVGLJLWDGRVHPFyGLJRKH[DGHFLPDOQDPHPyULD ([HPSOR$ %3DGGU!%UHDNSRLQW &ULDXPEUHDNSRLQWQRHQGHUHoRHVSHFLILFDGR&DGDEUHDNSRLQWFULDGRUHFHEH XPQ~PHURGHD2VEUHDNSRLQWVGHILQLGRVSRGHPVHUYLVXDOL]DGRVFRPR FRPDQGR %/ 3RGH KDYHU QR Pi[LPR  EUHDNSRLQWV GHILQLGRV DR PHVPR WHPSR ([HPSORV%3%3&6,3 %/%UHDNSRLQW/LVW /LVWD RV EUHDNSRLQWV FULDGRV SHOR FRPDQGR %3 DSUHVHQWDQGR R Q~PHUR GR EUHDNSRLQWVHXHQGHUHoRHVHHVWiKDELOLWDGR VtPEROR H GH HQDEOHG  RX QmR G GLVDEOHG  2V EUHDNSRLQWV SRGHP VHU KDELOLWDGRV H GHVDELOLWDGRV FRP RV FRPDQGRV%(H%'UHVSHFWLYDPHQWH ([HPSOR%/ %&Q!%UHDNSRLQW&OHDU (OLPLQDSHUPDQHQWHPHQWHREUHDNSRLQW Q ([HPSORV%&%&  OLPSDWRGRV %'Q!%UHDNSRLQW'LVDEOH 'HVDELOLWDREUHDNSRLQWQ ([HPSORV%'%'  GHVDELOLWDWRGRV %(Q!%UHDNSRLQW(QDEOH +DELOLWDREUHDNSRLQWQ ([HPSORV%(%(  KDELOLWDWRGRV &DGGU!/OHQJWK!DGGU!&RPSDUH &RPSDUDGRLVEORFRVGHPHPyULD ([HPSOR&/ '$DGGU!'$DGGU!DGGU!'XPS$6&,, /LVWDRVFDUDFWHUHV$6&,,GDVSRVLo}HVGHPHPyULDHVSHFLILFDGDV



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

([HPSORV'$'$ '%DGGU!'%DGGU!DGGU!'XPS%\WH /LVWD RV FRQWH~GRV GDV SRVLo}HV GH PHPyULD HVSHFLILFDGDV E\WH D E\WH HP KH[DGHFLPDOH$6&,, ([HPSORV'%'% ':DGGU!':DGGU!DGGU!'XPS:RUG /LVWDRVFRQWH~GRVHPIRUPDGHZRUGV ([HPSORV':': ''DGGU!''DGGU!DGGU!'XPS'RXEOH:RUG /LVWDRVFRQWH~GRVHPIRUPDGHGRXEOHZRUGV ([HPSORV'''' '6DGGU!'6DGGU!DGGU!'XPSVKRUWUHDO /LVWDFRQWH~GRVLQWHUSUHWDGRVFRPRYDULiYHLVVKRUWUHDO )2575$1  '/DGGU!'/DGGU!DGGU!'XPSORQJUHDO /LVWDFRQWH~GRVLQWHUSUHWDGRVFRPRYDULiYHLVORQJUHDO )2575$1  '7DGGU!'7DGGU!DGGU!'XPSWHQE\WH /LVWDFRQWH~GRVLQWHUSUHWDGRVFRPRYDULiYHLVWHQE\WH )2575$1  'DGGU!'DGGU!DGGU!'XPS 5HSHWHR~OWLPRFRPDQGR'XPSH[HFXWDGR '%':''  ([HPSORV'' (DGGU!>YDOXH@(GLW 6XEVWLWXLRFRQWH~GRGHXPRXPDLVE\WHVQRHQGHUHoRHVSHFLILFDGR ([HPSORV(('6%; (:DGGU!>YDOXH@(GLWZRUG 6XEVWLWXLRFRQWH~GRGHXPRXPDLVZRUGV )DGGU!/OHQJWK!YDOXH!)LOO 3UHHQFKHXPDIDL[DGHPHPyULDFRPXPE\WHHVSHFLILFDGR ([HPSOR)/ **DGGU!*DGGU!DGGU!*R ([HFXWDRSURJUDPDTXH HVWi QD PHPyULD D SDUWLU GH &6,3 RX GR HQGHUHoR HVSHFLILFDGRRXGHDGGUDWpDGGU ([HPSORV**&6* +YDOXH!YDOXH!+H[DULWKPHWLF 6RPDHVXEWUDLGRLVYDORUHVKH[DGHFLPDLV ([HPSOR+ ,,QSXW3RUW 5HFHEHHPRVWUDXPE\WHGHXPDSRUWD

&RPDQGRVGR6\PGHE



([HPSOR,Q~PHURGDSRUWD! //DGGU!GULYH!/RDG &DUUHJDRDUTXLYRHVSHFLILFDGRSHORFRPDQGR1 YDEDL[R  0DGGU!DGGU!DGGU!0RYH 0RYHEORFRGHPHPyULDHQWUHDGGUHDGGUSDUDDGGU ([HPSOR0 1QDPH!1DPH (VSHFLILFDXPDUTXLYRSDUDVHUFDUUHJDGRRXVDOYRSHORVFRPDQGRV/H: ([HPSOR1/DEH[H 33URFHHG ([HFXWDVXEURWLQDRXWUDWDGRUGHLQWHUUXSomR 44XLW (QFHUUDRSURJUDPD 55UHJ!5UHJ! Y!5HJLVWHU $SUHVHQWDRVUHJLVWUDGRUHVRXDWULEXLDRUHJLVWUDGRUHVSHFLILFDGRRYDORUY ([HPSORV55$;5,3  6DGGU!DGGU!YDOXHV!6HDUFK 3URFXUDXPDVHTrQFLDGHE\WHVGHQWURGHXPDIDL[D ([HPSOR6 77Q!7UDFH ([HFXWDSDVVRDSDVVRXPDRXQLQVWUXo}HV ([HPSORV77 8DGGU!8DGGU!/OHQJWK!8QDVVHPEOH ,QWHUSUHWD R FRQWH~GR GD PHPyULD FRPR LQVWUXo}HV DVVHPEOHU H JHUD RV PQHP{QLFRVFRUUHVSRQGHQWHV ([HPSORV88&6,3/ ::DGGU!GULYH!:ULWH 6DOYDRDUTXLYRFRPRQRPHHVSHFLILFDGRSHORFRPDQGR1 "+HOS $MXGD'HVFUHYHUHVXPLGDPHQWHFDGDXPGRVFRPDQGRV ?8VHURXWSXW $SUHVHQWDDWHODGHVDtGDGRSURJUDPD'LVSRQtYHOVRPHQWHVHR6\PGHEIRU FKDPDGRFRPDRSomR6



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$QH[R6HUYLoRVGR'26HGR %,26
(VWHDQH[RDSUHVHQWDFRQYHQo}HVGHFKDPDGDGHDOJXQVVHUYLoRVGR'26HGR %,26 ,QIRUPDo}HV PDLV FRPSOHWDV VREUH HVWHV H RXWURV VHUYLoRV SRGHP VHU REWLGDV HP OLYURV FRPR >%.@ RX DLQGD QD ,QWHUQHW &RQVXOWH R LWHP /LQNV ,QWHUHVVDQWHVQDKRPHSDJHTXHGiVXSRUWHDROLYUR &DGD VHUYLoR FRUUHVSRQGH D XPD LQWHUUXSomR GR 3& H RIHUHFH XPD RX PDLV IXQo}HV LGHQWLILFDGDV SRU XP Q~PHUR HQWUH + H ))+ $OJXPDV GHVWDV IXQo}HV WrP VXEIXQo}HV WDPEpP QXPHUDGDV GH + D ))+ GH IRUPD TXH WHRULFDPHQWHSRGHVHWHUDWp  VXEIXQo}HV SDUD XPD ~QLFD LQWHUUXSomR 2 Q~PHUR GH IXQo}HV H VXEIXQo}HV LPSOHPHQWDGDV QmR p WmR JUDQGHPDVFKHJDDYiULDVFHQWHQDV3RULVVRpSUHFLVRWHUjPmRDOJXPWLSR GHUHIHUrQFLDSDUDWUDEDOKDU $ ILP GH XWLOL]DU HVVHV VHUYLoRV p SUHFLVR VHJXLU j ULVFD DV FRQYHQo}HV GH FKDPDGD GHILQLGDV SHOR IDEULFDQWH GR VRIWZDUH (VWDV FRQYHQo}HV VmR H[SUHVVDV HP WHUPRV GRV YDORUHV D VHUHP FRORFDGRV QRV UHJLVWUDGRUHV GR SURFHVVDGRU DQWHV GH LQYRFDU D IXQomR GHVHMDGD H VH IRU R FDVR GRV YDORUHV UHWRUQDGRV

)XQo}HVGR%,26
6HUYLoRVGHYtGHR ,17+
)XQomR+6(79,'(202'(
$+ + $/ PRGR +SDUD9*$[ 



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

2EVQRUPDOPHQWHHVWDIXQomRWDPEpPOLPSDDWHODGRPRQLWRU1RVPRGRV SDGUmR,%0RFRQWH~GRGDWHODSRGHVHUSUHVHUYDGRFRORFDQGRVHRELWPDLV VLJQLILFDWLYRGH$/HP

)XQomR+VHWFXUVRUVL]H

$+ + &+ ELW  ELWVH  QRUPDO  LQYLVtYHO  ELWVD OLQKDPDLVDOWDGRFDUDFWHURQGHGHYHDSDUHFHURFXUVRU &/ELWVD OLQKDPDLVEDL[DGRFDUDFWHURQGHGHYHDSDUHFHURFXUVRU 9WDPEpPIXQomR+

)XQomR+VHWFXUVRUSRVLWLRQ

$+ + %+ Q~PHURGDSiJLQDGHYtGHRGHDSDUDRPRGRGHYtGHR '+ OLQKD +pDOLQKDVXSHULRU  '/ FROXQD +pDFROXQDGDHVTXHUGD  9WDPEpPIXQo}HV+H+

)XQomR+JHWFXUVRUSRVLWLRQDQGVL]H

$+ + %+ Q~PHURGDSiJLQDGHYtGHR DSDUDPRGRGHYtGHRYIXQomR   5HJLVWUDGRUHVQRUHWRUQR &+ OLQKDLQLFLDOGRFDUDFWHUFRQWHQGRFXUVRU &/ OLQKDILQDOGRFDUDFWHUFRQWHQGRFXUVRU '+ OLQKDGDWHODTXHFRQWpPRFXUVRU +pDOLQKDVXSHULRU  '/ FROXQDGRFDUDFWHUTXHFRQWpPRFXUVRU + HVTXHUGD  9WDPEpPIXQo}HV+H+

)XQomR+VHOHFWDFWLYHGLVSOD\SDJH
$+ + $/ SiJLQDTXHGHYHVHWRUQDUDWLYD

)XQomR+ZULWHFKDUDFWHUDQGDWWULEXWHDWFXUVRUSRVLWLRQ
$+ + $/ FDUDFWHUDVHUHVFULWRQDWHOD %+ Q~PHURGDSiJLQDGHYtGHR DSDUD9*$ 

6HUYLoRVGR'26HGR%,26 %/ DWULEXWRGHYtGHR YILJXUD  &; Q~PHURGHYH]HVTXHRFDUDFWHUGHYHVHUHVFULWR


       



%O

)LJ$$WULEXWRGHYtGHRHPPRGRWH[WR

2DWULEXWRGHXPFDUDFWHU
&DGDFDUDFWHUTXHDSDUHFHQDWHODpGHVFULWRSRUGRLVE\WHV2SULPHLURFRQWpP VHX FyGLJR $6&,, H R VHJXQGR TXH GHWHUPLQD VXD DSDUrQFLD p GHQRPLQDGR DWULEXWR2ELWGHVWHE\WH EOLQNLQJ GHWHUPLQDVH RFDUDFWHUDSDUHFHSLVFDQGR HRVELWVHGHWHUPLQDPUHVSHFWLYDPHQWHDFRUGRIXQGRVREUHRTXDOR FDUDFWHUVHUiHVFULWRHDFRUGRSUySULRFDUDFWHUGHDFRUGRFRPDWDEHOD$ &RU 3UHWR $]XO 9HUGH &LDQR 9HUPHOKR 0DJHQWD 0DUURP &LQ]DFODUR &LQ]DHVFXUR $]XOFODUR 9HUGHFODUR &LDQRFODUR 9HUPHOKRFODUR 0DJHQWDFODUR $PDUHOR %UDQFR 9DORU + + + + + + + + + + $+ %+ &+ '+ (+ )+ 8WLOL]DomR &DUDFWHUHIXQGR &DUDFWHUHIXQGR &DUDFWHUHIXQGR &DUDFWHUHIXQGR &DUDFWHUHIXQGR &DUDFWHUHIXQGR &DUDFWHUHIXQGR &DUDFWHUHIXQGR 6RPHQWHFDUDFWHU 6RPHQWHFDUDFWHU 6RPHQWHFDUDFWHU 6RPHQWHFDUDFWHU 6RPHQWHFDUDFWHU 6RPHQWHFDUDFWHU 6RPHQWHFDUDFWHU 6RPHQWHFDUDFWHU

7DE$9DORUHVGRVFDPSRVGRDWULEXWR

)XQomR$+ZULWHFKDUDFWHURQO\DWFXUVRUSRVLWLRQ
$+ $/ %+ %/ &; $+ FDUDFWHUDVHUHVFULWRQDWHOD Q~PHURGDSiJLQDGHYtGHR DSDUD9*$  DWULEXWRGHYtGHR Q~PHURGHYH]HVTXHRFDUDFWHUGHYHVHUHVFULWR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

)XQomR%+VHWEDFNJURXQGERUGHUFRORU
$+ %+ %+ + %/ FRUGRUIXQGRGDERUGD

)XQo}HVGR'26
6HUYLoRVJHUDLV ,17+
)XQomR+UHDGFKDUDFWHUIURPVWDQGDUGLQSXWZLWKHFKR
$+ + 5HJLVWUDGRUHVQRUHWRUQR $/ FyGLJR$6&,,GRFDUDFWHUOLGR 9WDPEpPIXQomR+

)XQomR+ZULWHFKDUDFWHUWRVWDQGDUGRXWSXW
$+ + '/ FyGLJR$6&,,GRFDUDFWHUDVHUHVFULWR 2EVQRPRQLWRURFDUDFWHUDSDUHFHQDSRVLomRDWXDOGRFXUVRU 9WDPEpPIXQomR+

)XQomR+FKDUDFWHULQSXWZLWKRXWHFKR
$+ + 5HJLVWUDGRUHVQRUHWRUQR $/ FyGLJR$6&,,GRFDUDFWHUOLGR 9WDPEpPIXQomR+

)XQomR+ZULWHWHUPLQDWHGVWULQJWRVWDQGDUGRXWSXW
$+ + '6'; SRQWHLURIDUSDUDRLQtFLRGDFDGHLDGHFDUDFWHUHVDVHUHVFULWD 2EV VH D VDtGD SDGUmR IRU R PRQLWRU D HVFULWD LQLFLD QD SRVLomR DWXDO GR FXUVRU $ HVFULWD WHUPLQD TXDQGR IRU HQFRQWUDGR R FDUDFWHU  TXH QmR p HVFULWR 9WDPEpPIXQomR+

)XQomR+6HWLQWHUUXSWYHFWRU
$+ +

6HUYLoRVGR'26HGR%,26 $/ Q~PHURGRYHWRUGHLQWHUUXSomRDVHUPRGLILFDGR '6'; QRYRYDORUSDUDRYHWRUDVHUPRGLILFDGR $+ + $/ UHWXUQFRGH '; Q~PHURGHSDUiJUDIRVTXHGHYHPSHUPDQHFHUUHVLGHQWHV



)XQomR+WHUPLQDWHDQGVWD\UHVLGHQW 765

)XQomR&+WHUPLQDWHSURJUDP
$+ &+ $/ UHWXUQFRGH

'26,GOHLQWHUUXSW ,17+
(VWDLQWHUUXSomRpFKDPDGDSHORSUySULRVLVWHPDRSHUDFLRQDOVHPSUHTXHHVWH HVWiHVSHUDQGRXPDHQWUDGDGRXVXiULR)RLFULDGDFRPRSURSyVLWRGHSHUPLWLU TXHSURJUDPDV765PRGLILTXHPVHXWUDWDGRUGHLQWHUUXSomR TXHSRUGHIDXOW FRQVLVWHDSHQDVGHXPDLQVWUXomR,5(7 DILPGHTXHSRVVDPVHUFKDPDGRV HQTXDQWRVHDJXDUGDDOJXPDDomRGRXVXiULR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$QH[R$UTXLYRVFRP
1R VLVWHPD RSHUDFLRQDO 06'26 R IRUPDWR GH DUTXLYR H[HFXWiYHO PDLV FRPXP FDUDFWHUL]DGR SHOD H[WHQVmR H[H SHUPLWH D XWLOL]DomR GH WRGD D FDSDFLGDGHGHHQGHUHoDPHQWRGRSURFHVVDGRU3RULVVRSRGHVHUXWLOL]DGRSDUD SURJUDPDVGHTXDOTXHUWDPDQKRVXSRUWDGRSHORVLVWHPDRSHUDFLRQDO ([LVWHWDPEpPXPIRUPDWRPDLVFRPSDFWRFDUDFWHUL]DGRSHODH[WHQVmRFRP H TXH OLPLWD R WDPDQKR WRWDO GR SURJUDPD FyGLJR GDGRV H SLOKD  D  N% 1HVWH IRUPDWR WRGRV RV UHJLVWUDGRUHV GH VHJPHQWR VmR LQLFLDOL]DGRV SHOR VLVWHPDRSHUDFLRQDOFRPRPHVPRYDORUGHPRGRTXHRSURFHVVDGRUHQ[HUJD DSHQDVXPVHJPHQWR&yGLJRGDGRVHSLOKDGHYHPVHUGLVSRVWRVGHPDQHLUDD QmR LQWHUIHULUHP XQV FRP RV RXWURV GD PHVPD IRUPD TXH QR FDVR GH SURFHVVDGRUHVTXHHQGHUHoDPDSHQDVN%GHPHPyULDFRPRR 3URJUDPDVFRPHVWHIRUPDWRGHYHPREHGHFHUjVVHJXLQWHVFRQYHQo}HV RDUTXLYRIRQWHQmRGHYHGHFODUDUVHJPHQWRGHSLOKD LVWRJHUDXPZDUQLQJGHOLQNDJHPTXHGHYHVHULJQRUDGR DGLUHWLYD$6680(QmRGHYHID]HUUHIHUrQFLDD66 PHVPR DVVLP D SLOKD SRGH VHU XWLOL]DGD QRUPDOPHQWH 63 p LQLFLDOL]DGRHP)))(+  D GLUHWLYD $6680( GHYH UHIHUHQFLDU &6 H '6 DPERV SDUD R PHVPR VHJPHQWR QmRGHYHKDYHUVHJPHQWRVHSDUDGRGHGDGRV GDGRVHFyGLJRGHYHPILFDUGHQWURGRPHVPRVHJPHQWR QHQKXPUHJLVWUDGRUGHVHJPHQWRGHYHVHULQLFLDOL]DGR DUTXLYRVFRPWrPXPFDEHoDOKRGHE\WHV RIIVHWVD))+ QRLQtFLR GRSURJUDPD RVHJPHQWRGHFyGLJRGHYHLQLFLDUFRP25*+ RHQGHUHoR+WHPTXHVHURSRQWRGHHQWUDGD QmRSRGHKDYHUGDGRVRXVXEURWLQDVDQWHVGHVVHHQGHUHoR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$PRQWDJHPHDOLQNDJHPGRSURJUDPDVmRIHLWDVGDPHVPDIRUPDFRPRQR FDVRGRVDUTXLYRVH[HFRPRVVHJXLQWHVSDVVRV
MASM <nome>,,,, LINK <nome>,,,,

'HSRLV GLVVR FRQYHUWHVH R DUTXLYR H[H HP XP DUTXLYR FRP 2 SURJUDPD TXHID]HVWDFRQYHUVmRFKDPDVHH[HELQH[H
EXE2BIN <nome>.exe <nome>.com

2H[HPSORDVHJXLUPRVWUDXPSURJUDPDVLPSOHVHVFULWRSULPHLUDPHQWHFRPR H[HHGHSRLVWUDQVIRUPDGRHPFRP&RPSDUHRVREVHUYDQGRDVFRQYHQo}HV DSUHVHQWDGDV

9HUVmRH[H
PILHA SEGMENT STACK DB 128 DUP(?) PILHA ENDS DADOS SEGMENT MSG1 DB Este programa DADOS ENDS CODIGO SEGMENT ASSUME CS:CODIGO, INICIO: MOV AX,DADOS MOV DS,AX ; MOV AH,09H LEA DX,MSG1 ; INT 21H ; MOV AH,4CH ; INT 21H CODIGO ENDS END INICIO

tem formato .exe.$

DS:DADOS, SS:PILHA Inicializacao de DS Aponta para o texto Escreve MSG1 na tela Termina e retorna ao DOS

9HUVmRFRP
CODIGO SEGMENT ASSUME CS:CODIGO, ORG 100H INICIO: MOV AH,09H LEA DX, MSG1 ; INT 21H ; MOV AH,4CH ; INT 21H MSG1 DB Este programa CODIGO ENDS END INICIO DS:CODIGO Aponta para o texto Escreve MSG1 na tela Termina e retorna ao DOS tem formato .com.$

$QH[R$GLUHWLYD$6680(
$ GLUHWLYD $6680( DVVRFLD XP UHJLVWUDGRU GH VHJPHQWR D XP VHJPHQWR GHWHUPLQDGR (VWD DVVRFLDomR SRGH SDUHFHU D SULQFtSLR GHVQHFHVViULD PDV p H[WUHPDPHQWH~WLOHPVLWXDo}HVFRPRDH[SOLFDGDDVHJXLU 6XSRQKD XP SURJUDPD TXH XWLOL]H RV GRLV VHJPHQWRV GH GDGRV DSUHVHQWDGRV DEDL[RHTXHSUHWHQGDHQGHUHoDU'$'26YLD'6H'$'26YLD(6
DADOS1 X1 Y1 Z1 DADOS1 DADOS2 X2 Y2 Z2 DADOS2 SEGMENT DB 01 DB 01 DB 01 ENDS SEGMENT DB 02 DB 02 DB 02 ENDS

2JUDQGHEHQHItFLRGDGLUHWLYD$6680(HVWiHPGLVSHQVDURSURJUDPDGRUGH HVFUHYHURSUHIL[RGHPRGLILFDomRGHVHJPHQWR VHJPHQWRYHUULGHSUHIL[ QDV LQVWUXo}HVTXHUHIHUHQFLDPGDGRVIRUDGRVHJPHQWRGHIDXOW 6HLVWRQmRIRVVHDVVLPHQWmRDVLQVWUXo}HVGHDFHVVRjVYDULiYHLV;<H= SUHFLVDULDP LQFOXLU R SUHIL[R GH PRGLILFDomR GH VHJPHQWR (6  FRPR SRU H[HPSORHP
MOV AL,ES:X2

TXHRDVVHPEOHUFRQVWUXLULDFRPR
MOV AL,ES:[0000H]

HPTXH+pRRIIVHWGDYDULiYHO;



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

(VWDDERUGDJHPWHULDGXDVJUDQGHVGHVYDQWDJHQV VHRSUHIL[RIRVVHHVTXHFLGRRDVVHPEOHUDLQGDXWLOL]DULDRRIIVHWGDYDULiYHO ;PDVJHUDULDRFyGLJR


MOV AL,[0000H]

HDFDEDULDHQGHUHoDQGRDYDULiYHO; VHDYDULiYHO;SUHFLVDVVHVHUPXGDGDSDUDRVHJPHQWR'$'26HQWmRR SURJUDPDGRU WHULD TXH SHUFRUUHU D OLVWDJHP H UHWLUDU R SUHIL[R GH PRGLILFDomRGHVHJPHQWRGHWRGDVDVLQVWUXo}HVTXHUHIHUHQFLDVVHP;GD PHVPD IRUPD XPD YDULiYHO SDVVDGD GR VHJPHQWR '$'26 SDUD R VHJPHQWR'$'26WHULDTXHUHFHEHURSUHIL[RHPWRGDVDVLQVWUXo}HVTXH DUHIHUHQFLDVVHP &RP D GLUHWLYD $6680( SRUpP QmR p QHFHVViULR XWLOL]DU R SUHIL[R GH PRGLILFDomR GH VHJPHQWR TXDQGR VH UHIHUHQFLD XPD YDULiYHO SHOR QRPH 2 DVVHPEOHUSURFXUDRQRPHGDYDULiYHOQRVVHJPHQWRVHJHUDRFyGLJRFRPR SUHIL[R GH PRGLILFDomR GH VHJPHQWR VH QHFHVViULR PHVPR TXH HVWH QmR DSDUHoDQRFyGLJRIRQWH (P WHUPRV GR H[HPSOR DQWHULRU LVWR VLJQLILFD TXH R FyGLJR JHUDGR SDUD D LQVWUXomR
MOV AL,Y2

VHULD
MOV AL,ES:[0001].

0DLV DLQGD VH < IRVVH PRYLGD SDUD R VHJPHQWR '$'26 R DVVHPEOHU SDVVDULD D JHUDU R FyGLJR FRUUHWR VHP SUHFLVDU GH TXDOTXHU DOWHUDomR QR SURJUDPDIRQWH $ WtWXOR GH H[HUFtFLR H[SHULPHQWH PRQWDU R SURJUDPD D VHJXLU JHUDQGR D OLVWDJHP /67  1HVWD OLVWDJHP REVHUYH TXH DR UHIHUHQFLDU DV YDULiYHLV GR VHJPHQWR '$'26 SDUD R TXDO YDOH $6680( (6  R PRQWDGRU LQFOXL DXWRPDWLFDPHQWH R SUHIL[R GH PRGLILFDomR GH VHJPHQWR UHFRQKHFtYHO SHOR FyGLJRKH[DGHFLPDO+([SHULPHQWHUHWLUDUDGLUHWLYDRXPXGDUYDULiYHLVGH XPVHJPHQWRRXWURDFRPSDQKDQGRRTXHRDVVHPEOHUID]
PILHA PILHA DADOS1 X1 Y1 Z1 DADOS1 SEGMENT STACK DB 128 DUP (?) ENDS SEGMENT DB 01 DB 01 DB 01 ENDS

$GLUHWLYD$6680(
DADOS2 X2 Y2 Z2 DADOS2 CODIGO START: SEGMENT DB 02 DB 02 DB 02 ENDS SEGMENT ASSUME CS:CODIGO, SS:PILHA, DS:DADOS1, ES:DADOS2 MOV AX,DADOS1 MOV DS,AX MOV AX,DADOS2 MOV ES,AX MOV X1,11H MOV Y1,11H MOV Z1,11H MOV X2,22H MOV Y2,22H MOV Z2,22H MOV AH,4CH ; TERMINAR INT 21H ENDS END START



CODIGO



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$QH[R3URJUDPDVFRP P~OWLSORVDUTXLYRV
4XDQGR VH WUDEDOKD FRP SURMHWRV PDLRUHV GHVHQYROYLGRV HP HTXLSH p LQWHUHVVDQWH GLVWULEXLU DV WDUHIDV GH LPSOHPHQWDomR GH FyGLJR 3DUD WDQWR DV IHUUDPHQWDVGHVRIWZDUH DVVHPEOHUOLQNHU GHYHPVHUFDSD]HVGH PRQWDU VHSDUDGDPHQWH GLIHUHQWHV DUTXLYRVIRQWH TXH UHIHUHQFLHP GDGRV H VXEURWLQDVXQVGRVRXWURV UHXQLU RV DUTXLYRVREMHWR JHUDGRV GHVWD IRUPD QXP ~QLFR DUTXLYR H[HFXWiYHO ([LVWHPDTXLGRLVSUREOHPDVFXMDVROXomRpGHVFULWDDVHJXLU 2SULPHLURSUREOHPDDSDUHFHTXDQGRXPDUTXLYRIRQWHUHIHUHQFLDXPVtPEROR GHFODUDGR HP RXWUR DUTXLYR 1HVWH FDVR VH QDGD IRU IHLWR R DVVHPEOHU JHUD XPDPHQVDJHPGHHUURUHFODPDQGRGRVtPERORGHVFRQKHFLGR3DUDHYLWDUTXH HVWHHUURVHMDJHUDGRXWLOL]DVHDGLUHWLYD(;751TXHGL]DRDVVHPEOHUSDUD LJQRUDURHUURSURPHWHQGROKHTXHROLQNHUHQFRQWUDUiRVtPERORPDLVWDUGH $VLQWD[HGDGLUHWLYDp (;751QRPHGRVtPERORH[WHUQR!WLSRGRVtPERORH[WHUQR! 3RUH[HPSORVHXPDUTXLYRIRQWHFRQWpPDOLQKD &$//)$53756+2:06* H6+2:06*pXPDVXEURWLQDGHILQLGDHPRXWURDUTXLYRHQWmRDGLUHWLYD (;7516+2:06*)$5 GHYHVHUFRORFDGD QR LQtFLR GR VHJPHQWR GH FyGLJR TXH FRQWpP R &$// 2 DVVHPEOHUJHUDUiHQWmRRFyGLJRFRUUHVSRQGHQWHD&$//FDEHQGR DR OLQNHU FRUULJLU R HQGHUHoR GH FKDPDGD TXDQGR UHXQLU RV GLIHUHQWHV DUTXLYRVREMHWR 2VHJXQGRSUREOHPDTXHWHPTXHVHUUHVROYLGRpTXHSRUGHIDXOWROLQNHUQmR WHPDFHVVRDRVVtPERORVGHFODUDGRVGHQWURGHXPDUTXLYRIRQWH3RUWDQWRQR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

H[HPSORDFLPDQmREDVWDTXHRDUTXLYRTXHFKDPDDVXEURWLQD6+2:06* VHMDOLQNDGRFRPRDUTXLYRREMHWRTXHFRQWpPVXDLPSOHPHQWDomReSUHFLVR GL]HU DR DVVHPEOHU Mi QD JHUDomR GR FyGLJR REMHWR TXH GLYXOJXH R VtPEROR 6+2:06* SDUD TXH R OLQNHU SRVVD HQFRQWUiOR PDLV WDUGH ,VWR VH ID] FRORFDQGRDGLUHWLYD 38%/,&6+2:06* QRLQtFLRGRDUTXLYRIRQWH $VOLVWDJHQVDVHJXLULOXVWUDPRTXHIRLGLWR

2PyGXORSULQFLSDO
(VWHPyGXORFKDPDDVXEURWLQD6+2:06*GHILQLGDHPRXWURPyGXOR3RU LVVRSUHFLVDGDGLUHWLYD(;751
PILHA SEGMENT STACK DW 80H DUP(?) PILHA ENDS DADOS SEGMENT MSG1 DB 'Foi chamada uma rotina de outro segmento.$',0DH,0AH DADOS ENDS CODE SEGMENT ASSUME CS:CODE,DS:DADOS,SS:PILHA EXTRN SHOWMSG:FAR ; AQUI!! START: MOV AX,DADOS MOV DS,AX LEA AX,MSG1 PUSH AX CALL FAR PTR SHOWMSG ADD SP,2 MOV AH,4CH INT 21H CODE ENDS END START

3URJUDPDVFRPP~OWLSORVDUTXLYRV



2PyGXORFRPDVXEURWLQDDX[LOLDU
(VWHPyGXORGHILQHDVXEURWLQD6+2:06*FKDPDGDHPRXWURPyGXOR3RU LVVRSUHFLVDH[SRUWiODFRPDGLUHWLYD38%/,&
PUBLIC SHOWMSG AUXCODE SEGMENT ASSUME CS:AUXCODE SHOWMSG PROC FAR PUSH BP MOV BP,SP MOV AH,09H MOV DX,[BP+6] INT 21H POP BP RET SHOWMSG ENDP AUXCODE ENDS END ; AQUI!!

3DUD FULDU R SURJUDPD H[HFXWiYHO SULPHLUR VH PRQWDP RV PyGXORV FRP R DVVHPEOHUXPGHFDGDYH](PVHJXLGDFKDPDVHROLQNHUSDVVDQGROKHFRPR SDUkPHWURVRVQRPHV GRV GRLV DUTXLYRVREMHWR D H[WHQVmR QmR p QHFHVViULD  3RU GHIDXOW R QRPH GR DUTXLYR H[HFXWiYHO VHUi R PHVPR GR SULPHLUR DUTXLYRREMHWRSDVVDGR 3RU H[HPSOR VH RV PyGXORV DFLPD IRUHP VDOYRV FRPR 7HVWDVP H 6KRZ0VJDVPUHVSHFWLYDPHQWHDJHUDomRGRH[HFXWiYHO7HVWH[HVHID]FRP
MASM TEST,,,, MASM SHOWMSG,,,, LINK TEST SHOWMSG,,,,



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$QH[R'LYLVmRGHQ~PHURV LQWHLURV
$ GLYLVmR GH Q~PHURV LQWHLURV HP SURJUDPDV HVFULWRV HP $VVHPEO\ p XP FDStWXORH[WHQVRTXH QmRVHUiDERUGDGRHPVXD WRWDOLGDGH DTXL1RHQWDQWRp PXLWR LQVWUXWLYR DSUHQGHU DR PHQRV FRPR VH ID] HVWD RSHUDomR HP DOJXQV FDVRV $ GLILFXOGDGH DVVRFLDGDDHVWDRSHUDomRpIUHTHQWHPHQWHVXEHVWLPDGD YLVWR TXH R OHLJR DVVXPH TXH D LQVWUXomR ',9 GR SURFHVVDGRU UHVROYHUi R SUREOHPD9HUHPRVDVHJXLUTXHLVWRQmRpDVVLPWmRVLPSOHV (PERUDRPDWHULDODSUHVHQWDGRDTXLVHMDLOXVWUDGRFRPFyGLJRSDUDRRV SULQFtSLRVVmRJHUDLVHSRGHPVHUDSOLFDGRVDRXWURVSURFHVVDGRUHV 2FRQMXQWRGHLQVWUXo}HVGRLQFOXLDLQVWUXomR',9TXHVHFRPSRUWDGH GXDVIRUPDVGLVWLQWDVGHSHQGHQGRGHRRSHUDQGRXWLOL]DGRVHUXPUHJLVWUDGRU GHRXGHELWV ',9UHJ!GLYLGH$;SHORUHJHFRORFDRTXRFLHQWHHP$/HRUHVWRHP $+ ',9UHJ!GLYLGH';$;SHORUHJHFRORFDRTXRFLHQWHHP$;HR UHVWRHP'; $ SULQFtSLR SRGH SDUHFHU TXH FRP D VHJXQGD DOWHUQDWLYD p SRVVtYHO GLYLGLU TXDOTXHUQ~PHURGHELWVSRURXWUR'HIDWRpSRVVtYHOGLYLGLUQ~PHURVGH ELWVSRUQ~PHURVGHELWVFRORFDQGRRVZRUGVTXHFRPS}HPRGLYLVRU HP '; H $; H R GLYLGHQGR SRU H[HPSOR HP %; H H[HFXWDQGR HQWmR D LQVWUXomR',9%; 1R HQWDQWR p LPSRUWDQWH FRQVLGHUDU TXH HVWD GLYLVmR Vy WHUi VXFHVVR VH R TXRFLHQWH IRU WDO TXH FDLED HP $; H SRUWDQWR PHQRU GR TXH + &DVR LVWR QmR DFRQWHoD R SURFHVVDGRU JHUD DXWRPDWLFDPHQWH XPD LQWHUUXSomR GH VRIWZDUH ,17 +  DFXVDQGR RYHUIORZ GH GLYLVmR 3RU H[HPSOR D LQVWUXomR FLWDGD SRGH VHU XWLOL]DGD SDUD GLYLGLU + SRU + R TXRFLHQWH p



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

$+ H R UHVWR +  PDV QmR SDUD GLYLGLU + SRU + FXMR TXRFLHQWHVHULD$%&+ 2TXHIRLGLWRDFLPDFRORFDSRUWDQWRRVHJXLQWHSUREOHPDFRPRXWLOL]DUGD PDQHLUD PDLV HILFLHQWH D LQVWUXomR ',9 SDUD ID]HU D GLYLVmR GH TXDOTXHU Q~PHUR GH  ELWV SRU TXDOTXHU Q~PHUR GH  ELWV" 2 WH[WR TXH VHJXH DSUHVHQWDXPDOJRULWPRFRPHVVDILQDOLGDGH 6HMD'XPQ~PHURGHELWVTXHGHYHVHUGLYLGLGRSRUGXPQ~PHURGH ELWV DPERV LQWHLURV VHP VLQDO (QWmR HVWDPRV LQWHUHVVDGRV HP FDOFXODU R TXRFLHQWHHRUHVWRGDGLYLVmR D   d 1RWHTXHRQ~PHUR'SRGHVHUHVFULWRQDIRUPD D = 10000 H D1 + D0   HPTXH D1 H D0 VmRUHVSHFWLYDPHQWHRVZRUGVPDLVHPHQRVVLJQLILFDWLYRV GH' 1RWH WDPEpP TXH FRP D LQVWUXomR ',9 VHPSUH VHUi SRVVtYHO GLYLGLU GRLV Q~PHURV GH  ELWV EDVWDQGR SDUD LVVR ID]HU '; + H FRORFDU R GLYLGHQGRHP$;3RULVVRpSRVVtYHOID]HUDGLYLVmR D1 d HHVFUHYHU D1 = q1d + r1   HP TXH q1  H r1  VmR UHVSHFWLYDPHQWH R TXRFLHQWH H R UHVWR GHVVD GLYLVmR &RORFDQGRHHPYHP 10000 H r1 + D0 D   = 10000 H q1 + d d $HTXDomRUHSUHVHQWDRSULPHLURSDVVRGDGLYLVmR(PSDUWLFXODUHVWiQRV GL]HQGRTXHVHIRUSRVVtYHOID]HUDGLYLVmR 10000 H r1 + D0  d H VH R UHVXOWDGR GHVWD MDPDLV SDVVDU GH ))))+ HQWmR q1  p R ZRUG PDLV VLJQLILFDWLYRGRUHVXOWDGRSURFXUDGR

'LYLVmRGHQ~PHURVLQWHLURV



9HUHPRVDJRUDTXHpH[DWDPHQWHLVWRTXHDFRQWHFHSRUTXHDGLYLVmRQXQFD SRGHFDXVDURYHUIORZ3DUDWDQWRFRQVLGHUHTXHRPDLRUYDORUTXH r1 SRGHWHU p d 1 HTXHRPDLRUYDORUTXH D0 SRGHWHUp))))+(QWmR 10000 H r1 + D0 10000 H (d 1) + FFFFH   d d TXHSRGHVHUWUDEDOKDGDSDUDVHFKHJDUD 10000 H r1 + D0 d 1   FFFFH + d d $ HTXDomR  QRV GL] TXH R PDLRU TXRFLHQWH TXH SRGH VHU REWLGR FRPR UHVXOWDGRGH  p))))+XPQ~PHURGHELWVHTXH PDLRUUHVWRp d 1  WDPEpP GH  ELWV 3RU LVVR R FiOFXOR GH   SRGH VHU IHLWR SHOD LQVWUXomR ',9FRORFDQGRVH r1 HP';H D0 HP $;(VWDGLYLVmRSHUPLWHHVFUHYHUR UHVXOWDGRGH  FRPR 10000 H r1 + D0  = q 0 d + r0  d HPTXH q 0 H r0 VmRRTXRFLHQWHHRUHVWRGDGLYLVmRUHVSHFWLYDPHQWH &RORFDQGRHPYHP r0 D  = 10000 H q1 + q 0 +  d d TXH VLJQLILFD TXH D GLYLVmR WHP SRU TXRFLHQWH R Q~PHUR GH  ELWV IRUPDGR SHORVZRUGV q1 H q 0 HTXHVHXUHVWRp r0  $HTXDomRSHUPLWHHQWmR HVFUHYHURVHJXLQWHDOJRULWPRSDUDID]HUDGLYLVmR SUHWHQGLGD  ID]HU'; H$;  D1   ID]HU%; G  H[HFXWDU',9%;TXHFRORFD q1 HP$;H r1 HP';  VDOYDU q1 FRPRZRUGPDLVVLJQLILFDWLYRGRTXRFLHQWH  FRORFDU D0 HP$; ';SHUPDQHFHFRP r1   H[HFXWDUQRYDPHQWH',9%;TXHFRORFD q 0 HP$;H r0 HP';  VDOYDU q 0 FRPRZRUGPHQRVVLJQLILFDWLYRGRTXRFLHQWH  VDOYDU r0 FRPRUHVWR 2 SURFHGLPHQWR DSUHVHQWDGR SRGH VHU JHQHUDOL]DGR SDUD GLYLGHQGRV PDLRUHV GRTXHELWV%DVWDFRPHoDUFRP'; H$; ZRUGPDLVVLJQLILFDWLYR HUHSHWLUDGLYLVmRDWpFKHJDUDRZRUGPHQRVVLJQLILFDWLYR



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

5HIHUrQFLDVELEOLRJUiILFDV
&RQFHLWRVEiVLFRVGH6LVWHPDV'LJLWDLV
>0RUV@ 0RUVH 6WHSKHQ 3 0LFURSURFHVVDGRUHV  $UTXLWHWXUD SURMHWR VLVWHPDV H SURJUDPDomR  (GLWRUD &DPSXV 5LR GH -DQHLUR  :DNHUO\-RKQ)6WRQH +DUROG 6DPXHO 'LJLWDO 'HVLJQ 3ULQFLSOHV DQG3UDFWLFHV3UHQWLFH+DOO  ,6%1 ,QWHO &RUSRUDWLRQ  $VVHPEO\ /DQJXDJH 3URJUDPPLQJ 0DQXDORUGHUQXPEHU 9LVFRQWL$QW{QLR&DUORV 0LFURSURFHVVDGRUHVH9RO 6RIWZDUH(GLWRUDeULFD/WGD  %URZQ 5DOI .\OH -LP 3& ,QWHUUXSWV $GGLVRQ:HVOH\  ,6%1 1RUWRQ3$LWNHQ3:LOWRQ5 $%tEOLDGR3URJUDPDGRU(GLWRUD &DPSXV  ,6%1 :DNHUO\-RKQ) 0LFURFRPSXWHU$UFKLWHFWXUHDQG 3URJUDPPLQJ-RKQ :LOH\ 6RQV1<  ,6%1 =HOHQRYVN\ 5 0HQGRQoD $ 3& 8P JXLD SUiWLFR GH KDUGZDUH H LQWHUIDFHDPHQWR0=(GLWRUD/WGD 

>:6@

0LFURSURFHVVDGRU
>,QWH@ >9LVF@

0LFURSURFHVVDGRU
>%.@ >1$:@ >:DNH@ >=0@

&RQVXOWHWDPEpPRLWHP /LQNV ,QWHUHVVDQWHV QD KRPHSDJH TXH Gi VXSRUWH D HVWHOLYURSDUDVDEHUFRPRREWHUOLYURVJUDWXLWRVGD,QWHUQHW



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

2XWURVOLYURVGHSURIHVVRUHVGR ((/8)6&

*HUDOGR.LQGHUPDQQ
 JHUDOGR#JSVHXIVFEU &XUWRFLUFXLWR  'HVFDUJDV$WPRVIpULFDV  &KRTXH(OpWULFR  3URWHomRGH6LVWHPDV(OpWULFRVGH3RWrQFLD 

*HUDOGR.LQGHUPDQQ-RUJH0DULR&DPSDJQROR
$WHUUDPHQWR(OpWULFR 

-3$VVXPSomR%DVWRV
MSDE#JUXFDGXIVFEU (OHWURPDJQHWLVPRH&iOFXORGH&DPSRV(GLWRUDGD8)6&  WHUFHLUDHGLomRHP



0LFURSURFHVVDGRUHVFRQFHLWRVLPSRUWDQWHV

6LGQHL1RFHWL)LOKR
VLGQHL#OLQVHXIVFEU )LOWURV6HOHWRUHVGH6LQDLV(GLWRUDGD8)6&