Skip to content

Commit f7bf549

Browse files
committed
correct xor to test not clear value, invert test so 808x is 0 and NEC is 1 matching returned value
1 parent 07155e6 commit f7bf549

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

kernel/cpu.asm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ CPU 386
5353
; based on https://hg.pushbx.org/ecm/ldebug/file/7f3440d5824d/source/init.asm#l3071
5454
; which is based on http://www.textfiles.com/hamradio/v20_bug.txt
5555
mov ax, sp ; we use stack to do test
56-
mov cx, 1 ; after pop still 1 if 8088/8086
56+
mov cx, 0 ; after pop still 0 if 8088/8086
5757
push cx
58-
dec cx ; after pop still 0 if NEC V20/V30
58+
inc cx ; after pop still 1 if NEC V20/V30
5959
; next instructions may lock system if breakpoint or trace flag set
6060
db 8Fh, 0C1h; pop r/m16 with operand cx on 808x, nop on NEC V20/V30
6161
mov sp, ax ; reset stack to known good state (pre push, optional pop)
62-
xor cx, cx ; cx is 1 if NEC, 0 if 808x
63-
jz is808x
64-
mov bx, cx
62+
or cx, cx ; cx is 0 if 808x, 1 if NEC
63+
jz is808x ; if not NEC then goto test for 808x vs 8018x
64+
mov bx, cx ; treat NEC V20/V30 as 8018x, i.e. return 1
6565
jmp short cleanup
6666
is808x:
6767
mov ax,1 ; determine if 8086 or 186

kernel/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ STATIC VOID signon()
461461
" - 80386 CPU required"
462462
#elif defined (I186)
463463
" - 80186 CPU required"
464+
#else
465+
" - 808x compatible"
464466
#endif
465467

466468
#ifdef WITHFAT32

0 commit comments

Comments
 (0)