Systems Programming Fundamentals

Systems Programming Fundamentals
Slide Note
Embed
Share

Systems programming involves the study of compilers, assemblers, and low-level programming languages to create efficient software solutions. This includes single-pass assemblers, forward references, and examples of assembly language programming.

  • Systems Programming
  • Assemblers
  • Forward References
  • Single Pass
  • Assembly Language

Uploaded on Mar 06, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Subject : Systems Programming Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  2. Single Pass Assembler Forward reference: reference to a label that is defined later in the program. START 200 ADD AREG A .. .. What is Forward reference ??Eg.. A DS 2 .. .. END Table of Incomplete Instruction Instruction Address Symbol 200 A .. .. Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  3. Single Pass Assembler Forward reference: reference to a label that is defined later in the program. START 200 ADD AREG A Symbol Address .. .. A A DS 2 .. .. END Table of Incomplete Instruction Instruction Address Symbol 200 A .. .. Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  4. Single Pass Assembler Forward reference: reference to a label that is defined later in the program. START 200 Target Code ADD AREG A 200 01 01 - .. .. .. .. .. A DS 2 202 .. .. END Table of Incomplete Instruction Instruction Address Symbol Symbol Address Target Code 200 01 01 202 A 202 200 A .. .. .. .. .. .. .. .. 202 Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  5. Single pass Assembler Examples SOURCE PROGRAM TARGET CODE TII INSTRUCTI ON Address SYMBOL START 101 READ N 101 09 - 101 N MOVER BREG, ONE 102 04 02 - 102 ONE MOVEM BREG, TERM 103 05 02 - 103 TERM AGAIN MULT BREG, TERM 104 03 02 - 104 TERM MOVER CREG, TERM 105 04 03 - 105 TERM ADD CREG, ONE 106 01 03 - 106 ONE MOVEM CREG, TERM 107 05 03 - 107 TERM COMP CREG, TERM 108 06 03 - 108 TERM BC LE, AGAIN 109 07 02 104 110 RESULT MOVEM BREG, RESULT 110 05 02 - 111 RESULT PRINT RESULT 111 10 - Symbol Table STOP 112 00 SYMBOL ADDRESS N DS 1 113 N 113 RESULT DS 1 114 115 ONE DC 1 ONE 115 116 TERM DS 1 TERM 116 END RESULT 114 Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  6. Single pass Assembler Examples TII SOURCE PROGRAM TARGET CODE INSTRUCTI ON Address SYMBOL START 101 READ N 101 09 113 101 N MOVER BREG, ONE 102 04 02 115 102 ONE MOVEM BREG, TERM 103 05 02 116 103 TERM AGAIN MULT BREG, TERM 104 03 02 116 104 TERM MOVER CREG, TERM 105 04 03 116 105 TERM ADD CREG, ONE 106 01 03 115 106 ONE MOVEM CREG, TERM 107 05 03 116 107 TERM COMP CREG, TERM 108 06 03 116 108 TERM BC LE, AGAIN 109 07 02 104 110 RESULT MOVEM BREG, RESULT 110 05 02 114 111 RESULT PRINT RESULT 111 10 114 Symbol Table STOP 112 00 SYMBOL ADDRESS N DS 1 113 N 113 RESULT DS 1 114 ONE 115 ONE DC 1 115 TERM 116 TERM DS 1 116 AGAIN 104 END RESULT 114 Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  7. Design of Two Pass Assembler PASS I Separate the symbol, mnemonic opcode,and operand fields. Build the symbol table Perform LC processing Construct intermediate code PASS II Synthesize the target code Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  8. Required Data Structures for Two Pass Assembler MOT Register Value Table Conditional Value Table Source Code Input Prerequisite Intermediate Code Symbol Table Literal Table Pool Table Output Input PASS II PASS I Output Machine Code Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  9. Assembler Pass I INTERMEDIATE CODE SOURCE PROGRAM (AD,01) (C,200) START 200 200 (IS,04) 1 (L,01) MOVER AREG, = 5 201 (IS,05) 1 (S,01) MOVEM AREG, A 202 (IS,04) 1 (S,01) LOOP MOVER AREG, A 203 (IS,04) 3 (S,03) MOVER CREG, B 204 (IS,01) 3 (L,02) ADD CREG, = 1 (AD,05) LTORG 205 005 NEXT1 SUB AREG, =1 206 001 ORIGIN LOOP+1 207 (IS,02) 1 (L,03) MULT CREG, B (AD,03) (S,02)+(C,1) A DS 2 203 (IS,03) 3 (S,03) BACK EQU LOOP 204 (DL,02) (C,02) B DC 1 (AD,04) (S,02) END 206 (DL,02) (C,02) (AD,02) 207 001 Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  10. Assembler Pass I SOURCE PROGRAM INTERMEDIATE CODE START 200 (AD,01) (C,200) MOVER AREG, = 5 200 (IS,04) 1 (L,01) MOVEM ADD, A 201 (IS,05) 1 (S,01) LOOP MOVER AREG, A 202 (IS,04) 1 (S,01) MOVER CREG, B 203 (IS,04) 3 (S,03) ADD CREG, = 1 204 (IS,01) 3 (L,02) LTORG (AD,05) NEXT1 SUB AREG, =1 205 005 ORIGIN LOOP+1 206 001 MULT CREG, B 207 (IS,02) 1 (L,03) A DS 1 (AD,03) (S,02)+(C,1) BACK EQU LOOP 203 (IS,03) 3 (S,03) B DS 1 204 (DL,02) (C,01) END (AD,04) (S,02) 205 (DL,02) (C,01) (AD,02) 206 001 Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  11. Assembler Pass I SYMBOL TABLE INTERMEDIATE CODE INDEX SYMBOL ADDRESS LENGTH (AD,01) (C,200) 01 A 204 2 200 (IS,04) 1 (L,01) 02 LOOP 202 1 201 (IS,05) 1 (S,01) 03 B 205 1 202 (IS,04) 1 (S,01) 04 NEXT1 207 1 203 (IS,04) 3 (S,03) 204 (IS,01) 3 (L,02) 05 BACK 202 1 (AD,05) LITERAL TABLE 205 005 INDEX LITERAL ADDRESS 206 001 01 = 5 205 207 (IS,02) 1 (L,03) 02 = 1 206 (AD,03) (S,02)+(C,1) 03 = 1 207 203 (IS,03) 3 (S,03) 204 (DL,02) (C,02) POOL TABLE (AD,04) (S,02) LIT_INDEX 206 (DL,02) (C,02) #01 (AD,02) #03 207 001 Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  12. Assembler Examples Convert Source code into Pass I & Pass II START 100 EXAMPLE 2 MOVER AREG, = 5 SIMPLE START 100 ADD CREG, = 1 BALR 15, 0 A DS 3 USING *, 15 L1 MOVER AREG, B LOOP L R1, TWO ADD AREG, C A R1, FOUR MOPVEM AREG, D ST R1, FOUR LTORG CLI FOUR+3, 4 D EQU A+1 BNE LOOP L2 PRINT D BR 14 ORIGIN A-1 R1 EQU 1 SUB AREG, = 1 TWO DC F 2 MULT CREG, B FOUR DS F C DS 5 END ORIGIN L2+1 STOP ASSUME:-BALR & BR are of two bytes . L,A,ST,CLI,BNE are of four byte instructions B DC 19 END Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  13. Intermediate Code Forms Variant I Variant II SOURCE PROGRAM VARIANT I VARIANT -II START 200 (AD,01) (C,200) (AD,01) (C,200) READ A (IS,09) (S,01) (IS,09) A LOOP MOVER AREG, A (IS,04) AREG, A (IS,04) 1 (S,01) : : : : : : SUB AREG, = 1 (IS,02) AREG, (L,01) (IS,02) 1 (L,01) Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  14. Assembler Pass II INTERMEDIATE CODE TARGET CODE (AD,01) (C,200) 200 (IS,04) 1 (L,01) 200 04 1 205 201 (IS,05) 1 (S,01) 201 05 1 204 202 (IS,04) 1 (S,01) 202 04 1 204 203 (IS,04) 3 (S,03) 203 04 3 205 204 (IS,01) 3 (L,02) 204 01 3 206 (AD,05) 205 005 205 005 206 001 206 001 207 (IS,02) 1 (L,03) 207 02 1 207 (AD,03) (S,02)+(C,1) 203 (IS,03) 3 (S,03) 203 03 3 205 204 (DL,02) (C,02) 204 (AD,04) (S,02) 206 (DL,02) (C,02) 206 (AD,02) 207 001 207 001 Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  15. Assembler Examples SOURCE PROGRAM INTERMEDIATE CODE START 1000 (AD,01) (C,1000) READ N 1000 (IS,09) (S,01) MOVER B, = 1 1001 (IS,04) 2 (L,01) MOVEM B, TERM 1002 (IS,05) 2 (S,02) AGAIN MULT B, TERM 1003 (IS,03) 3 (S,02) MOVER C, TERM 1004 (IS,05) 3 (S,02) ADD C, = 1 1005 (IS,01) 3 (L,01) MOVEM C, TERM 1006 (IS,05) 3 (S,02) COMP C, N 1007 (IS,06) 3 (S,01) BC LE, AGAIN 1008 (IS,07) 2 (S,03) MOVEM B, RESULT 1009 (IS,05) 2 (S,04) LTORG ()AD,05) PRINT RESULT 1010 (L,01) STOP 1011 (IS,10) (S,04) N DS 1 1012 (IS,00) 1013 (DL,02) (C,01) RESUL T DS 20 1014 (DL,02) (C,20) TERM DS 1 1034 (DL,02) (C,01) (AD,02) END Hope Foundation s ,International Institute of Information Technology, I IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

  16. THANK YOU For Details feel free to contact Prof. Sameer Mamadapure sameerm@isquareit.edu.in Department of Information Technology Hope Foundation s International Institute of Information Technology, P-14 Rajiv Gandhi Infotech Park, MIDC Phase I Hinjawadi, Pune 411 057 Phone - +91 20 22933441 www.isquareit.edu.in | info@isquareit.edu.in

More Related Content