程序提示内存不足;out of memory
CODESEGMENTASSUMECS:CODE,ds:dataSTART:MOVAX,dataMOVDS,AXCALLDELAYCALLINT_LCDCALLDELAY...
CODE SEGMENT
ASSUME CS:CODE,ds:data
START: MOV AX,data
MOV DS,AX
CALL DELAY
CALL INT_LCD
CALL DELAY ;初始化后延迟
MOV BL,38H ;设置8位操作数,2行显示,5×7点阵
CALL W_LCD_C ;
MOV BL,0CH ;显示开关控制:显示开关
CALL W_LCD_C ;10
MOV BL,06H ;输入方式设置:设置AC为自动加1,光标右移一个字符位
CALL W_LCD_C
MOV bl,40H ;设置CGRAM地址
CALL W_LCD_C
CALL Check_Busy
mov bx,0
CG1: MOV AL,CS:[cgtab+BX]
MOV DX,LCD_DATAW
OUT DX,AL
CALL DELAY ;20
INC BX
CMP BX,64
JNZ CG1
JMP $
INT_LCD PROC NEAR
CALL Check_Busy
MOV AL,01H ; 清屏
MOV DX,LCD_COMW
OUT DX,AL
RET
INT_LCD ENDP
W_LCD_C PROC NEAR
CALL Check_Busy
MOV AL,BL
MOV DX,LCD_COMW
OUT DX,AL
RET
W_LCD_C ENDP
Check_Busy PROC NEAR
Busy_Loop: MOV DX,LCD_COMR
IN AL,DX
TEST AL,80H
JNZ Busy_Loop
RET
Check_Busy ENDP
DELAY PROC NEAR
PUSH CX
PUSH BX
MOV BX,0FH
DDD: MOV CX,0FFFH
CCC: LOOP CCC
DEC BX
CMP BX,0
JNE DDD
POP BX
POP CX
RET
DELAY ENDP
CODE ENDS
DATA SEGMENT
CGTAB DB 08H,0FH,12H,0FH,0AH,1FH,02H,02H ;“年”代码=00H
DB 0FH,09H,0FH,09H,0FH,09H,11H,00H ;“月”代码=01H
DB 1FH,11H,11H,1FH,11H,11H,1FH,00H ;“日”代码=02H
DB 11H,0AH,04H,1FH,04H,1FH,04H,00H ;“$”代码=03H
DB 0EH,00H,1FH,0AH,0AH,0AH,13H,00H ;“元”代码=04H
DB 18H,18H,07H,08H,08H,08H,07H,00H ;“℃”代码=05H
DB 04H,0AH,15H,04H,04H,04H,04H,00H ;“↑”代码=06H
DB 17H,15H,15H,15H,15H,15H,17H,00H ;“10”代码=07H
LCD_COMW EQU 0200H ;写命令字
LCD_DATAW EQU 0201H ;写数据寄存器
LCD_COMR EQU 0202H
LCD_DATAR EQU 0203H ;读数据寄存器
DATA ENDS
STACK1 SEGMENT PARA STACK
DW 20H DUP(0)
STACK1 ENDS
END start 展开
ASSUME CS:CODE,ds:data
START: MOV AX,data
MOV DS,AX
CALL DELAY
CALL INT_LCD
CALL DELAY ;初始化后延迟
MOV BL,38H ;设置8位操作数,2行显示,5×7点阵
CALL W_LCD_C ;
MOV BL,0CH ;显示开关控制:显示开关
CALL W_LCD_C ;10
MOV BL,06H ;输入方式设置:设置AC为自动加1,光标右移一个字符位
CALL W_LCD_C
MOV bl,40H ;设置CGRAM地址
CALL W_LCD_C
CALL Check_Busy
mov bx,0
CG1: MOV AL,CS:[cgtab+BX]
MOV DX,LCD_DATAW
OUT DX,AL
CALL DELAY ;20
INC BX
CMP BX,64
JNZ CG1
JMP $
INT_LCD PROC NEAR
CALL Check_Busy
MOV AL,01H ; 清屏
MOV DX,LCD_COMW
OUT DX,AL
RET
INT_LCD ENDP
W_LCD_C PROC NEAR
CALL Check_Busy
MOV AL,BL
MOV DX,LCD_COMW
OUT DX,AL
RET
W_LCD_C ENDP
Check_Busy PROC NEAR
Busy_Loop: MOV DX,LCD_COMR
IN AL,DX
TEST AL,80H
JNZ Busy_Loop
RET
Check_Busy ENDP
DELAY PROC NEAR
PUSH CX
PUSH BX
MOV BX,0FH
DDD: MOV CX,0FFFH
CCC: LOOP CCC
DEC BX
CMP BX,0
JNE DDD
POP BX
POP CX
RET
DELAY ENDP
CODE ENDS
DATA SEGMENT
CGTAB DB 08H,0FH,12H,0FH,0AH,1FH,02H,02H ;“年”代码=00H
DB 0FH,09H,0FH,09H,0FH,09H,11H,00H ;“月”代码=01H
DB 1FH,11H,11H,1FH,11H,11H,1FH,00H ;“日”代码=02H
DB 11H,0AH,04H,1FH,04H,1FH,04H,00H ;“$”代码=03H
DB 0EH,00H,1FH,0AH,0AH,0AH,13H,00H ;“元”代码=04H
DB 18H,18H,07H,08H,08H,08H,07H,00H ;“℃”代码=05H
DB 04H,0AH,15H,04H,04H,04H,04H,00H ;“↑”代码=06H
DB 17H,15H,15H,15H,15H,15H,17H,00H ;“10”代码=07H
LCD_COMW EQU 0200H ;写命令字
LCD_DATAW EQU 0201H ;写数据寄存器
LCD_COMR EQU 0202H
LCD_DATAR EQU 0203H ;读数据寄存器
DATA ENDS
STACK1 SEGMENT PARA STACK
DW 20H DUP(0)
STACK1 ENDS
END start 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询