125 lines
2.9 KiB
NASM
125 lines
2.9 KiB
NASM
|
|
times 442 - ($-$$) db 0
|
|
db "####"
|
|
times 446 - ($-$$) db 0
|
|
|
|
mbr_table:
|
|
.part_1:
|
|
db 0x80 ; bootable flag
|
|
db 0, 2, 0 ; CHS - start-address (ordering: cylinder, sector, header)
|
|
db 0x9d
|
|
db 0, 16, 0 ; CHS - end-address (ordering: cylinder, sector, header)
|
|
dd 2
|
|
dd 16
|
|
|
|
.part_2:
|
|
db 0x00 ; bootable flag
|
|
db 0, 0, 0 ; CHS - start-address (ordering: cylinder, sector, header)
|
|
db 0x0
|
|
db 0, 0, 0 ; CHS - end-address (ordering: cylinder, sector, header)
|
|
dd 0
|
|
dd 0
|
|
|
|
.part_3:
|
|
db 0x00 ; bootable flag
|
|
db 0, 0, 0 ; CHS - start-address (ordering: cylinder, sector, header)
|
|
db 0x00
|
|
db 0, 0, 0 ; CHS - end-address (ordering: cylinder, sector, header)
|
|
dd 0
|
|
dd 0
|
|
|
|
.part_4:
|
|
db 0x00 ; bootable flag
|
|
db 0, 0, 0 ; CHS - start-address (ordering: cylinder, sector, header)
|
|
db 0x00
|
|
db 0, 0, 0 ; CHS - end-address (ordering: cylinder, sector, header)
|
|
dd 0
|
|
dd 0
|
|
|
|
.signature:
|
|
db 0x55, 0xaa
|
|
|
|
|
|
|
|
second_stage:
|
|
|
|
;mov si, finish_text
|
|
;mov dl, 36
|
|
;mov dh, 12
|
|
;mov cx, 8
|
|
|
|
; set the video mode correctly
|
|
xor ah, ah ; bios-function (set video mode)
|
|
mov al, 3 ; video mode with 80x25 characters
|
|
int 0x10
|
|
|
|
.happiness:
|
|
|
|
mov ah, 0x02 ; action: move cursor
|
|
mov bh, 0 ; page
|
|
mov dh, 1 ; row
|
|
mov dl, 1 ; column
|
|
int 0x10
|
|
|
|
mov ah, 0x0a ; action: write character
|
|
mov al, '$' ; character
|
|
mov bh, 0 ; page
|
|
mov cx, 13 ; count
|
|
int 10h
|
|
|
|
jmp .happiness
|
|
|
|
.prolog:
|
|
push di
|
|
push cx
|
|
push bx
|
|
push ax
|
|
|
|
xor di, di ; character index
|
|
|
|
.printing_loop:
|
|
|
|
.set_cursor_position:
|
|
|
|
.write_character:
|
|
|
|
push cx ; save len_buffer
|
|
|
|
; get the current character
|
|
mov bx, si
|
|
add bx, di
|
|
mov al, [bx]
|
|
; al now contains the current character
|
|
|
|
; set the other needed interrupt values
|
|
mov ah, 0x0a ; wanted function (write character at cursor position)
|
|
mov bh, 0 ; page number
|
|
mov cx, 1 ; repetitions of character
|
|
int 0x10 ; call bios basic draw functions
|
|
|
|
pop cx ; restore len_buffer
|
|
|
|
|
|
|
|
inc dl ; go to next column
|
|
|
|
; go to a new line if needed
|
|
cmp dl, 80
|
|
jb .no_new_line_needed
|
|
xor dl, dl
|
|
inc dh ; increase column
|
|
|
|
.no_new_line_needed:
|
|
|
|
inc di ; go to next character
|
|
|
|
; go further if the string-printing hasn't been finished
|
|
cmp di, cx
|
|
jb .printing_loop
|
|
|
|
.epilog:
|
|
jmp .epilog
|
|
|
|
finish_text:
|
|
db "-FINISH-"
|