4 ans cela fait quand même beaucoup
cordialement
re,fandeonepiece2 a écrit:bonjour,
4 ans cela fait quand même beaucoup
cordialement
ORG 100h ; Fichier .com
MOV AH, 09h ; Indique le numéro de la fonction à utiliser par l'interruption
MOV DX, message ; Indique le paramètre utilisé par la fonction
INT 21h ; Appel de l'interruption 33 (21h), fonction numéro 9 : afficher une chaîne à l'écran.
RET ; On termine l'application proprement.
message db "Bonjour le monde !", '$' ; On définit la chaîne de caractères 'message', terminée par '$'
lereparateurdepc
re,
Et le binaire ?
C'est bien aussi :)faut juste ne pas se mélanger entre 0 et 1.
Cordialement,
Le réparateur de PC
TITLE POWER$ IDLE DETECTION V1.0
.xlist
include version.inc ; M004 set build flags
break macro ; satisfy mult.inc
endm
include mult.inc ; get our int 2f function equates ; M077
include win386.inc ; NSM2
include devmark.inc
IFDEF POWER
IFNDEF POWERALONE ; segment declarations for resident version
include biosseg.inc ; establish bios segment structure
ELSE ; segment declarations for standalonde version
.SEQ
Bios_Code segment word public 'Bios_Code'
Bios_Code ends
Bios_Data segment word public 'Bios_Data'
Bios_Data ends
SysInitSeg segment word public 'system_init'
SysInitSeg ends
Trans_Code segment word public 'CODE'
extrn ParseCmdLine:far
Trans_Code ends
Trans_Data segment word public 'DATA'
extrn BadDOSMsg:byte
extrn PW_Low:byte, PW_Mode:byte, PW_Savings_Value:word ; M104
IFDEF DEBUG
extrn PW_Debug:byte ; M104
ENDIF
Trans_Data ends
ENDIF
include msequ.inc
include devsym.inc
include bpb.inc
include ioctl.inc
include power.inc
IFDEF POWERALONE ; M098
include umb.inc ; M098
include syscall.inc ; M098
ENDIF ; POWERALONE ; M098
IFDEF INCL_APM
include apmequ.inc ; M001
ENDIF
break macro
endm
include error.inc
.list
include msgroup.inc ; define Bios_Data segment
IFDEF POWERALONE ; standalone device driver version
Bios_Res dw Bios_Code ; Our code segment address
ELSE ; resident BIOS version
extrn Bios_Res:word ; Code segment address supplied externally
extrn ttticks:dword ; far ptr to time_to_ticks routine
extrn P_UpdFromCMOS_Ptr:dword ; ptr to CMOS clock read ; M081
IFDEF INCL_APM
extrn Check_and_Init_APM_Ptr:dword ; ptr to APM init routine
ENDIF ;INCL_APM
ENDIF ;NOT POWERALONE
;
; PUBLIC declaration for DATA
;
public RHPTR, KYC, I28, CONTROL, INFO, MSW
public IDLTIC, TOTTIC, SPDUP, SPDUP_DLY, SPDUP_CNT ; M004
public I2F_VEC, I28_TMR0, I28_VEC, KYC_TMR0, IN_KYC
public I16_VEC, SWITCH_CNT, I9_COUNT, I9_VEC, I10_VEC, I13_VEC
public I14_VEC, I17_VEC, I21_VEC,I25_VEC,I26_VEC,I2A_VEC, I08_VEC
; PUBLIC declarations for APM related Data
;
IFDEF INCL_APM ; M001
public fAPM_PRESENT,APM_FLAGS,APM_VER,APM_POLL_COUNT,fAPM_CONNECT
public APM_MAX_POLLCOUNT,fAPM_STATE,APM_RESUME_COUNT
ENDIF
RHPTR dd 0
; DEBUG Macro
; Prints the argument (dispchar) on screen
;
dbg_printchar macro dispchar
IFDEF DEBUG
push ax
mov ah,0eh
mov al,dispchar
int 10h
pop ax
ENDIF
endm
POWER_DATA label byte
;
; Period Info structure for Keyboard (KYC) and Int 28 (I28)
; This holds the values for BASE,NOISE, AVG, SPREAD etc.
; (look at power.inc for PERIOD_INFO structure
;
; BUGBUG - Nagara - PERIOD_INFO structure has changed and the following
; lines do not reflect that. These lines should have been:
; KYC PERIOD_INFO <0,0,0,0,0,20,20,0,0,0>
; I28 PERIOD_INFO <0,0,0,0,0,100,20,0,0,0>
; Luckily the current def., though wrong, will not cause any problems
KYC PERIOD_INFO < 0, 0,20, 20, 0, 0, 0> ; default values for base and
I28 PERIOD_INFO < 0, 0,100, 20, 0, 0, 0> ; noise are (random)conservative
; BUGBUG END
; CONTROL holds constant/tunable parameters for (mainly) int 16/int 28 idle
; detection strategies.
;
CONTROL CONTROL_INFO < 00011111b, 8*2, 31*1024, 4, 40, 0, 1, 8, 0>
; M078
; idle_flg, sw_dly,thres,ad_dl,mx,sp_dl,ramp,sp_mx,386flg
;
; INFO holds the idle detection statistics such as no of i16 idles detected etc.
INFO IDLE_INFO < 0, 0, 0, 0, 0, 0, 0>
ErrSampleCount dw 0 ; no of errors encountered so far in adapt cycle
MSW dw 0 ; store machine status word
; used by ChkV86 procedure
; bit 0 = 1 indicates protected mode
IDLTIC dw 0 ; M004 used as a flag that says CPU was idle
; in the last (I08) tick period
TOTTIC dw 0 ; running total of halt time ; counted in Int8
; in 1/1.19 MHZ increments 65536=55ms
;
; ACTIVITY MONITOR DATA
;
SPDUP dw 0 ; Activity indicator; 1=> active =>avoid halting
SPDUP_DLY dw 0 ; MAX DELAY set by activity monitor
SPDUP_CNT dw 0 ; incremented via INT 08
;
; M100 - begin
;
; Data to track Int2F aware apps.
; Instance data structure for instancing PSPOf2fApp
;
Pwr_InstData label byte
Pwr_SIVersion dw 3 ; ignored
Pwr_SINextDev dd 0 ; ptr to next Instance packet
Pwr_SIVirtDev dd 0 ; ignored
Pwr_SIRefData dd 0 ; ignored
Pwr_SIInstData dw offset Bios_Data:Pwr_SITable, Bios_Data
; pointer to instance table
Pwr_SITable label byte
Inst_PSPOf2fApp dw offset Bios_Data:PSPOf2fApp, Bios_Data
dw 2 ; 2 bytes
Inst_End dd 0
;
; M100 - end
;
PSPOf2fApp dw 0 ; PSP of the current 2f-1680 App ; M099
PSPsegment dw (?) ; JAH3 - Dos DATA seg used to
; access Current PSP
; Data to store prev. vectors of interrupts we hook
; At startup these hold our ISRs for corresponding ints, and exchanged with
; the previous ISR addresses at Device init time
;
I2F_VEC dw I2F_IDLE, 0 ; holds next pointer in chain
; BUGBUG - Nagara - I2F_TMR0 is not used at all and can be deleted
I2F_TMR0 dw 0 ;+0, holds temporary PC timer 0
; values used to compute PERIOD
dw 2 ;+2, Counts number of times PC
; timer has Overflowed
;BUGBUG END
I2A_VEC dw I2A_IDLE, 0 ; holds next pointer in chain
; I28_TMR0 is used to store TMR0 readings whenever Int 28 occurs.
I28_TMR0 dw 0 ;+0, holds temporary PC timer 0
; values used to compute PERIOD
dw 2 ;+2, Counts number of times PC
; timer has Overflowed
I28_VEC dw I28_IDLE, 0
KYC_TMR0 dw 0 ;+0, holds temporary PC timer 0
; values used to compute PERIOD for Int 16s
dw 2 ;+2, Counts number of times PC
; timer has Overflowed
IN_KYC dw 0 ; flags re-entry of key board check
I16_VEC dw I16_IDLE, 0 ; stores next key routine in chain
; SWITCH_CNT keeps track of when to switch idle detect method (whether int16
; or int 28)
SWITCH_CNT dw 0
I08_VEC dw Pwr_i08_isr,0 ; our Int 8 ISR ; NSM5
I9_COUNT dw 2 ; for every key press more
; a minimum of 2 INT 9's occur
; Application activity monitor interrupts
I9_VEC dw I9_APP,0
I10_VEC dw I10_APP,0
I13_VEC dw I13_APP,0
I14_VEC dw I14_APP,0
I17_VEC dw I17_APP,0
I21_VEC dw I21_APP,0
I25_VEC dw I25_APP,0
I26_VEC dw I26_APP,0
; Our hook for Int 6c- update system date and time
I6C_VEC dw I6C_RESUME, 0 ;M080
;------------------------------------------------------------------------
; APM SPECIFIC DATA
;
IFDEF INCL_APM ; M001
fAPM_PRESENT db 0 ; set to 1 if APM present
fAPM_CONNECT db 0 ; set to 1 if we are connected
APM_MAX_POLLCOUNT dw 50 ; interval bet PM event polls (in tmr tics)
APM_FLAGS dw 0 ; flags returned by APM detect call
APM_VER dw 0 ; APM BIOS ver returned by APM detect call
APM_POLL_COUNT dw 50 ; interval bet PM event polls (in tmr tics)
; counter for APM polling ; counted in int 8 time
fAPM_STATE db 0 ; 0 if APM disabled and 1 if APM enabled
APM_RESUME_COUNT dw 0 ; counter for no of resumes from last
; APM enable
ENDIF ;INCL_APM
;-------------------------------------------------------------------
; DATA for CLOCK$ driver
PUBLIC CMOSUpdFlg ; M090
PUBLIC CMOSPollCount ; M090
CMOSUpdFlg db 0 ; M090 set to 1 if we need to update from CMOS
; set when we see a rollover in BDA (40:70h) or periodically
; in POWER STD mode in an APM machine
CMOSPollCount dw MAXCMOSPOLLCOUNT ; M090
; counted at int 8 time and used in POWER STD mode to update
; system date and time periodically
CMOSFlg db 0 ; M091 bit 0 set to 1 in POWER STD mode on APM
; machines
;-------------------------------------------------------------------
; BASE LINE calculation data for Int 16 idle detection
BaseLineRef dw 0 ; counters for counting no of i16s we can get
; through in about 4 secs (done at each
; exec)
BaseLineOvf dw 0 ; also used to store previous calculated
; BaseLineRef
; SMR7 - Baseline Max calculation
public BL_Samples
BL_NUMSAMPLES equ 9 ; no of samples collected at EXEC time
BL_Samples dw BL_NUMSAMPLES dup ('SM') ; data to hold i16 samples
BL_EndSamples label byte
; SMR7 END
;-------------------------------------------------------------------
; CLOCK$ driver DATA
IFDEF POWERALONE ; needed only for standalone version
public daycnt ; no of days from 1-1-80 (ABS)
daycnt dw 0
public daycnt2
daycnt2 dw 0 ; used as a temp while calculating daycnt
public base_century
base_century db 19
public base_year
base_year db 80
public month_tab
month_tab db 31,28,31,30,31,30,31,31,30,31,30,31
public bin_date_time
bin_date_time:
db 0 ; year in century (0...99) or minutes (0-59)
db 0 ; century (19 or 20) or hours (0-23)
db 0 ; day in month (1...31)
db 0 ; month in year (1...12) or seconds (0-59)
public month_table
month_table: ; no of days in year upto this month
dw 0 ; january
dw 31 ; february
dw 59 ; march
dw 90 ; april
dw 120 ; may
dw 151 ; june
dw 181 ; july
dw 212 ; august
dw 243 ; september
dw 273 ; october
dw 304 ; november
dw 334 ; december
ELSE ; for resident version
extrn bin_date_time:byte
extrn month_table:word
extrn daycnt:word
extrn daycnt2:word
ENDIF ; POWERALONE
;-------------------------------------------------------------------
; Used by Int 21 application activity monitor to filter those sysem calls
; that should not inhibit idles and those calls that have to be special cased
;
; 1 byte for each int 21 api from functions 0 thro 5fh
; an entry of 0ffh means ignore this api for false idle monitoring
; 0 -> this api means the system is busy (NOT idle)
; any other number -> special cases
i21_table label near
db 0, 0, 0, 0, 0, 0, 5, 0 ; fns 0-7
db 0, 0, 0,0ffh, 0, 0, 0, 0 ; fns 8-0f
db 0, 0, 0, 0, 0, 0, 0, 0 ; fns 10-17
db 0, 0, 0, 0, 0, 0, 0, 0 ; fns 18-1f
db 0, 0, 0, 0, 0,0ffh, 0, 0 ; fns 20-27
db 0, 0,0ffh, 0,0ffh, 0, 0, 0 ; fns 28-2f
db 0, 0, 0, 0, 0,0ffh, 0, 0 ; fns 30-37
db 0, 0, 0, 0, 0, 0, 0, 0 ; fns 38-3f
db 0, 0, 0, 0,043h, 0, 0, 0 ; fns 40-47
db 0, 0, 0,04ah, 0, 0, 0, 0 ; fns 48-4f
db 0ffh,0ffh, 0, 0, 0, 0, 0, 0 ; fns 50-57
db 0, 0, 0, 0, 0, 0, 0,05eh ; fns 58-5f
MAX_I21_ENTRY equ 5fh
;
;-------------------------------------------------------------------
;
; MISCELLANEOUS FLAGS and TABLES
;
POWER_STATUS db 1 ; default ;bit 0 - S/W pw.mgmt always enabled
; bit 1 - Take control of APM/FIRMWARE mgmt
; (or get connected to APM)
; M001
; M089 If bit1 is set, We are connected to APM
; but not neccessarily enabled APM
; (look at fAPM_State)
;NSM1 BEGIN
; NSM9 BEGIN - 8 sets of savings modes with 6 being the default
Savings_Mode dw 6 ; 3 = MIN savings
; 6 = Reg savings (default)
; 7 = Max savings
;--------------------------------------------------------------------
; date_verify loosely checks bcd date values to be in range in bin_date_time
date_verify proc near
assume ds:Bios_Data,es:nothing
cmp byte ptr bin_date_time+1,20h ; century check
ja date_error ; error
jz century_20 ; jmp in 20th century
cmp byte ptr bin_date_time+1,19h ; century check
jb date_error ; error
cmp byte ptr bin_date_time+0,80h ; year check
jb date_error ; error
century_20:
cmp byte ptr bin_date_time+0,99h ; year check
ja date_error ; error
cmp byte ptr bin_date_time+3,12h ; month check
ja date_error ; error
cmp byte ptr bin_date_time+3,00h ; month check
jbe date_error ; error
cmp byte ptr bin_date_time+2,31h ; day check
ja date_error ; error
cmp byte ptr bin_date_time+2,00h ; day check
jbe date_error ; error
clc ; set success flag
ret
date_error:
stc ; set error flag
ret
date_verify endp
;--------------------------------------------------------------------
; time_verify very loosely checks bcd date values to be in range in bin_date_time
time_verify proc near
assume ds:Bios_Data,es:nothing
cmp byte ptr bin_date_time+1,24h
ja time_error
cmp byte ptr bin_date_time+0,59h
ja time_error
cmp byte ptr bin_date_time+3,59h
ja time_error
clc
ret
time_error:
stc
ret
time_verify endp
;--------------------------------------------------------------------
; bcd_verify checks values in bin_date_time to be valid
; bcd numerals. carry set if any nibble out of range
bcd_verify proc near
assume ds:Bios_Data,es:nothing
mov cx,4 ; 4 bytes to check
mov bx,offset bin_date_time
bv_loop:
mov al,[bx] ; get a bcd number (0..99)
mov ah,al
and ax,0f00fh ; 10's place in high ah, 1's in al
cmp al,10 ; is 1's place in range?
ja bv_error ; jmp out of range
shr ah,1 ; swap nibbles
shr ah,1
shr ah,1
shr ah,1
and ah,0fh ; get rid of any erroneous bits
cmp ah,10 ; is 10's place in range
ja bv_error ; jmp out of range
inc bx ; next byte
dec cx
jnz bv_loop
clc ; set success flag
ret
bv_error:
stc ; set error flag
ret
bcd_verify endp
;--------------------------------------------------------------------
daycnttoday proc near ; for real time clock support
;entry: [daycnt] = number of days since 1-1-80
;
;return: ch - centry in bcd
; cl - year in bcd
; dh - month in bcd
; dl - day in bcd
push di
mov di,daycnt
cmp di,(365*20+(20/4)) ;# of days from 1-1-1980 to 1-1-2000
jae century20
mov base_century,19
mov base_year,80
jmp short years
century20: ;20th century
mov base_century,20
mov base_year,0
sub di,(365*20+(20/4)) ;adjust daycnt
years:
xor dx,dx
mov ax,di
mov bx,(366+365*3) ;# of days in a leap year block
div bx ;ax = # of leap block, dx = daycnt
mov di,dx ;save daycnt left
mov bl,4
mul bl ;ax = # of years. less than 100 years!
add base_year,al ;so, ah = 0. adjust year accordingly.
inc di ;set daycnt to 1 base
cmp di,366 ;the daycnt here is the remainder of the leap year block.
jbe leapyear ;so, it should within 366+355+355+355 days.
inc base_year ;first if daycnt <= 366, then leap year
sub di,366 ;else daycnt--, base_year++;
;and the next three years are regular years.
mov cx,3
regularyear:
cmp di,365 ;for(i=1; i>3 or daycnt <=365;i++)
jbe yeardone ;{if (daycnt > 365)
inc base_year ; { daycnt -= 365
sub di,365 ; }
loop regularyear ;}
; should never fall through loop
leapyear:
mov byte ptr month_tab+1,29 ;leap year. change the month table.
yeardone:
xor bx,bx
xor dx,dx
mov ax,di
mov si,offset month_tab
mov cx,12
months:
inc bl
mov dl,byte ptr ds:[si] ;compare daycnt for each month until fits
cmp ax,dx ;dh=0.
jbe month_done
inc si ;next month
sub ax,dx ;adjust daycnt
loop months
; should never fall through loop
month_done:
mov byte ptr month_tab+1,28 ;restore month table value
mov dl,bl
mov dh,base_year
mov cl,base_century ;now, al=day, dl=month,dh=year,cl=century
call bintobcd ;oh my!!! to save 15 bytes, bin_to_bcd proc
;was relocated seperately from daycnt_to_day proc.
xchg dl,al ;dl = bcd day, al = month
call bintobcd
xchg dh,al ;dh = bcd month, al = year
call bintobcd
xchg cl,al ;cl = bcd year, al = century
call bintobcd
mov ch,al ;ch = bcd century
pop di ;restore original value
ret
daycnttoday endp
IFDEF POWERALONE ; needed only for standalone version
; for resident version use the one in
; mschar.asm
;--------------------------------------------------------------------
; convert time to ticks
; input : time in cx and dx
; ticks returned in cx:dx
time_to_ticks proc near
; first convert from hour,min,sec,hund. to
; total number of 100th of seconds
mov al,60
mul ch ;hours to minutes
mov ch,0
add ax,cx ;total minutes
mov cx,6000 ;60*100
mov bx,dx ;get out of the way of the multiply
mul cx ;convert to 1/100 sec
mov cx,ax
mov al,100
mul bh ;convert seconds to 1/100 sec
add cx,ax ;combine seconds with hours and min.
adc dx,0 ;ripple carry
mov bh,0
add cx,bx ;combine 1/100 sec
adc dx,0
; dx:cx is time in 1/100 sec
xchg ax,dx
xchg ax,cx ;now time is in cx:ax
mov bx,59659
mul bx ;multiply low half
xchg dx,cx
xchg ax,dx ;cx->ax, ax->dx, dx->cx
mul bx ;multiply high half
add ax,cx ;combine overlapping products
adc dx,0
xchg ax,dx ;ax:dx=time*59659
mov bx,5
div bl ;divide high half by 5
mov cl,al
mov ch,0
mov al,ah ;remainder of divide-by-5
cbw
xchg ax,dx ;use it to extend low half
div bx ;divde low half by 5
mov dx,ax
; cx:dx is now number of ticks in time
ret
time_to_ticks endp
ENDIF
Bios_Code ends
ENDIF
END
TITLE PATH - Directory related system calls
NAME PATH
;
; Microsoft Confidential
; Copyright (C) Microsoft Corporation 1991
; All Rights Reserved.
;
;** Directory related system calls. These will be passed direct text of the
; pathname from the user. They will need to be passed through the macro
; expander prior to being sent through the low-level stuff. I/O specs are
; defined in DISPATCH. The system calls are:
;
; $CURRENT_DIR Written
; $RMDIR Written
; $CHDIR Written
; $MKDIR Written
;
;
; Modification history:
;
; Created: ARR 4 April 1983
; MZ 10 May 1983 CurrentDir implemented
; MZ 11 May 1983 RmDir, ChDir, MkDir implemented
; EE 19 Oct 1983 RmDir no longer allows you to delete a
; current directory.
; MZ 19 Jan 1983 Brain damaged applications rely on success
.xlist
.xcref
include version.inc
include dosseg.inc
INCLUDE DOSSYM.INC
INCLUDE DEVSYM.INC
include curdir.inc
include filemode.inc
include mult.inc
include dpb.inc
.cref
.list
I_Need ThisCDS,DWORD ; pointer to Current CDS
I_Need WFP_Start,WORD ; pointer to beginning of directory text
I_Need Curr_Dir_End,WORD ; offset to end of directory part
I_Need OpenBuf,128 ; temp spot for translated name
I_need fSplice,BYTE ; TRUE => do splice
I_Need NoSetDir,BYTE ; TRUE => no exact match on splice
I_Need cMeta,BYTE
I_Need DrvErr,BYTE ;AN000;
DOSCODE SEGMENT
allow_getdseg
ASSUME SS:DOSDATA,CS:DOSCODE
EXTRN DOS_MkDir:NEAR,DOS_RmDir:NEAR
BREAK <$CURRENT_DIR - dump the current directory into user space>
;---------------------------------------------------------------------------
; Procedure Name : $CURRENT_DIR
;
; Assembler usage:
; LDS SI,area
; MOV DL,drive
; INT 21h
; ; DS:SI is a pointer to 64 byte area that contains drive
; ; current directory.
; Error returns:
; AX = error_invalid_drive
;
;---------------------------------------------------------------------------
procedure $CURRENT_DIR,NEAR
ASSUME CS:DOSCODE,SS:NOTHING
EnterCrit critDisk
MOV AL,DL ; get drive number (0=def, 1=A)
Invoke GetVisDrv ; grab it
JNC CurrentValidate ; no error -> go and validate dir
CurdirErr:
LeaveCrit critDisk
;hkn; Set up DS to access DrvErr
push ds
getdseg <ds> ; ds -> dosdata
MOV AL,[DrvErr] ;IFS. ;AN000;
pop ds
assume ds:nothing
transfer SYS_RET_ERR ;IFS. make noise ;AN000;
CurrentValidate:
SAVE <DS,SI> ; save destination
;hkn; Set up DS to access ThisCDS
getdseg <ds> ; ds -> dosdata
LDS SI,ThisCDS
assume ds:nothing
TEST [SI].curdir_flags,curdir_isnet
JNZ DoCheck
; Random optimization nuked due to some utilities using GetCurrentDir to do
; media check.
; CMP [SI].curdir_id,0
; JZ GetDst
DoCheck:
;hkn; Set up DS to access NoSetDir
push ds
getdseg <ds> ; ds -> dosdata
MOV NoSetDir,0 ; interested only in contents
pop ds
assume ds:nothing ;hkn; restore ds
;hkn; OpenBuf is in DOSDATA
MOV DI,OFFSET DOSDATA:OpenBuf
Invoke ValidateCDS ; output is ES:DI -> CDS
SAVE <ES,DI> ; swap source and destination
RESTORE <SI,DS>
GetDst:
RESTORE <DI,ES> ; get real destination
JC CurdirErr
ADD SI,curdir_text
ADD SI,[SI.curdir_END]
CMP BYTE PTR [SI],'\' ; root or subdirs present?
JNZ CurrentCopy
INC SI
CurrentCopy:
; Invoke FStrCpy
;; 10/29/86 E5 char
PUSH AX
LODSB ; get char
OR AL,AL
JZ FOK
CMP AL,05
JZ FCHANGE
JMP short FFF
FCPYNEXT:
LODSB ; get char
FFF:
CMP AL,'\' ; beginning of directory
JNZ FOK ; no
STOSB ; put into user's buffer
LODSB ; 1st char of dir is 05?
CMP AL,05H
JNZ FOK ; no
FCHANGE:
MOV AL,0E5H ; make it E5
FOK:
STOSB ; put into user's buffer
OR AL,AL ; final char
JNZ FCPYNEXT ; no
POP AX
;; 10/29/86 E5 char
xor AL,AL ; MZ 19 Jan 84
LeaveCrit critDisk
transfer Sys_Ret_OK ; no more, bye!
EndProc $Current_Dir
BREAK <$RmDir -- Remove a directory>
;---------------------------------------------------------------------------
;
; Procedure Name : $RmDir
;
; Inputs:
; DS:DX Points to asciz name
; Function:
; Delete directory if empty
; Returns:
; STD XENIX Return
; AX = error_path_not_found If path bad
; AX = error_access_denied If
; Directory not empty
; Path not directory
; Root directory specified
; Directory malformed (. and .. not first two entries)
; User tries to delete a current directory
; AX = error_current_directory
;----------------------------------------------------------------------------
procedure $RMDIR,NEAR
ASSUME CS:DOSCODE,SS:DOSDATA
push dx ; Save ptr to name
push ds
mov si,dx ; Load ptr into si
;hkn; OpenBuf is in DOSDATA
mov di,offset DOSDATA:OpenBuf ; di = ptr to buf for trans name
push di
Invoke TransPathNoSet ; Translate the name
pop di ; di = ptr to buf for trans name
jnc rmlset ; If transpath succeeded, continue
pop ds
pop dx ; Restore the name
error error_path_not_found ; Otherwise, return an error
rmlset:
;hkn; SS override
CMP cMeta,-1 ; if (cMeta >= 0)
Jnz rmerr ; return (-1);
Context ES
xor al,al ; al = 0 , ie drive a:
rmloop: Invoke GetCDSFromDrv ; Get curdir for drive in al
jc rmcont ; If error, exit loop & cont normally
Invoke StrCmp ; Are the 2 paths the same?
jz rmerr ; Yes, report error.
inc al ; No, inc al to next drive number
jmp rmloop ; Go check next drive.
rmerr:
pop ds
pop dx ; Restore the name
error error_current_directory ; error
rmcont:
pop ds
pop dx ; Restore the name
;hkn; DOS_RmDIR is in DOSCODE
MOV SI,OFFSET DOSCODE:DOS_RmDIR
JMP DoDirCall
EndProc $RMDIR
BREAK <$ChDir -- Change current directory on a drive>
;----------------------------------------------------------------------------
;
; $ChDir - Top-level change directory system call. This call is responsible
; for setting up the CDS for the specified drive appropriately. There are
; several cases to consider:
;
; o Local, simple CDS. In this case, we take the input path and convert
; it into a WFP. We verify the existance of this directory and then
; copy the WFP into the CDS and set up the ID field to point to the
; directory cluster.
; o Net CDS. We form the path from the root (including network prefix)
; and verify its existance (via DOS_Chdir). If successful, we copy the
; WFP back into the CDS.
; o SUBST'ed CDS. This is no different than the local, simple CDS.
; o JOIN'ed CDS. This is trouble as there are two CDS's at work. If we
; call TransPath, we will get the PHYSICAL CDS that the path refers to
; and the PHYSICAL WFP that the input path refers to. This is perfectly
; good for the validation but not for currency. We call TransPathNoSet
; to process the path but to return the logical CDS and the logical
; path. We then copy the logical path into the logical CDS.
;
; Inputs:
; DS:DX Points to asciz name
; Returns:
; STD XENIX Return
; AX = chdir_path_not_found if error
;----------------------------------------------------------------------------
procedure $CHDIR,NEAR
ASSUME CS:DOSCODE,SS:DOSDATA
;hkn; OpenBuf is in DOSDATA
MOV DI,OFFSET DOSDATA:OpenBuf ; spot for translated name
MOV SI,DX ; get source
Invoke TransPath ; go munge the path and get real CDS
JNC ChDirCrack ; no errors, try path
ChDirErrP:
MOV AL,error_path_not_found
ChdirErr:
transfer SYS_Ret_Err ; oops!
ChDirCrack:
;hkn; Transpath sets DS to DOSGroup (DOSDATA now)
;hkn; Assume DS:DOSGroup
Assume DS:DOSDATA
CMP cMeta,-1 ; No meta chars allowed.
JNZ ChDirErrP
;
; We cannot do a ChDir (yet) on a raw CDS. This is treated as a path not
; found.
;
LES DI,ThisCDS
CMP DI,-1 ; if (ThisCDS == NULL)
JZ ChDirErrP ; error ();
;
; Find out if the directory exists.
;
Invoke DOS_ChDir
JC ChDirErr
;
; Get back CDS to see if a join as seen. Set the currency pointer (only if
; not network). If one was seen, all we need to do is copy in the text
;
LES DI,ThisCDS
TEST ES:[DI].curdir_flags,curdir_splice
JZ GotCDS
;
; The CDS was joined. Let's go back and grab the logical CDS.
;
SAVE <ES,DI,CX> ; save CDS and cluster...
Invoke Get_User_Stack ; get original text
ASSUME DS:NOTHING
MOV DI,[SI.User_DX]
MOV DS,[SI.User_DS]
;hkn; OpenBuf is in DOSDATA
MOV SI,OFFSET DOSDATA:OpenBuf ; spot for translated name
XCHG SI,DI
XOR AL,AL ; do no splicing
SAVE <DI>
Invoke TransPathNoSet ; Munge path
RESTORE <SI>
;hkn; Assume DS:DOSGroup
Assume DS:DOSDATA
;
; There should NEVER be an error here.
;
IF FALSE
JNC SKipErr
fmt <>,<>,<"$p: Internal CHDIR error\n">
SkipErr:
ENDIF
LES DI,ThisCDS ; get new CDS
MOV ES:[DI].curdir_ID,-1 ; no valid cluster here...
RESTORE <CX,DI,ES>
;
; ES:DI point to the physical CDS, CX is the ID (local only)
;
GotCDS:
;
; wfp_start points to the text. See if it is long enough
;
CALL Check_PathLen ;PTM. ;AN000;
JA ChDirErrP
TEST ES:[DI].curdir_flags,curdir_isnet
JNZ SkipRecency
TEST ES:[DI].curdir_flags,curdir_splice ;PTM. for Join and Subst ;AN000;
JZ setdirclus ;PTM. ;AN000;
MOV CX,-1 ;PTM. ;AN000;
setdirclus:
MOV ES:[DI].curdir_id,CX
LES DI,ThisCDS ; get logical CDS
SkipRecency:
invoke FStrCpy
XOR AL,AL
transfer Sys_Ret_OK
EndProc $CHDIR
BREAK <$MkDir - Make a directory entry>
;---------------------------------------------------------------------------
;
; Procedure Name : $MkDir
; Inputs:
; DS:DX Points to asciz name
; Function:
; Make a new directory
; Returns:
; STD XENIX Return
; AX = mkdir_path_not_found if path bad
; AX = mkdir_access_denied If
; Directory cannot be created
; Node already exists
; Device name given
; Disk or directory(root) full
;---------------------------------------------------------------------------
procedure $MKDIR,NEAR
ASSUME CS:DOSCODE,SS:DOSDATA
;hkn; DOS_MkDir is in DOSCODE
MOV SI,OFFSET DOSCODE:DOS_MkDir
DoDirCall:
;hkn; OpenBuf is in DOSDATA
MOV DI,OFFSET DOSDATA:OpenBuf ; spot for translated name
SAVE <SI>
MOV SI,DX ; get source
Invoke TransPath ; go munge the path
RESTORE <SI>
JNC MkDirCrack ; no errors, try path
MkErrP:
MOV AL,error_Path_Not_Found ; oops!
MkErr:
transfer Sys_Ret_Err
MkDirCrack:
;hkn; SS override
CMP cMeta,-1
JNZ MkErrP
PUSH SI ;PTM. ;AN000;
CALL Check_PathLen ;PTM. check path len > 67 ? ;AN000;
POP SI ;PTM. ;AN000;
JBE pathok ;PTM. ;AN000;
MOV AL,error_Access_Denied ;PTM. ops!
transfer Sys_Ret_Err ;PTM.
pathok:
CALL SI ; go get file
ASSUME ES:NOTHING
JC MkErr ; no errors
transfer Sys_Ret_OK
EndProc $MKDIR
;----------------------------------------------------------------------------
;
; Procedure Name : Check_PathLen
;
; Inputs:
; nothing
; Function:
; check if final path length greater than 67
; Returns:
; Above flag set if > 67
;---------------------------------------------------------------------------
procedure Check_PathLen,NEAR
ASSUME CS:DOSCODE,SS:DOSDATA
;hkn; SS override
MOV SI,Wfp_Start
entry Check_PathLen2
;hkn; SS is DOSDATA
Context <DS>
SAVE <CX>
invoke DStrLen
CMP CX,DirStrLen
RESTORE <CX>
ret
EndProc Check_PathLen
DOSCODE ENDS
END
Exact Rassure toi même moi je touche presque pas à l'ASM : j'ai pas encore les bases exactes... donc je m'avance pas sur l'ASM je préfère continuer le C avant comme toifandeonepiece2 a écrit:bonjour,
Je pense que le C est bien pour le moment
cordialmeent
softewarzatorman a écrit:Re,
ouais mais déjà qu'on galère avec les 1 et les 0, pourquoi se casser la tête encore plus avec des 1.un_nombre_très_long_voire_trop_long_que_j'ai_la_flemme_d'écrire_donc_ne_m'en_voulez_pas_, je propose de laisser ça à l'ordinateur, il se démerd* assez bien tout seul, pas besoin de notre aide... Nan mon ordi! Ne te vexe pas... Je vou... Enfin je voulais...Oh et puis mer... Oui d'accord je sors -> xD
Cordialement,
Softewarzatorman (et son ordi, j'ose plus le vexer )
fandeonepiece2 a écrit:bonjour,
je vous annonce que j’arrête le projet Droid car je trouve les possibilités du VB.NET (et donc celles de SoftwareZator) très limités par rapport au C que je commence a apprendre.
Je ferais peut être une version 3.0 avec SoftwareZator 2014 juste pour corriger les deux trois bug restant et faire propre avant d'abandonner le projet définitivement.
Je pense être arrivé au bout des possibilités et fonctions que je peux faire pour Droid.
J'avais commencé de créer Droid pour apprendre a me servir de SoftwareZator et donc apprendre a programmer, mais vu que maintenant je ne peut plus rien apprendre en matière de programmation avec Droid ou SoftwareZator, j’arrête donc d'utiliser SZ.
Je continuerais par contre à venir régulièrement sur ce forum et à aider les débutant qui ont besoin d'aide.
cordialement
|
|