;PROGRAM GOES HERE;9:39 2023/5/1
;FOLLOWED BY DESCRIPTIVE PHRASES
;EQU STATEMENTS GO HERE
ST_SEG SEGMENT STACK
DB 20 DUP('STACK')
ST_SEG ENDS
;****************
DATAREA SEGMENT ;DEFINE CODE SEGMENT
buffer1 db 20 dup('$')
pif DB "PLEASE INPUT FILENAME:$ " ;DATA GOES HERE
yf DB "YOUR FILENAME:$ "
yn db "[Y/N]?$ "
pip DB "PLEASE INPUT PASSWORD:$ "
ok1 db "OK!$"
changeline db 13,10,'$'
xuehao db '20201050'
buffer db 3,32 dup(?)
blank db ' ','$'
ERROR DB 'PLEASE WRITE AGAIN!',10,13,'$'
a db 32 dup(?)
b db 32 dup(?)
DATAREA ENDS
PROGRAM SEGMENT
MAIN PROC FAR
ASSUME CS:PROGRAM,DS:DATAREA,SS:ST_SEG
START:
MOV AX,DATAREA ;SET DS REGISTER TO CURRENT DATA SEGMENT,DATEREA SEGMENT ADDR
MOV DS,AX ;INTO DS REGISTER
;-----------------------------------------------主程序开始
call clear;清屏
mov ax,0b800h
mov es,ax
mov dx,7100h;字符为‘ ’,颜色为灰色。
;-----
mov cx,80
mov di,0
s2:
call display
inc di
inc di
loop s2
;---------
mov cx,80
mov di,0f00h
s3:
call display
inc di
inc di
loop s3
;---------
mov cx,25
mov di,0
s4:
call display
add di,160
loop s4
;-------
mov cx,25
mov di,158
s5:
call display
add di,160
loop s5
;------到这里矩形框边界输出完毕,也就是25*80的边界。
mov dx,4000h
mov di,1778
call display
;-------s_head
mov dx,7100h
mov di,1776
call display
;---------s_body
mov di,3220
call display
;---------food
call delay;---
;------------
jmp start
;-----------------------------------------------
exit:
MOV AH,4CH
INT 21H
;RETURN TO DOS
MAIN ENDP ;END OF MAIN PART OF PROGRAM
;-------------------------------------------------------
delay:
push ax
push bx
mov ax,0001h
s0:mov bx,000fh
s1:dec bx
cmp bx,0
jnz s1
cmp ax,0
jnz s0
pop bx
pop ax
ret
;------------------------------------------------------------
display:
push dx
push di
mov es:[di],dx
pop di
pop dx
ret
;------------------------------------------------------------
clear:
mov ax,3
int 10h
ret
;-------
SUBRL PROC NEAR ;DEFINE SUBPROCEDURE
;SUBROUTINE GOES HERE
SUBRL ENDP ;END SUBPROCEDURE
;-------------------
PROGRAM ENDS ; END OF CODE SEGMENT
;******************
END START; END ASSEMBLY
0b800直接写显存的方式实现贪吃蛇(静态显示)
最新推荐文章于 2024-10-01 23:03:13 发布