2023-02-12 00:42:14 -06:00
|
|
|
[BITS 32]
|
2023-02-17 01:41:30 -06:00
|
|
|
[ORG 0x800000]
|
2023-01-31 21:26:43 -06:00
|
|
|
global user_test
|
|
|
|
user_test:
|
|
|
|
mov dword [0xb8000], 0x0f000f00 | 'U' | 's' << 16
|
|
|
|
mov dword [0xb8004], 0x0f000f00 | 'e' | 'r' << 16
|
|
|
|
mov dword [0xb8008], 0x0f000f00 | 'm' | 'o' << 16
|
|
|
|
mov dword [0xb800C], 0x0f000f00 | 'd' | 'e' << 16
|
2023-02-07 23:53:13 -06:00
|
|
|
mov dword [0xb8010], 0x0f000f00 | '!'
|
2023-02-06 05:49:03 -06:00
|
|
|
mov dword [0xb8000+160], 0x0f000f00 | 'F' | 'a' << 16
|
|
|
|
mov dword [0xb8004+160], 0x0f000f00 | 'u' | 'l' << 16
|
|
|
|
mov dword [0xb8008+160], 0x0f000f00 | 't' | 's' << 16
|
|
|
|
mov dword [0xb800C+160], 0x0f000f00 | ':' | ' ' << 16
|
|
|
|
mov dword [0xb8000+320], 0x0f000f00 | 'd' | ':' << 16
|
|
|
|
mov dword [0xb8004+320], 0x0f000f00 | ' ' | '#' << 16
|
|
|
|
mov dword [0xb8008+320], 0x0f000f00 | 'D' | 'I' << 16
|
|
|
|
mov dword [0xb800C+320], 0x0f000f00 | 'V' | ' ' << 16
|
|
|
|
mov dword [0xb8000+480], 0x0f000f00 | 'p' | ':' << 16
|
|
|
|
mov dword [0xb8004+480], 0x0f000f00 | ' ' | 'P' << 16
|
|
|
|
mov dword [0xb8008+480], 0x0f000f00 | 'G' | 'F' << 16
|
|
|
|
mov dword [0xb800C+480], 0x0f000f00 | 'L' | 'T' << 16
|
2023-02-07 23:53:13 -06:00
|
|
|
mov dword [0xb8000+640], 0x0f000f00 | 'u' | ':' << 16
|
|
|
|
mov dword [0xb8004+640], 0x0f000f00 | ' ' | '#' << 16
|
|
|
|
mov dword [0xb8008+640], 0x0f000f00 | 'U' | 'D' << 16
|
|
|
|
mov dword [0xb800C+640], 0x0f000f00 | '2' | ' ' << 16
|
|
|
|
mov dword [0xb8000+800], 0x0f000f00 | 'g' | ':' << 16
|
|
|
|
mov dword [0xb8004+800], 0x0f000f00 | ' ' | '#' << 16
|
|
|
|
mov dword [0xb8008+800], 0x0f000f00 | 'G' | 'P' << 16
|
|
|
|
mov dword [0xb800C+800], 0x0f000f00 | 'F' | ' ' << 16
|
2024-01-07 22:33:27 -06:00
|
|
|
.busy:
|
|
|
|
jmp .busy
|
2023-02-06 02:27:33 -06:00
|
|
|
mov eax, 0 ; command = 00h, get key
|
2023-02-02 00:50:16 -06:00
|
|
|
int 0x21 ; OS call
|
2023-02-06 05:49:03 -06:00
|
|
|
cmp al, 'd'
|
|
|
|
je .div_err
|
|
|
|
cmp al, 'p'
|
|
|
|
je .page_err
|
2023-02-07 23:53:13 -06:00
|
|
|
cmp al, 'u'
|
|
|
|
je .undefined_err
|
|
|
|
cmp al, 'g'
|
|
|
|
je .gpf_err
|
2023-02-02 14:52:26 -06:00
|
|
|
push 0x00000013 ; eax AH=0,AL=3 set video mode 3
|
|
|
|
push 0x00000000 ; ecx
|
|
|
|
push 0x00000000 ; edx
|
|
|
|
push 0x00000000 ; ebx
|
|
|
|
push 0x00000000 ; esi
|
|
|
|
push 0x00000000 ; edi
|
2023-02-17 01:41:30 -06:00
|
|
|
push 0x00000000 ; ebp
|
2023-02-02 14:52:26 -06:00
|
|
|
push esp ; regs
|
2023-02-06 02:27:33 -06:00
|
|
|
push 0x10 ; interrupt
|
|
|
|
mov eax, 0x86 ; command = 86h, virtual 8086 call
|
2023-02-02 00:50:16 -06:00
|
|
|
int 0x21 ; OS call
|
2023-01-31 21:26:43 -06:00
|
|
|
mov edi, 0xA0000
|
|
|
|
xor eax, eax
|
|
|
|
.loop:
|
|
|
|
mov ecx, 320
|
|
|
|
rep stosb
|
|
|
|
inc al
|
|
|
|
cmp eax, 200
|
|
|
|
jl .loop
|
|
|
|
mov eax, 0xA0000
|
|
|
|
int 0x30 ; Exit
|
2023-02-06 05:49:03 -06:00
|
|
|
.page_err:
|
2023-02-01 20:42:05 -06:00
|
|
|
mov edx, 0x105000 ; somewhere in kernel mem
|
|
|
|
mov edx, [edx] ; should page fault
|
2023-02-06 05:49:03 -06:00
|
|
|
.div_err:
|
2023-01-31 21:26:43 -06:00
|
|
|
xor ebx, ebx
|
|
|
|
div bl ; Unhandled DIV0 exception
|
2023-02-07 23:53:13 -06:00
|
|
|
.undefined_err:
|
|
|
|
ud2 ; undefined instruction
|
|
|
|
.gpf_err:
|
|
|
|
mov ax, 0x10
|
|
|
|
mov ds, ax ; load ds with bad value
|