SOCS

87
1 SOCS Hoofdstuk 3 Basisprogrammatuu r

description

SOCS. Hoofdstuk 3 Basisprogrammatuur. Inhoud. De Vertaler De Voorvertaler De Lader De Binder De Vertolker Het Speurprogramma Het Opstarten van de Computer. Inhoud. De Vertaler De Voorvertaler De Lader De Binder Verantwoording Modules + Vertaler directieven Taken van de Binder - PowerPoint PPT Presentation

Transcript of SOCS

Page 1: SOCS

1

SOCS

Hoofdstuk 3

Basisprogrammatuur

Page 2: SOCS

2

Inhoud

De Vertaler De Voorvertaler De Lader De Binder De Vertolker Het Speurprogramma Het Opstarten van de Computer

Page 3: SOCS

3

Inhoud

De Vertaler De Voorvertaler De Lader De Binder

Verantwoording Modules + Vertaler directieven Taken van de Binder Werking van de Binder Van Bron-programma tot Uitvoering

De Vertolker Het Speurprogramma Het Opstarten van de Computer

Page 4: SOCS

4

Project

VertaleVertalerr

7299999999…

2131000000…

…12210000109999999999…

druk: DRU …

som: OPT R0,b…

main: … BIG R0,a STPa: RESGR 1

VertaleVertalerr

VertaleVertalerr

Vertaalde ModuleModule

Page 5: SOCS

5

Binder

BinderBinder

7299999999…

2131000000…

…12210000109999999999…

Vertaalde Module

7299999999…

21310000400040…

…122100006600669999999999…

Uitvoerbaar programma

Page 6: SOCS

6

Zelfde Resultaat

VertaleVertalerr

SamengevoegdeModules

druk: DRU …

som: OPT R0,b…

main: … BIG R0,a STPa: RESGR 1

7299999999…

21310000400040…

…122100006600669999999999…

Uitvoerbaar programma

Page 7: SOCS

7

Verantwoording

Samenvoegen van bronprogramma: Unieke symbolische adressen ? Stricte afspraken nodig

Hervertaling duurt langer Verbetering fout in een module

Programmabibliotheken Reeds vertaalde deelprogramma’s

Vb. parse (ASCII-string binair getal), sqrt, sort, …

Broncode niet beschikbaar Bovendien onpraktisch om manueel samen

te voegen

Page 8: SOCS

8

Modules

Gedeelte van een programma Hoofdprogramma Procedure of Functie

Verwijzigingen symbolische adressen uit andere modules

main: … SBR kwad …

Module A

…kwad: … HIA R0,A …

Module B

*** fout *** lijn 17: ‘kwad’ niet gedefinieerd*** fout *** lijn 17: ‘kwad’ niet gedefinieerd

Page 9: SOCS

9

Vertaler directieven

EXTERN symbolisch_adresEXTERN symbolisch_adres symb.adres is in een andere module gedefinieerd

GLOBAAL symbolisch_adresGLOBAAL symbolisch_adres andere module mag naar symb.adres verwijzen

EXTERN kwadEXTERN kwadmain: … SBR kwad …

Module A

GLOBAAL kwadGLOBAAL kwad…kwad: … HIA R0,A …

Module B

Page 10: SOCS

10

Vertaler directieven

STARTPR adresSTARTPR adres De uitvoering start bij “adres” Moet in 1 module aanwezig zijn

EXTERN kwadSTARTPR mainSTARTPR mainmain: … SBR kwad …

Module A

GLOBAAL kwad…kwad: … HIA R0,A …

Module B

Page 11: SOCS

11

Objectmodule

Resultaat van vertaling van module Machinecode Niet uitvoerbaar!

Onvolledig Sommige adressen onbekend

(externe symbolische adressen) Reloceerbaar

Samenvoegen (niet allemaal vanaf 0000)

Vertaler genereert steeds objectmodule

Page 12: SOCS

12

Objectmodule Uitvoerbaar programma

0000000100

1131100001…

0000000200

#symbolen …

Type Type

Lengte Lengte

Startadres Startadres

Symbool-Symbool-tabeltabel

HoofdingHoofding0000000024002400000000020002

99999999999999999999

Object-Object-modulemodule

0000000100

