www.pudn.com > shuji.asm.rar > shuji.asm.ASM


;PROGRAM TITLE GOSE HERE--COMPARE STRING 
datarea segment 
R0              DW         ? 
R1              DW         ? 
R2              DW         ? 
R3              DW         ? 
R4              DW         ? 
R5              DW         ? 
R6              DW         ? 
R7              DW         ? 
;------------------------------------------------------- 
TEMP1           DW         ? 
TEMP2           DW         ? 
TEMP3           DW         ? 
TEMP4           DW         ? 
;------------------------------------------------------- 
 
Buffer0         DB         ? 
Buffer1         DB         ? 
Buffer2         DB         ? 
Buffer3         DB         ? 
Buffer4         DB         ? 
Buffer5         DB         ? 
Buffer6         DB         ? 
Buffer7         DB         ? 
led1            db         ? 
led2            db         ? 
led3            db         ? 
led4            db         ? 
led5            db         ? 
led6            db         ? 
led7            db         ? 
led8            db         ? 
led10           db         ? 
led11           db         ? 
led12           db         ? 
led13           db         ? 
led14           db         ? 
led15           db         ? 
led16           db         ? 
led17           db         ? 
led18           db         ? 
led19           db         ? 
date            DB   10  DUP  (?) 
time            DB   10  DUP  (?) 
; 
datarea        ends 
;------------------------------------------------------------- 
video           segment   at    0b800h      ;define extra segment 
wd_buff         label     word 
v_buff          db        25*80*2 dup (?) 
video           ends 
;-------------------------------------------------------------  
program         segment 
; 
main            proc far 
                assume cs:program,ds:datarea,es:video 
START: 
                push  ds 
                sub   ax,ax 
                push  ax 
                mov   ax,datarea 
                mov   ds,ax 
                mov   ax,video 
                mov   es,ax 
;----------------------------------------------------------- 
;the following programm is to set screen background 
                 
                mov     temp1,0000h 
                mov     temp2,184fh 
                mov     bh,37h        ;set background color 
                call    clr_screen 
 
                mov     temp1,0821h   ;set date background 
                mov     temp2,0a2ch 
                mov     bh,5fh 
                call    clr_screen 
 
                mov     temp1,0d21h  ;set time background 
                mov     temp2,0f2ch 
                mov     bh,1eh 
                call    clr_screen 
;------------------------------------------------------------------- 
                mov     R1,0800h 
                mov     R2,0a0ah 
                mov     R3,0 
;------------------------------------------------------------------- 
; 
bigloop: 
                mov     ah,1      ;judge if key was pressed 
                int     16h 
                jz      yes_key   ;no key pressed ,to yes_key 
                mov     ah,0 
                int     16h 
                cmp     al,1bh    ;test if it is "esc" 
                jnz     yes_key   ;no,to yes_key 
                jmp     exit 
 
