Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .org 7C00h ; BIOS loading address
- START:
- mov AX, 0 ; Clear register AX
- mov DS, AX ; Set DS to 0
- mov ES, AX ; Set ES to 0
- mov SI, 0 ; Reset starter index
- mov DI, 0 ; Reset usage index
- mov AH, 00h ; Reset keyboard
- int 16h ; Call BIOS to reset keyboard
- mov ah, 3Dh ; Open file
- mov al, 0 ; Access code to read
- mov dx, OFFSET file_name ; File name
- int 21h
- mov bx, ax ; Save file descryptor
- CHECK_KEY:
- mov AH, 00h ; Get button
- int 16h ; Call BIOS to get button
- cmp AL, 53h ; Compare with Delete key code
- jne CHECK_KEY ; If Delete not pressed, re-run code
- jz read
- ; Run the following BIOS screen functions to print messages
- mov AH, 09h ; Print text on top screen
- mov DX, msg
- int 21h
- mov AH, 0
- int 16h ; Wait press button on keyboard
- cmp ah, 28h ; Run code if pressed button Escape or F10
- je quit ; Run if pressed ESC
- je save_exit ; Run if pressed F10
- jmp $ ; Infinite loop
- quit:
- mov ah, 09h ; Print text "Esc - Quit F10 - Save & Exit Setup" int bottom screen
- mov dx, quit_msg
- int 21h
- int 20h ; Start operating system
- ; Your code to start operating system
- save_exit:
- ; Open file
- mov eax, 5 ; System call to open file
- mov ebx, file_name ; Filename flag
- mov ecx, 0 ; Open file flag (O_CREAT | O_WRONLY)
- mov edx, 0644 ; File access permission
- int 0x80 ; Call system call
- ; Write data to file
- mov eax, 4 ; System call to write in file data
- mov ebx, eax ; File descryptor
- mov ecx, pc_health_status ; Write data of your pc status
- mov edx, pc_health_len ; Line length
- int 0x80 ; Call system call
- ; Close file
- mov eax, 6 ; System call to close file
- int 0x80 ; Call system call
- int 20h ; Start operating system
- ; Your code to start operating system
- read:
- mov ah, 3Fh ; Read from file
- mov bx, ax ; Get file descryptor
- lea dx, buffer ; Buffer to save data from file
- mov cx, 255 ; Count bytes to read (maximum 255)
- int 21h
- ; If reader value assign `null` close
- or ax, ax
- jz close_reader ; Close file call
- ; Write data to screen
- mov ah, 9 ; Print line to screen
- lea ds, buffer ; Get value from buffer
- int 21h
- jmp read ; Read next line
- close_reader:
- mov ah, 3Eh ; Close file
- mov bx, ax ; Get file descryptor
- int 21h
- section .data
- buffer db 1000 dup(0)
- file_name db "bios.ini", 0
- pc_health_status db "PCHealtStatus=Normal", 0
- pc_health_len equ $ - pc_health_status
- msg db "LMScript BIOS", 0
- quit_msg db "Esc - Quit F10 - Save & Exit Setup", 0
- TIMES 510 - ($ - START) DB 0 ; Fill unused bytes with zeros
- DW 0xAA55 ; End loading sector signature
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement