blob: 222e91370fe84b5e21cc05972fad5899b1efcf6b [file] [log] [blame]
Tim Windelschmidt8e19fa42024-11-12 13:39:43 +00001org 7c00h
2
3start:
4 jmp main
5
6; si: string data, null terminated
7; di: start offset
8writestring:
9 mov al, [si]
10 or al, al
11 jz writestring_done
12 inc si
13 mov byte [fs:di], al
14 add di, 2
15 jmp writestring
16writestring_done:
17 ret
18
19; si: rle encoded data (high bit == color, lower 7: length)
20; di: start offset
21writegfx:
22 mov al, [si]
23 or al, al
24 jz writegfx_done
25 inc si
26
27 mov cl, al
28 and cx, 0b01111111
29 shr al, 7
30
31writegfx_nextinner:
32 or al, al
33 jz writegfx_space
34 mov byte [fs:di], 'M'
35writegfx_space:
36 add di, 2
37 sub cx, 1
38 jz writegfx
39 jmp writegfx_nextinner
40writegfx_done:
41 ret
42
43main:
44 xor ax, ax
45 mov ds, ax
46
47 ; set mode 3 (text 80x25, 16 color)
48 mov ax, 0x3
49 int 0x10
50
51 ; set up fs segment to point at framebuffer
52 mov ax, 0xb800
53 mov fs, ax
54
55 mov di, 4
56 mov si, logo
57 call writegfx
58
59 mov di, 3400
60 mov si, line1
61 call writestring
62
63 mov di, 3544
64 mov si, line2
65 call writestring
66
67end:
68 jmp end
69
70; Workaround to pass file as argument
71%macro incdef 1
72 %push _incdef_
73 %defstr %$file %{1}
74 %include %{$file}
75 %pop
76%endmacro
77
78incdef LOGO
79
80line1:
81 db "Hi there! Didn't see you coming in.", 0
82
83line2:
84 db "Unfortunately, Metropolis can only boot in UEFI mode.", 0
85
86db 0x55
87db 0xAA
88
89; We don't fill the rest with zeros, as this is done by mkimage and friends.