1131100001

……

0000000200

0000000086008600000000020002

99999999919999999991

#symbolen … #relocatie …

Relocatie-Relocatie-& Bindings-& Bindings-tabeltabel

#reloc/bind. … …

Machine-Machine-CodeCode

UitvoerbaarUitvoerbaarprogrammaprogramma

Page 13: SOCS

13

Informatie: Vertaler Binder

Objectmodule = reloceerbaar Relocatie-informatie Externe symbolische adressen?

Niet gekend, dus 0000 en informatie voor binder Relocatie- en bindingstabel Relatief-adres +/-BewerkingRelatief-adres +/-Bewerking

Uitgebreide symbooltabel Naam Waarde TypeNaam Waarde Type

Type = lokaal, globaal, extern

Page 14: SOCS

14

Voorbeeld STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Page 15: SOCS

15

Afspraak

HIA.w 0,9995(-)HIA.w 0,9995(-)

HIA.w R0,EIND-MACHT

11110099951111009995

VertaleVertalerr

Schrijven als …

Page 16: SOCS

16

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

0 PPTT

1 LLTT

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

Page 17: SOCS

17

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

0 PPTT

1 LLTT

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

Page 18: SOCS

18

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

0 PPTT

2 LLTT

Page 19: SOCS

19

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

0 PPTT

3 LLTT

2

Page 20: SOCS

20

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

2 PPTT

4 LLTT

3

Page 21: SOCS

21

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

3 PPTT

5 LLTT

4

Page 22: SOCS

22

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

4 PPTT

6 LLTT

5

Page 23: SOCS

23

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

5 PPTT

7 LLTT

6

Page 24: SOCS

24

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

6 PPTT

8 LLTT

7

Page 25: SOCS

25

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

7 PPTT

9 LLTT

8

Page 26: SOCS

26

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

7 PPTT

10 LLTT

8

Page 27: SOCS

27

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

0 PPTT

1 LLTT

-1 StSt

Page 28: SOCS

28-1 StSt

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

0 PPTT

1 LLTT

2

Page 29: SOCS

29

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

0 PPTT

2 LLTT

2 StSt

Page 30: SOCS

30

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

0 PPTT

3 LLTT

2

0000000100000000010000000010000000001000

2 StSt

Page 31: SOCS

31

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

2 PPTT

4 LLTT

3

00000001000000000100

0002 +EIND0002 +EIND

00000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)

2 StSt

0002 -#LAADADRES#0002 -#LAADADRES#

0000 – 0005 = 99950000 – 0005 = 9995

Page 32: SOCS

32

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

3 PPTT

5 LLTT

4

00000001000000000100

0002 +EIND0002 +EIND

00000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)DRUDRU

2 StSt

0002 -#LAADADRES#0002 -#LAADADRES#

Page 33: SOCS

33

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

4 PPTT

6 LLTT

5

00000001000000000100

0002 +EIND0002 +EIND

00000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)DRUDRUHIA.d 1,0001(-)HIA.d 1,0001(-)

2 StSt

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#

0000 + 1 = 00010000 + 1 = 0001

Page 34: SOCS

34

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

5 PPTT

7 LLTT

6

00000001000000000100

0002 +EIND0002 +EIND

00000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)DRUDRUHIA.d 1,0001(-)HIA.d 1,0001(-)SBR.d 0000(-)SBR.d 0000(-)

2 StSt

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#0005 +KWAD0005 +KWAD

Page 35: SOCS

35

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

6 PPTT

8 LLTT

7

00000001000000000100

0002 +EIND0002 +EIND

00000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)DRUDRUHIA.d 1,0001(-)HIA.d 1,0001(-)SBR.d 0000(-)SBR.d 0000(-)DRUDRU

2 StSt

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#0005 +KWAD0005 +KWAD

Page 36: SOCS

36

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

7 PPTT

9 LLTT

8

00000001000000000100

0002 +EIND0002 +EIND

00000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)DRUDRUHIA.d 1,0001(-)HIA.d 1,0001(-)SBR.d 0000(-)SBR.d 0000(-)DRUDRUSTPSTP

2 StSt

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#0005 +KWAD0005 +KWAD

Page 37: SOCS

37

Vertaler Binder

