Feedjit

Articles for you

Tuesday, December 31, 2013

.asm, ASM, MASM, NASM, Assembly Language, To Display Floppy,MAth,Game-IO,DMA information when caps lock is on ; Else : Display Video Mode and No.of Drives installed.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
;Programmed by Saqib khan
;Purpose: To Display Floppy,MAth,Game-IO,DMA information when caps lock is on
;    Else : Display Video Mode and No.of Drives installed.
;Dated: 22nd/May/2012
.model small
.stack 100h
.data 
 str_floppy_n  db 10,"Floppy disk drive not installed.$"
 str_floppy_y  db 10,"Floppy disk drive installed.   $"
 str_math_n    db 10,"Math coprocessor not installed. $"
 str_math_y    db 10,"Math coprocessor installed.$"
 str_game_y    db 10,"Game IO is installed:$"
 str_game_n    db 10,"Game IO is not installed:$"
 str_vid0    db 10,"Video Mode None $"
 str_vid1    db 10,"Video Mode:40*25 color $"
 str_vid2    db 10,"Video Mode:80*25 color $"
 str_vid3    db 10,"Video Mode:80*25 Monochrome $"
 str_dma_ok    db 10,"DMA is Present $"
 str_dma_not   db 10,"DMA is not Present $"
 str_drives    db 10,"No.of drives are: $"
.code
main: 
 mov ax,@data  
 mov ds,ax
 int 11h    ;Interrupt for Equipment installed
 mov bx,ax   ;Store original Copy
 mov ah,2   ;Interrup for Keyboard Special Keys
 int 16h    ;Call OS to do the job
 mov cl,2   ;Offset value for shifting
 shl al,cl   ;Shift Left al by the value of cl
 jc  video_mode  ;Jump if carry flag is on
floppy_y:
 mov ax,bx 
 and ax, 1   ;Masking value for Floppy disk drive
 jz floppy_n   ;Jump if zero flag
 lea dx,str_floppy_y ;Load address of string
 mov ah,9h   ;Service # to display string
 int 21h    ;Call OS to do the job
 jmp math_ok   ;jmp next block
floppy_n:
 lea dx,str_floppy_n ;Load address of string
 mov ah,9h   ;Service # to display string
 int 21h    ;Call OS to do the job
math_ok:
 mov ax,bx   ;Restore the original value
 and ax,2   ;Masking value for 
 jz math_no
 lea dx,str_math_y
 mov ah,9h
 int 21h
 jmp dma_ok
math_no:
 lea dx,str_math_n
 mov ah,9h
 int 21h
dma_ok:
 mov ax,bx
 and ax,256
 jz no_dma
 lea dx,str_dma_ok
 mov ah,9h
 int 21h
 jmp Game_IO
no_dma:
 lea dx,str_dma_not
 mov ah,9h
 int 21h 
Game_IO:
 mov ax,bx
 and ax,4096
 jz no_game_io
 lea dx,str_game_y
 mov ah,9h
 int 21h
no_game_io:
 lea dx,str_game_n
 mov ah,9h
 int 21h
 jmp end_lbl
video_mode:
 mov ax,bx
 mov cl,4
 and ax,48
 shr al,cl 
 add al,30h
 cmp al,30h
 je str0_disp
 cmp al,31h
 je str1_disp
 cmp al,32h
 je str2_disp
 lea dx,str_vid3
 mov ah,9h
 int 21h
 jmp chk_drives
str0_disp:
 lea dx,str_vid0
 mov ah,9h
 int 21h
 jmp chk_drives
str1_disp:
 lea dx,str_vid1
 mov ah,9h
 int 21h
 jmp chk_drives
str2_disp:
 lea dx,str_vid2
 mov ah,9h
 int 21h
chk_drives:
 lea dx,str_drives
 mov ah,9h
 int 21h
 mov cl,6
 mov ax,bx
 and ax,192
 shr al,cl
 inc al
 mov dl,al
 add dl,30h
 mov ah,2h
 int 21h
end_lbl:
 mov ah,4ch
 int 21h
     end main

Read More

Articles for you