Set align 4 for subroutines in main loop.

git-svn-id: svn://kolibrios.org@1168 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2009-09-18 18:30:04 +00:00
parent 49698c69f7
commit 83e2f051b2
6 changed files with 748 additions and 745 deletions

File diff suppressed because it is too large Load Diff

View File

@ -282,6 +282,7 @@ save_timer_fdd_motor:
;***************************************** ;*****************************************
;* 闲温判世 抢呐衅嗜 论仕拮磐冗 涛椅欣 * ;* 闲温判世 抢呐衅嗜 论仕拮磐冗 涛椅欣 *
;***************************************** ;*****************************************
align 4
check_fdd_motor_status: check_fdd_motor_status:
cmp [fdd_motor_status],0 cmp [fdd_motor_status],0
je end_check_fdd_motor_status_1 je end_check_fdd_motor_status_1

View File

@ -69,103 +69,103 @@ incecx2:
drawbuttonframes: drawbuttonframes:
push esi push esi
push edi push edi
push eax push eax
push ebx push ebx
push ecx push ecx
push edx push edx
shr ebx,16 shr ebx,16
shr ecx,16 shr ecx,16
mov eax,[TASK_BASE] mov eax,[TASK_BASE]
add ebx,[eax-twdw + WDATA.box.left] add ebx,[eax-twdw + WDATA.box.left]
add ecx,[eax-twdw + WDATA.box.top] add ecx,[eax-twdw + WDATA.box.top]
mov eax, ebx mov eax, ebx
shl eax, 16 shl eax, 16
mov ax, bx mov ax, bx
add ax, word [esp+8] add ax, word [esp+8]
mov ebx, ecx mov ebx, ecx
shl ebx, 16 shl ebx, 16
mov bx, cx mov bx, cx
push ebx push ebx
xor edi, edi xor edi, edi
mov ecx, esi mov ecx, esi
call incecx call incecx
call [draw_line] call [draw_line]
movzx edx,word [esp+4+4] movzx edx,word [esp+4+4]
add ebx,edx add ebx,edx
shl edx,16 shl edx,16
add ebx,edx add ebx,edx
mov ecx,esi mov ecx,esi
call dececx call dececx
call [draw_line] call [draw_line]
pop ebx pop ebx
push edx push edx
mov edx,eax mov edx,eax
shr edx,16 shr edx,16
mov ax,dx mov ax,dx
mov edx,ebx mov edx,ebx
shr edx,16 shr edx,16
mov bx,dx mov bx,dx
mov dx,[esp+4+4] mov dx,[esp+4+4]
add bx,dx add bx,dx
pop edx pop edx
mov ecx,esi mov ecx,esi
call incecx call incecx
call [draw_line] call [draw_line]
mov dx,[esp+8] mov dx,[esp+8]
add ax,dx add ax,dx
shl edx,16 shl edx,16
add eax,edx add eax,edx
add ebx,1*65536 add ebx,1*65536
mov ecx,esi mov ecx,esi
call dececx call dececx
call [draw_line] call [draw_line]
pop edx pop edx
pop ecx pop ecx
pop ebx pop ebx
pop eax pop eax
pop edi pop edi
pop esi pop esi
ret ret
button_dececx: button_dececx:
cmp [buttontype],dword 1 cmp [buttontype],dword 1
jne .finish jne .finish
; je bdece ; je bdece
; ret ; ret
; bdece: ; bdece:
push eax push eax
mov eax,0x01 mov eax,0x01
cmp edi,20 cmp edi,20
jg @f jg @f
mov eax,0x02 mov eax,0x02
@@: @@:
test ecx,0xff test ecx,0xff
jz @f jz @f
sub ecx,eax sub ecx,eax
@@: @@:
shl eax,8 shl eax,8
test ecx,0xff00 test ecx,0xff00
jz @f jz @f
sub ecx,eax sub ecx,eax
@@: @@:
shl eax,8 shl eax,8
test ecx,0xff0000 test ecx,0xff0000
jz @f jz @f
sub ecx,eax sub ecx,eax
@@: @@:
pop eax pop eax
.finish: .finish:
ret ret
sys_button: sys_button:
@ -190,7 +190,7 @@ sys_button:
test edx, 0x40000000 test edx, 0x40000000
jnz button_no_draw jnz button_no_draw
pushad ; button body pushad ; button body
movzx edi, cx movzx edi, cx
shr ebx, 16 shr ebx, 16
shr ecx, 16 shr ecx, 16
@ -293,44 +293,44 @@ rnmba:
find_pressed_button_frames: find_pressed_button_frames:
pushad pushad
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+ WDATA.box.left] ; window x start mov ecx, [ebx+ WDATA.box.left] ; window x start
movzx edx,word [eax+4] ; button x start movzx edx,word [eax+4] ; button x start
add ecx,edx add ecx,edx
push ecx push ecx
mov dx,[eax+6] ; button x size mov dx,[eax+6] ; button x size
add cx,dx add cx,dx
mov esi,ecx mov esi,ecx
inc esi inc esi
mov ecx, [ebx+WDATA.box.top] ; window y start mov ecx, [ebx+WDATA.box.top] ; window y start
mov dx,[eax+8] ; button y start mov dx,[eax+8] ; button y start
add ecx,edx add ecx,edx
mov ebx,ecx mov ebx,ecx
mov dx,[eax+10] ; button y size mov dx,[eax+10] ; button y size
add dx,cx add dx,cx
inc dx inc dx
pop eax pop eax
; eax x beginning ; eax x beginning
; ebx y beginning ; ebx y beginning
; esi x end ; esi x end
; edx y end ; edx y end
; ecx color ; ecx color
mov [pressed_button_eax],eax mov [pressed_button_eax],eax
mov [pressed_button_ebx],ebx mov [pressed_button_ebx],ebx
mov [pressed_button_ecx],ecx mov [pressed_button_ecx],ecx
mov [pressed_button_edx],edx mov [pressed_button_edx],edx
mov [pressed_button_esi],esi mov [pressed_button_esi],esi
popad popad
ret ret
uglobal uglobal
pressed_button_eax dd 0 pressed_button_eax dd 0
@ -343,70 +343,70 @@ endg
; negative button image ; negative button image
negativebutton: negativebutton:
; If requested, do not display button ; If requested, do not display button
; boarder on press. ; boarder on press.
test ebx,0x20000000 test ebx,0x20000000
jz draw_negative_button jz draw_negative_button
ret ret
draw_negative_button: draw_negative_button:
pushad pushad
mov eax,[pressed_button_eax] mov eax,[pressed_button_eax]
mov ebx,[pressed_button_ebx] mov ebx,[pressed_button_ebx]
mov ecx,[pressed_button_ecx] mov ecx,[pressed_button_ecx]
mov edx,[pressed_button_edx] mov edx,[pressed_button_edx]
mov esi,[pressed_button_esi] mov esi,[pressed_button_esi]
mov ecx,0x01000000 mov ecx,0x01000000
dec edx dec edx
push edx push edx
inc edx inc edx
dec esi dec esi
push esi push esi
inc esi inc esi
push eax push eax
push ebx push ebx
push ecx push ecx
push edx push edx
push edi push edi
call [disable_mouse] call [disable_mouse]
bdbnewline: bdbnewline:
mov edi,1 ; force mov edi,1 ; force
cmp eax,[esp+16] cmp eax,[esp+16]
jz bneg jz bneg
cmp eax,[esp+20] cmp eax,[esp+20]
jz bneg jz bneg
cmp ebx,[esp+12] cmp ebx,[esp+12]
jz bneg jz bneg
cmp ebx,[esp+24] cmp ebx,[esp+24]
jnz nbneg jnz nbneg
; jz bneg ; jz bneg
; jmp nbneg ; jmp nbneg
bneg: bneg:
;;;call [disable_mouse] ;;;call [disable_mouse]
call [putpixel] call [putpixel]
nbneg: nbneg:
inc eax inc eax
cmp eax,esi cmp eax,esi
jnz bdbnewline jnz bdbnewline
mov eax,[esp+16] mov eax,[esp+16]
inc ebx inc ebx
cmp ebx,edx cmp ebx,edx
jnz bdbnewline jnz bdbnewline
add esp,28 add esp,28
popad popad
ret ret
; check buttons ; check buttons
@ -423,7 +423,7 @@ negativebutton:
; ;
; first at 0x10 ; first at 0x10
align 4
checkbuttons: checkbuttons:
cmp [BTN_DOWN],byte 0 ; mouse buttons pressed cmp [BTN_DOWN],byte 0 ; mouse buttons pressed
@ -455,7 +455,7 @@ checkbuttons:
mov ax,[MOUSE_Y] mov ax,[MOUSE_Y]
mov [my],ax mov [my],ax
@@: @@:
pop ax pop ax
;and it is only refreshed after the mouse's button release ;and it is only refreshed after the mouse's button release
;..................................... end 2/5 : modified by vhanla ............................. ;..................................... end 2/5 : modified by vhanla .............................
@ -471,7 +471,7 @@ checkbuttons:
cmp edx,esi cmp edx,esi
jge bch jge bch
popad ; no button pressed popad ; no button pressed
ret ret
bch: bch:
@ -494,8 +494,8 @@ checkbuttons:
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED
jnz buttonnewcheck jnz buttonnewcheck
; add ebx,window_data ; add ebx,window_data
; mov ecx,[window_data+ebx+8] ; window end X ; mov ecx,[window_data+ebx+8] ; window end X
@ -509,50 +509,50 @@ checkbuttons:
jge buttonnewcheck jge buttonnewcheck
; check coordinates ; check coordinates
; mouse x >= button x ? ; mouse x >= button x ?
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+WDATA.box.left] ; window x start mov ecx, [ebx+WDATA.box.left] ; window x start
movzx edx,word [eax+4] ; button x start movzx edx,word [eax+4] ; button x start
add edx,ecx add edx,ecx
;..................................... start 3/5 : modified by vhanla ............................. ;..................................... start 3/5 : modified by vhanla .............................
mov cx,[mx] ;mov cx,[MOUSE_X] mov cx,[mx] ;mov cx,[MOUSE_X]
;..................................... end 3/5 : modified by vhanla ............................. ;..................................... end 3/5 : modified by vhanla .............................
cmp edx,ecx cmp edx,ecx
jg buttonnewcheck jg buttonnewcheck
movzx ebx,word [eax+6] ; button x size movzx ebx,word [eax+6] ; button x size
add edx,ebx add edx,ebx
cmp ecx,edx cmp ecx,edx
jg buttonnewcheck jg buttonnewcheck
; mouse y >= button y ? ; mouse y >= button y ?
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+WDATA.box.top] ; window y start mov ecx, [ebx+WDATA.box.top] ; window y start
movzx edx,word [eax+8] ; button y start movzx edx,word [eax+8] ; button y start
add edx,ecx add edx,ecx
;..................................... start 4/5 : modified by vhanla ............................. ;..................................... start 4/5 : modified by vhanla .............................
mov cx,[my] ;mov cx,[MOUSE_Y] mov cx,[my] ;mov cx,[MOUSE_Y]
;..................................... start 4/5 : modified by vhanla ............................. ;..................................... start 4/5 : modified by vhanla .............................
cmp edx,ecx cmp edx,ecx
jg buttonnewcheck jg buttonnewcheck
movzx ebx,word [eax+10] ; button y size movzx ebx,word [eax+10] ; button y size
add edx,ebx add edx,ebx
cmp ecx,edx cmp ecx,edx
jg buttonnewcheck jg buttonnewcheck
; mouse on button ; mouse on button
pop edx pop edx
pop esi pop esi
mov bx,[eax+0xc] ; button id : bits 16-31 mov bx,[eax+0xc] ; button id : bits 16-31
shl ebx,16 shl ebx,16
mov bx,[eax+2] ; button id : bits 00-16 mov bx,[eax+2] ; button id : bits 00-16
push ebx push ebx
mov [MOUSE_DOWN],byte 1 ; no mouse down checks mov [MOUSE_DOWN],byte 1 ; no mouse down checks
@ -596,46 +596,46 @@ endg
pusha pusha
; mouse x >= button x ? ; mouse x >= button x ?
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+WDATA.box.left] ; window x start mov ecx, [ebx+WDATA.box.left] ; window x start
movzx edx,word [eax+4] ; button x start movzx edx,word [eax+4] ; button x start
add edx,ecx add edx,ecx
mov cx,[MOUSE_X] mov cx,[MOUSE_X]
cmp edx,ecx cmp edx,ecx
jg no_on_button ;if we release the pointer out of the button area jg no_on_button ;if we release the pointer out of the button area
movzx ebx,word [eax+6] ; button x size movzx ebx,word [eax+6] ; button x size
add edx,ebx add edx,ebx
cmp ecx,edx cmp ecx,edx
jg no_on_button jg no_on_button
; mouse y >= button y ? ; mouse y >= button y ?
movzx ebx,word [eax+0] movzx ebx,word [eax+0]
shl ebx,5 shl ebx,5
add ebx,window_data add ebx,window_data
mov ecx, [ebx+WDATA.box.top] ; window y start mov ecx, [ebx+WDATA.box.top] ; window y start
movzx edx,word [eax+8] ; button y start movzx edx,word [eax+8] ; button y start
add edx,ecx add edx,ecx
mov cx,[MOUSE_Y] mov cx,[MOUSE_Y]
cmp edx,ecx cmp edx,ecx
jg no_on_button jg no_on_button
movzx ebx,word [eax+10] ; button y size movzx ebx,word [eax+10] ; button y size
add edx,ebx add edx,ebx
cmp ecx,edx cmp ecx,edx
jg no_on_button jg no_on_button
popa popa
mov [BTN_COUNT],byte 1 ; no of buttons in buffer mov [BTN_COUNT],byte 1 ; no of buttons in buffer
pop ebx pop ebx
mov [BTN_BUFF],ebx ; lets put the button id in buffer mov [BTN_BUFF],ebx ; lets put the button id in buffer
push ebx push ebx
pusha pusha
jmp yes_on_button jmp yes_on_button
no_on_button: no_on_button:
mov [BTN_COUNT],byte 0 ; no of buttons in buffer mov [BTN_COUNT],byte 0 ; no of buttons in buffer
yes_on_button: yes_on_button:
mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw mov [MOUSE_DOWN],byte 0 ; mouse down -> do not draw
popa popa
pop ebx pop ebx
popa popa

