Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BITS 16
- ORG 7C00h
- start:
- cli
- mov ah, 02h
- mov al, 1
- mov ch, 0
- mov dh, 0
- mov cl, 2
- mov bx, loadLocation
- int 13h
- xor ax, ax
- push ax
- popf
- mov ds, ax
- lgdt [gdt_desc]
- mov eax, cr0
- or eax, 1
- mov cr0, eax
- jmp 08h:protectedModeBegin
- BITS 32
- protectedModeBegin:
- mov ax, 10h
- mov ds, ax
- mov ss, ax
- mov esp, 90000h
- mov [0B8000h], BYTE 'P'
- mov [0B8001h], BYTE 1Bh
- jmp loadLocation
- gdt:
- gdt_null:
- dq 0
- gdt_code:
- dw 0FFFFh
- dw 0
- db 0
- db 10011010b
- db 11001111b
- db 0
- gdt_data:
- dw 0FFFFh
- dw 0
- db 0
- db 10010010b
- db 11001111b
- db 0
- gdt_end:
- gdt_desc:
- dw gdt_end - gdt
- dd gdt
- times 510-($-$$) db 0
- dw 0AA55h
- loadLocation:
- mov [0B8002h], BYTE 'L'
- mov [0B8003h], BYTE 1Bh
- mov si, text
- mov ax, 01h
- mov bx, 01h
- call placeText
- mov si, text
- mov ax, 02h
- mov bx, 02h
- call placeText
- mov si, text
- mov ax, 03h
- mov bx, 03h
- call placeText
- mov si, text
- mov ax, 04h
- mov bx, 04h
- call placeText
- mov si, text
- mov ax, 05h
- mov bx, 05h
- call placeText
- mov si, text
- mov ax, 06h
- mov bx, 06h
- call placeText
- mov si, text
- mov ax, 07h
- mov bx, 07h
- call placeText
- mov si, text
- mov ax, 08h
- mov bx, 08h
- call placeText
- .loop:
- jmp .loop
- text:
- db "This is some test text.", 0FFh
- xPos: db 0
- yPos: db 0
- temp1: dw 0
- temp2: dw 0
- ;esi - Pointer to text
- ;ax - X Pos.
- ;bx - Y Pos.
- placeText:
- mov [temp1], ax
- mov ax, bx
- mov bx, 160
- mul bx
- mov [temp2], ax
- mov ax, [temp1]
- mov bx, 2
- mul bx
- mov bx, ax
- mov ax, [temp2]
- add eax, ebx
- mov ecx, 0B8000h
- add ecx, eax
- .placeTextLoop:
- lodsb
- cmp al, 0FFh
- je .donePlacingText
- mov [ecx], BYTE al
- add ecx, 1h
- mov [ecx], BYTE 1Bh
- add ecx, 1h
- jmp .placeTextLoop
- .donePlacingText:
- ret
Advertisement
Add Comment
Please, Sign In to add comment