flash
                   
                   
                   
                  Joined: 11 Mar 2006 
                  Posts: 55 
                  Location: Cuba
                    | 
                
                  
                  
                  Hi you all!!
 
I am using  cod3b453 iso code to create a bootable CD for a very simple real mode code.
 
Writing to VRAM works fine at Virtual Box, but the problems came when I try to read the keyboard.
 
Moreover, when I boot a real PC then nothing happens except for stranges characters.
 
The code for keyboard works ok at DOS program. I take the idea from DexOS and Linux codes. What can be happening?? What I am loosing??
 
This is my boot.asm file:
     
org 0x7C00
                cli
                jmp     0:@f
            @@: mov     SI,1982
                call    LocateFBText
                mov     SI,msg
                mov     BL,00001111b
                call    Print
            @@: call    KeyPress
                cmp     AL,1
                jne     @b
                xor     SI,SI
                call    LocateFBText
                mov     SI,msgi
                mov     BL,00001001b
                call    Print
                mov     SI,320
                call    LocateFBText
                call    PutCursor
            @@: call    PutCursor
                call    ReadKey
                call    PutChar
                jmp     @b
;
; Subrutinas
;
  LocateFBText: cmp     SI,4000
                ja      @f
                and     SI,0FFFEh
                mov     [textfbpos],SI
                ret
            @@: mov     [textfbpos],4000
                ret
         Print: mov     AX,0B800h
                mov     ES,AX
            @@: mov     AL,[SI]
                cmp     AL,0
                je      @f
                mov     DI,[textfbpos]
                mov     [ES:DI],AL
                mov     [ES:DI+1],BL
                inc     SI
                add     DI,2
                jmp     @b
            @@: mov     [textfbpos],DI
                ret
     PutCursor: push    0B800h
                pop     ES
                mov     SI,[textfbpos]
                mov     [ES:SI],byte 219
                ret
      KeyPress: cli
                xor     CX,CX
            @@: in      AL,64h
                test    AL,1
                loopz   @b
                in      AL,60h
                sti
                ret
       ReadKey: call    KeyPress
                cmp     AL,42                   ;Tecla Shift izquierda presionada
                jne     @f
                mov     [shiftstatus],0FFh
                jmp     ReadKey
            @@: cmp     AL,42+128               ;Tecla Shift izquierda liberada
                jne     @f
                mov     [shiftstatus],0
                jmp     ReadKey
            @@: cmp     AL,54                   ;Tecla Shift derecha presionada
                jne     @f
                mov     [shiftstatus],0FFh
                jmp     ReadKey
            @@: cmp     AL,54+128               ;Tecla Shift derecha liberada
                jne     @f
                mov     [shiftstatus],0
                jmp     ReadKey
            @@: cmp     AL,58+128               ;Tecla CapsLock activada
                jne     @f
                not     [capsstatus]
                jmp     ReadKey
            @@: cmp     AL,56                   ;Evitar eco de la tecla Alt
                jne     @f
                jmp     ReadKey
            @@: cmp     AL,58                   ;Evitar eco de la tecla CapsLock
                jne     @f
                jmp     ReadKey
            @@: cmp     AL,29                   ;Evitar eco de la tecla Control izquierda
                jne     @f
                jmp     ReadKey
            @@: cmp     AL,128                  ;Evitar eco de las teclas liberadas
                jb      @f
                jmp     ReadKey
            @@: xor     AH,AH
                mov     DI,AX
                cmp     [shiftstatus],0FFh
                jne     @f
                mov     AL,[DI+shiftkeymap]
                ret
            @@: cmp     [capsstatus],0FFh
                jne     @f
                mov     AL,[DI+capskeymap]
                ret
            @@: mov     AL,[DI+normalkeymap]
                ret
       PutChar: push    0B800h
                pop     ES
                mov     SI,[textfbpos]
                cmp     AL,8                    ;Ejecutar BackSpace
                jne     @f
                cmp     SI,0
                jne     PutCharBackSpc
                ret
PutCharBackSpc: mov     [ES:SI],byte 32         ;Borrar el cursor
                sub     SI,2
                mov     [ES:SI],byte 32         ;Borrar el caracter anterior
                mov     [textfbpos],SI
                ret
            @@: cmp     AL,9                    ;Ejecutar Tab
                jne     @f
                mov     CX,6
    PutCharTab: mov     [ES:SI],byte 32         ;Rellenar con espacios
                add     SI,2
                loop    PutCharTab
                mov     [textfbpos],SI
                ret
            @@: cmp     AL,10                   ;Ejecutar Enter
                jne     @f
                mov     [ES:SI],byte 0          ;Marcar el cambio de lĂnea
                call    NextFrameBufferLine
                mov     [textfbpos],SI
                ret
            @@: mov     [ES:SI],AL
                add     SI,2
                mov     [textfbpos],SI
                ret
NextFrameBufferLine:
                mov     SI,160
                mov     AX,[textfbpos]
                xor     DX,DX
                div     SI
                sub     SI,DX
                mov     AX,[textfbpos]
                add     SI,AX
                ret
 PreviousFrameBufferPos:
                push    0B800h
                pop     ES
                mov     SI,[textfbpos]
            @@: sub     SI,2
                mov     AL,[ES:SI]
                cmp     AL,32
                jne     @f
                jmp     @b
            @@: cmp     AL,0
                je      @f
                mov     SI,[textfbpos]
                sub     SI,2
                ret
            @@: add     SI,2
                ret
        msg     db 'Bienvenido a CDOS!',0
        msgi    db 'Puede usar el teclado',0
      textfbpos dw 0
    shiftstatus DB 0
     capsstatus DB 0
  normalkeymap: DB 0
                DB 27,'1234567890-=',8
                DB 9,'qwertyuiop[]',10
                DB 0,'asdfghjkl;',39,96,0,'\'
                DB 'zxcvbnm,./',0,'*',0,' '
                DB 0,'2345678901',0,'3789-456+1230.'
                DB 172 DUP(0)
   shiftkeymap: DB 0
                DB 27,'!@#$%^&*()_+',8
                DB 9,'QWERTYUIOP{}',10
                DB 0,'ASDFGHJKL:"~',0,'|'
                DB 'ZXCVBNM<>?',0,'*',0,' '
                DB 0,'2345678901',0,'3789-456+1230.'
                DB 172 DUP(0)
    capskeymap: DB 0
                DB 27,'1234567890-=',8
                DB 9,'QWERTYUIOP[]',10
                DB 0,'ASDFGHJKL;',39,96,0,'\'
                DB 'ZXCVBNM,./',0,'*',0,' '
                DB 0,'2345678901',0,'3789-456+1230.'
                DB 172 DUP(0)
        times (0x7C00 + DISK_SIZE_SECTOR - $ - 2) db 0
                dw 0xAA55
     
Thank's!  
                   _________________ i don't hate goto 
                 |