Problem in ax or bx register values....
condition is not working in both cases true or false it is jumping to DMA_N
; Check DMA is present or not
dosseg
.model small
.stack 100h
.data
int 11h
DMA_ON db 'DMA_Present', 0dh, 0ah, '$'
DMA_OF db 'DMA_NOT_Present', 0dh, 0ah, '$'
.code
main proc
mov ax,@data
mov ds,ax
;to check bit number 8 in ax
mov bx,100h
and bx,ax
cmp bx,0 ; if i change : cmp bx,1
jne DMA_N ; In both cases 0 or 1 it jumps to DMA_N ?
mov ah,9
mov dx,offset DMA_OF ;DMA is not persent
int 21h ; Print the character
DMA_N:
mov ah,9
mov dx,offset DMA_ON ;DMA is persent
int 21h ; Print the character
mov ax,4C00h ;terminate program
int 21h
main endp
end main
the INT 11h instruction cannot be in the data segment
.CODE
main PROC
mov ax,@data
mov ds,ax
int 11h
mov dx,offset DMA_ON
test ax,100h
jnz ShowResult
mov dx,offset DMA_OFF
ShowResult:
mov ah,9
int 21h
mov ax,4C00h
int 21h
main ENDP
I have another program which is working fine :
; Check Co-Processor is present or not
dosseg
.model small
.stack 100h
.data
int 11h
CProcessor_ON db 'Co-Processor_Present', 0dh, 0ah, '$'
CProcessor_OF db 'Co-Processor_NOT_Present', 0dh, 0ah, '$'
.code
main proc
mov ax,@data
mov ds,ax
;to check bit number 1 in ax
mov bx,2h
and bx,ax
cmp bx,0 ; if i change : cmp bx,1
jne CPN ; In both cases 0 or 1 it jumps to Co-Processor_N ?
mov ah,9
mov dx,offset CProcessor_OF ; Co-Processor is not persent
int 21h ; Print the character
jmp ter
CPN:
mov ah,9
mov dx,offset CProcessor_ON ; Co-Processor is persent
int 21h ; Print the character
ter:
mov ax,4C00h ;terminate program
int 21h
main endp
end main
well - it's not working fine - you just think it is :biggrin:
by the way...
as far as i know, all IBM PC compatibles have DMA
and - all modern ones have a "math co-processor"
Bit 8 of the equipment list word is unused for a normal PC. Per the Ralf Brown Interrupt List (http://www.ctyme.com/intr/rb-0575.htm) it was used only for the PCjr and for several Tandy models.
BTW, you can AND AX with an immediate value, specifying the immediate value by one of several different methods and then jump based on the state of the zero flag. For example:
and ax, 1
jz bit0clear
and ax, 10b ; specify value in base 2
jz bit1clear
and ax, 1 SHL 2 ; using SHL operator, result is 0100b
jnz bit2set
Or instead of AND you can use the TEST instruction to avoid changing the value in AX. And note that virtually any interrupt you call will change the value in AX, and likely other registers, so depending on where you use a value in a register you may need to preserve it around the interrupt calls.
...also....
most anything you can get with INT 11h, you can also get by accessing the BIOS data segment at 40h
you can reference Ralf for the the values in that segment, or use one of several other online references
http://www.bioscentral.com/misc/bda.htm# (http://www.bioscentral.com/misc/bda.htm#)
that list reports that the word at offset 0040:0010, bit 8 is "reserved"
(same as byte at 0040:0011, bit 0)