View File

@ -1016,7 +1016,7 @@ osloop:
; MAIN OS LOOP END ; ; MAIN OS LOOP END ;
; ; ; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 4
checkidle: checkidle:
pushad pushad
call change_task call change_task

View File

@ -38,35 +38,35 @@ StackCounters:
dumped_rx_count dd 0 dumped_rx_count dd 0
arp_tx_count: dd 0 arp_tx_count: dd 0
arp_rx_count: dd 0 arp_rx_count: dd 0
ip_rx_count: dd 0 ip_rx_count: dd 0
ip_tx_count: dd 0 ip_tx_count: dd 0
endg endg
; socket buffers ; socket buffers
SOCKETBUFFSIZE equ 4096 ; state + config + buffer. SOCKETBUFFSIZE equ 4096 ; state + config + buffer.
SOCKETHEADERSIZE equ SOCKET.rxData ; thus 4096 - SOCKETHEADERSIZE bytes data SOCKETHEADERSIZE equ SOCKET.rxData ; thus 4096 - SOCKETHEADERSIZE bytes data
;NUM_SOCKETS equ 16 ; Number of open sockets supported. Was 20 ;NUM_SOCKETS equ 16 ; Number of open sockets supported. Was 20
; IPBUFF status values ; IPBUFF status values
BUFF_EMPTY equ 0 BUFF_EMPTY equ 0
BUFF_RX_FULL equ 1 BUFF_RX_FULL equ 1
BUFF_ALLOCATED equ 2 BUFF_ALLOCATED equ 2
BUFF_TX_FULL equ 3 BUFF_TX_FULL equ 3
NUM_IPBUFFERS equ 20 ; buffers allocated for TX/RX NUM_IPBUFFERS equ 20 ; buffers allocated for TX/RX
NUMQUEUES equ 4 NUMQUEUES equ 4
EMPTY_QUEUE equ 0 EMPTY_QUEUE equ 0
IPIN_QUEUE equ 1 IPIN_QUEUE equ 1
IPOUT_QUEUE equ 2 IPOUT_QUEUE equ 2
NET1OUT_QUEUE equ 3 NET1OUT_QUEUE equ 3
NO_BUFFER equ 0xFFFF NO_BUFFER equ 0xFFFF
IPBUFFSIZE equ 1500 ; MTU of an ethernet packet IPBUFFSIZE equ 1500 ; MTU of an ethernet packet
NUMQUEUEENTRIES equ NUM_IPBUFFERS NUMQUEUEENTRIES equ NUM_IPBUFFERS
NUMRESENDENTRIES equ 18 ; Buffers for TCP resend packets NUMRESENDENTRIES equ 18 ; Buffers for TCP resend packets
; These are the 0x40 function codes for application access to the stack ; These are the 0x40 function codes for application access to the stack
STACK_DRIVER_STATUS equ 52 STACK_DRIVER_STATUS equ 52
@ -81,10 +81,10 @@ SOCKET_INTERFACE equ 53
;stack_data_end equ 0x71ffff ;stack_data_end equ 0x71ffff
; 32 bit word ; 32 bit word
stack_config equ stack_data stack_config equ stack_data
; 32 bit word - IP Address in network format ; 32 bit word - IP Address in network format
stack_ip equ stack_data + 4 stack_ip equ stack_data + 4
; 1 byte. 0 == inactive, 1 = active ; 1 byte. 0 == inactive, 1 = active
ethernet_active equ stack_data + 9 ethernet_active equ stack_data + 9
@ -95,30 +95,30 @@ ethernet_active equ stack_data + 9
; Address of selected socket ; Address of selected socket
;sktAddr equ stack_data + 32 ;sktAddr equ stack_data + 32
; Parameter to checksum routine - data ptr ; Parameter to checksum routine - data ptr
checkAdd1 equ stack_data + 36 checkAdd1 equ stack_data + 36
; Parameter to checksum routine - 2nd data ptr ; Parameter to checksum routine - 2nd data ptr
checkAdd2 equ stack_data + 40 checkAdd2 equ stack_data + 40
; Parameter to checksum routine - data size ; Parameter to checksum routine - data size
checkSize1 equ stack_data + 44 checkSize1 equ stack_data + 44
; Parameter to checksum routine - 2nd data size ; Parameter to checksum routine - 2nd data size
checkSize2 equ stack_data + 46 checkSize2 equ stack_data + 46
; result of checksum routine ; result of checksum routine
checkResult equ stack_data + 48 checkResult equ stack_data + 48
; holds the TCP/UDP pseudo header. SA|DA|0|prot|UDP len| ; holds the TCP/UDP pseudo header. SA|DA|0|prot|UDP len|
pseudoHeader equ stack_data + 50 pseudoHeader equ stack_data + 50
; receive and transmit IP buffer allocation ; receive and transmit IP buffer allocation
;sockets equ stack_data + 62 ;sockets equ stack_data + 62
Next_free2 equ stack_data + 62;Next_free2 equ sockets + (SOCKETBUFFSIZE * NUM_SOCKETS) Next_free2 equ stack_data + 62;Next_free2 equ sockets + (SOCKETBUFFSIZE * NUM_SOCKETS)
; 1560 byte buffer for rx / tx ethernet packets ; 1560 byte buffer for rx / tx ethernet packets
Ether_buffer equ Next_free2 Ether_buffer equ Next_free2
Next_free3 equ Ether_buffer + 1518 Next_free3 equ Ether_buffer + 1518
last_1sTick equ Next_free3 last_1sTick equ Next_free3
IPbuffs equ Next_free3 + 1 IPbuffs equ Next_free3 + 1
queues equ IPbuffs + ( NUM_IPBUFFERS * IPBUFFSIZE ) queues equ IPbuffs + ( NUM_IPBUFFERS * IPBUFFSIZE )
queueList equ queues + (2 * NUMQUEUES) queueList equ queues + (2 * NUMQUEUES)
last_1hsTick equ queueList + ( 2 * NUMQUEUEENTRIES ) last_1hsTick equ queueList + ( 2 * NUMQUEUEENTRIES )
;resendQ equ queueList + ( 2 * NUMQUEUEENTRIES ) ;resendQ equ queueList + ( 2 * NUMQUEUEENTRIES )
;resendBuffer equ resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP ;resendBuffer equ resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP
@ -128,7 +128,7 @@ last_1hsTick equ queueList + ( 2 * NUMQUEUEENTRIES )
;resendQ equ 0x770000 ;resendQ equ 0x770000
;resendBuffer equ resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP ; XTODO: validate size ;resendBuffer equ resendQ + ( 4 * NUMRESENDENTRIES ) ; for TCP ; XTODO: validate size
resendBuffer equ resendQ + ( 8 * NUMRESENDENTRIES ) ; for TCP resendBuffer equ resendQ + ( 8 * NUMRESENDENTRIES ) ; for TCP
uglobal uglobal
@ -138,15 +138,15 @@ endg
; simple macro for memory set operation ; simple macro for memory set operation
macro _memset_dw adr,value,amount macro _memset_dw adr,value,amount
{ {
mov edi, adr mov edi, adr
mov ecx, amount mov ecx, amount
if value = 0 if value = 0
xor eax, eax xor eax, eax
else else
mov eax, value mov eax, value
end if end if
cld cld
rep stosd rep stosd
} }
@ -170,21 +170,21 @@ include "socket.inc"
;*************************************************************************** ;***************************************************************************
stack_init: stack_init:
; Init two address spaces with default values ; Init two address spaces with default values
_memset_dw stack_data_start, 0, 0x20000/4 _memset_dw stack_data_start, 0, 0x20000/4
_memset_dw resendQ, 0, NUMRESENDENTRIES * 2 _memset_dw resendQ, 0, NUMRESENDENTRIES * 2
mov [net_sockets], 0 mov [net_sockets], 0
mov [net_sockets + 4], 0 mov [net_sockets + 4], 0
; Queries initialization ; Queries initialization
call queueInit call queueInit
; The following block sets up the 1s timer ; The following block sets up the 1s timer
mov al, 0x0 mov al, 0x0
out 0x70, al out 0x70, al
in al, 0x71 in al, 0x71
mov [last_1sTick], al mov [last_1sTick], al
ret ret
@ -198,6 +198,7 @@ ret
; This is a kernel function, called in the main loop ; This is a kernel function, called in the main loop
; ;
;*************************************************************************** ;***************************************************************************
align 4
stack_handler: stack_handler:
call ethernet_driver call ethernet_driver
@ -207,7 +208,7 @@ stack_handler:
; Test for 10ms tick, call tcp timer ; Test for 10ms tick, call tcp timer
mov eax, [timer_ticks] ;[0xfdf0] mov eax, [timer_ticks] ;[0xfdf0]
cmp eax, [last_1hsTick] cmp eax, [last_1hsTick]
je sh_001 je sh_001
mov [last_1hsTick], eax mov [last_1hsTick], eax
call tcp_tx_handler call tcp_tx_handler
@ -217,9 +218,9 @@ sh_001:
; Test for 1 second event, call 1s timer functions ; Test for 1 second event, call 1s timer functions
mov al, 0x0 ;second mov al, 0x0 ;second
out 0x70, al out 0x70, al
in al, 0x71 in al, 0x71
cmp al, [last_1sTick] cmp al, [last_1sTick]
je sh_exit je sh_exit
mov [last_1sTick], al mov [last_1sTick], al
@ -246,7 +247,7 @@ proc checksum_jb stdcall uses ebx esi ecx,\
mov esi, dword[buf_ptr] mov esi, dword[buf_ptr]
mov ecx, dword[buf_size] mov ecx, dword[buf_size]
shr ecx, 1 ; ecx=ecx/2 shr ecx, 1 ; ecx=ecx/2
jnc @f ; if CF==0 then size is even number jnc @f ; if CF==0 then size is even number
mov bh, byte[esi + ecx*2] mov bh, byte[esi + ecx*2]
@@: @@:
cld cld
@ -281,11 +282,11 @@ endp
checksum: checksum:
pusha pusha
mov eax, [checkAdd1] mov eax, [checkAdd1]
xor edx, edx ; edx is the accumulative checksum xor edx, edx ; edx is the accumulative checksum
xor ebx, ebx xor ebx, ebx
mov cx, [checkSize1] mov cx, [checkSize1]
shr cx, 1 shr cx, 1
jz cs1_1 jz cs1_1
cs1: cs1:
mov bh, [eax] mov bh, [eax]
@ -298,7 +299,7 @@ cs1:
cs1_1: cs1_1:
and word [checkSize1], 0x01 and word [checkSize1], 0x01
jz cs_test2 jz cs_test2
mov bh, [eax] mov bh, [eax]
xor bl, bl xor bl, bl
@ -308,12 +309,12 @@ cs1_1:
cs_test2: cs_test2:
mov cx, [checkSize2] mov cx, [checkSize2]
cmp cx, 0 cmp cx, 0
jz cs_exit ; Finished if no 2nd buffer jz cs_exit ; Finished if no 2nd buffer
mov eax, [checkAdd2] mov eax, [checkAdd2]
shr cx, 1 shr cx, 1
jz cs2_1 jz cs2_1
cs2: cs2:
mov bh, [eax] mov bh, [eax]
@ -326,7 +327,7 @@ cs2:
cs2_1: cs2_1:
and word [checkSize2], 0x01 and word [checkSize2], 0x01
jz cs_exit jz cs_exit
mov bh, [eax] mov bh, [eax]
xor bl, bl xor bl, bl
@ -393,7 +394,7 @@ not1:
and bl, 0x7f and bl, 0x7f
cmp bl, 3 cmp bl, 3
je ash_eth_enable je ash_eth_enable
; Ethernet isn't enabled, so make sure that the card is disabled ; Ethernet isn't enabled, so make sure that the card is disabled
mov [ethernet_active], byte 0 mov [ethernet_active], byte 0
@ -404,7 +405,7 @@ ash_eth_enable:
; if found ; if found
call eth_probe call eth_probe
cmp eax, 0 cmp eax, 0
je ash_eth_done ; Abort if no hardware found je ash_eth_done ; Abort if no hardware found
mov [ethernet_active], byte 1 mov [ethernet_active], byte 1
@ -497,75 +498,75 @@ not13:
;<added by Frank Sommer> ;<added by Frank Sommer>
not14: not14:
cmp eax, 15 cmp eax, 15
jnz not15 jnz not15
; in ebx we need 4 to read the last 2 bytes ; in ebx we need 4 to read the last 2 bytes
cmp ebx, dword 4 cmp ebx, dword 4
je read je read
; or we need 0 to read the first 4 bytes ; or we need 0 to read the first 4 bytes
cmp ebx, dword 0 cmp ebx, dword 0
jnz param_error jnz param_error
; read MAC, returned (in mirrored byte order) in eax ; read MAC, returned (in mirrored byte order) in eax
read: read:
mov eax, [node_addr + ebx] mov eax, [node_addr + ebx]
jmp @f jmp @f
param_error: param_error:
mov eax, -1 ; params not accepted mov eax, -1 ; params not accepted
@@: @@:
ret ret
; 0 -> arp_probe ; 0 -> arp_probe
; 1 -> arp_announce ; 1 -> arp_announce
; 2 -> arp_responce (not supported yet) ; 2 -> arp_responce (not supported yet)
not15: ; ARP stuff not15: ; ARP stuff
cmp eax, 16 cmp eax, 16
jnz not16 jnz not16
cmp ebx, 0 cmp ebx, 0
je a_probe je a_probe
cmp ebx, 1 cmp ebx, 1
je a_ann ; arp announce je a_ann ; arp announce
; cmp ebx,2 ; cmp ebx,2
; jne a_resp ; arp response ; jne a_resp ; arp response
jmp param15_error jmp param15_error
; arp probe, sender IP must be set to 0.0.0.0, target IP is set to address being probed ; arp probe, sender IP must be set to 0.0.0.0, target IP is set to address being probed
; ecx: pointer to target MAC, MAC should set to 0 by application ; ecx: pointer to target MAC, MAC should set to 0 by application
; edx: target IP ; edx: target IP
a_probe: a_probe:
push dword [stack_ip] push dword [stack_ip]
mov edx, [stack_ip] mov edx, [stack_ip]
mov [stack_ip], dword 0 mov [stack_ip], dword 0
mov esi, ecx ; pointer to target MAC address mov esi, ecx ; pointer to target MAC address
call arp_request call arp_request
pop dword [stack_ip] pop dword [stack_ip]
jmp @f jmp @f
; arp announce, sender IP must be set to target IP ; arp announce, sender IP must be set to target IP
; ecx: pointer to target MAC ; ecx: pointer to target MAC
a_ann: a_ann:
mov edx, [stack_ip] mov edx, [stack_ip]
mov esi, ecx ; pointer to target MAC address mov esi, ecx ; pointer to target MAC address
call arp_request call arp_request
jmp @f jmp @f
param15_error: param15_error:
mov eax, -1 mov eax, -1
@@: @@:
ret ret
;</added by Frank Sommer> ;</added by Frank Sommer>
; modified by [smb] ; modified by [smb]
@ -582,7 +583,7 @@ not16:
;</added by Johnny_B> ;</added by Johnny_B>
stack_driver_end: stack_driver_end:
ret ret
@ -672,7 +673,7 @@ nots9:
mov eax,dword[drvr_cable] mov eax,dword[drvr_cable]
test eax,eax test eax,eax
jnz @f ; if function is not implented, return -1 jnz @f ; if function is not implented, return -1
mov al,-1 mov al,-1
ret ret
@ -923,9 +924,9 @@ stack_get_packet:
mov eax, NET1OUT_QUEUE mov eax, NET1OUT_QUEUE
call dequeue call dequeue
cmp ax, NO_BUFFER cmp ax, NO_BUFFER
je sgp_non_exit ; Exit if no buffer available je sgp_non_exit ; Exit if no buffer available
push eax ; Save buffer number for freeing at end push eax ; Save buffer number for freeing at end
push edx push edx
; convert buffer pointer eax to the absolute address ; convert buffer pointer eax to the absolute address
@ -934,7 +935,7 @@ stack_get_packet:
add eax, IPbuffs add eax, IPbuffs
pop edx pop edx
push eax ; save address of IP data push eax ; save address of IP data
; Get the address of the callers data ; Get the address of the callers data
mov edi,[TASK_BASE] mov edi,[TASK_BASE]
add edi,TASKDATA.mem_start add edi,TASKDATA.mem_start
@ -942,10 +943,10 @@ stack_get_packet:
mov edi, edx mov edi, edx
pop eax pop eax
mov ecx, 1500 ; should get the actual number of bytes to write mov ecx, 1500 ; should get the actual number of bytes to write
mov esi, eax mov esi, eax
cld cld
rep movsb ; copy the data across rep movsb ; copy the data across
; And finally, return the buffer to the free queue ; And finally, return the buffer to the free queue
pop eax pop eax
@ -976,7 +977,7 @@ stack_insert_packet:
mov eax, EMPTY_QUEUE mov eax, EMPTY_QUEUE
call dequeue call dequeue
cmp ax, NO_BUFFER cmp ax, NO_BUFFER
je sip_err_exit je sip_err_exit
push eax push eax
@ -993,9 +994,9 @@ stack_insert_packet:
; So, edx holds the IPbuffer ptr ; So, edx holds the IPbuffer ptr
pop ecx ; count of bytes to send pop ecx ; count of bytes to send
mov ebx, ecx ; need the length later mov ebx, ecx ; need the length later
pop eax ; get callers ptr to data to send pop eax ; get callers ptr to data to send
; Get the address of the callers data ; Get the address of the callers data
mov edi,[TASK_BASE] mov edi,[TASK_BASE]
@ -1005,7 +1006,7 @@ stack_insert_packet:
mov edi, edx mov edi, edx
cld cld
rep movsb ; copy the data across rep movsb ; copy the data across
pop ebx pop ebx

View File

@ -113,7 +113,7 @@ palette320x200:
loop palnew loop palnew
ret ret
align 4
uglobal uglobal
novesachecksum dd 0x0 novesachecksum dd 0x0
EGA_counter db 0 EGA_counter db 0
@ -123,7 +123,7 @@ uglobal
temp: temp:
.cx dd 0 .cx dd 0
endg endg
align 4
checkVga_N13: checkVga_N13:
cmp [SCR_MODE],dword 0x13 cmp [SCR_MODE],dword 0x13