diff --git a/programs/other/rainbow/Tupfile.lua b/programs/other/rainbow/Tupfile.lua new file mode 100644 index 0000000000..9acfd4b5eb --- /dev/null +++ b/programs/other/rainbow/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("rainbow.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "rainbow") diff --git a/programs/other/rainbow/colors.asm b/programs/other/rainbow/colors.asm new file mode 100644 index 0000000000..b58f0c7f67 --- /dev/null +++ b/programs/other/rainbow/colors.asm @@ -0,0 +1,155 @@ +; Autogenerated from colors.txt, do not edit this file! +; gawk -f colors.gawk colors.txt > colors.asm + +colors dd 0xf0f8ff, 0xfaebd7, 0x00ffff, 0x7fffd4, 0xf0ffff, 0xf5f5dc, 0xffe4c4, 0x000000, 0xffebcd, 0x0000ff, 0x8a2be2, 0xa52a2a, 0xdeb887, 0x5f9ea0, 0x7fff00, 0xd2691e, 0xff7f50, 0x6495ed, 0xfff8dc, 0xdc143c, 0x00ffff, 0x00008b, 0x008b8b, 0xb8860b, 0xa9a9a9, 0x006400, 0xa9a9a9, 0xbdb76b, 0x8b008b, 0x556b2f, 0xff8c00, 0x9932cc, 0x8b0000, 0xe9967a, 0x8fbc8f, 0x483d8b, 0x2f4f4f, 0x2f4f4f, 0x00ced1, 0x9400d3, 0xff1493, 0x00bfff, 0x696969, 0x696969, 0x1e90ff, 0xb22222, 0xfffaf0, 0x228b22, 0xff00ff, 0xdcdcdc, 0xf8f8ff, 0xffd700, 0xdaa520, 0x808080, 0x008000, 0xadff2f, 0x808080, 0xf0fff0, 0xff69b4, 0xcd5c5c, 0x4b0082, 0xfffff0, 0xf0e68c, 0xe6e6fa, 0xfff0f5, 0x7cfc00, 0xfffacd, 0xadd8e6, 0xf08080, 0xe0ffff, 0xfafad2, 0xd3d3d3, 0x90ee90, 0xd3d3d3, 0xffb6c1, 0xffa07a, 0x20b2aa, 0x87cefa, 0x778899, 0x778899, 0xb0c4de, 0xffffe0, 0x00ff00, 0x32cd32, 0xfaf0e6, 0xff00ff, 0x800000, 0x66cdaa, 0x0000cd, 0xba55d3, 0x9370db, 0x3cb371, 0x7b68ee, 0x00fa9a, 0x48d1cc, 0xc71585, 0x191970, 0xf5fffa, 0xffe4e1, 0xffe4b5, 0xffdead, 0x000080, 0xfdf5e6, 0x808000, 0x6b8e23, 0xffa500, 0xff4500, 0xda70d6, 0xeee8aa, 0x98fb98, 0xafeeee, 0xdb7093, 0xffefd5, 0xffdab9, 0xcd853f, 0xffc0cb, 0xdda0dd, 0xb0e0e6, 0x800080, 0x663399, 0xff0000, 0xbc8f8f, 0x4169e1, 0x8b4513, 0xfa8072, 0xf4a460, 0x2e8b57, 0xfff5ee, 0xa0522d, 0xc0c0c0, 0x87ceeb, 0x6a5acd, 0x708090, 0x708090, 0xfffafa, 0x00ff7f, 0x4682b4, 0xd2b48c, 0x008080, 0xd8bfd8, 0xff6347, 0x40e0d0, 0xee82ee, 0xf5deb3, 0xffffff, 0xf5f5f5, 0xffff00, 0x9acd32 + +names dw aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkgrey, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, green, greenyellow, grey, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, rebeccapurple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen + +aliceblue db 9,'aliceblue' +antiquewhite db 12,'antiquewhite' +aqua db 4,'aqua' +aquamarine db 10,'aquamarine' +azure db 5,'azure' +beige db 5,'beige' +bisque db 6,'bisque' +black db 5,'black' +blanchedalmond db 14,'blanchedalmond' +blue db 4,'blue' +blueviolet db 10,'blueviolet' +brown db 5,'brown' +burlywood db 9,'burlywood' +cadetblue db 9,'cadetblue' +chartreuse db 10,'chartreuse' +chocolate db 9,'chocolate' +coral db 5,'coral' +cornflowerblue db 14,'cornflowerblue' +cornsilk db 8,'cornsilk' +crimson db 7,'crimson' +cyan db 4,'cyan' +darkblue db 8,'darkblue' +darkcyan db 8,'darkcyan' +darkgoldenrod db 13,'darkgoldenrod' +darkgray db 8,'darkgray' +darkgreen db 9,'darkgreen' +darkgrey db 8,'darkgrey' +darkkhaki db 9,'darkkhaki' +darkmagenta db 11,'darkmagenta' +darkolivegreen db 14,'darkolivegreen' +darkorange db 10,'darkorange' +darkorchid db 10,'darkorchid' +darkred db 7,'darkred' +darksalmon db 10,'darksalmon' +darkseagreen db 12,'darkseagreen' +darkslateblue db 13,'darkslateblue' +darkslategray db 13,'darkslategray' +darkslategrey db 13,'darkslategrey' +darkturquoise db 13,'darkturquoise' +darkviolet db 10,'darkviolet' +deeppink db 8,'deeppink' +deepskyblue db 11,'deepskyblue' +dimgray db 7,'dimgray' +dimgrey db 7,'dimgrey' +dodgerblue db 10,'dodgerblue' +firebrick db 9,'firebrick' +floralwhite db 11,'floralwhite' +forestgreen db 11,'forestgreen' +fuchsia db 7,'fuchsia' +gainsboro db 9,'gainsboro' +ghostwhite db 10,'ghostwhite' +gold db 4,'gold' +goldenrod db 9,'goldenrod' +gray db 4,'gray' +green db 5,'green' +greenyellow db 11,'greenyellow' +grey db 4,'grey' +honeydew db 8,'honeydew' +hotpink db 7,'hotpink' +indianred db 9,'indianred' +indigo db 6,'indigo' +ivory db 5,'ivory' +khaki db 5,'khaki' +lavender db 8,'lavender' +lavenderblush db 13,'lavenderblush' +lawngreen db 9,'lawngreen' +lemonchiffon db 12,'lemonchiffon' +lightblue db 9,'lightblue' +lightcoral db 10,'lightcoral' +lightcyan db 9,'lightcyan' +lightgoldenrodyellow db 20,'lightgoldenrodyellow' +lightgray db 9,'lightgray' +lightgreen db 10,'lightgreen' +lightgrey db 9,'lightgrey' +lightpink db 9,'lightpink' +lightsalmon db 11,'lightsalmon' +lightseagreen db 13,'lightseagreen' +lightskyblue db 12,'lightskyblue' +lightslategray db 14,'lightslategray' +lightslategrey db 14,'lightslategrey' +lightsteelblue db 14,'lightsteelblue' +lightyellow db 11,'lightyellow' +lime db 4,'lime' +limegreen db 9,'limegreen' +linen db 5,'linen' +magenta db 7,'magenta' +maroon db 6,'maroon' +mediumaquamarine db 16,'mediumaquamarine' +mediumblue db 10,'mediumblue' +mediumorchid db 12,'mediumorchid' +mediumpurple db 12,'mediumpurple' +mediumseagreen db 14,'mediumseagreen' +mediumslateblue db 15,'mediumslateblue' +mediumspringgreen db 17,'mediumspringgreen' +mediumturquoise db 15,'mediumturquoise' +mediumvioletred db 15,'mediumvioletred' +midnightblue db 12,'midnightblue' +mintcream db 9,'mintcream' +mistyrose db 9,'mistyrose' +moccasin db 8,'moccasin' +navajowhite db 11,'navajowhite' +navy db 4,'navy' +oldlace db 7,'oldlace' +olive db 5,'olive' +olivedrab db 9,'olivedrab' +orange db 6,'orange' +orangered db 9,'orangered' +orchid db 6,'orchid' +palegoldenrod db 13,'palegoldenrod' +palegreen db 9,'palegreen' +paleturquoise db 13,'paleturquoise' +palevioletred db 13,'palevioletred' +papayawhip db 10,'papayawhip' +peachpuff db 9,'peachpuff' +peru db 4,'peru' +pink db 4,'pink' +plum db 4,'plum' +powderblue db 10,'powderblue' +purple db 6,'purple' +rebeccapurple db 13,'rebeccapurple' +red db 3,'red' +rosybrown db 9,'rosybrown' +royalblue db 9,'royalblue' +saddlebrown db 11,'saddlebrown' +salmon db 6,'salmon' +sandybrown db 10,'sandybrown' +seagreen db 8,'seagreen' +seashell db 8,'seashell' +sienna db 6,'sienna' +silver db 6,'silver' +skyblue db 7,'skyblue' +slateblue db 9,'slateblue' +slategray db 9,'slategray' +slategrey db 9,'slategrey' +snow db 4,'snow' +springgreen db 11,'springgreen' +steelblue db 9,'steelblue' +tan db 3,'tan' +teal db 4,'teal' +thistle db 7,'thistle' +tomato db 6,'tomato' +turquoise db 9,'turquoise' +violet db 6,'violet' +wheat db 5,'wheat' +white db 5,'white' +whitesmoke db 10,'whitesmoke' +yellow db 6,'yellow' +yellowgreen db 11,'yellowgreen' diff --git a/programs/other/rainbow/colors.gawk b/programs/other/rainbow/colors.gawk new file mode 100644 index 0000000000..2cb4dde4a4 --- /dev/null +++ b/programs/other/rainbow/colors.gawk @@ -0,0 +1,33 @@ +BEGIN { +} + +{ + cnt++ + names[cnt] = $1 + colors[cnt] = $2 +} + +END { + printf "; Autogenerated from colors.txt, do not edit this file!\n" + printf "; gawk -f colors.gawk colors.txt > colors.asm\n\n" + printf "colors dd " + printf colors[1] + for (i=2; i<=cnt; i++) { + printf ", %s", colors[i] + } + + printf "\n\n" + + printf "names dw " + printf names[1] + for (i=2; i<=cnt; i++) { + printf ", %s", names[i] + } + + printf "\n\n" + + for (i=1; i<=cnt; i++) { + printf "%s db %d,'%s'\n", names[i], length(names[i]), names[i] + } +} + diff --git a/programs/other/rainbow/colors.txt b/programs/other/rainbow/colors.txt new file mode 100644 index 0000000000..391a150e63 --- /dev/null +++ b/programs/other/rainbow/colors.txt @@ -0,0 +1,148 @@ +aliceblue 0xf0f8ff +antiquewhite 0xfaebd7 +aqua 0x00ffff +aquamarine 0x7fffd4 +azure 0xf0ffff +beige 0xf5f5dc +bisque 0xffe4c4 +black 0x000000 +blanchedalmond 0xffebcd +blue 0x0000ff +blueviolet 0x8a2be2 +brown 0xa52a2a +burlywood 0xdeb887 +cadetblue 0x5f9ea0 +chartreuse 0x7fff00 +chocolate 0xd2691e +coral 0xff7f50 +cornflowerblue 0x6495ed +cornsilk 0xfff8dc +crimson 0xdc143c +cyan 0x00ffff +darkblue 0x00008b +darkcyan 0x008b8b +darkgoldenrod 0xb8860b +darkgray 0xa9a9a9 +darkgreen 0x006400 +darkgrey 0xa9a9a9 +darkkhaki 0xbdb76b +darkmagenta 0x8b008b +darkolivegreen 0x556b2f +darkorange 0xff8c00 +darkorchid 0x9932cc +darkred 0x8b0000 +darksalmon 0xe9967a +darkseagreen 0x8fbc8f +darkslateblue 0x483d8b +darkslategray 0x2f4f4f +darkslategrey 0x2f4f4f +darkturquoise 0x00ced1 +darkviolet 0x9400d3 +deeppink 0xff1493 +deepskyblue 0x00bfff +dimgray 0x696969 +dimgrey 0x696969 +dodgerblue 0x1e90ff +firebrick 0xb22222 +floralwhite 0xfffaf0 +forestgreen 0x228b22 +fuchsia 0xff00ff +gainsboro 0xdcdcdc +ghostwhite 0xf8f8ff +gold 0xffd700 +goldenrod 0xdaa520 +gray 0x808080 +green 0x008000 +greenyellow 0xadff2f +grey 0x808080 +honeydew 0xf0fff0 +hotpink 0xff69b4 +indianred 0xcd5c5c +indigo 0x4b0082 +ivory 0xfffff0 +khaki 0xf0e68c +lavender 0xe6e6fa +lavenderblush 0xfff0f5 +lawngreen 0x7cfc00 +lemonchiffon 0xfffacd +lightblue 0xadd8e6 +lightcoral 0xf08080 +lightcyan 0xe0ffff +lightgoldenrodyellow 0xfafad2 +lightgray 0xd3d3d3 +lightgreen 0x90ee90 +lightgrey 0xd3d3d3 +lightpink 0xffb6c1 +lightsalmon 0xffa07a +lightseagreen 0x20b2aa +lightskyblue 0x87cefa +lightslategray 0x778899 +lightslategrey 0x778899 +lightsteelblue 0xb0c4de +lightyellow 0xffffe0 +lime 0x00ff00 +limegreen 0x32cd32 +linen 0xfaf0e6 +magenta 0xff00ff +maroon 0x800000 +mediumaquamarine 0x66cdaa +mediumblue 0x0000cd +mediumorchid 0xba55d3 +mediumpurple 0x9370db +mediumseagreen 0x3cb371 +mediumslateblue 0x7b68ee +mediumspringgreen 0x00fa9a +mediumturquoise 0x48d1cc +mediumvioletred 0xc71585 +midnightblue 0x191970 +mintcream 0xf5fffa +mistyrose 0xffe4e1 +moccasin 0xffe4b5 +navajowhite 0xffdead +navy 0x000080 +oldlace 0xfdf5e6 +olive 0x808000 +olivedrab 0x6b8e23 +orange 0xffa500 +orangered 0xff4500 +orchid 0xda70d6 +palegoldenrod 0xeee8aa +palegreen 0x98fb98 +paleturquoise 0xafeeee +palevioletred 0xdb7093 +papayawhip 0xffefd5 +peachpuff 0xffdab9 +peru 0xcd853f +pink 0xffc0cb +plum 0xdda0dd +powderblue 0xb0e0e6 +purple 0x800080 +rebeccapurple 0x663399 +red 0xff0000 +rosybrown 0xbc8f8f +royalblue 0x4169e1 +saddlebrown 0x8b4513 +salmon 0xfa8072 +sandybrown 0xf4a460 +seagreen 0x2e8b57 +seashell 0xfff5ee +sienna 0xa0522d +silver 0xc0c0c0 +skyblue 0x87ceeb +slateblue 0x6a5acd +slategray 0x708090 +slategrey 0x708090 +snow 0xfffafa +springgreen 0x00ff7f +steelblue 0x4682b4 +tan 0xd2b48c +teal 0x008080 +thistle 0xd8bfd8 +tomato 0xff6347 +turquoise 0x40e0d0 +violet 0xee82ee +wheat 0xf5deb3 +white 0xffffff +whitesmoke 0xf5f5f5 +yellow 0xffff00 +yellowgreen 0x9acd32 diff --git a/programs/other/rainbow/rainbow.asm b/programs/other/rainbow/rainbow.asm new file mode 100644 index 0000000000..3264f109cb --- /dev/null +++ b/programs/other/rainbow/rainbow.asm @@ -0,0 +1,165 @@ +use32 + org 0x0 + db 'MENUET01' + dd 0x01,start,i_end,e_end,e_end,0,0 + +include '../../proc32.inc' +include '../../macros.inc' + + +NUMCOLORS = 148 ; CSS4 named colors (http://dev.w3.org/csswg/css-color/) + + +start: + mcall 66, 1, 1 ; set kbd mode to scancodes +still: + mcall 10 + dec eax + jz redraw + dec eax + jz key + +button: + mcall 17 + shr eax, 8 + + cmp eax, 1 + jz quit + jmp still + +redraw: + mcall 12, 1 + + mov ebx, [window.left] + shl ebx, 16 + add ebx, [window.width] + mov ecx, [window.top] + shl ecx, 16 + add ecx, [window.height] + mcall 0, , , [window_style], , window_title + mcall 9, proc_info, -1 + + + mov eax, [current_color] + mov ebx, [proc_info.client_box.width] + inc ebx + mov ecx, [proc_info.client_box.height] + inc ecx + or edx, [colors + eax*4] + mcall 13, , , + + mov eax, [current_color] + movzx edx, byte[colors + eax*4 + 0] + add dl, byte[colors + eax*4 + 1] + adc dh, 0 + add dl, byte[colors + eax*4 + 2] + adc dh, 0 + xor ecx, ecx + cmp edx, 0x80*3 + jae @f + add ecx, 0xffffff + @@: + movzx edx, [names + eax*2] + movzx esi, byte[edx] + inc edx + lea eax, [esi*3] + add eax, eax + + mov ebx, [proc_info.client_box.width] + sub ebx, eax + inc ebx + shr ebx, 1 + shl ebx, 16 + add ebx, [proc_info.client_box.height] + sub ebx, 9 + shr bx, 1 + + mcall 4, , , + + mcall 12, 2 + jmp still + +key: + mcall 2 + cmp ah, 63 ; f5 + jnz @f + call toggle_fullscreen + jmp redraw + @@: + cmp ah, 1 ; esc + jnz @f + bt [window_style], 25 + jc quit + call toggle_fullscreen + jmp redraw + @@: + cmp ah, 72 ; up + jz .prev + cmp ah, 75 ; left + jz .prev + cmp ah, 73 ; page up + jz .prev + cmp ah, 77 ; right + jz .next + cmp ah, 80 ; down + jz .next + cmp ah, 81 ; page down + jz .next + jmp still + +.prev: + dec [current_color] + jns @f + mov [current_color], NUMCOLORS - 1 + @@: + jmp redraw + +.next: + inc [current_color] + cmp [current_color], NUMCOLORS + jnz @f + mov [current_color], 0 + @@: + jmp redraw + + +toggle_fullscreen: + btc [window_style], 25 + jc .fullscreen + ; back from fullscreen + mcall 67, [window.left], [window.top], [window.width], [window.height] + jmp .done + .fullscreen: + mov eax, [proc_info.box.width] + mov [window.width], eax + mov eax, [proc_info.box.height] + mov [window.height], eax + mov eax, [proc_info.box.left] + mov [window.left], eax + mov eax, [proc_info.box.top] + mov [window.top], eax + mcall 14 + mov edx, eax + shr edx, 16 + movzx eax, ax + mov esi, eax + mcall 67, 0, 0, , + .done: + ret + +quit: + mcall -1 + + +window_title db 'Rainbow',0 +window_style dd 0x73000000 +window BOX 300, 300, 315, 184 ; left top width height +current_color dd 0 + +align 4 +include 'colors.asm' ; generated data + +i_end: +proc_info process_information +rb 0x100 ;stack +e_end: