Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

creating a display using all colors

I need help making a display that ouputs one character in all colors text and also all colors of background. I know I need to use a nested loop, but I am a bit lost past that.

Comments

  • ChojinChojin Member Posts: 39
    : I need help making a display that ouputs one character in all colors text and also all colors of background. I know I need to use a nested loop, but I am a bit lost past that.
    :
    I dont understand what you want , but you can write directly for video memory its more easy .

    in video text memory you have to bytes for one caracter , one is the caracter in ASCII code and the other is the caracter actributs , the byte of caracter atributs is divided in 2 (background and caracter color ) , if you want to change color or background you only need to write for the atribuit byte .

    the loop i dont now what you mean ??? use jumps or the loop func !!!


  • andrewkennedyandrewkennedy Member Posts: 28
    : I need help making a display that ouputs one character in all colors text and also all colors of background. I know I need to use a nested loop, but I am a bit lost past that.

    This gives all the color combinations for direct video writes.

    ;-----------------------------------------------------------------------------
    ; Tasm code Andrew Kennedy 6/97/02
    ; video.asm Write characters directly to video (fastest video method)
    ;
    ; --------------- ----------------------------------------------
    ; Bit Position Meaning
    ; --------------- ----------------------------------------------
    ; 1 . . . . . . . Blinking enabled Bit 7
    ; . 1 . . . . . . Red component of background color Bit 6
    ; . . 1 . . . . . Green " " " " Bit 5
    ; . . . 1 . . . . Blue " " " " Bit 4
    ; . . . . 1 . . . Intensity enabled for foreground color Bit 3
    ; . . . . . 1 . . Red component of forground color Bit 2
    ; . . . . . . 1 . Green " " " " Bit 1
    ; . . . . . . . 1 Blue " " " " Bit 0
    ;
    ; Foreground colors
    ;
    ; gray = 8d = 00001000b magenta = 5d = 00000101b
    ; lt.cyan = 11d = 00001001b black = 0d = 00000000b
    ; brown = 6d = 00000110b lt.red = 12d = 00001100b
    ; green = 2d = 00000010b white = 7d = 00000111b
    ; lt.magenta = 13d = 00001101b
    ; cyan = 3d = 00000011b lt.blue = 9d = 00001001b
    ; brite white= 15d = 00001111b blue = 1d = 00000001b
    ; red = 4d = 00000100b lt.green = 10d = 00001010b
    ; yellow = 14d = 00001110b
    ;
    ; WHITE=RED+GREEN+BLUE, BROWN=RED+GREEN, MAGENTA=RED+BLUE, CYAN=GREEN+BLUE
    ;
    ; BACKGROUND COLORS (Add this decimal values to the foreground decimal values)
    ;
    ; Add 112d - white 128d - blink BACKGROUND color
    ; 16d - blue 48d - cyan
    ; 32d - green
    ; 64d - red
    ;
    ; ESC ends program.
    ;
    .model small
    .stack 200h ; 512 byte stack

    .data

    mov ah,0 ; restore original video mode
    mov al,vid_mode ;
    int 10h
    vid_mode db 0

    .code

    start:
    mov ax,@data
    mov ds,ax
    push es
    push ax
    mov ah,0fh ; determine current video mode
    int 10h
    mov vid_mode,al ; move mode value into buffer

    ; HIDE CURSOR
    mov ah,1 ; set text mode cursor shape function
    mov ch,20h ;
    int 10h ;

    mov [video],0b800h
    mov ah,15
    int 10h
    mov es,[video] ; address video buffer segment with es
    mov di,0 ; assign offset address to di
    mov al,'' ; character
    ;mov ah, ; ; 1 = blue foreground 4 = red
    mov ah,120 ;120d = blk on gray

    mov cx,2000 ; show it 2000x
    rep stosw
    pop es
    pop ax
    escape: ; check for escape key to end program
    mov ah,1
    int 21h
    cmp al,1bh
    jz short restore
    jmp escape
    restore:

    mov ah,0 ; restore original video mode
    mov al,vid_mode ;
    int 10h
    mov bh,0
    mov dx,0
    ;mov dl,0 ; restore cursor at row 0, column 0
    ;mov dh,0 ; dl is column, dh is row
    mov ah,2 ; ( TOP LEFT CORNER )
    int 10h
    exit:
    mov ax,4c00h
    int 21h

    end start



  • Shawn CarterShawn Carter Member Posts: 0

    _ / http://forcoder.org / free ebooks and video tutorials about | Ruby Swift Visual Basic Python Scratch C# Visual Basic .NET R Delphi C Java JavaScript Assembly Objective-C PL/SQL MATLAB PHP Go C++ Perl Apex Crystal SAS ABAP Kotlin ML Julia F# Lua Lisp Ada Awk Hack Scala Rust Alice Logo VBScript FoxPro COBOL Transact-SQL LabVIEW Scheme Clojure Fortran Erlang Dart Bash Prolog D | _

Sign In or Register to comment.