Current location - Quotes Website - Personality signature - Find: 1 with the assembly language of single chip microcomputer, and count the number of positive and negative numbers (excluding zero) in a string of data.
Find: 1 with the assembly language of single chip microcomputer, and count the number of positive and negative numbers (excluding zero) in a string of data.
ORG 0000H

LJMP 0 100H

ORG 0 100H

MOV R7,#06H

MOV R0,#30H

MOV R 1, # 00H stores numbers less than 0.

MOV R2, # 00H stores a number equal to 0.

MOV R3, # 00H stores numbers greater than 0.

Starting: MOV A, @R0

CJNE A, #00H, loop

SJMP slope 1

Loop: JC SLOOP0

JNC SLOOP2

SLOOP0:INC R 1

The next one is SJMP

SLOOP 1:INC R2

The next one is SJMP

SLOOP2:INC R3

The next one is SJMP

Next: INC R0

DJNZ R7, go

MOV 22H,R3

MOV 2 1H,R 1

R2 MOV 20H

end

If you want to send it, you must have an address. I did it.

A set of 8-bit signed numbers are stored in 30h-35h cells of on-chip RAM, and the numbers of cells greater than 0, less than 0 and equal to 0 are counted, and the results are stored in 20H, 2 1H and 22H cells off-chip respectively.

You can use it if you change it. If you can change it, you won't ask me again.