-
Notifications
You must be signed in to change notification settings - Fork 7
/
2-ibm-logo.8o
52 lines (40 loc) · 1.61 KB
/
2-ibm-logo.8o
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
# Disassembly of the famous "IBM logo" program, published here before:
# https://github.com/Timendus/chip-8/blob/master/octo/IBM%20logo.8o
# Annotated and converted to Octo mnemonics by Timendus, in the hope that it
# will be useful to people trying to debug their CHIP-8 interpreters
#
# Original "IBM logo" MD5 hash: 2dbace8066709ac9a264d23281820d32
# MD5 hash of binary from this code: 2dbace8066709ac9a264d23281820d32
#
# Unfortunately adding the version number to the image data changed the MD5
# hash of the final binary, but functionally absolutely nothing changed.
: main
clear # Address 512 / 0x200
i := ibm-0-0 # Address 514 / 0x202
v0 := 12 # Address 516 / 0x204
v1 := 8
sprite v0 v1 15 # Address 520 / 0x208
v0 += 9 # Address 522 / 0x20A
i := ibm-1-0
sprite v0 v1 15
i := ibm-2-0 # Interesting mixup here, swapping the operations
v0 += 8
sprite v0 v1 15
v0 += 4
i := ibm-3-0
sprite v0 v1 15
v0 += 8
i := ibm-4-0
sprite v0 v1 15
v0 += 8
i := ibm-5-0
sprite v0 v1 15
loop again # Address 552 / 0x228
:segment data
# What's interesting about this image data is that the author could have
# precisely stored the full image in 5 by 15 bytes. Yet they have chosen a way
# to pack the image which needs 6 by 15 bytes. The most obvious explanation for
# this that I can come up with is that they approached the challenge one letter
# at a time. Maybe it was easier to do the conversions from bits to hexadecimal
# this way.
:include "../../pictures/ibm.png" 8x15