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

Placement algorithm - process allocation, Placement algorithm - computer ar...

Placement algorithm - computer architecture: Different strategies can be taken as to how space is allocated to processes: First fit : Allocate the first hole that is la

Show the connections used in sound cards, Q. Show the Connections used in S...

Q. Show the Connections used in Sound cards? Sound cards must have connections to allow different functions.  One of the most significant is MIDI port (MIDI signifies Musical I

How the simulation is done - Weather simulation, How the simulation is done...

How the simulation is done -  Information from the satellites/sensors sent to computer -  This data is compared to information stored on files ..... -  ..... Which contain kno

What is game playing ai, This covers a number of game playing methods, nota...

This covers a number of game playing methods, notably checkers and backgammon because so much good research has been completed on these problems and because so many different metho

What is trp, TRP is the number of clock cycles required to terminate access...

TRP is the number of clock cycles required to terminate access to an open row of memory, and open access to the next row. It stand for row precharge time.

Explain functions introduction, Common used functions are placed within lib...

Common used functions are placed within libraries in the SQABasic directory. Files ending with ".SBH" have the public interface they give to other libraries and scripts. Files endi

What is instruction register, Q. What is Instruction Register? Instruct...

Q. What is Instruction Register? Instruction Register (IR): Here instructions are loaded before execution. Comments on figure above are as below: All representations are

How many bits require in TCP protocol header checksum, In TCP protocol head...

In TCP protocol header "checksum" is of___________? In protocol header of Transfer Control Protocol checksum is of 16 bits.

Arrays of any size, Modify your program so that the line "int numStones = u...

Modify your program so that the line "int numStones = ui.readStones();" in the Game constructor is considered. Depending on the value of numStones read from the user, you should cr

Implement the concept of true and radix minus one complement, Q. Develop a...

Q. Develop a program to implement the concept of true and radix minus one complement. Program should ask for radix and two numbers from that radix. For that two numbers program

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