answersLogoWhite

0

; count_chars.asm ; counts the number of characters of a zero terminated string. name "counter" org 100h jmp start str1 db 'abcdefg hijklmnop qrstvuwxyz', 0 start: lea bx, str1 ; load address of string. mov ax, 0 ; reset counter. compare: cmp [bx], 0 ; is it end of string? je done ; if zero, then it's the end. inc ax ; count char. inc bx ; next memory position in string. jmp compare ; print result in binary: done: mov bx, ax mov cx, 8 print: mov ah, 2 ; print function. mov dl, '0' test bl, 10000000b ; test first bit. jz zero mov dl, '1' zero: int 21h shl bl, 1 loop print ; print binary suffix: mov dl, 'b' int 21h ; wait for any key press.... mov ah, 0 int 16h ret

; ; count_chars.asm ; counts the number of characters of a zero terminated string. name "counter" org 100h jmp start str1 db 'abcdefg hijklmnop qrstvuwxyz', 0 start: lea bx, str1 ; load address of string. mov ax, 0 ; reset counter. compare: cmp [bx], 0 ; is it end of string? je done ; if zero, then it's the end. inc ax ; count char. inc bx ; next memory position in string. jmp compare ; print result in binary: done: mov bx, ax mov cx, 8 print: mov ah, 2 ; print function. mov dl, '0' test bl, 10000000b ; test first bit. jz zero mov dl, '1' zero: int 21h shl bl, 1 loop print ; print binary suffix: mov dl, 'b' int 21h ; wait for any key press.... mov ah, 0 int 16h ret

;

User Avatar

Wiki User

17y ago

What else can I help you with?

Continue Learning about Engineering

Why are assemblers used?

to translate mnemonic operation codes to their machine language equivalents and assigning machine address to symbolic labels used by the programmer.


What are the advantages using c?

control, control, control. the original c code had a 1 to 1 mapping between commands and assembly codes, so a programmer could in theory do anything that was possable in assembly in c.


What are the drawbacks of assembly level language?

The assembly language does not support object oriented program so they change to c and c++ the c++ will support object oriented program this are the demerits of assembly language.


Is Assembly-language programs are written using binary codes?

Assembly language allows the developer to have almost total control over what the sequence of instructions will be when a program executes. A compiler tries to translate a high level language such as C++ into a series of instructions, but a good assembly language programmer may be able to optimize the sequence when a compiler cannot. Primarily assembly language is used for speed and optimal machine code.


Why assembly language is still needed if you have hll offering sophisicated tools?

Yes, assembly language is definitely still used. Many I/O drivers and much of the bootstrap code that starts a computer must be written in assembly language as high level languages do not provide means for coding certain special purpose instructions needed for these operations. Also high level languages usually require that subroutine library codes be available, while assembly language does not. As these subroutine library codes usually cannot be loaded until the Operating System is up and running, assembly language must be used for much of the code that bootstraps the computer and loads the Operating System.

Related Questions

What program can translate mnemonic codes used?

Programs that can translate mnemonic codes are typically called assemblers. Assemblers convert assembly language, which uses mnemonic codes for instructions, into machine code that computers can execute. Some popular assemblers include NASM (Netwide Assembler), MASM (Microsoft Macro Assembler), and GAS (GNU Assembler). These tools are essential for low-level programming and system software development.


Why are assemblers used?

to translate mnemonic operation codes to their machine language equivalents and assigning machine address to symbolic labels used by the programmer.


The acceptable treatment of slaves was detailed in the slave codes.?

Whipping, beating,molesting etc.


What do the numbers mean on hazardous placards?

For detailed descriptions of the codes used follow the related link.


What is Pakistan zip code?

Different cities have different codes and countries don't have zip codes. Detailed list of Zip Codes of all cities of Pakistan can be found on Wikipedia.


What does the order of the bases in DNA ultimately?

Order of bases in a gene codes for the amino acid assembly into a protein.


Will disconnecting battery clear abs codes on 99 Chevy blazer?

you probably need to repalce one of the front wheel bearings(hub assembly). the sensor for the abs is located in the assembly


How do you get codes off of 1999-2003 windstar?

The "Related Questions" below cover the Check Engine Light and retrieving the diagnostic trouble codes (DTC).Lots of detailed information and guidance...


How do you interpret circuit diagrams wiring diagrams and specifications used for the assembly?

Circuit diagrams represent the electrical connections and components in a system, using standardized symbols to indicate parts like resistors, capacitors, and power sources. Wiring diagrams provide a more detailed view, showing the physical layout and connections between components, often including color codes for wires. Specifications outline the required characteristics and performance standards for each component, guiding assembly and ensuring compatibility. Together, these documents enable accurate assembly and troubleshooting of electrical systems.


What are the advantages using c?

control, control, control. the original c code had a 1 to 1 mapping between commands and assembly codes, so a programmer could in theory do anything that was possable in assembly in c.


What is the zip code for London Heathrow?

The UK doesn't use ZIP codes, it uses post codes which are much more detailed, so each of the five terminals at Heathrow will have its own post code.


What is the cpt code for hysteroscopy?

You can use code range 58555-58565 depending on what services are performed. Supercoder.com has detailed info of these codes.

Trending Questions
What is a bar of steel called? Is this true or false.Two functions are defined with the same name and same return type the first one accepts string input parameter type and the second accepts integer this represents abstraction? What are 2 technologies that were used in the past? Write c plus plus program that compare 3 integer numbers and print out the smallest one among them? What is the inversion temperature of Helium at a pressure of 330 bars? What are the uses of logical operators in Java? What size resistor is needed to drop 12 volt dc to 3 volt what is the formula? What is the water distribution system of river Ganges in an urban or rural area? What is the interface between the application language and high level language? How do you save a notepad file into a java file? What is unearthed DC system? Does the law that makes sending or posting annoying messages without using your real name make most message boards illegal? How do you embed music in an HTML document? What do you call a human born as another creature? How do you Calculate the capacity of a crude oil pipeline? What does a GMO label look like? What is the prototype of a copy constructor for a class X? Can you clean a urethane sealed wood floor with a steam cleaner? Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store An Invoice should include four pieces of information as instance variables a part n? Why do you drill extra holes in the circuit board before soldering wires?