;-------------------------------------------------- 
yes_key:        mov     ah,02h          ;read time  CH=hour(BCD) 
                int     1aH             ;CL=minute(BCD,  DH=second(BCD) 
;----------------------------------------- 
                mov     temp1,cx 
                mov     al,ch 
                and     al,0f0h 
                mov     cl,4 
                ror     al,cl 
                add     al,30h 
                mov     led1,al 
                mov     cx,temp1 
                and     ch,0fh 
                add     ch,30h 
                mov     led2,ch 
 
                mov     al,cl 
                and     al,0f0h 
                mov     cl,4 
                ror     al,cl 
                add     al,30h 
                mov     led4,al 
                mov     cx,temp1 
                and     cl,0fh 
                add     cl,30h 
                mov     led5,cl 
 
                mov     al,dh 
                and     al,0f0h 
                mov     cl,4 
                ror     al,cl 
                add     al,30h 
                mov     led7,al 
                and     dh,0fh 
                add     dh,30h 
                mov     led8,dh 
 
                mov     led3,3ah 
                mov     led6,3ah 
 
;-------------------------------------------------- 
                mov     ah,04h          ;read date  CH=century(BCD),CL=year(BCD) 
                int     1aH             ;DH=month,DL=day 
;----------------------------------------- 
                mov     temp1,cx 
                mov     al,cl 
                and     al,0f0h 
                mov     cl,4 
                ror     al,cl 
                add     al,30h 
                mov     led12,al 
                mov     cx,temp1 
                and     cl,0fh 
                add     cl,30h 
                mov     led13,cl 
 
                mov     al,dh 
                and     al,0f0h 
                mov     cl,4 
                ror     al,cl 
                add     al,30h 
                mov     led15,al 
                and     dh,0fh 
                add     dh,30h 
                mov     led16,dh 
 
                mov     al,dl 
                and     al,0f0h 
                mov     cl,4 
                ror     al,cl 
                add     al,30h 
                mov     led18,al 
                and     dl,0fh 
                add     dl,30h 
                mov     led19,dl 
 
                mov     led10,32h 
                mov     led11,30h 
                mov     led14,2dh 
                mov     led17,2dh 
 
                mov     R0,8 
                lea     bx,led1 
                mov     cx,0e23h 
                mov     Buffer0,1eH 
disp_time: 
                mov     al,[bx] 
                call    display 
                inc     bx 
                inc     cx 
                dec     R0 
                jnz     disp_time 
 
                mov     R0,10 
                lea     bx,led10 
                mov     cx,0922h 
                mov     Buffer0,5fH 
disp_date: 
                mov     al,[bx] 
 
                call    display 
                inc     bx 
                inc     cx 
                dec     R0 
                jnz     disp_date 
;----------------------------------------------------------- 
                CMP     R3,0 
                JZ      GO_RIGHT 
                JMP     GO_LEFT 
GO_RIGHT: 
                inc     R1 
                inc     R2 
                cmp     R2,0A50h 
                jc      do_mov2 
                INC     R3 
                jmp     do_mov1 
do_mov2: 
                mov     ax,R1 
                mov     temp1,ax 
                mov     ax,R2 
                mov     temp2,ax 
                mov     bh,5fh 
                call    clr_screen 
                call    delay 
                call    delay 
                JMP     do_mov1 
 
GO_LEFT: 
                DEC     R1 
                DEC     R2 
                cmp     R2,0A0Ah 
                jnc     do_mov31 
                MOV     R3,0 
                jmp     do_mov1 
do_mov31: 
                mov     ax,R1 
                mov     temp1,ax 
                mov     ax,R2 
                mov     temp2,ax 
                mov     bh,1fh 
                call    clr_screen 
                call    delay 
                call    delay 
                JMP     do_mov1 
do_mov1: 
                jmp     bigloop 
 
 
exit:           mov     temp1,0000h 
                mov     temp2,184fh 
                mov     bh,07h        ;set background color 
                call    clr_screen 
                ret 
main            endp 
;********************************************************* 
; bellow are some  processes 
 
delay           proc    near 
                mov     cx,10 
                mov     temp1,0 
delay1: 
                nop 
                dec     temp1 
                jnz     delay1 
                loop    delay1 
                ret 
delay           endp 
;---------------------------------------------- 
;row=ch 
;column=cl 
;display symbol=al 
 
display         proc    near 
                push    bx 
                push    cx 
                push    ax 
                mov     al,160 
                mul     ch               ;row*80*2+column*2 
                                        ;al*ch=ax 
                mov     bl,cl 
                rol     bl,1             ;mov a times to left 
                mov     bh,0             ;bl*2 
                add     bx,ax 
                pop     ax 
                mov     ah,Buffer0 
                mov     es:[wd_buff+bx],ax 
                pop     cx 
                pop     bx 
                ret 
display         endp 
;------------------------------------------------------ 
clr_screen      proc    near 
                mov     ah,06h 
                mov     cx,temp1      ;top=row*col 
                mov     dx,temp2      ;botten=row*col 
                int     10h 
                mov     ah,02h        ;set arrow location 
                mov     dh,24 
                mov     dl,80 
                mov     bh,0 
                int     10h 
                ret 
clr_screen      endp 
 
;------------------------------------------------------------------- 
PROGRAM         ENDS 
                END     START