-
Under the version (XP system) the debugging passes.
dseg segment
buf db 5,-4,0,3,100,-51cnt dw $-bufplus db "y=1",0ah,0dh,"$"
zero db "y=0",0ah,0dh,"$"
minu db "y=-1",0ah,0dh,"$"
dseg ends
cseg segment
assume cs:cseg,ds:dsegbegin: mov ax,dsegmov ds,ax
lea si,buf
mov cx,cnt
next: mov al,[si]and al,al
js fujz ling
lea dx,plus
jmp disp
fu: lea dx,minujmp disp
ling: lea dx,zerodisp: mov ah,9
int 21h
inc si
loop next
mov ah,4ch
int 21h
cseg ends
end begin
-
This is a program with a two-cycle structure.
Outer loop: controls the read character and determines whether the "e" determines whether the loop continues or ends;
Inner Circulation: The number of occurrences of "1" is recorded by shifting left and judging the state of the CF flag.
The procedure is as follows, and it has been debugged.
cseg segment
assume cs:cseg
begin:
mov ah,1
int 21h;Enter a character.
cmp al,'e'
jz stop;If it is "e", then go to stopxor dl, dl; Register zero for recording 1 number.
mov cx,8;The inner layer is cycled 8 times.
next: shl al,1;Shift 1 bit to the left, the highest is to move in cfjnc skip; If cf=0, go to skipinc dl; CF=1, DL increases by 1
skip: loop next;cx-1, if cx is not zero, then go to the next loop execution.
or dl,30h;Convert the number of occurrences of 1 to the corresponding ASCII code.
mov ah,2
int 21h;The number 2 function is called to display the number of times 1.
mov dl,0ah
int 21h
mov dl,0dh
int 21h;Show wrap carriage returns.
jmp begin;Go to Begin and read in the next character.
stop: mov ah,4ch
int 21h;End of program.
cseg ends
end begin
-
mov ax,var
cmp ax,0 )
jz zero ;is equal to 0, then turn.
jg great;If it is greater than 0, it will be turned.
mov ax, 0ffffh;Less than 0
jmp short next
zero: mov ax,0
jmp next )
great: mov ax,0001h
next: mov result,ax
-
① inc s10 ;The number of 100 is added to 1
jmp short change_addr ;short is a pseudo command, and the redirected label is change addr
loop compare ;Circulate.
-
data1 starts as the hexadecimal number corresponding to (256-35), 33h, 35h
data2 starts at the lower 16 digits of the hexadecimal number corresponding to (65536-35), the upper sixteen digits, 33h, 00,00,00,35h,00,00,00
-
data1 dd,35
data2 ffdd,0035
But in memory, the storage is high and low. That is, the high position is at the high address, and the status is at the low address.
I don't know what you told him, and I don't know what you did to be sorry for your friends before, why did it become a loose meal, even if you scolded you, I didn't know what to scold you, how to evaluate you? >>>More
There is no suitable idiom.
It means that there is nothing to be done. >>>More
Well, don't say I didn't tell you, the constellations are based on the solar calendar. So first use the perpetual calendar to find out that your solar birthday is Saturday, October 23, 1993. Also, I've never heard of horoscopes having to divide into morning and afternoon >>>More
The Hermit Doesn't Meet".
Gia Island. Panasonic asked the boy, and the teacher went to collect medicine. >>>More
1. My happiness is to watch you be happy.
2. Life is simple and charming, and people's hearts are simple and happy; Learning to be simple is not simple. >>>More