All 256 colors from the BIOS - Assembler code

Goalatio 0 Tallied Votes 560 Views Share

Compile this with NASM16 (Must be compiled in .COM format!)
It will display all 256 colors usable by the BIOS in a neat rectangle that contains 16 columns, 17 rows (Just counted, it may be different).

KNOWN BUGS:
If you enter FULLSCREEN or run this program from a DOS operating system, a nice half of the colored rectangle will begin flashing.

[org 0100h]

[section .text]
	push cx
	mov bl,01

START:
	cmp bl,255
	je EXIT
	cmp byte [counter],15
	je NEWLINE
	mov cx,1
	mov ah,9
	mov al,0
	int 10h
	mov dx,blank
	call WRITE
	inc bl
	inc byte [counter]
	jmp START


EXIT:
	pop cx
	xor ah,ah
	int 16h
	mov ah,4ch
	mov al,0
	int 21h

WRITE:
	mov ah,9
	int 21h
	ret

NEWLINE:
	mov dx,eol
	call WRITE
	mov byte [counter],0
	jmp START


[section .data]
counter db 0
blank db "0", "$"
eol db 13, 10, "$"