-
Notifications
You must be signed in to change notification settings - Fork 1
/
poc.asm
77 lines (62 loc) · 1 KB
/
poc.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
[bits 16]
org 0x7c00
start:
; vga video mode bios settings
mov ah, 0x0
mov al, 0x2
int 0x10
; vga video memory map
mov ax, 0xb000
mov ds, ax
mov es, ax
; set up code segment
push cs
; set up stack
pop ds
mov bx, before_str
call print_string
mov ax, 0x$NBL1
mov [exec_context+1], ax
mov ax, 0x$NBL2
mov [exec_context+3], ax
jmp exec_context
after:
mov bx, after_str
call print_string
loop_forever:
jmp loop_forever
print_letter:
pusha
mov ah, 0xe
mov bx, 0xf
int 0x10
popa
ret
print_string:
pusha
print_string_begin:
mov al, [bx]
test al, al
je print_string_end
push bx
call print_letter
pop bx
inc bx
jmp print_string_begin
print_string_end:
popa
ret
exec_context:
pusha
nop
nop
nop
nop
popa
jmp after
before_str:
db "Before", 0xa, 0xd, 0x0
after_str:
db "After", 0xa, 0xd, 0x0
times 510-($-$$) db 0
db 0x55, 0xaa