A character graphic program

zhaozj2021-02-16  62

This is the first applet made after learning the compilation. The program is small, but it is quite satisfactory. Self-considered is the first molded program they do. In order to remember the mood of the priest, put this programs that are difficult to refer to the program :).

Introduction: Making a graphical element table, a number of various character graphics required in the table, and display it on the top left of the screen with a memory mapping method. Position the cursor on the right half of the screen. Up, lower, left, and right cursor control key control the cursor in four directions, do not show its trajectory at the same time to control the border of the cursor position without exceeding the border of the drawing area. When a digital key is pressed, the character graphic of the corresponding number is displayed at the cursor position, then move the cursor, then display a character graph, and finally draw a graphic composed of characters. Press the ESCAPE button to exit the program and return to DOS.

Data segment

Buffer DB 200 DUP (?)

DB1 DB 1

DB2 DB 0

DB3 DB 00H

MSG1 DB 'The Table: The Drawing Area: (Press "ESC" Key To EXIT)', '$'

Data ends

Program segment

Main Proc Far

Assume Cs: Program, DS: Data

Start:

Push DS

Sub Ax, AX

Push AX

Mov AX, DATA

MOV DS, AX

Mov Ah, 09

LEA DX, MSG1; display information

Int 21h

MOV BX, 26

MOV DB1, 0; display boundary line

MOV DB2, 36

OP:

MOV AH, 2

MOV BH, 0

MOV DH, DB1; initialized cursor

MOV DL, DB2

INT 10h

MOV BH, 0

MOV CX, 1

Mov Al, 2ah

Mov Ah, 0ah

INT 10h

INC DB1

Dec BX

JNZ OP

MOV DB1, 1

MOV DB2, 0

MOV Si, 0

OP1:; production graphic element table

MOV AH, 2

MOV BH, 0

MOV DH, DB1; positioning cursor

MOV DL, DB2

INT 10h

MOV Al, DB3

Mov Buffer [Si], Al; Display Digital and Deposits the ASCII

Push Si

Add Si, 30H

MOV BH, 0

MOV AX, SI

And AX, 00ffh

MOV CX, 1

Mov Ah, 0ah

INT 10h

INC DB2

CMP DB2, 39; judgment is overcrowded

JNA OP2

INC DB1

MOV DB2, 0

OP2: MOV AH, 2

MOV BH, 0

MOV DH, DB1; Relocation Cursor

MOV DL, DB2

INT 10h

Mov Ah, 0ah

MOV BH, 0; display character

MOV Al, DB3

MOV CX, 1

INT 10h

POP Si

Inc Si

INC DB3

CMP DB3, 09H

Ja over

Add DB2, 7

CMP DB2, 39; judgment is overcrowded

JNA OP1

INC DB1

MOV DB2, 0

JMP OP1

Over:

MOV DB1, 1

MOV DB2, 38

MOV AH, 2MOV BH, 0

MOV DH, 1

MOV DL, 38; Initialization Cursor

INT 10h

OPP0:

MOV AH, 0

INT 16H; judgment input key

CMP AH, 48H; arrow keys

JE UP

CMP AH, 50H

JE Down

CMP AH, 4DH

Je Right

CMP AH, 4BH

Je left

CMP AH, 01H; ESC button

JNZ RR

RET

RR: CMP AL, 30H; Number

JNB OPP2

JMP OPP0

OPP2:

CMP Al, 39h

JA OPP0

And AX, 00ffh

SUB AX, 30H

Mov Si, AX

MOV Al, Buffer [Si]; Display the corresponding characters

MOV BH, 0

MOV CX, 1

Mov Ah, 0ah

INT 10h

JMP OPP0

Up:

DEC DB1

JZ Edg_UP

JMP OPP1; Digital Line

EDG_UP:

MOV DB1, 1

JMP OPP1

Down:

INC DB1

CMP DB1, 24

Ja Edg_Down

JMP OPP1

Edg_down:

MOV DB1, 24

JMP OPP1

Right:

INC DB2

CMP DB2, 78

Ja Edg_Right

JMP OPP1

EDG_RIGHT:

MOV DB2, 78

JMP OPP1

LEFT:

DEC DB2

CMP DB2, 38

JB Edg_Left

JMP OPP1

Edg_left:

MOV DB2, 38

OPP1:

MOV AH, 2

MOV BH, 0; relocation cursor

MOV DH, DB1

MOV DL, DB2

INT 10h

JMP OPP0

EXIT:

Ret; return to DOS

Main endp

Program Ends

End Start

转载请注明原文地址:https://www.9cbs.com/read-17064.html

New Post(0)