STARTPR PRG EXTERN KWAD,EINDX: 100; 1000PRG: HIA.w R0,EIND-MACHT DRU HIA R1,X+1MACHT: SBR KWAD DRU STP EINDPR

Vertaler (2de stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

8 PPTT

10 LLTT

00000001000000000100

0002 +EIND0002 +EIND

00000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)DRUDRUHIA.d 1,0001(-)HIA.d 1,0001(-)SBR.d 0000(-)SBR.d 0000(-)DRUDRUSTPSTP

2 StSt

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#0005 +KWAD0005 +KWAD

Page 38: SOCS

38

0000000100

HIA.w 0,9995(-)

HIA.d 1,0001(-)DRU

0000001000

SBR.d 0000(-)DRUSTP

Vertaler Binder8 PPTT

0000000100000000010000000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)DRUDRUHIA.d 1,0001(-)HIA.d 1,0001(-)SBR.d 0000(-)SBR.d 0000(-)DRUDRUSTPSTP

2 StSt

0002 +EIND0002 +EIND0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#0005 +KWAD0005 +KWAD

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

0000000008000800000000020002

99999999999999999999

Page 39: SOCS

39

Vertaler Binder8 PPTT

0000000100000000010000000010000000001000HIA.w 0,9995(-)HIA.w 0,9995(-)DRUDRUHIA.d 1,0001(-)HIA.d 1,0001(-)SBR.d 0000(-)SBR.d 0000(-)DRUDRUSTPSTP

2 StSt

0002 +EIND0002 +EIND0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#0005 +KWAD0005 +KWAD

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

KWADKWAD ?? externextern

EINDEIND ?? externextern

XX 00 lokaallokaal

PRGPRG 22 lokaallokaal

MACHTMACHT 55 lokaallokaal

#symbolenKWAD ???? ???? externEIND ???? ???? externX 0000 0000 lokaal

PRG 0002 0002 lokaalMACHT 0005 0005 lokaal

#relocatie/binding#relocatie/binding

0002 +EIND0002 +EIND

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +KWAD+KWAD

Page 40: SOCS

40

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

0 PPTT

1 LLTT

Page 41: SOCS

41

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM ? ? globaalglobaal

KWADKWAD ? ? globaalglobaal

EINDEIND ? ? globaalglobaal

0 PPTT

1 LLTT

Page 42: SOCS

42

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM ? ? globaalglobaal

KWADKWAD ? ? globaalglobaal

EINDEIND ? ? globaalglobaal

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

0 PPTT

2 LLTT

1

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 0 0 globaalglobaal

KWADKWAD ? ? globaalglobaal

EINDEIND ? ? globaalglobaal

Page 43: SOCS

43

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD ?? globaalglobaal

EINDEIND ?? globaalglobaal

1 PPTT

3 LLTT

2

Page 44: SOCS

44

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD ?? globaalglobaal

EINDEIND ?? globaalglobaal

2 PPTT

4 LLTT

3

Page 45: SOCS

45

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD ?? globaalglobaal

EINDEIND ?? globaalglobaal

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND ?? globaalglobaal

3 PPTT

5 LLTT

4

Page 46: SOCS

46

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND ?? globaalglobaal

4 PPTT

6 LLTT

5

Page 47: SOCS

47

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND ?? globaalglobaal

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND ?? globaalglobaal

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

5 PPTT

7 LLTT

6

Page 48: SOCS

48

Vertaler Binder

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Vertaler (1ste stap):

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

6 PPTT

8 LLTT

Page 49: SOCS

49

Vertaler BinderVertaler (2de stap):

0 PPTT

1 LLTT

-1 StSt

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 50: SOCS

50

Vertaler BinderVertaler (2de stap):

0 PPTT

1 LLTT

-1 StSt

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 51: SOCS

51

Vertaler BinderVertaler (2de stap):

0 PPTT

2 LLTT

1

SBR.d 0003(-)SBR.d 0003(-)

-1 StSt

0000 +#LAADADRES#0000 +#LAADADRES#

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 52: SOCS

52

Vertaler BinderVertaler (2de stap):

1 PPTT

3 LLTT

2

SBR.d 0003(-)SBR.d 0003(-)VER.w 0,0000(1)VER.w 0,0000(1)

