Farbige Hello World in TASM

Guten Tag. Ich bin neu in der Assembler-und ich bin versucht zu drucken eines farbigen "Hallo Welt" in TASM. Hier ist mein code bisher. Es druckt nur "Hallo Welt", ohne eine Farbe.

.model small
.stack 100h

.data
message db 13,10,"Hello World!$"

.code
main proc near
   lea dx, message
   mov ah, 09h
   int 21h

   mov ah,4ch
   int 21h
main endp


Ich habe so etwas Lesen

mov ah,9    ;Function 9: Write character and attribute at cursor position
mov al,'H'  ;AL = character to display
mov bh,0    ;BH = page number
mov bl,02EH ;BL = attribute (yellow on green)
mov cx,1    ;CX = number of times to write character
int 10H  ;Int 10H: Video (show the character)

in einem forum, aber ich kann nicht integrieren, es mit meiner hello world. Ich bin verwirrt, warum verwenden Sie, dass insbesondere register und dergleichen. Bitte helfen Sie mir. Ich danke Ihnen sehr!

BEARBEITEN

.model small
.stack 100h

.data
hello db 'Hello World!',0

.code
main proc near
    mov ax, @data
    mov ds, ax

    mov ax, 3
    int 10h

    mov si, 0             ; cl is the counter register, set it to
                      ; zero (the first character in the string)

start:                ; Beginning of loop
    mov al, hello[si]   ; Read the next byte from memory
    cmp al, 0           ; Compare the byte to null (the terminator)
    je endthis              ; If the byte is null, jump out of the loop

    mov ah, 09h
    mov al, hello[si]
    mov bh, 0
    mov bl,02EH
    mov cx,11
    int 10H  

    add si, 1           ; Move to the next byte in the string
    jmp start           ; Loop

endthis:    
    mov ah, 4ch
    int 21h

main endp
end main
Schreibe einen Kommentar