Sunteți pe pagina 1din 4

1/29/13

Single pass assembler in c language

Sign In | Sign Up

Ask us anything

GO

Answers members: Username

Single pass assembler in c language?


Computer Programming Questions
Answers.com > Wiki Answers > Categories > Technology > Computers > Computer Programming > C Programming
Ads

Password

Lost password?

Remember me

ASM Assembler to C Tools


Automatically convert Assembly to C ASM360 ASM370 ASM390 HLASM. Low $. www.mpsinc.com/

Sign in

.NET Programming C omputer Programming C omputers Technology

Contributors
Supe rvisors

Ganderton

View Slide Show Best Answer


Question - Implement a single pass assembler. Program #include "stdio.h" #include "stdlib.h" #include "string.h" int count[20]; void main() { FILE *f1,*f2,*f3,*f4; int linenumber,locctr,f; char lbl[10],mne[10],opd[10],ch,mneu1[10],sval[10]; char sadr[10],slbl[10],op1[10],label[10]; void wordcount(); printf("Word count for Input Program:"); wordcount(); printf("\n Output \n"); printf("\n Source Code \t Object code \n\n"); f1=fopen("INPUT.C","r"); f2=fopen("SYMTAB.C","w+"); f4=fopen("INTER.C","w"); fscanf(f1,"%s %s %x\n",lbl,mne,&locctr); linenumber=2; while(!feof(f1)) { if(count[linenumber]==1) { fscanf(f1,"%s\n",mne); fprintf(f4,"%x\t%s",locctr,mne); } if(count[linenumber]==2) { fscanf(f1,"%s%s\n",mne,opd); fscanf(f4,"%X \t %s \t %s \n",locctr,mne,opd); printf("%s\t%s\t",mne,opd); f3=fopen("OPCODE.C","r"); while(!feof(f3)) { fscanf(f3,"%s %s \n",mneu1,op1); if(strcmp(mne,mneu1)==0) printf("%s\t",op1); } fclose(f3); f=0; rewind(f2); while(!feof(f2)) { fscanf(f2,"%s %s %s \n",sadr,slbl,sval); if(strcmp(opd,slbl)==0) { printf("%s\n\n",sadr);

Trust: 4098 Technology Supervisor Google Profile Recommend Superviso

Help Us Improve
Answer Rating
Rate This Answer

Like

Be the first of your friends to like

Recommend this Answer

Questions that People need Answ

What is the difference between earthi and lightning conductor? In: The Difference
Between

Did Coretta Scott king have brothers? In: African-American


History

What happens when a drug partly bloc membranes potassium channels? In: Medication and Drugs

What is a monthly salary for a nurse in Trinidad? In: Salary and Pay Rates

wiki.answers.com/Q/Single_pass_assembler_in_c_language

1/4

1/29/13

Single pass assembler in c language


f=1; } } if(f==0) printf("0000\n"); } if(count[linenumber]==3) { fscanf(f1,"%s %s %s \n",lbl,mne,opd); fprintf(f4,"%X \t %s \t %s \t %s \n",locctr,lbl,mne,opd); fprintf(f2,"%X \t %s \t %s \n", locctr, lbl,opd); if((strcmp(mne,"RESW")==0) || (strcmp(mne,"RESB")==0)) printf("%s \t %s \t 00 \t 000 %s \n\n",lbl,mne,opd); else printf("%s \t %s \t 00 \t 000 %s \n\n",lbl,mne,opd); } linenumber+=1; if(strcmp(mne,"WORD")==0) locctr+=3; else if(strcmp(mne,"BYTE")==0) locctr+=strlen(opd); else if(strcmp(mne,"RESW)==0) locctr+=3 * (atoi(opd)); else if(strcmp(mne,"RESB")==0) locctr+=atoi(opd); else locctr+=3; } fclose(f1); fclose(f2); fclose(f4); getch(); } void wordcount() { FILE *f3; char c; int word=0,i=1; printf("\n Word Count"); f3=fopen("INPUT.C","r"); c=fgetc(f3); while(c!=EOF) { if(c==' ') word+=1; if(c=='\n') { word+=1; count[i]=word; printf("\n No.of words in %d:%d",r,word); i+=1; word=0; } c=fgetc(f3); } fclose(f3); } INPUT.c WC START 1000 FIRST WORD 5 SECOND WORD 6 THIRD RESW 1 LDA FIRST ADD SECOND STA THIRD END OPCODE.c LDA 00 ADD 18 SUB 1C STA 0C SYMTAB.c FIRST 1009 SECOND 100C THIRD 100F INTER.c 1000 LDA FIRST 1003 ADD SECOND 1006 STA THIRD 1009 FIRST WORD 100C SECOND WORD 100F THIRD RESW

wiki.answers.com/Q/Single_pass_assembler_in_c_language

2/4

1/29/13
1012 END 1015 ENDL

Single pass assembler in c language

Related Answers: Single pass assembler?


Single Pass Assembler . A single pass assembler scans the program only once and creates

In programming language C what is meant by assembler?


an assembler is a program,just like a compiler.that processes staaements written in a particular

Related Videos:

Men Sunglasses- 50% Off


Jabong.com/Sunglasses_Sale

How to Use C# - 01 Introduction

Exclusive Collection, Best Price Cash On Delivery - Free Shipping !

EliteMatrimony.com
www.elitematrimony.com/Know_more Exclusive Matchmaking Service From BharatMatrimony for Rich & Affluent

C# - 03 - Compile and Run

Related Answers: What is the Design of single pass assembler?


A hammer, one pass and you're done

C# - 02 - Hello World

Why c language is called as c language?

Labs by Key Thompson.\n The C itself is improvement on the B language

Why c language is called c language?


The language it was originally based on was called B.

Ayumilove Haskell Programming Tutorial Part 3

Is c language regular language?

it is not regular language .it is high level language

Recent Answers Activity


How many Canadian players are in the nhl in 2013?
ask e d 33 se conds ago

What is the correct tyre size for a citroen c3 desire?


ask e d 36 se conds ago

Aura Lee Joya updated What is the Lesson of the witch by edilberto tiempo?
update d 39 se conds ago

Where is gold found in Pakistan?


answe re d 42 se conds ago

Imo pop answered Did William Shakespeare have children with Anne Hathaway?
answe re d 42 se conds ago MORE RECENT UPDATES

Searching for Single pass assembler in c language:

Today's Top MMA Rates


Browse Top 25 Money Market Rates. Sort by APY,Reviews, Banks.

www.Bankaholic.com

Searching for Single pass assembler in c language:

Home Loan EMI Calculator Your Daily Dose Of Fun

www.ApnaPaisa.com/emicalculator

How much EMI will you have to pay? Just enter amount, tenure & rate.
http://www.india.com/
A ds by C hitika

With Bollywood Gossip, Pics, Cars, Gadgets & More - On India.com!

Answers Properties
Answers Wiki Answers Video Answers Local Answers Online Answers Shop Answers

Company
About Careers Terms of Use

Community
Guidelines Reputation Roles

Updates
Email Watchlist RSS

wiki.answers.com/Q/Single_pass_assembler_in_c_language

3/4

1/29/13
Guides Coupons ResellerRatings Surveys Blog Sitemap

Single pass assembler in c language


Privacy Policy IP Issues Disclaimer
International sites English De utsch Espaol Franais Italiano

Help

Copyright 2012 A nswers Corporation

wiki.answers.com/Q/Single_pass_assembler_in_c_language

4/4

S-ar putea să vă placă și