-1 StSt

0000 +#LAADADRES#0000 +#LAADADRES#

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 53: SOCS

53

Vertaler BinderVertaler (2de stap):

2 PPTT

4 LLTT

3

SBR.d 0003(-)SBR.d 0003(-)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTG

-1 StSt

0000 +#LAADADRES#0000 +#LAADADRES#

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 54: SOCS

54

Vertaler BinderVertaler (2de stap):

3 PPTT

5 LLTT

4

SBR.d 0003(-)SBR.d 0003(-)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTGHIA.w 0,0000(1)HIA.w 0,0000(1)

-1 StSt

0000 +#LAADADRES#0000 +#LAADADRES#

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 55: SOCS

55

Vertaler BinderVertaler (2de stap):

4 PPTT

6 LLTT

5

SBR.d 0003(-)SBR.d 0003(-)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTGHIA.w 0,0000(1)HIA.w 0,0000(1)VER.w 0,0000(1)VER.w 0,0000(1)

-1 StSt

0000 +#LAADADRES#0000 +#LAADADRES#

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 56: SOCS

56

Vertaler BinderVertaler (2de stap):

5 PPTT

7 LLTT

6

SBR.d 0003(-)SBR.d 0003(-)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTGHIA.w 0,0000(1)HIA.w 0,0000(1)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTG

-1 StSt

0000 +#LAADADRES#0000 +#LAADADRES#

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 57: SOCS

57

Vertaler BinderVertaler (2de stap):

6 PPTT

8 LLTT

SBR.d 0003(-)SBR.d 0003(-)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTGHIA.w 0,0000(1)HIA.w 0,0000(1)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTG

-1 StSt

0000 +#LAADADRES#0000 +#LAADADRES#

GLOBAAL DDM,KWAD,EINDDDM: SBR KWAD VER R0,R1 KTGKWAD: HIA R0,R1 VER R0,R1EIND: KTG EINDPR

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

Page 58: SOCS

58

Vertaler Binder6 PPTT

SBR.d 0003(-)SBR.d 0003(-)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTGHIA.w 0,0000(1)HIA.w 0,0000(1)VER.w 0,0000(1)VER.w 0,0000(1)KTGKTG

-1 StSt

0000 +#LAADADRES#0000 +#LAADADRES#

Symb.Symb.AdresAdres

Abs.Abs.AdresAdres

TypeType

DDMDDM 00 globaalglobaal

KWADKWAD 33 globaalglobaal

EINDEIND 55 globaalglobaal

SBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

#relocatie/binding#relocatie/binding

0000 +#LAADADRES#0000 +#LAADADRES#

#symbolenDDM 0000 0000 globaalKWAD 0003 0003 globaal

EIND 0005 0005 globaal

000000000600069999999999

99999999999999999999

Page 59: SOCS

59

Taken van de binder

Plaats voorzien voor de modules Machinecode samenvoegen Code reloceren Externe referenties in rekening brengen Startadres bepalen (Relocatietabel genereren)

Page 60: SOCS

60

Werking van de binder

Twee stappen: Stap 1: allocatie en globale symbooltabel Stap 2: code samenvoegen, reloceren, binden, …

Page 61: SOCS

61

Stap 1: Allocatie- en globale symbooltabel

Allocatietabel Beginadres van elke module bepalen

Globale Symbooltabel globale etiketten globale symbooltabel

Gebruikte delen van objectmodules: Hoofding Symbooltabel

Page 62: SOCS

62

AllocatietabelAllocatietabel

ModuleModule BeginadresBeginadres

Stap 1: Allocatie- en globale symbooltabel

0000000008000800000000020002

99999999999999999999

#symbolenKWAD ???? ???? externEIND ???? ???? externX 0000 0000 lokaal

PRG 0002 0002 lokaalMACHT 0005 0005 lokaal

CODE

Relocatie/Binding

Module AModule A

AllocatietabelAllocatietabel

ModuleModule BeginadresBeginadres

AA 00000000

Globale SymbooltabelGlobale Symbooltabel

EtiketEtiket AdresAdres

0 PPTT

A00000000

00080008

8

Page 63: SOCS

63

Stap 1: Allocatie- en globale symbooltabel

