assad77 0 Newbie Poster

i want to draw all ascii chars and their corresponding values in dec and hex using a three colomned table, each colomn for one type of chars. if possible i would love to display each colomn in a different color.

this is my code so far.

.MODEL SMALL
.STACK 100h

Blue = 1
Cyan = 3
Yellow = 14
LightRed = 12
TableColors = Blue*10h+Yellow ; Yellow on Blue (16h)
HeadingColors = Cyan*10h+LightRed ; LightRed on Cyan (3Ch)
.data
row db ?
col db ?
contstr db "press any key to continue"
ContLen = $ - ContStr
.code
;------------------------the clear screen procedure---------------------
clrscr proc
mov ax,0600h
mov cx,0
mov dx,184fh
mov bh,7
int 10h
mov ah,2
mov bh,0
mov dx,0
int 10h
ret
clrscr endp
;------------------------------------------------------------------

;------------------------the press key to continue----------------------
pause proc
MOV BP, OFFSET ContStr ; Load efective address of
MOV AX, SEG ContStr; of ContStr
MOV ES, AX ; in ES:BP
MOV CX, ContLen ; Load length of string

CALL DisplayStr
; Wait for key press
MOV AH, 10h ; BIOS keyboard read key
INT 16h
RET
Pause ENDP
;---------------------------------------------------------------------
;----------------------display string ---------------------------------
DisplayStr PROC
MOV AH, 13h ; BIOS video display string function
MOV AL, 01h ; Advance cursor
MOV BH, 00h ; Print on page 00
MOV BL, 70h ; Set inverse video
INT 10h
RET
DisplayStr ENDP
;---------------------------------------------------------------------

;------------------------set video mode--------------------------------
setvideo proc

mov ah,0
mov al,3 ;video mode color
int 10h
ret
setvideo endp
;----------------------------------------------------------------------

;---------------------------screen to display table------------------
displaywindow proc
mov ax,0600h
mov bh,headingcolors
mov cx,050ah ;upperleft corner
mov dx,0a30h ;lower right corner
int 10h
ret
displaywindow endp
;-------------------------------------------------------------------------

;-------------------------Set cursor location-----------------------------
setcursorpos proc
mov ah,02h
mov bh,00h
mov dh,row
mov dl,col
int 10h
ret
setcursorpos endp
;-------------------------------------------------------------------------

main PROC
mov ax,@data ; set up DS segment
mov ds,ax
call Clrscr
call displaywindow
mov bh,0 ; video page 0
mov dh,0 ; row 0
mov dl,0 ; column 0
mov cx,0 ; char counter
L1: push cx ; save counter
mov ah, 2 ; set cursor position
int 10h ; call BIOS
mov ah,0Ah ; write character
mov al,cl ; AL = char to display
mov cx,1 ; display only once
int 10h ; call BIOS
cmp dl,39 ;.IF dl >= 39 ; then line is complete
jae l2

;.ELSE ; line is not complete
inc dl ; go to next column
mov ah, 2 ; set cursor position
int 10h ; call BIOS
mov ah,0Ah ; write character
mov al,' ' ; AL = char to display
mov cx,1 ; display only once
int 10h ; call BIOS
inc dl ; go to next column
;.ENDIF
l2: mov dl,0 ; reset column
inc dh ; go to next row
pop cx ; restore counter
inc cx ; next char
cmp cx,256 ; is counter >= 256
jae quit ; if true, quit
jmp L1 ; else, loop
quit:
;call Crlf

main ENDP
END main