about summary refs log tree commit diff stats
path: root/316colors.subx
blob: 5ecd9a14bb38552336c2185b40c5457bb484bb03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
*~
*.pyc
*.pyo
stuff/*
93'>193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
# Some information about the default palette of 256 colors provided by the
# BIOS on x86 computers.

== code

# Return the r/g/b for color [0, 256) in ecx/edx/ebx respectively.
color-rgb:  # color: int -> _/ecx: int, _/edx: int, _/ebx: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    56/push-esi
    # esi = color
    8b/-> *(ebp+8) 6/r32/esi
    #
    81 7/subop/compare %esi 0x100/imm32
    {
      7c/jump-if-< break/disp8
      (abort "invalid color")
    }
    # var color/esi: int = Colors-rgb[color]
    b8/copy-to-eax Colors-rgb/imm32
    8b/-> *(eax+esi<<2+4) 6/r32/esi
    # var red/ecx: int = color & 0xff
    89/<- %eax 6/r32/esi
    25/and-eax-with 0xff/imm32
    89/<- %ecx 0/r32/eax
    # var green/edx: int = (color >> 8) & 0xff
    89/<- %eax 6/r32/esi
    c1 5/subop/shift-right-logical %eax 8/imm8
    25/and-eax-with 0xff/imm32
    89/<- %edx 0/r32/eax
    # var blue/ebx: int = (color >> 16)
    89/<- %eax 6/r32/esi
    c1 5/subop/shift-right-logical %eax 0x10/imm8
    89/<- %ebx 0/r32/eax
$colors-rgb:end:
    # . restore registers
    5e/pop-to-esi
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-color-rgb:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (color-rgb 0x10)  # => eax ecx edx
    (check-ints-equal %ecx 0 "F - test-color-rgb/0x10/r")
    (check-ints-equal %edx 0 "F - test-color-rgb/0x10/g")
    (check-ints-equal %ebx 0 "F - test-color-rgb/0x10/b")
    (color-rgb 1)  # => eax ecx edx
    (check-ints-equal %ecx 0 "F - test-color-rgb/1/r")
    (check-ints-equal %edx 0 "F - test-color-rgb/1/g")
    (check-ints-equal %ebx 0xaa "F - test-color-rgb/1/b")
    (color-rgb 0xf)  # => eax ecx edx
    (check-ints-equal %ecx 0xff "F - test-color-rgb/0xf/r")
    (check-ints-equal %edx 0xff "F - test-color-rgb/0xf/g")
    (check-ints-equal %ebx 0xff "F - test-color-rgb/0xf/b")
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

== data

Colors-rgb:
  0x400/imm32
  00 00 00 00
  00 00 aa 00
  00 aa 00 00
  00 aa aa 00
  aa 00 00 00
  aa 00 aa 00
  aa 55 00 00
  aa aa aa 00
  55 55 55 00
  55 55 ff 00
  55 ff 55 00
  55 ff ff 00
  ff 55 55 00
  ff 55 ff 00
  ff ff 55 00
  ff ff ff 00
  00 00 00 00
  14 14 14 00
  20 20 20 00
  2c 2c 2c 00
  38 38 38 00
  45 45 45 00
  51 51 51 00
  61 61 61 00
  71 71 71 00
  82 82 82 00
  92 92 92 00
  a2 a2 a2 00
  b6 b6 b6 00
  cb cb cb 00
  e3 e3 e3 00
  ff ff ff 00
  00 00 ff 00
  41 00 ff 00
  7d 00 ff 00
  be 00 ff 00
  ff 00 ff 00
  ff 00 be 00
  ff 00 7d 00
  ff 00 41 00
  ff 00 00 00
  ff 41 00 00
  ff 7d 00 00
  ff be 00 00
  ff ff 00 00
  be ff 00 00
  7d ff 00 00
  41 ff 00 00
  00 ff 00 00
  00 ff 41 00
  00 ff 7d 00
  00 ff be 00
  00 ff ff 00
  00 be ff 00
  00 7d ff 00
  00 41 ff 00
  7d 7d ff 00
  9e 7d ff 00
  be 7d ff 00
  df 7d ff 00
  ff 7d ff 00
  ff 7d df 00
  ff 7d be 00
  ff 7d 9e 00
  ff 7d 7d 00
  ff 9e 7d 00
  ff be 7d 00
  ff df 7d 00
  ff ff 7d 00
  df ff 7d 00
  be ff 7d 00
  9e ff 7d 00
  7d ff 7d 00
  7d ff 9e 00
  7d ff be 00
  7d ff df 00
  7d ff ff 00
  7d df ff 00
  7d be ff 00
  7d 9e ff 00
  b6 b6 ff 00
  c7 b6 ff 00
  db b6 ff 00
  eb b6 ff 00
  ff b6 ff 00
  ff b6 eb 00
  ff b6 db 00
  ff b6 c7 00
  ff b6 b6 00
  ff c7 b6 00
  ff db b6 00
  ff eb b6 00
  ff ff b6 00
  eb ff b6 00
  db ff b6 00
  c7 ff b6 00
  b6 ff b6 00
  b6 ff c7 00
  b6 ff db 00
  b6 ff eb 00
  b6 ff ff 00
  b6 eb ff 00
  b6 db ff 00
  b6 c7 ff 00
  00 00 71 00
  1c 00 71 00
  38 00 71 00
  55 00 71 00
  71 00 71 00
  71 00 55 00
  71 00 38 00
  71 00 1c 00
  71 00 00 00
  71 1c 00 00
  71 38 00 00
  71 55 00 00
  71 71 00 00
  55 71 00 00
  38 71 00 00
  1c 71 00 00
  00 71 00 00
  00 71 1c 00
  00 71 38 00
  00 71 55 00
  00 71 71 00
  00 55 71 00
  00 38 71 00
  00 1c 71 00
  38 38 71 00
  45 38 71 00
  55 38 71 00
  61 38 71 00
  71 38 71 00
  71 38 61 00
  71 38 55 00
  71 38 45 00
  71 38 38 00
  71 45 38 00
  71 55 38 00
  71 61 38 00
  71 71 38 00
  61 71 38 00
  55 71 38 00
  45 71 38 00
  38 71 38 00
  38 71 45 00
  38 71 55 00
  38 71 61 00
  38 71 71 00
  38 61 71 00
  38 55 71 00
  38 45 71 00
  51 51 71 00
  59 51 71 00
  61 51 71 00
  69 51 71 00
  71 51 71 00
  71 51 69 00
  71 51 61 00
  71 51 59 00
  71 51 51 00
  71 59 51 00
  71 61 51 00
  71 69 51 00
  71 71 51 00
  69 71 51 00
  61 71 51 00
  59 71 51 00
  51 71 51 00
  51 71 59 00
  51 71 61 00
  51 71 69 00
  51 71 71 00
  51 69 71 00
  51 61 71 00
  51 59 71 00
  00 00 41 00
  10 00 41 00
  20 00 41 00
  30 00 41 00
  41 00 41 00
  41 00 30 00
  41 00 20 00
  41 00 10 00
  41 00 00 00
  41 10 00 00
  41 20 00 00
  41 30 00 00
  41 41 00 00
  30 41 00 00
  20 41 00 00
  10 41 00 00
  00 41 00 00
  00 41 10 00
  00 41 20 00
  00 41 30 00
  00 41 41 00
  00 30 41 00
  00 20 41 00
  00 10 41 00
  20 20 41 00
  28 20 41 00
  30 20 41 00
  38 20 41 00
  41 20 41 00
  41 20 38 00
  41 20 30 00
  41 20 28 00
  41 20 20 00
  41 28 20 00
  41 30 20 00
  41 38 20 00
  41 41 20 00
  38 41 20 00
  30 41 20 00
  28 41 20 00
  20 41 20 00
  20 41 28 00
  20 41 30 00
  20 41 38 00
  20 41 41 00
  20 38 41 00
  20 30 41 00
  20 28 41 00
  2c 2c 41 00
  30 2c 41 00
  34 2c 41 00
  3c 2c 41 00
  41 2c 41 00
  41 2c 3c 00
  41 2c 34 00
  41 2c 30 00
  41 2c 2c 00
  41 30 2c 00
  41 34 2c 00
  41 3c 2c 00
  41 41 2c 00
  3c 41 2c 00
  34 41 2c 00
  30 41 2c 00
  2c 41 2c 00
  2c 41 30 00
  2c 41 34 00
  2c 41 3c 00
  2c 41 41 00
  2c 3c 41 00
  2c 34 41 00
  2c 30 41 00
  00 00 00 00
  00 00 00 00
  00 00 00 00
  00 00 00 00
  00 00 00 00
  00 00 00 00
  00 00 00 00
  00 00 00 00