#symbolenDDM 0000 0000 globaalKWAD 0003 0003 globaal

EIND 0005 0005 globaal

000000000600069999999999

99999999999999999999

CODE

Relocatie/Binding

Module BModule B

AllocatietabelAllocatietabel

ModuleModule BeginadresBeginadres

AA 00000000

Globale SymbooltabelGlobale Symbooltabel

EtiketEtiket AdresAdres

8 PPTT

A00000000

00080008

AllocatietabelAllocatietabel

ModuleModule BeginadresBeginadres

AA 00000000

BB 00080008B

00140014

14

0000 + 0008 = 00080000 + 0008 = 0008

Page 64: SOCS

64

Stap 1: Allocatie- en globale symbooltabel

#symbolenDDM 0000 0000 globaalKWAD 0003 0003 globaal

EIND 0005 0005 globaal

000000000600069999999999

99999999999999999999

CODE

Relocatie/Binding

Module BModule B

Globale SymbooltabelGlobale Symbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

14 PPTT

A00000000

00080008B

AllocatietabelAllocatietabel

ModuleModule BeginadresBeginadres

AA 00000000

BB 00080008

00140014

0003 + 0008 = 00110003 + 0008 = 0011

Page 65: SOCS

65

Stap 1: Allocatie- en globale symbooltabel

#symbolenDDM 0000 0000 globaalKWAD 0003 0003 globaal

EIND 0005 0005 globaal

000000000600069999999999

99999999999999999999

CODE

Relocatie/Binding

Module BModule B

Globale SymbooltabelGlobale Symbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

14 PPTT

A00000000

00080008B

AllocatietabelAllocatietabel

ModuleModule BeginadresBeginadres

AA 00000000

BB 00080008

00140014

0005 + 0008 = 00130005 + 0008 = 0013

Page 66: SOCS

66

Stap 1: Allocatie- en globale symbooltabel

#symbolenDDM 0000 0000 globaalKWAD 0003 0003 globaal

EIND 0005 0005 globaal

000000000600069999999999

99999999999999999999

CODE

Relocatie/Binding

Module BModule B

Globale SymbooltabelGlobale Symbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

14 PPTT

A00000000

00080008B

AllocatietabelAllocatietabel

ModuleModule BeginadresBeginadres

AA 00000000

BB 00080008

00140014

Page 67: SOCS

67

Stap 2: Samenvoegen, reloceren en binden

Code van alle modules samenvoegen Relocatie/Binding m.b.v. Relocatie/Bindingstabel

Adres +#LAADADRES# + beginadres van Module

Adres +EXTERN + waarde van globaal symbool

Startadres bepalen startadres + beginadres van de module

Symbooltabel toevoegen Relocatietabel aanmaken

Page 68: SOCS

68

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,9995(-)

HIA.d 1,0001(-)DRU

0000001000

SBR.d 0000(-)DRUSTPSBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

SamenvoegenSamenvoegen

Page 69: SOCS

69

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,9995(-)

HIA.d 1,0001(-)DRU

0000001000

SBR.d 0000(-)DRUSTPSBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

#relocatie/binding#relocatie/binding

0002 +EIND0002 +EIND

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +KWAD+KWAD

Module AModule A

Globale Globale SymbooltabelSymbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

SamenvoegenReloceren + BindenReloceren + Binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

Page 70: SOCS

70

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,9995(-)

HIA.d 1,0001(-)DRU

0000001000

SBR.d 0000(-)DRUSTPSBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

#relocatie/binding#relocatie/binding

0002 +EIND0002 +EIND

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +KWAD+KWAD

Module AModule A

Globale Globale SymbooltabelSymbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

9995 + 0013 - 0000 = 00089995 + 0013 - 0000 = 0008

SamenvoegenReloceren + BindenReloceren + Binden

0002 + 0000 = 00020002 + 0000 = 0002

Page 71: SOCS

71

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,00080008(-)

HIA.d 1,0001(-)DRU

0000001000

SBR.d 0000(-)DRUSTPSBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

#relocatie/binding#relocatie/binding

0002 +EIND0002 +EIND

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +KWAD+KWAD

Module AModule A

Globale Globale SymbooltabelSymbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

