-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuck-you-os.py
executable file
·76 lines (66 loc) · 1.08 KB
/
fuck-you-os.py
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
#!/usr/bin/env python
import sys
import os
if len(sys.argv) == 1:
print "Usage:"
print "\t%s /path/to/image.pbm"%(os.path.basename(sys.argv[0]))
sys.exit(1)
image = open(sys.argv[1])
lines = image.readlines()
print """
[BITS 16]
[ORG 0x7C00]
jmp main
TIMES 510 - ($ - $$) db 0
DW 0xAA55
main:
; enter video mode 13h
mov ax,0x13
int 0x10
mov al,0x00
redraw:
mov edi,0x0A0000
inc al
"""
run = 1
runNum = 0
lastChar = "1"
for line in lines[3:]:
for char in line.strip():
if char == lastChar:
run += 1
else:
print "not al"
print "mov ecx,", run
print "run%d:"%(runNum)
print "mov [edi],al"
print "inc edi"
print "loop run%d"%(runNum)
print ""
runNum += 1
lastChar = char
run = 1
print "not al"
print "mov ecx,", run
print "run%d:"%(runNum)
print "mov [edi],al"
print "inc edi"
print "loop run%d"%(runNum)
print ""
runNum += 1
lastChar = char
run = 1
print """
mov ax,0
mov ds,ax
mov cx,18
mov bx,[46Ch]
WaitForAnotherChange:
NoChange:
mov ax,[46Ch]
cmp ax, bx
je NoChange
mov bx,ax
loop WaitForAnotherChange
jmp redraw
"""