खोज…


BIOS कॉल

कैसे BIOS के साथ बातचीत करने के लिए

बेसिक इनपुट / आउटपुट सिस्टम, या BIOS, किसी भी ऑपरेटिंग सिस्टम के चलने से पहले कंप्यूटर को नियंत्रित करता है। BIOS द्वारा प्रदान की गई सेवाओं तक पहुंचने के लिए, विधानसभा कोड इंटरप्ट का उपयोग करता है । एक व्यवधान का रूप ले लेता है

int <interrupt> ; interrupt must be a literal number, not in a register or memory

समावेशी संख्या 0 और 255 (0x00 - 0xFF), समावेशी के बीच होनी चाहिए।

अधिकांश BIOS कॉल AH रजिस्टर का उपयोग "फ़ंक्शन सिलेक्ट" पैरामीटर के रूप में करते हैं, और AL रजिस्टर का उपयोग डेटा पैरामीटर के रूप में करते हैं। AH द्वारा चयनित फ़ंक्शन नामक रुकावट पर निर्भर करता है। कुछ BIOS कॉलों को AX में एक एकल 16-बिट पैरामीटर की आवश्यकता होती है, या सभी मापदंडों को स्वीकार नहीं करते हैं, और बस इसे रुकावट कहा जाता है। कुछ के पास और भी अधिक पैरामीटर हैं, जो अन्य रजिस्टरों में पारित किए जाते हैं।

BIOS कॉल के लिए उपयोग किए जाने वाले रजिस्टरों को ठीक किया गया है और अन्य रजिस्टरों के साथ नहीं बदला जा सकता है।

फ़ंक्शन चयन के साथ BIOS कॉल का उपयोग करना

फ़ंक्शन सिलेक्ट पैरामीटर का उपयोग करके BIOS इंटरप्ट के लिए सामान्य सिंटैक्स है:

mov ah, <function>
mov al, <data>
int <interrupt>

उदाहरण

प्रदर्शन के लिए एक चरित्र कैसे लिखें:

mov ah, 0x0E             ; Select 'Write character' function
mov al, <char>           ; Character to write
int 0x10                 ; Video services interrupt

कीबोर्ड से किसी वर्ण को कैसे पढ़ें (अवरुद्ध):

mov ah, 0x00             ; Select 'Blocking read character' function
int 0x16                 ; Keyboard services interrupt
mov <ascii_char>, al     ; AL contains the character read
mov <scan_code>, ah      ; AH contains the BIOS scan code

बाहरी ड्राइव से एक या एक से अधिक सेक्टर कैसे पढ़ें (CHS एड्रेसिंग का उपयोग करके):

mov ah, 0x02             ; Select 'Drive read' function
mov bx, <destination>    ; Destination to write to, in ES:BX
mov al, <num_sectors>    ; Number of sectors to read at a time
mov dl, <drive_num>      ; The external drive's ID
mov cl, <start_sector>   ; The sector to start reading from
mov dh, <head>           ; The head to read from
mov ch, <cylinder>       ; The cylinder to read from
int 0x13                 ; Drive services interrupt
jc <error_handler>       ; Jump to error handler on CF set

सिस्टम RTC (रियल टाइम क्लॉक) कैसे पढ़ें:

mov ah, 0x00             ; Select 'Read RTC' function
int 0x1A                 ; RTC services interrupt
shl ecx, 16              ; Clock ticks are split in the CX:DX pair, so shift ECX left by 16...
or cx, dx                ; and add in the low half of the pair
mov <new_day>, al        ; AL is non-zero if the last call to this function was before midnight
                         ; Now ECX holds the clock ticks (approx. 18.2/sec) since midnight
                         ; and <new_day> is non-zero if we passed midnight since the last read

RTC से सिस्टम का समय कैसे पढ़ें:

mov ah, 0x02             ; Select 'Read system time' function
int 0x1A                 ; RTC services interrupt
                         ; Now CH contains hour, CL minutes, DH seconds, and DL the DST flag,
                         ; all encoded in BCD (DL is zero if in standard time)
                         ; Now we can decode them into a string (we'll ignore DST for now)

mov al, ch               ; Get hour
shr al, 4                ; Discard one's place for now
add al, 48               ; Add ASCII code of digit 0
mov [CLOCK_STRING+0], al ; Set ten's place of hour
mov al, ch               ; Get hour again
and al, 0x0F             ; Discard ten's place this time
add al, 48               ; Add ASCII code of digit 0 again
mov [CLOCK_STRING+1], al ; Set one's place of hour

mov al, cl               ; Get minute
shr al, 4                ; Discard one's place for now
add al, 48               ; Add ASCII code of digit 0
mov [CLOCK_STRING+3], al ; Set ten's place of minute
mov al, cl               ; Get minute again
and al, 0x0F             ; Discard ten's place this time
add al, 48               ; Add ASCII code of digit 0 again
mov [CLOCK_STRING+4], al ; Set one's place of minute

mov al, dh               ; Get second
shr al, 4                ; Discard one's place for now
add al, 48               ; Add ASCII code of digit 0
mov [CLOCK_STRING+6], al ; Set ten's place of second
mov al, dh               ; Get second again
and al, 0x0F             ; Discard ten's place this time
add al, 48               ; Add ASCII code of digit 0 again
mov [CLOCK_STRING+7], al ; Set one's place of second
...
db CLOCK_STRING "00:00:00", 0   ; Place in some separate (non-code) area

RTC से सिस्टम दिनांक कैसे पढ़ें:

mov ah, 0x04             ; Select 'Read system date' function
int 0x1A                 ; RTC services interrupt
                         ; Now CH contains century, CL year, DH month, and DL day, all in BCD
                         ; Decoding to a string is similar to the RTC Time example above

सन्निहित निम्न स्मृति का आकार कैसे प्राप्त करें:

int 0x12                 ; Conventional memory interrupt (no function select parameter)
and eax, 0xFFFF          ; AX contains kilobytes of conventional memory; clear high bits of EAX
shl eax, 10              ; Multiply by 1 kilobyte (1024 bytes = 2^10 bytes)
                         ; EAX contains the number of bytes available from address 0000:0000

कंप्यूटर को रिबूट कैसे करें:

int 0x19                 ; That's it! One call. Just make sure nothing has overwritten the
                         ; interrupt vector table, since this call does NOT restore them to the
                         ; default values of normal power-up. This means this call will not
                         ; work too well in an environment with an operating system loaded.

गलती संभालना

कुछ BIOS कॉल हर मशीन पर लागू नहीं हो सकते हैं, और काम करने की गारंटी नहीं है। अक्सर AH लागू 0x80 पर रजिस्टर AH में या तो 0x86 या 0x86 वापस आ जाएगा। हर बाधा के बारे में बस एक त्रुटि स्थिति पर कैरी फ्लैग (CF) सेट करेगा। इससे jc सशर्त कूद के साथ एक त्रुटि हैंडलर को कूदना आसान हो जाता है। (देखें सशर्त कूदता है )

संदर्भ

BIOS कॉल और अन्य इंटरप्ट की एक विस्तृत सूची Ralf Brown की इंटरप्ट सूची है । एक HTML संस्करण यहां पाया जा सकता है

अक्सर उपलब्ध होने वाली रुकावटों को विकिपीडिया पर एक सूची में पाया जाता है।

आमतौर पर उपलब्ध इंटरप्ट का अधिक गहराई से अवलोकन osdev.org पर किया जा सकता है



Modified text is an extract of the original Stack Overflow Documentation
के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
से संबद्ध नहीं है Stack Overflow