0001 + 0000 = 00010001 + 0000 = 0001

SamenvoegenReloceren + BindenReloceren + Binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

0004 + 0000 = 00040004 + 0000 = 0004

Page 72: SOCS

72

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,00080008(-)

HIA.d 1,00010001(-)DRU

0000001000

SBR.d 0000(-)DRUSTPSBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

#relocatie/binding#relocatie/binding

0002 +EIND0002 +EIND

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +KWAD+KWAD

Module AModule A

Globale Globale SymbooltabelSymbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

0000 + 0011 = 00110000 + 0011 = 0011

SamenvoegenReloceren + BindenReloceren + Binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

0005 + 0000 = 00050005 + 0000 = 0005

Page 73: SOCS

73

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,00080008(-)

HIA.d 1,00010001(-)DRU

0000001000

SBR.d 00110011(-)DRUSTPSBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

#relocatie/binding#relocatie/binding

0002 +EIND0002 +EIND

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +KWAD+KWAD

Module AModule A

Globale Globale SymbooltabelSymbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

SamenvoegenReloceren + BindenReloceren + Binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

Page 74: SOCS

74

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,00080008(-)

HIA.d 1,00010001(-)DRU

0000001000

SBR.d 00110011(-)DRUSTPSBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

Globale Globale SymbooltabelSymbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

Module BModule B

#relocatie/binding#relocatie/binding

0000 +#LAADADRES#0000 +#LAADADRES#

SamenvoegenReloceren + BindenReloceren + Binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

Page 75: SOCS

75

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,00080008(-)

HIA.d 1,00010001(-)DRU

0000001000

