.model small
.data
instexit db "Press any key to exit $" ;instant exit
navb db "Press B to end or N for Next Month: $" ;navigation instruction of january month
nav db "Press B for previous month or N for Next Month: $" ;navigation instruction of months between january and december
nave db "Press B for previous month or N to end: $" ;navigation instruction of december month ; setting of value to zero
greeting db "Welcome to the 2015 Calendar$" ;greetings message displayed in the beginning
-------
Jan db " January$ " ;whole january month
string db "Sun Mon Tue Wed Thu Fri Sat$" ;prints the day string and the string will be used througout the months
string1 db " 1 2 3$"
string2 db " 4 5 6 7 8 9 10$"
string3 db "11 12 13 14 15 16 17$"
string4 db "18 19 20 21 22 23 24$"
string5 db "25 26 27 28 29 30 31$"
; taking out the other strings for month due to the character limitation here
.code
.386
mov ax,@data
mov ds,ax
mov ax,0003h ;setting screen to 80*25
int 10h
mov ah,02h
mov bh,00
mov dh,1
mov dl,25
int 10h
lea dx,greeting ; load & display the STRING
call print
call nline ;function for next line
call january ;prints whole january month
mov cx,1 ;counter for navigation
command:
mov ah,1h ;user input
int 10h ; ;calling the interrupt handler
cmp al,'n' ;comparing which button user pressed
jz up ;jumping to up function for cx addition with 1
cmp al,'b' ;comparing which button user pressed
jz down ;jumping to up function for cx subtraction with 1
ending:
mov ax,4C00h
int 21h
up:
inc cx ;added one to cx for watching the next month
jmp navigate ;jumping to display the desired calendar
down:
dec cx ;subtracting one to cx for watching the previous month
jmp navigate ;jumping to display the desired calendar
navigate:
cmp cx,1
jz m1 ;jumping to print january
; similar function has been taken due to space issues
cmp cx,0
jz ending ;end the program
cmp cx,13
jz ending ;end the program
m1:
call clr ;clear out the screen
call nline ;prints the next line
call january ;print the whole january month
jmp command
; similar month function has been taken due to space issues
clr: ;clears the screen
mov ax,0003h
int 10h
ret
nline: ;prints next line
mov ah, 2 ;carriage return
mov dl, 0DH
int 10h ;
mov dl, 0AH ;line feed
int 10h ;
ret
print: ;prints the string
mov ah,9
int 10h ;
ret
color1: ;assigning the color for the string
mov ax,0920h
mov bx,0047h ;white on red
mov cx,30
int 10h
ret
color2: ;assigning the color for the string
mov ax,0920h
mov bx,0021h ;blue on green
mov cx,30
int 10h
ret
january: ;prints the whole januarty month
push cx
mov ah,02h
mov bh,00
mov dh,2
mov dl,25
int 10h
call color1
lea dx,Jan ; load & display the STRING
call print
call nline ;prints the next line
mov ah,02h
mov bh,00
mov dh,3
mov dl,25
int 10h
call color2
lea dx, string ; load & display the STRING
call print
;prints the next line
call nline ;prints the next line
mov ah,02h
mov bh,00
mov dh,4
mov dl,25
int 10h
call color2
lea dx, string1 ; load & display the STRING
call print
call nline ;prints the next line
mov ah,02h ;changing the rows and columns and bring it to center
mov bh,00
mov dh,5 ;shifting row
mov dl,25 ;shifting column
int 10h
call color2
lea dx, string2 ; load & display the STRING
call print
call nline ;prints the next line
mov ah,02h
mov bh,00
mov dh,6
mov dl,25
int 10h
call color2
lea dx, string3 ; load & display the STRING
call print
call nline ;prints the next line
mov ah,02h
mov bh,00
mov dh,7
mov dl,25
int 10h
call color2
lea dx, string4 ; load & display the STRING
call print
call nline ;prints the next line
mov ah,02h
mov bh,00
mov dh,8
mov dl,25
int 10h
call color2
lea dx, string5 ; load & display the STRING
call print
call nline ;prints the next line
call nline ;prints the next line
lea dx,instexit ;Instructions for instant exit
call print
call nline
lea dx,navb
call print
pop cx
ret
; similar month functions has been taken due to space issues
end
答案 0 :(得分:1)
command:
mov ah,1h ;user input
int 10h ; ;calling the interrupt handler
nline: ;prints next line
mov ah, 2 ;carriage return
mov dl, 0DH
int 10h ;
mov dl, 0AH ;line feed
int 10h ;
ret
print: ;prints the string
mov ah,9
int 10h ;
ret
在上面的代码中,您必须将int 10h
的每次出现更改为int 21h
。请记住,您正在使用DOS函数。
回答你的问题。一旦此程序在文本视频模式下工作,它也将在图形视频模式下工作。当然是传统视频模式,数字从1到19。