Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Batch Script - Print colored text with debug.exe by bl8086

By: bl8086 on Aug 2nd, 2012  |  syntax: None  |  size: 2.44 KB  |  views: 796  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. set /a _er=0
  4. set /a _n=0
  5. set _ln=%~4
  6. goto init
  7.  
  8.  
  9. :howuse ---------------------------------------------------------------
  10.  
  11.         echo ------------------
  12.         echo ECOL.BAT - ver 1.0
  13.         echo ------------------
  14.         echo Print colored text in batch script
  15.         echo Written by BrendanLS - http://640kbworld.forum.st
  16.         echo.
  17.         echo Syntax:
  18.         echo ECOL.BAT [COLOR] [X] [Y] "Insert your text"
  19.         echo COLOR value must be a hexadecimal number
  20.         echo.
  21.         echo Example:
  22.         echo ECOL.BAT F0 20 30 "The 640KB World Forum"
  23.         echo.
  24.         echo Enjoy ;^)
  25.         goto quit
  26.  
  27. :error ----------------------------------------------------------------
  28.  
  29.         set /a "_er=_er | (%~1)"
  30.         goto quit
  31.  
  32. :geth -----------------------------------------------------------------
  33.  
  34.         set return=
  35.         set bts=%~1
  36.  
  37. :hshift ---------------------------------------------------------------
  38.  
  39.         set /a "nn = bts & 0xff"
  40.         set return=!h%nn%!%return%
  41.         set /a "bts = bts >> 0x8"
  42.         if %bts% gtr 0 goto hshift
  43.         goto quit
  44.  
  45. :init -----------------------------------------------------------------
  46.  
  47.         if "%~4"=="" call :error 0xff
  48.  
  49.         (
  50.                 set /a _cl=0x%1
  51.                 call :error !errorlevel!
  52.                 set _cl=%1
  53.                 call :error "0x!_cl! ^>^> 8"
  54.                 set /a _px=%2
  55.                 call :error !errorlevel!
  56.                 set /a _py=%3
  57.                 call :error !errorlevel!
  58.         ) 2>nul 1>&2
  59.  
  60.         if !_er! neq 0 (
  61.                 echo.
  62.                 echo ERROR: value exception "!_er!" occurred.
  63.                 echo.
  64.                 goto howuse
  65.         )
  66.  
  67.         set nsys=0123456789abcdef
  68.         set /a _val=-1
  69.  
  70.         for /l %%a in (0,1,15) do (
  71.                 for /l %%b in (0,1,15) do (
  72.                         set /a "_val += 1"
  73.                         set byte=!nsys:~%%a,1!!nsys:~%%b,1!
  74.                         set h!_val!=!byte!
  75.                 )
  76.         )
  77.  
  78.         set /a cnb=0
  79.         set /a cnl=0
  80.  
  81. :parse ----------------------------------------------------------------
  82.  
  83.         set _ch=!_ln:~%_n%,1!
  84.         if "%_ch%"=="" goto perform
  85.  
  86.         set /a "cnb += 1"
  87.         if %cnb% gtr 7 (
  88.                 set /a cnb=0
  89.                 set /a "cnl += 1"
  90.         )
  91.  
  92.         set bln%cnl%=!bln%cnl%! "!_ch!" %_cl%
  93.         set /a "_n += 1"
  94.         goto parse
  95.  
  96. :perform --------------------------------------------------------------
  97.  
  98.         set /a "in = ((_py * 160) + (_px * 2)) & 0xffff"
  99.         call :geth %in%
  100.         set ntr=!return!
  101.         set /a jmp=0xe
  102.  
  103.  
  104.         @for /l %%x in (0,1,%cnl%) do (
  105.                 set bl8086%%x=eb800:!ntr! !bln%%x!
  106.                 set /a "in=!jmp! + 0x!ntr!"
  107.                 call :geth !in!
  108.                 set ntr=!return!
  109.                 set /a jmp=0x10
  110.         )
  111.  
  112.         (
  113.         echo.%bl80860%&echo.%bl80861%&echo.%bl80862%&echo.%bl80863%&echo.%bl80864%
  114.         echo.q
  115.         )|debug >nul 2>&1
  116.  
  117. :quit