Affichage de texte

cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 - 9 juil. 2009 à 10:40
cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 - 9 juil. 2009 à 10:41
Bonjour à tous,
Je suis en train de créer un OS (pour l'instant, 16 bits) et mes routines d'affichage ne fonctionnent pas ...
Voilà le code en question :

x86_screen_drv__CurrentX     DB            0
x86_screen_drv__CurrentY     DB            0
x86_screen_drv__CurrentA    DB            0x07

x86_screen_drv__MaximumX     EQU            80
x86_screen_drv__MaximumY     EQU            25

x86_screen_drv__ClearScreen:
    push ax
    xor ah,ah
    mov al,3h
    int 10h
    pop ax
ret

x86_screen_drv__IncCursor:
    push ax
    pushf
    mov al,[CS:x86_screen_drv__CurrentX]
    mov ah,[CS:x86_screen_drv__CurrentY]
    cmp al,x86_screen_drv__MaximumX
    jne .lbl1
    xor al,al
    inc ah
    .lbl1:
    cmp ah,x86_screen_drv__MaximumY
    jne .lbl2
    call x86_screen_drv__ClearScreen
    xor al,al
    xor ah,ah
    .lbl2:
    mov byte [CS:x86_screen_drv__CurrentY],ah
    mov byte [CS:x86_screen_drv__CurrentX],al
    popf
    pop ax
ret
   
x86_screen_drv__WriteCRLF:
    push ax
    pushf
    mov ah,[CS:x86_screen_drv__CurrentY]
    cmp ah,x86_screen_drv__MaximumY
    jne .lbl
    call x86_screen_drv__ClearScreen
    xor ah,ah
    .lbl:
    mov byte [CS:x86_screen_drv__CurrentY],ah
    mov byte [CS:x86_screen_drv__CurrentX],0
    popf
    pop ax
ret

x86_screen_drv__GetMemOffset:
    push bx
    xor ax,ax
    mov al,[CS:x86_screen_drv__CurrentY]
    shl al,4
    xor bx,bx
    mov bl,5
    mul bl
    add ax,[CS:x86_screen_drv__CurrentX]
    shl al,1
    pop bx
ret

x86_screen_drv__PrintChar:
;Params :    Char in AL
    pushf
    push ds
    push si
    push ax
    call x86_screen_drv__GetMemOffset
    mov si,ax
    mov ax,0xB800
    mov ds,ax
    pop ax
    cmp al,0x0D
    jne .lbl
    call x86_screen_drv__WriteCRLF
    jmp .end
    .lbl:
    stosb
    push ax
    mov al,[CS:x86_screen_drv__CurrentA]
    stosb
    pop ax
    call x86_screen_drv__IncCursor
    .end:
    pop si
    pop ds
    popf
ret

Dernière précision : en débuggant le code compilé en tant que .com, ça fonctionne ...

1 réponse

cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
9 juil. 2009 à 10:41
Sorry, j'ai oublié la question : qu'est-ce qui cloche là-dedans ?
0
Rejoignez-nous