求用汇编语言编一个很简单的程序。。。

求8*8 点阵显示出 数字6 即可。。。。。。全部代码。。
2024-12-03 14:47:33
推荐回答(3个)
回答1:

TIMES EQU 40H ;循环次数
COL EQU 41H ;决定扫描哪一列
NUM EQU 42H ;决定列显示代码
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN: MOV TIMES,#00H
MOV COL,#00H
MOV NUM,#00H
LOOP: MOV P3,#00H ;在下一次显示之前清除原有显示代码
MOV DPTR,#TAB0
MOV A,NUM
MOV B,#8
MUL AB
ADD A,COL
ADD A,#8H ;考虑到表中第一行为列显示代码
MOVC A,@A+DPTR
CPL A
MOV P1,A ;列显示代码
MOV A,COL
MOVC A,@A+DPTR ;取代码
MOV P3,A ;决定哪一列显示
CALL DELAY
INC COL
MOV A,COL
CJNE A,#8,LOOP ;判断是否扫完8列
MOV COL,#00H
INC TIMES
MOV A,TIMES
CJNE A,#200,LOOP
MOV TIMES,#00H
INC NUM
MOV COL,#00H
MOV A,NUM
CJNE A,#10H,LOOP ;判断是否扫描完0~F
MOV NUM,#00H
LJMP LOOP
DELAY: MOV R5,#01
D2: MOV R6,#01
D1: MOV R7,#248
DJNZ R7,$
DJNZ R6,D1
DJNZ R5,D2
RET
TAB0: DB 001H,002H,004H,008H,010H,020H,040H,080H ;从第1列到第8列的列扫描码
TAB1: DB 01CH,022H,022H,022H,022H,022H,022H,01CH ; 0
DB 008H,00CH,008H,008H,008H,008H,008H,01CH ; 1
DB 01CH,022H,022H,010H,008H,004H,002H,03EH ; 2
DB 01CH,022H,020H,018H,020H,020H,022H,01CH ; 3
DB 010H,018H,014H,014H,012H,03CH,010H,038H ; 4
DB 03EH,002H,002H,01EH,020H,020H,022H,01CH ; 5
DB 01CH,022H,002H,01EH,022H,022H,022H,01CH ; 6
DB 03EH,012H,010H,008H,008H,008H,008H,008H ; 7
DB 01CH,022H,022H,01CH,022H,022H,022H,01CH ; 8
DB 01CH,022H,022H,022H,03CH,020H,022H,01CH ; 9
DB 008H,008H,018H,014H,014H,03CH,024H,066H ; A
DB 01EH,024H,024H,01CH,024H,024H,024H,01EH ; B
DB 03CH,022H,002H,002H,002H,002H,022H,01CH ; C
DB 01EH,024H,024H,024H,024H,024H,024H,01EH ; D
DB 03EH,024H,014H,01CH,014H,004H,024H,03EH ; E
DB 03EH,024H,014H,01CH,014H,004H,004H,00EH ; F
END

回答2:

汗 一楼 你让我很纠结
话说 在8*8的矩阵画一个6不久就完了么 有那么纠结了
就是有点麻烦而已

回答3:

这个要取模,还要涉及硬件的连接