[Reduction] #531: conio_type_init

Yup, platform detection by checking whether the date returned by the IBM real-
time clock interrupt is in the 20th or 21st century.
This commit is contained in:
nmlgc 2014-10-10 21:20:22 +02:00
parent 47a6be4db2
commit 365763c459
5 changed files with 33 additions and 106 deletions

View File

@ -0,0 +1,24 @@
public ___conio_type_init
___conio_type_init proc near
push si
push di
cmp ___conio_type, 0
jnz short @@ret
mov ah, 4
xor cx, cx
int 1Ah
cmp ch, 19h
jz short @@IBM
cmp ch, 20h
jz short @@IBM
mov ___conio_type, 2
jmp short @@ret
@@IBM:
mov ___conio_type, 1
@@ret:
pop di
pop si
ret
___conio_type_init endp

View File

@ -0,0 +1,3 @@
db 0
db 0Fh
dd ___conio_type_init

View File

@ -5548,39 +5548,7 @@ include libs/BorlandC/strings.asm
include libs/BorlandC/ccomdely.asm
include libs/BorlandC/cibmdely.asm
include libs/BorlandC/cnecdely.asm
; =============== S U B R O U T I N E =======================================
sub_9B78 proc near
push si
push di
cmp ___conio_type, 0
jnz short loc_9B9F
mov ah, 4
xor cx, cx
int 1Ah ; CLOCK - READ DATE FROM REAL TIME CLOCK (AT,XT286,CONV,PS)
; Return: DL = day in BCD
; DH = month in BCD
; CL = year in BCD
; CH = century (19h or 20h)
cmp ch, 19h
jz short loc_9B99
cmp ch, 20h ; ' '
jz short loc_9B99
mov ___conio_type, 2
jmp short loc_9B9F
; ---------------------------------------------------------------------------
loc_9B99:
mov ___conio_type, 1
loc_9B9F:
pop di
pop si
retn
sub_9B78 endp
include libs/BorlandC/conioini.asm
include libs/BorlandC/mbjmsjis.asm
include libs/BorlandC/loadprog.asm
seg000 ends
@ -24789,9 +24757,7 @@ include libs/BorlandC/pathops[initdata].asm
include libs/BorlandC/setargv[initdata].asm
include libs/BorlandC/setenvp[initdata].asm
include libs/BorlandC/cibmdely[initdata].asm
db 0
db 0Fh
dd sub_9B78
include libs/BorlandC/conioini[initdata].asm
InitEnd label byte
ExitStart label byte

View File

@ -5110,37 +5110,7 @@ include libs/BorlandC/strings.asm
include libs/BorlandC/ccomdely.asm
include libs/BorlandC/cibmdely.asm
include libs/BorlandC/cnecdely.asm
; ---------------------------------------------------------------------------
loc_9DF3:
push si
push di
cmp ___conio_type, 0
jnz short loc_9E1A
mov ah, 4
xor cx, cx
int 1Ah ; CLOCK - READ DATE FROM REAL TIME CLOCK (AT,XT286,CONV,PS)
; Return: DL = day in BCD
; DH = month in BCD
; CL = year in BCD
; CH = century (19h or 20h)
cmp ch, 19h
jz short loc_9E14
cmp ch, 20h ; ' '
jz short loc_9E14
mov ___conio_type, 2
jmp short loc_9E1A
; ---------------------------------------------------------------------------
loc_9E14:
mov ___conio_type, 1
loc_9E1A:
pop di
pop si
retn
include libs/BorlandC/conioini.asm
include libs/BorlandC/mbjmsjis.asm
include libs/BorlandC/loadprog.asm
seg000 ends
@ -21794,9 +21764,7 @@ include libs/BorlandC/pathops[initdata].asm
include libs/BorlandC/setargv[initdata].asm
include libs/BorlandC/setenvp[initdata].asm
include libs/BorlandC/cibmdely[initdata].asm
db 0
db 0Fh
dd loc_9DF3
include libs/BorlandC/conioini[initdata].asm
InitEnd label byte
ExitStart label byte

View File

@ -8704,39 +8704,7 @@ include libs/BorlandC/strings.asm
include libs/BorlandC/ccomdely.asm
include libs/BorlandC/cibmdely.asm
include libs/BorlandC/cnecdely.asm
; =============== S U B R O U T I N E =======================================
sub_B11B proc near
push si
push di
cmp ___conio_type, 0
jnz short loc_B142
mov ah, 4
xor cx, cx
int 1Ah ; CLOCK - READ DATE FROM REAL TIME CLOCK (AT,XT286,CONV,PS)
; Return: DL = day in BCD
; DH = month in BCD
; CL = year in BCD
; CH = century (19h or 20h)
cmp ch, 19h
jz short loc_B13C
cmp ch, 20h ; ' '
jz short loc_B13C
mov ___conio_type, 2
jmp short loc_B142
; ---------------------------------------------------------------------------
loc_B13C:
mov ___conio_type, 1
loc_B142:
pop di
pop si
retn
sub_B11B endp
include libs/BorlandC/conioini.asm
include libs/BorlandC/kbhit.asm
include libs/BorlandC/mbjmsjis.asm
include libs/BorlandC/loadprog.asm
@ -42612,9 +42580,7 @@ include libs/BorlandC/cputype[initdata].asm
include libs/BorlandC/pathops[initdata].asm
include libs/BorlandC/setenvp[initdata].asm
include libs/BorlandC/cibmdely[initdata].asm
db 0
db 0Fh
dd sub_B11B
include libs/BorlandC/conioini[initdata].asm
InitEnd label byte
ExitStart label byte