In [here], a colour TV screen is printed using Javascript. The following presents the MSDOS .COM format (16-bit executable) which shows the colour TV screen. The file size of this executable is 56 bytes only. However, the latest Windows versions discontinue the support of this format e.g. if you run it in the MSDOS Shell (actuall an emulator) you will get the following error.
However, running the .COM at earlier versions will show a similar colored screen (i.e. different colour layout). The idea is to print each colour column one by one and increment the colour index. From left to right, from top to bottom, each pixel is located and printed with the current colour index. The mov ah, 0ch specifies the 0c services for int 10h. The register AL specifies the colour index to print.
; PROGRAMMED BY justyy, 2008 ; LOOKS LIKE A TV SCREEN, 8 COLOR BARS ; 640 X 480 ; 56 BYTES. .MODEL TINY CODE SEGMENT ORG 100H START: MOV AX, 12H INT 10H MOV CX, 1 MOV DX, 1 JUDGE: CMP CX, 640 JL SAMELINE MOV CX, 1 ; new line INC DX CMP DX, 480 JG READKEY ; finish SAMELINE: MOV AX, CX DEC AX MOV BL, 80 DIV BL INC AL MOV AH, 0CH INT 10H ; draw a pixel INC CX JMP JUDGE READKEY: MOV AH, 01H INT 21H MOV AX, 3H INT 10H MOV AH, 4CH INT 21H CODE ENDS END START
If you don’t have a Assembly compiler, and wanna have a go, don’t worry, the following .BAT file will create this .COM file. You can also use this online tool to convert any .COM binary to DOS Batch, which reveals the machine code.
@rem This file is generated by machine... at 2012-08-25 32:08:55 @rem .COM file to .BAT convertor,,, programmed by justyy, 2008 @rem The .COM File Generated is size of 56 bytes. @if exist %0.bat %0.bat @debug < %0 @dir /l tv.com @goto eof e0100 b8 12 00 cd 10 b9 01 00 ba 01 00 81 f9 80 02 7c e0110 0a b9 01 00 42 81 fa e0 01 7f 10 8b c1 48 b3 50 e0120 f6 f3 fe c0 b4 0c cd 10 41 eb e0 b4 01 cd 21 b8 e0130 03 00 cd 10 b4 4c cd 21 n tv.com r cx 38 w q :eof
Well, this was improved from the 60 byte versions earlier.
;BEFORE, THE 60 BYTE VERSION.... ;E0100 32 E4 B0 12 CD 10 B9 01 00 BA 01 00 81 F9 80 02 ;E0110 7C 0A B9 01 00 42 81 FA E0 01 7F 10 8B C1 48 B3 ;E0120 50 F6 F3 FE C0 B4 0C CD 10 41 EB E0 32 E4 CD 16 ;E0130 32 E4 B0 03 CD 10 B4 4C 32 C0 CD 21 ;R CX ;3C ;N ZLAI.COM ;W ;G ;Q
The binary can be downloaded at [here].
Here is the TV screen (output):
–EOF (The Ultimate Computing & Technology Blog) —
loading...
Last Post: Get QueryString using Javascript
Next Post: Bug-fixes for PHP Online Logo Interpreter
Awesome work and Explanation…
I am a batch programmer and randomly came to know about your site…and read some articles here…
I appreciate it …
My blog of batch programming is : https://batchprogrammers.blogspot.com
Glad that you like it 🙂