SBR.d 00110011(-)DRUSTPSBR.d 0003(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

Globale Globale SymbooltabelSymbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

Module BModule B

#relocatie/binding#relocatie/binding

0000 +#LAADADRES#0000 +#LAADADRES#

0003 + 0008 = 00110003 + 0008 = 0011

SamenvoegenReloceren + BindenReloceren + Binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

0000 + 0008 = 00080000 + 0008 = 0008

Page 76: SOCS

76

Stap 2: Samenvoegen, reloceren en binden

0000000100

HIA.w 0,00080008(-)

HIA.d 1,00010001(-)DRU

0000001000

SBR.d 00110011(-)DRUSTPSBR.d 00110011(-)

KTG

VER.w 0,0000(1)HIA.w 0,0000(1)

VER.w 0,0000(1)

KTG

Module BModule B

Globale Globale SymbooltabelSymbooltabel

EtiketEtiket AdresAdres

DDMDDM 00080008

KWADKWAD 00110011

EINDEIND 00130013

00

11

22

33

44

55

66

77

88

99

1010

1111

1212

1313

#relocatie/binding#relocatie/binding

0000 +#LAADADRES#0000 +#LAADADRES#

SamenvoegenReloceren + BindenReloceren + Binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

Page 77: SOCS

77

Stap 2: Samenvoegen, reloceren en binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

0002 + 0000 = 00020002 + 0000 = 0002

Module AModule A

0000000008000800000000020002

99999999999999999999

SamenvoegenReloceren + BindenStartadresStartadres 00020002

Page 78: SOCS

78

Stap 2: Samenvoegen, reloceren en binden

Module AModule A

#symbolenKWAD ???? ???? externEIND ???? ???? externX 0000 0000 lokaal

PRG 0002 0002 lokaalMACHT 0005 0005 lokaal

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

#symbolen

X 00000000PRG 00020002MACHT 00050005

0000 + 0000 = 00000000 + 0000 = 00000002 + 0000 = 00020002 + 0000 = 00020005 + 0000 = 00050005 + 0000 = 0005

SamenvoegenReloceren + BindenStartadres 0002

SymbooltabelSymbooltabel

Page 79: SOCS

79

Stap 2: Samenvoegen, reloceren en binden

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

#symbolen

X 00000000PRG 00020002MACHT 00050005

Module BModule B

#symbolenDDM 0000 0000 globaalKWAD 0003 0003 globaal

EIND 0005 0005 globaal

DDM 00080008KWAD 00110011EIND 00130013

0000 + 0008 = 00080000 + 0008 = 00080003 + 0008 = 00110003 + 0008 = 00110005 + 0008 = 00130005 + 0008 = 0013

SamenvoegenReloceren + BindenStartadresSymbooltabelSymbooltabel

0002

Page 80: SOCS

80

Stap 2: Samenvoegen, reloceren en binden

SamenvoegenReloceren + Binden

#relocatie/binding#relocatie/binding

0002 +EIND0002 +EIND

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +KWAD+KWAD

Module AModule A

StartadresSymbooltabel

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

0002 + 0000 = 00020002 + 0000 = 00020004 + 0000 = 00040004 + 0000 = 00040005 + 0000 = 00050005 + 0000 = 0005

#relocatie#relocatie

0002 +#LAADADRES#0002 +#LAADADRES#

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +#LAADADRES#+#LAADADRES#

RelocatietabelRelocatietabel

0002

Page 81: SOCS

81

Stap 2: Samenvoegen, reloceren en binden

SamenvoegenReloceren + BindenStartadresSymbooltabel

AllocatietabelAllocatietabel

Mod.Mod. BeginadresBeginadres

AA 00000000

BB 00080008

0000 + 0008 = 00080000 + 0008 = 0008

#relocatie#relocatie

0002 +#LAADADRES#0002 +#LAADADRES#

0002 -#LAADADRES#0002 -#LAADADRES#0004 +#LAADADRES#0004 +#LAADADRES#00050005 +#LAADADRES#+#LAADADRES#

RelocatietabelRelocatietabel

Module BModule B

#relocatie/binding#relocatie/binding

0000 +#LAADADRES#0000 +#LAADADRES#

00080008 +#LAADADRES#+#LAADADRES#

0002

Page 82: SOCS

82

Stap 2: Samenvoegen, reloceren en binden

SamenvoegenReloceren + BindenStartadresSymbooltabel

#relocatie#relocatie

0002 +#LAADADRES#0002 +#LAADADRES#

0002 -#LAADADRES#0002 -#LAADADRES#

RelocatietabelRelocatietabel0004 +#LAADADRES#0004 +#LAADADRES#00050005 +#LAADADRES#+#LAADADRES#

00080008 +#LAADADRES#+#LAADADRES#

0002

Page 83: SOCS

83

Stap 2: Samenvoegen, reloceren en binden

SamenvoegenReloceren + BindenStartadresSymbooltabel

#relocatie#relocatie

RelocatietabelRelocatietabel

0004 +#LAADADRES#0004 +#LAADADRES#00050005 +#LAADADRES#+#LAADADRES#

00080008 +#LAADADRES#+#LAADADRES#

0002

Page 84: SOCS

84

Stap 2: Uitvoerbaar programma

#relocatie#relocatie

0004 +#LAADADRES#0004 +#LAADADRES#00050005 +#LAADADRES#+#LAADADRES#

00080008 +#LAADADRES#+#LAADADRES#

#symbolen

X 00000000PRG 00020002MACHT 00050005DDM 00080008KWAD 00110011EIND 00130013

0000000100

HIA.w 0,00080008(-)

HIA.d 1,00010001(-)DRU

0000001000

SBR.d 00110011(-)DRUSTPSBR.d 00110011(-)

KTGVER.w 0,0000(1)

VER.w 0,0000(1)HIA.w 0,0000(1)

KTG

0000000014001400000000020002

99999999919999999991

Page 85: SOCS

85

Programmabibliotheek

Bij vertaler Verzameling subroutines

Vertaald Samengevoegd in bibliotheek

Binder: Symbolisch adres niet gedefinieerd

Gezocht in de bibliotheek

Page 86: SOCS

86

RAM

Van bronprogramma tot Uitvoerbaar programma

Module A(met macro’s)

Module B(met macro’s)

Module A(zonder macro’s)

Objectmodule A

VoorvertalerVoorvertaler

VertalerVertaler

BinderBinder

UitvoerbaarProgramma

Module B(zonder macro’s)

Objectmodule B

VoorvertalerVoorvertaler

VertalerVertaler

Programma-bibliotheek

LaderLader

UitvoerbaarProgramma

Broncode

Machinecode

Legende:

Page 87: SOCS

87

Cursustekst

Hoofdstuk 3: pag. 63 pag. 77