Skip to content

Commit

Permalink
Optimization, stability fixes, fixes to etherpkt. #672
Browse files Browse the repository at this point in the history
  • Loading branch information
Falk Rehwagen committed Oct 19, 2024
1 parent b8a5416 commit dd96d53
Show file tree
Hide file tree
Showing 10 changed files with 8,981 additions and 8,863 deletions.
2 changes: 1 addition & 1 deletion Appl/Breadbox/BbxBrow/bbxbrow.gp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export StatusTextClass
export URLEntryClass
## ifndef GLOBAL_INTERNET_BUILD
## not needed for COMPILE_OPTION_TOGGLE_BARS
export GlobeAnimClass
#export GlobeAnimClass
## endif
export WMViewControlClass
export WMSearchReplaceControlClass
Expand Down
2 changes: 1 addition & 1 deletion Appl/Breadbox/BbxBrow/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ GOCFLAGS += $(COMPILE_OPTIONS)
# -Os: favor size of execution speed
# JavaScript code uses #if rather than #ifdef
#XCCOMFLAGS = -d -dc -Z -Os -O $(COMPILE_OPTIONS:S|JAVASCRIPT_SUPPORT|JAVASCRIPT_SUPPORT=1|g)
XCCOMFLAGS = $(COMPILE_OPTIONS:S|JAVASCRIPT_SUPPORT|JAVASCRIPT_SUPPORT=1|g)
XCCOMFLAGS = -zc $(COMPILE_OPTIONS:S|JAVASCRIPT_SUPPORT|JAVASCRIPT_SUPPORT=1|g)

# -N: Add stack probes to every routine (only for EC builds)
#ifndef NO_EC
Expand Down
4 changes: 2 additions & 2 deletions Appl/Breadbox/BbxBrow/options.goh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
//@define COMPILE_OPTION_CUSTOMIZE_TOOL_BARS

/* Uncomment the following compile option to turn off the spinning globe logo */
//@define COMPILE_OPTION_TURN_OFF_LOGO
@define COMPILE_OPTION_TURN_OFF_LOGO

/* Uncomment the following to enable timestamp logging through bboxlog lib */
//#define COMPILE_OPTION_ENABLE_LOGGING
Expand Down Expand Up @@ -194,7 +194,7 @@

#if PROGRESS_DISPLAY
/* we have an import thread for each fetch thread, so don't make too many */
#define DEFAULT_FETCH_ENGINE_CHILDREN 2
#define DEFAULT_FETCH_ENGINE_CHILDREN 1
/* to simplify conditional code */
#define LOAD_PROGRESS_DATAP_ARG ,loadProgressDataP
#define LOAD_PROGRESS_PARAMS_PROTO ,_LoadProgressParams_
Expand Down
6 changes: 3 additions & 3 deletions Driver/Socket/EtherPKT/ethpktInit.asm
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ typeCheckLoop:
gotAccess:
mov ds:[pktIpHandle], ax
pop es
pop ax, cx, dx, bx
pop temp
pop bp, si, di
mov sp, temp
pop temp
pop ax, cx, dx, bx
;mov sp, temp
;popa
mov si, offset packetTypeARP
mov cx, size word
Expand Down
124 changes: 121 additions & 3 deletions Library/AnsiC/wcc_rtl.asm
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ WCC_TEXT SEGMENT BYTE PUBLIC 'CODE'
; cx:bx remainder
;
; Note: This is a temporary implementation. This function must be reimplemented in 8086 assembler instructions.

if 0
.386
__U4D proc far

Expand All @@ -130,6 +130,67 @@ WCC_TEXT SEGMENT BYTE PUBLIC 'CODE'
ret
__U4D endp
endif

__U4D proc far
; Input:
; dx:ax = 32-bit dividend (high:low)
; cx:bx = 32-bit divisor (high:low)
; Output:
; dx:ax = quotient (high:low)
; cx:bx = remainder (high:low)
if 0
; Save the dividend (dx:ax) and divisor (cx:bx) on the stack
push dx ; Save high part of dividend
push ax ; Save low part of dividend
push cx ; Save high part of divisor
push bx ; Save low part of divisor

; Check if we can perform a simple 16-bit division (divisor high part = 0)
mov ax, cx ; Copy high word of divisor to ax
or ax, ax ; Is the high part of the divisor (cx) zero?
jnz full_division ; If not zero, perform full 32-bit division

; Simple 16-bit division: divide dx:ax by bx (low part of divisor)
pop bx ; Load low word of divisor (bx) from stack
xor dx, dx ; Clear high part of dividend for 16-bit division
div bx ; Divide dx:ax by bx -> ax = quotient, dx = remainder

mov cx, dx ; Store remainder in cx
xor dx, dx ; Clear high part of quotient
jmp end_division ; Jump to end

