8088 assemblyx86-16 machine code, IBM PC DOS, 44 43 bytes
00000000: be22 01b9 0100 ac8a d83c 10b8 db09 cd10 .".......<...... 00000010: b403 cd10 7204 7809 b2ff 42b4 02cd 10eb ....r.x...B..... 00000020: e2c3 0c0e 1d0e 0a1b 0d0b 91 ........... BE 0122 MOV SI, OFFSET CTBLCT ; load color bar table into [SI] LOOP_COLOR: B9 0001 MOV CX, 1 ; display 1 char and clear CH (changed by INT 10H:3) AC LODSB ; load next color byte 8A D8 MOV BL, AL ; move new color to BL 3C 10 CMP AL, 010H ; if this is third color in row: SF=0, CF=0 ; else if last color: SF=1, CF=0 ; else continue on same row: CF=1 B8 09DB MOV AX, 09DBH ; AH=9 (write char with attr), AL=0DBH (a block char) CD 10 INT 10H ; call PC BIOS, display color block B4 03 MOV AH, 3 ; get cursor position function CD 10 INT 10H ; call PC BIOS, get cursor 72 04 JC NEXT_COL ; if not last in row, move to next column 78 09 JS EXIT ; if last color, exit B2 FF MOV DL, -1 ; otherwise move to first column and next row NEXT_COL: 42 INC DX ; move to next column (and/or row) B4 02 MOV AH, 2 ; set cursor position function CD 10 INT 10H ; call PC BIOS, set cursor position EB E2 JMP LOOP_COLOR ; loop to next color byte EXIT: C3 RET ; return to DOS CTBL CT DB 0CH, 0EH, 1DH, ; color table DB 0EH, 0AH, 1BH, DB 0DH, 0BH, 91H ; color table Download and test RGBGRID.COM for DOS.
