From a12b553ffbb45f20edbbe4255a07c3fa8a574b30 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 13 Nov 2024 17:08:47 -0500 Subject: Fixed check for NEC vs Intel --- asm/386q.asm | 6 +++- gwfetch.bas | 97 +++++++++++++++++++++++++++++------------------------------- 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/asm/386q.asm b/asm/386q.asm index bf58033..250825a 100644 --- a/asm/386q.asm +++ b/asm/386q.asm @@ -61,8 +61,12 @@ lessthantwoeightsix: mov si, 0 mov cx, 0xffff ;0ffffh + ;rep lods [BYTE PTR es:si] - rep lodsb + ; INLINE assembler doesn't understand above - must be replaced after... + ; because we need a lods with ES as a parameter + ; so drop a 3-byte nonsense call to be replaced + mov cx, 0x0f99 ; replace with 0xF3, 0x26, 0xAC pop si diff --git a/gwfetch.bas b/gwfetch.bas index 4512e6d..d26bc85 100644 --- a/gwfetch.bas +++ b/gwfetch.bas @@ -63,24 +63,18 @@ 12001 DIM Q%(400) 12005 DEF SEG=VARSEG(Q%(0)) 12006 OS%=VARPTR(Q%(0)) -12007 BWOFFSET = -1: LASTBYTE = 0 -12010 FOR I = 1 TO 99 +12007 BWOFFSET = -1 : LASTBYTE = 0 +12010 FOR I = 1 TO 100 12020 READ JC:POKE I+OS%, JC 12021 REM Detect where we need to insert an offset for bus width detection -12022 IF LASTBYTE=99 AND JC=0 THEN BWOFFSET = I+OS% - 1: PRINT "BW ";BWOFFSET -12023 LASTBYTE = JC -12025 print i, peek(i+OS%) +12022 IF LASTBYTE=99 AND JC=0 THEN BWOFFSET = I+OS% - 1 +12029 LASTBYTE = JC 12030 NEXT I 12039 REM Need to set the offset for bus width 12040 TGTOFFSET = BWOFFSET + 16 -12045 print BWOFFSET, peek(BWOFFSET) -12046 print TGTOFFSET, peek(TGTOFFSET) - 12050 POKE BWOFFSET, (TGTOFFSET MOD 256) 12060 POKE BWOFFSET+1, INT(TGTOFFSET / 256) -12065 print BWOFFSET, peek(BWOFFSET) -12070 return 12080 CPUQ = 1 + OS% 12090 print "Calling!" @@ -116,10 +110,10 @@ 12126 DATA &H9C : REM pushf 12127 DATA &H58 : REM pop ax 12128 DATA &H25, &H00, &H70 : REM and ax, 0x7000 ;7000h -12129 DATA &H74, &H39 : REM jz alldone +12129 DATA &H74, &H3A : REM jz alldone 12130 REM ; mark as 386 (7) 12131 DATA &HFE, &HC2 : REM inc dl -12132 DATA &HE9, &H34, &H00 : REM jmp alldone +12132 DATA &HE9, &H35, &H00 : REM jmp alldone 12133 REM lessthantwoeightsix: 12134 REM ; Mark as 80188 (4) 12135 DATA &HB2, &H04 : REM mov dl, 4 @@ -127,7 +121,7 @@ 12137 DATA &HB1, &H21 : REM mov cl, 0x21 ;21h 12138 DATA &HD2, &HE8 : REM shr al, cl 12139 REM ; if the shift leaves zero, it's a 8088 class cpu, else 8018 -12140 DATA &H75, &H13 : REM jnz buswidth +12140 DATA &H75, &H14 : REM jnz buswidth 12141 REM ; Lets see if we have a V2 12142 DATA &HB2, &H02 : REM mov dl, 2 12143 DATA &HFB : REM sti @@ -135,44 +129,47 @@ 12145 DATA &HBE, &H00, &H00 : REM mov si, 0 12146 DATA &HB9, &HFF, &HFF : REM mov cx, 0xffff ;0ffffh 12147 REM ;rep lods [BYTE PTR es:si] -12148 DATA &HF2, &HAC : REM rep lodsb -12149 DATA &H5E : REM pop si -12150 DATA &H09, &HC9 : REM or cx, cx -12151 DATA &H74, &H02 : REM jz buswidth -12152 REM ; mark as a 808 -12153 DATA &HB2, &H00 : REM mov dl, 0 -12154 REM buswidth: -12155 REM ; we are destroying es now, must be restored later -12156 DATA &H0E : REM push cs -12157 DATA &H07 : REM pop es -12158 DATA &HFD : REM std -12159 REM ; The 99 _must_ be replaced with the true offset of qqend -12160 DATA &HBF, &H63, &H00 : REM mov di, 99 ; OFFSET qqend ;99 -12161 REM ;set up al and cx: 0xfb is the 'sti' instruction -12162 DATA &HB0, &HFB : REM mov al, 0xfb -12163 DATA &HB9, &H03, &H00 : REM mov cx, 3 -12164 REM ; disable interrupts -12165 DATA &HFA : REM cli -12166 DATA &HF2, &HAA : REM rep stosb -12167 DATA &HFC : REM cld -12168 DATA &H90 : REM nop -12169 DATA &H90 : REM nop -12170 DATA &H90 : REM nop -12171 DATA &H42 : REM inc dx +12148 REM ; INLINE assembler doesn't understand above - must be replaced after... +12149 REM ; because we need a lods with ES as a parameter +12150 REM ; so drop a 3-byte nonsense call to be replaced +12151 DATA &HF3, &H26, &HAC : REM mov cx, 0x0f99 ; replace with 0xF3, 0x26, 0xAC +12152 DATA &H5E : REM pop si +12153 DATA &H09, &HC9 : REM or cx, cx +12154 DATA &H74, &H02 : REM jz buswidth +12155 REM ; mark as a 808 +12156 DATA &HB2, &H00 : REM mov dl, 0 +12157 REM buswidth: +12158 REM ; we are destroying es now, must be restored later +12159 DATA &H0E : REM push cs +12160 DATA &H07 : REM pop es +12161 DATA &HFD : REM std +12162 REM ; The 99 _must_ be replaced with the true offset of qqend +12163 DATA &HBF, &H63, &H00 : REM mov di, 99 ; OFFSET qqend ;99 +12164 REM ;set up al and cx: 0xfb is the 'sti' instruction +12165 DATA &HB0, &HFB : REM mov al, 0xfb +12166 DATA &HB9, &H03, &H00 : REM mov cx, 3 +12167 REM ; disable interrupts +12168 DATA &HFA : REM cli +12169 DATA &HF2, &HAA : REM rep stosb +12170 DATA &HFC : REM cld +12171 DATA &H90 : REM nop 12172 DATA &H90 : REM nop -12173 REM qqend: -12174 DATA &HFB : REM sti -12175 REM ; ES must be restored -12176 DATA &H1E : REM push ds -12177 DATA &H07 : REM pop es -12178 REM alldone: -12179 REM ; store in ax -12180 DATA &H30, &HF6 : REM xor dh, dh -12181 DATA &H8B, &H7E, &H06 : REM mov di, [bp]+6 -12182 DATA &H89, &H15 : REM mov [di], dx -12183 DATA &H5D : REM pop bp -12184 DATA &HCA, &H02, &H00 : REM ); { retf 2} -12185 REM Total Bytes in Data: 99 +12173 DATA &H90 : REM nop +12174 DATA &H42 : REM inc dx +12175 DATA &H90 : REM nop +12176 REM qqend: +12177 DATA &HFB : REM sti +12178 REM ; ES must be restored +12179 DATA &H1E : REM push ds +12180 DATA &H07 : REM pop es +12181 REM alldone: +12182 REM ; store in ax +12183 DATA &H30, &HF6 : REM xor dh, dh +12184 DATA &H8B, &H7E, &H06 : REM mov di, [bp]+6 +12185 DATA &H89, &H15 : REM mov [di], dx +12186 DATA &H5D : REM pop bp +12187 DATA &HCA, &H02, &H00 : REM ); { retf 2} +12188 REM Total Bytes in Data: 100 12200 RETURN -- cgit v1.2.3