full_division:
; Full 32-bit division
; dx:ax = dividend, cx:bx = divisor

pop bx ; Load low word of divisor (bx)
pop cx ; Load high word of divisor (cx)

; Step-by-step division using 16-bit operations

; 1. Prepare dividend and divisor
push dx ; Save high part of dividend on the stack
push ax ; Save low part of dividend on the stack

; 2. Set up for division
xor dx, dx ; Clear high part of dividend for division
div bx ; Divide dx:ax by bx (low word of divisor)

; 3. Get quotient and remainder (low)
mov bx, ax ; Store quotient in bx
mov ax, dx ; Store remainder in ax
div cx ; Divide ax (remainder) by cx (high word of divisor)

; 4. Prepare for return
mov cx, ax ; Store remainder in cx
mov dx, bx ; Store quotient in dx

end_division:
endif
ret ; Return
__U4D endp


; __I4D
;
Expand All @@ -144,7 +205,7 @@ WCC_TEXT SEGMENT BYTE PUBLIC 'CODE'
; cx:bx remainder
;
; Note: This is a temporary implementation. This function must be reimplemented in 8086 assembler instructions.
if 0
.386
__I4D proc far

Expand All @@ -169,6 +230,62 @@ WCC_TEXT SEGMENT BYTE PUBLIC 'CODE'
ret
__I4D endp
endif

__I4D proc far
; Input:
; dx:ax = 32-bit dividend (high:low)
; cx:bx = 32-bit divisor (high:low)
; Output:
; dx:ax = quotient (high:low)
; cx:bx = remainder (high:low)
if 0
; Save the dividend (dx:ax) and divisor (cx:bx) on the stack
push dx ; Save high part of dividend
push ax ; Save low part of dividend
push cx ; Save high part of divisor
push bx ; Save low part of divisor

; Check if we can do a simple 16-bit signed division (if cx == 0)
or cx, cx ; Check if high part of divisor is 0
jnz full_signed_division ; If high part of divisor is not 0, go to full division

; Simple 16-bit signed division: (dx:ax) / bx
idiv bx ; Signed divide dx:ax by bx -> quotient in ax, remainder in dx

mov bx, dx ; Store remainder in cx
xor dx, dx ; Clear high part of quotient
xor cx, cx ; Clear high part of quotient
jmp end_signed_division ; Jump to end

full_signed_division:
; Full 32-bit signed division
; dx:ax = dividend, cx:bx = divisor

; Step-by-step signed division using 16-bit operations

; 1. Save the dividend
push dx ; Save high word of dividend on the stack
push ax ; Save low word of dividend on the stack

; 2. Prepare for division
cwd ; Sign-extend ax into dx:ax (needed for signed division)
idiv bx ; Divide dx:ax by bx (low word of divisor)

; 3. Get quotient and remainder (low part)
mov bx, ax ; Save quotient in bx
mov ax, dx ; Save remainder in ax
cwd ; Sign-extend ax (remainder) into dx:ax
idiv cx ; Divide remainder (ax) by cx (high word of divisor)

; 4. Prepare results for return
mov cx, ax ; Store remainder in cx
mov dx, bx ; Store quotient in dx

end_signed_division:
endif
ret ; Return
__I4D endp


; __CHP
Expand All @@ -180,7 +297,8 @@ WCC_TEXT SEGMENT BYTE PUBLIC 'CODE'
.enter

mov bp, sp
push 0000h ;allocate 2byte on stack
;push 0000h ;allocate 2byte on stack
sub sp, 2
fstcw -2[bp] ;store fpu control word
fwait
mov ax, -2[bp] ;store old fpu control word in ax
Expand Down
3 changes: 1 addition & 2 deletions Library/SSL/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
# -WDE Does dgroup fixup on _export'd routines
#
#CCOMFLAGS += -K -d -X -Fs- -dc -p -WDE -rd
CCOMFLAGS += -ecp -zu
#-zc
CCOMFLAGS += -ecp -zu -zc

#
# main options
Expand Down
2 changes: 1 addition & 1 deletion Tools/build/product/bbxensem/Template/geos.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ EC-long(SysTray Clock)
TOOLS(Tools\ResEdit)
}
specname = Motif Redux
background = Meadows
background = Black Meadows
backgroundattr = center

[motif options]
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions Tools/build/product/bbxensem/bbxensem.filetree
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ DIR (ensemble) {
Tools/build/product/bbxensem/Userdata/backgrnd/MEADOWS.000
Tools/build/product/bbxensem/Userdata/backgrnd/WIDE_MEA.000
Tools/build/product/bbxensem/Userdata/backgrnd/ENDLESS_.000
Tools/build/product/bbxensem/Userdata/backgrnd/BLACK_ME.000
}

DIR (dicts) {
Expand Down
Loading

0 comments on commit dd96d53

Please sign in to comment.