Program for encoding ASCII alpha numeric, Computer Engineering

Assignment Help:

Q. Program for encoding ASCII Alpha numeric?

; A program for encoding ASCII Alpha numeric.

; ALGORITHM:

            ; create the code table

            ; read an input string character by character

            ; translate it using code table 

            ; output the strings 

 DATA   SEGMENT

CODETABLE DB 48 DUP (0); no translation of first 

                                                ; 48 ASCII

                                    DB '4590821367'; ASCII codes 48 - 

                                                ; 57 ≡ (30h - 39h)

                                        DB 7 DUP (0); no translation of          these 7 characters

                                        DB    'GVHZUSOBMIKPJCADLFTYEQNWXR'

                                        DB 6 DUP (0); no translation

                                        DB  'gvhzusobmikpjcadlftyeqnwxr'

                                        DB 133 DUP (0); no translation of remaining 

                                                 ; Character

DATA ENDS

 

CODE SEGMENT

            MOV AX, DATA

            MOV DS, AX   ; initialize DS

            MOV BX, OFFSET CODETABLE; point to lookup table

GETCHAR:     

            MOV AH, 06; console input no wait

            MOV DL, 0FFh   ; specify input request

            INT 21h; call DOS

            JZ QUIT   ; quit if no input is waiting

            MOV DL, AL   ; save character in DL

            XLAT CODETABLE; translate the character

            CMP AL, 0; translatable?

            JE PUTCHAR   ; no: write it as is.

            MOV DL, AL; yes: move new character

                                    ; To DL

PUTCHAR:     

   MOV AH, 02   ; write DL to output 

   INT 21h  

   JMP   GETCHAR; get another character

QUIT:             MOV AX, 4C00h  

   INT 21h  

CODE ENDS    

END

Discussion: 

The program above will code the data. For illustration a line from an input file will be encoded:

A SECRET Message                          (Read from an input file)

G TUHFUY Juttgou                           (Encoded output)

The program above can be run by using following command line. If program file name is coding.asm

Coding infile > outfile 

The infile is input data file and outfile is output data file.

You can write more such applications by using 8086 assembly tables.


Related Discussions:- Program for encoding ASCII alpha numeric

How many chips will be required in a microprocessor , A microprocessor uses...

A microprocessor uses RAM chips of 1024 × 1 capacity. (i) How many chips will be required and how many address lines will be connected to provide capacity of 1024 bytes. (ii) How

Interaction design, This unit introduces the most important ID terminology,...

This unit introduces the most important ID terminology, explains why ID is important, and gives a description of the main ID activities and the characteristics of the ID process. I

Which device changes from serial data to parallel data, Which device change...

Which device changes from serial data to parallel data ? Ans. Demultiplexer is the device that changes from serial data to parallel data. Demultiplexer takes data in from on

Connector of conventional keyboard, 5-pin DIN connector: It is the conn...

5-pin DIN connector: It is the connector of conventional keyboard which have 5 pins (2 IN, 2 OUT and one ground pin) used for transfer and synchronization.

Summary of tasks, Summary of Tasks Task Summary attempts to show amoun...

Summary of Tasks Task Summary attempts to show amount of duration every task has spent starting from beginning of task until its completion on any processor as displayed in Fi

What is a virtual address, Q. What is a virtual address? Von Neumann ha...

Q. What is a virtual address? Von Neumann had suggested that execution of a program is possible only if program and data are residing in memory. In such a condition program len

Simplify pos expression, Q. For function F(X, Y, Z) = ∑(1, 2, 3, 5, 6) usin...

Q. For function F(X, Y, Z) = ∑(1, 2, 3, 5, 6) using TRUTH TABLE only 1.  Find POS expression 2.  Simplify POS expression 3.  Implement this simplified expression using t

Describe the different types of frequency hoping, Question: (a) What ...

Question: (a) What are the main challenges for Mobile Computing? (b) What is the ISM band and what is particular about this frequency band? Name two wireless technologies

Explian service topologies, Explian Service Topologies Service Topolog...

Explian Service Topologies Service Topologies In a service-based architecture there increase dependencies between services resulting from cooperation

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd