Subversion Repositories Kolibri OS

Rev

Rev 6464 | Rev 6502 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6464 Rev 6501
Line 69... Line 69...
69
format binary as "mnt"
69
format binary as "mnt"
Line 70... Line 70...
70
 
70
 
71
include 'macros.inc'
71
include 'macros.inc'
Line 72... Line 72...
72
include 'struct.inc'
72
include 'struct.inc'
Line 73... Line 73...
73
 
73
 
74
$Revision: 6464 $
74
$Revision: 6501 $
Line 4811... Line 4811...
4811
 
4811
 
Line 4812... Line 4812...
4812
msg_board_data_size = 65536 ; Must be power of two
4812
msg_board_data_size = 65536 ; Must be power of two
4813
 
4813
 
4814
uglobal
4814
uglobal
4815
  msg_board_data  rb msg_board_data_size
4815
msg_board_data  rb  msg_board_data_size
Line 4816... Line 4816...
4816
  msg_board_count dd 0x0
4816
msg_board_count dd  ?
4817
endg
-
 
4818
 
-
 
4819
sys_msg_board:
4817
endg
-
 
4818
 
Line -... Line 4819...
-
 
4819
iglobal
-
 
4820
msg_board_pos   dd  42*6*65536+10 ; for printing debug output on the screen
4820
 
4821
endg
-
 
4822
 
4821
; ebx=1 : write :  bl byte to write
4823
sys_msg_board:
4822
; ebx=2 :  read :  ebx=0 -> no data, ebx=1 -> data in al
4824
; ebx=1 -> write, cl = byte to write
4823
 
-
 
4824
        push    eax ebx                 ; Save eax and ebx, since we're restoring their order required.
4825
; ebx=2 -> read, ecx=0 -> no data, ecx=1 -> data in al
4825
        mov     eax, ebx
4826
        push    eax ebx
4826
        mov     ebx, ecx
4827
        mov     eax, ebx
Line 4827... Line 4828...
4827
 
4828
        mov     ebx, ecx
4828
        mov     ecx, [msg_board_count]
-
 
4829
        cmp     eax, 1
4829
        mov     ecx, [msg_board_count]
4830
        jne     .smbl1
-
 
4831
 
4830
        cmp     eax, 1
4832
if defined debug_com_base
4831
        jne     .read
4833
 
4832
 
4834
        push    dx ax
4833
if defined debug_com_base
4835
 
4834
        push    dx ax
4836
       @@:                              ; Wait for empty transmit register  (yes, this slows down system..)
-
 
4837
        mov     dx, debug_com_base+5
4835
@@: ; wait for empty transmit register
4838
        in      al, dx
4836
        mov     dx, debug_com_base+5
4839
        test    al, 1 shl 5
4837
        in      al, dx
4840
        jz      @r
-
 
4841
 
4838
        test    al, 1 shl 5
4842
        mov     dx, debug_com_base      ; Output the byte
-
 
4843
        mov     al, bl
4839
        jz      @r
Line 4844... Line 4840...
4844
        out     dx, al
4840
        mov     dx, debug_com_base      ; Output the byte
4845
 
-
 
4846
        pop     ax dx
4841
        mov     al, bl
4847
 
4842
        out     dx, al
4848
end if
4843
        pop     ax dx
4849
 
-
 
4850
        mov     [msg_board_data+ecx], bl
-
 
4851
; // if debug_direct_print == 1
-
 
4852
        cmp     byte [debug_direct_print], 1
4844
end if
4853
        jnz     @f
4845
 
4854
        pusha
4846
        mov     [msg_board_data+ecx], bl
4855
iglobal
4847
        cmp     byte [debug_direct_print], 1
4856
msg_board_pos   dd      (42*6)*65536+10 ; for printing debug output on the screen
4848
        jnz     .end
4857
endg
4849
        pusha
4858
        lea     edx, [msg_board_data+ecx]
4850
        lea     edx, [msg_board_data+ecx]
4859
        mov     ecx, 0x40FFFFFF
4851
        mov     ecx, 0x40FFFFFF
-
 
4852
        mov     ebx, [msg_board_pos]
-
 
4853
        mov     edi, 1
4860
        mov     ebx, [msg_board_pos]
4854
        mov     esi, 1
4861
        mov     edi, 1
4855
        call    dtext
-
 
4856
        popa
4862
        mov     esi, 1
4857
        add     word [msg_board_pos+2], 6
4863
        call    dtext
4858
        cmp     word [msg_board_pos+2], 105*6
4864
        popa
4859
        jnc     @f
-
 
4860
        cmp     bl, 10
4865
        add     word [msg_board_pos+2], 6
4861
        jnz     .end
4866
        cmp     bl, 10
4862
@@:
4867
        jnz     @f
4863
        mov     word [msg_board_pos+2], 42*6
4868
        mov     word [msg_board_pos+2], (42*6)
4864
        add     word [msg_board_pos], 10
4869
        add     word [msg_board_pos], 10
-
 
4870
        mov     ax, word [_display.width]
-
 
4871
        cmp     word [msg_board_pos], ax
-
 
4872
        jb      @f
4865
        mov     eax, [_display.height]
-
 
4866
        sub     eax, 10
-
 
4867
        cmp     ax, word [msg_board_pos]
4873
        mov     word [msg_board_pos], 10
4868
        jnc     @f
4874
@@:
4869
        mov     word [msg_board_pos], 10
-
 
4870
@@:
4875
; // end if
4871
        pusha
-
 
4872
        mov     eax, [msg_board_pos]
-
 
4873
        movzx   ebx, ax
-
 
4874
        shr     eax, 16
-
 
4875
        mov     edx, 105*6
-
 
4876
        xor     ecx, ecx
-
 
4877
        mov     edi, 1
4876
 
4878
        mov     esi, 9
4877
if 0
4879
@@:
4878
        pusha
4880
        call    hline
4879
        mov     al, bl
4881
        inc     ebx
4880
        mov     edx, 402h
4882
        dec     esi
4881
        out     dx, al
4883
        jnz     @b
4882
        popa
4884
        popa
4883
end if
4885
.end:
-
 
4886
        inc     ecx
-
 
4887
        and     ecx, msg_board_data_size - 1
-
 
4888
        mov     [msg_board_count], ecx
-
 
4889
.ret:
-
 
4890
        pop     ebx eax
-
 
4891
        ret
4884
        inc     ecx
4892
 
4885
        and     ecx, msg_board_data_size - 1
4893
@@:
4886
        mov     [msg_board_count], ecx
4894
        mov     [esp+32], ecx
4887
 
4895
        mov     [esp+20], ecx
4888
        pop     ebx eax
4896
        jmp     .ret
4889
        ret
-
 
4890
.smbl1:
4897
 
4891
        cmp     eax, 2
4898
.read:
4892
        jne     .smbl2
4899
        cmp     eax, 2
4893
        test    ecx, ecx
4900
        jne     .ret
4894
        jz      .smbl21
4901
        test    ecx, ecx
4895
 
4902
        jz      @b
4896
        add     esp, 8                  ; Returning data in ebx and eax, so no need to restore them.
4903
        add     esp, 8  ; returning data in ebx and eax, so no need to restore them
4897
        mov     eax, msg_board_data+1
4904
        mov     eax, msg_board_data+1
4898
        mov     ebx, msg_board_data
4905
        mov     ebx, msg_board_data
4899
        movzx   edx, byte [ebx]
-
 
4900
        call    memmove
-
 
4901
        dec     [msg_board_count]
-
 
4902
        mov     [esp + 32], edx ;eax
-
 
4903
        mov     [esp + 20], dword 1
-
 
4904
        ret
-
 
Line 4905... Line 4906...
4905
.smbl21:
4906
        movzx   edx, byte [ebx]
4906
        mov     [esp+32], ecx
4907
        call    memmove
4907
        mov     [esp+20], ecx
4908
        dec     [msg_board_count]
4908
.smbl2:
4909
        mov     [esp + 32], edx ;eax