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

Illustration of code conversion, Program: A good illustration of code conve...

Program: A good illustration of code conversion: Write a program to convert a; 4-digit BCD number into its binary equivalent. BCD number is stored as a; word in memory location kno

Example on cyclic distribution of data, Q. Example on Cyclic Distribution o...

Q. Example on Cyclic Distribution of data? !HPF$ PROCESSORS P1(4) !HPF$ TEMPLATE T1(18) !HPF$ DISTRIBUTE T1(CYCLIC) ONTO P1 The result of these instructions is display

Determine the operations from functions, Operations from Functions As ...

Operations from Functions As we know, function is actually operations on object. These   functions could be simple and summarized on object model. Organise functions into oper

Average number of instructions, Consider a processor with a 4-stage pipelin...

Consider a processor with a 4-stage pipeline. Each  time a conditional branch is encountered, the pipeline must be flushed (3 partially completed instructions are lost). Determine

Describe the various signalling techniques, Describe the various signalling...

Describe the various signalling techniques. Signaling systems link the variety of transmission systems, switching systems and subscriber elements in telecommunication network

DISCRETE STRUCTURES, SET 2I OF ALL INTEGERS WITH ZERO IS AN ABELIAN GROUP

SET 2I OF ALL INTEGERS WITH ZERO IS AN ABELIAN GROUP

Define mercantile process model from perspect of merchant, Define Mercantil...

Define Mercantile Process Model from the Merchant’s perspective along with a suitable diagram. This model consists of three activities into the purchase consummation phase: Aut

Contact-based keyboards, Contact-based keyboards employ switches directly. ...

Contact-based keyboards employ switches directly. Though they have a comparatively shorter life they are the most preferred type these days because of their lower cost.  Three such

Explain the matlab language, This is a high-level matrix/array language wit...

This is a high-level matrix/array language with control flow statements, functions, data structures, input/output, and object-oriented programming features. It permits both "progra

Disc shapes and diameters - computer architecture, Disc shapes and diameter...

Disc shapes and diameters:     A Mini-CD is 8 centimeters in diameter. The digital data on a CD start at the center of the disc and proceeds toward the edge, whi

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