Compilation language-based electronic piano design (5)

zhaozj2021-02-16  56

Load_audio Proc Near

; C / D adjustment corresponding to the corresponding low, medium, high frequency separately

; OUT: BX

; In: Tune, Audio

Tune_d:; D big mark judgment

CMP Tune, 'D'

JNZ TUNE_CL; is not judgment whether it is C

Tune_dl:

CMP AUDIO, 1; low frequency judgment

JNE TUNE_CM

Lea BX, Lowdd

JMP AUDIO_END

Tune_dm:

CMP AUDIO, 2; intermediate frequency judgment

JNE TUNE_CH

Lea BX, MIDD

JMP AUDIO_END

Tune_DH:

Lea BX, HGHD; high frequency judgment

JMP AUDIO_END

Tune_cl:; C Treatment

CMP Audio, 1

JNE TUNE_CM

Lea BX, Lowd

JMP AUDIO_END

Tune_cm:

CMP Audio, 2

JNE TUNE_CH

Lea BX, MID

JMP AUDIO_END

Tune_ch:

Lea BX, HGH

Audio_end:

RET

Load_audio ENDP

Scan_Tune Proc Near

; C / D adjustment and its status on the screen

; In: DL keyboard scanning code

OUT: TUNE

CMP DL, 2EH; Judgment is C No

JNZ next_d; not, it is determined to be D No

Mov tune, 'c'

Draw 55, 38, 60, 41, 0EH; Guan D light

Draw 65, 38, 70, 41, 0ah; open C lamp

JMP TUNE_END; end

Next_d:

CMP DL, 20H; Judgment D

JNZ Tune_END

Mov tune, 'd'

Draw 55, 38, 60, 41, 0ah; open D lamp

Draw 65, 38, 70, 41, 0EH; Guan C lamp

Tune_end:

RET

Scan_Tune ENDP

SHOW_TEXT PROC NEAR

; Display characters on the screen

Lea Di, Text; Loading the string address

MOV DH, [DI]; Employment Value

INC DI; get column MOV DL, [Di]; assignment value

MOV Start_col, DL; Save Start Column

MOV AH, 2; set cursor position

MOV BH, 0; 0 pages

INT 10h

INC DI; get color value

MOV BL, [DI]; color value

Char_write:

INC DI; get the character to display

MOV Al, [DI]

CMP

Al

, 0FFH; end of the line No

JE BUMP_ROW; next line

CMP

Al

0; end no

JZ end_text

Call show_char; display character

JMP char_write; next character

END_TEXT:

RET

Bump_row:

INC DH; next line

MOV DL, START_COL; assignment start column value

MOV AH, 2; set the cursor position

MOV BH, 0

INT 10h

JMP char_write

Show_text endp

Show_char proc near

Display characters

MOV AH, 9; display character

MOV BH, 0; 0 pages

MOV CX, 1

INT 10h

INC DL

MOV AH, 2; set cursor position

MOV BH, 0; 0 pages

INT 10h

RET

Show_char endp

Init Proc Near

Initialization Screen: Pirateup

Mov AX, DATA

MOV DS, AX

MOV AH, 0; set screen

MOV

Al

0DH

INT 10h

MOV AH, 0BH

MOV BH, 0

MOV BL, 00H; background color

INT 10h

Call show_text; display string

Draw 45, 30, 285, 94, 05h

Drawsqre 45, 30, 285, 94, 0DH

Drawsqre 49,48,280,49,00h

Draw 55, 38, 60, 41, 0Eh; C lamp

Draw 65, 38, 70, 41, 0ah; D-lamp

Call Song_light_off; Automatic Play Song Indicator

LEA SI, ST_LX; Draw 21 White Keys

Lea di, ed_lx

MOV CX, 21

INIT_DRAW:

Draw [Si], ST_Y, [DI], ED_Y, 0FH

Draw [Si], 90, [Di], 93, 07h; Shadow

Add Si, 2

Add di, 2

Loop

Init_draw

Lea Si, BT_X; draw 15 black keys

Lea di, bd_x

MOV CX, 15

Init_block:

Draw [Si], BT_Y, [DI], BD_Y, 00H

Add Si, 2

Add di, 2

Loop

Init_block

RET

Init ENDP

SONG_LIGHT_OFF PROC NEAR

Close the lamp 1 ~ 5

Draw 271, 42, 275, 46, 09h

Draw 265, 42, 269, 46, 09h

Draw 259, 42, 263, 46, 09h

Draw 253, 42, 257, 46, 09h

Draw 247, 42, 251, 46, 09h

RET

SONG_LIGHT_OFF ENDP

FREQ_CHANGE PROC NEAR

; IN: DL scanning code

CMP DELAY_TIME, 600

JB Change_Add

CMP delay_time, 60000

Ja change_sub

CMP DL, 0CH; -

JNZ FREQ_SUB

Add delay_time, 500

Draw 271, 38, 274, 41, 0EH

JMP Change_end

Change_add:

Add delay_time, 500

JMP Change_end

Change_sub:

SUB DELAY_TIME, 500

JMP Change_end

FREQ_SUB:

CMP DL, 0DH;

Draw 271, 38, 274, 41, 0ah

JNZ Change_end

SUB DELAY_TIME, 500

Change_end:

RET

FREQ_CHANGE ENDP

EXIT Proc Near

;

MOV AH, 4CH

Int 21h

RET

Exit Endp

Code ends

End Start

Seven, reference materials

---- Tsinghua University Press

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

New Post(0)