home *** CD-ROM | disk | FTP | other *** search
- Better Setter
- (PC Magazine Vol 6 No 3 Feb 10, 1987 User-to-User)
-
- SETCLOCK.COM reads the current time and date from DOS and uses
- these values to update the IBM AT's clock. This works with the AT
- only! To use it, set the time with the DOS TIME command, and then
- just type SETCLOCK to make it stick.
- Assemble SETCLOCK.COM from SETCLOCK.ASM, run the SETCLOCK.BAS
- program, or redirect SETCLOCK.SCR into DEBUG's mini-assembler with
- the command:
-
- DEBUG < SETCLOCK.SCR
-
- ; SETCLOCK.ASM
- .286c
- convert macro arg1
- xchg arg1,ax
- call bcdcnv
- xchg arg1,ax
- endm
- cseg segment para public 'code'
- assume cs:cseg
- org 100h
- start proc far
- mov ax,0FFFFh
- mov ds,ax
- cmp byte ptr [ds:0Eh]
- jne error
- mov ah,2Ah
- int 21h
- xchg cx,ax
- mov bl,100
- div bl
- xchg ah,al
- xchg cx,ax
- convert cx
- convert dx
- mov ah,5
- int 1Ah
- mov ah,2Ch
- int 21h
- convert cx
- mov dl,0
- convert dx
- mov ah,3
- int 1Ah
- mov al,0
- exit: mov ah,4Ch
- int 21h
- error: mov dx,offset msg
- mov ah,9
- int 21h
- mov al,1
- jmp exit
- start endp
- bcdcnv proc near
- mov bl,ah
- aam
- shl ah,4
- or al,ah
- xchg al,bl
- aam
- shl ah,4
- or ah,al
- mov al,bl
- ret
- bcdcnv endp
- msg db 'CPU is not an AT$'
- cseg ends
- end start
-
-
- 100 'SETCLOCK.BAS
- 110 CLS:PRINT "Checking DATA ...."
- 120 FOR B=1 TO 7:FOR C=1 TO 17:READ A$:IF C<17 THEN 140
- 130 Z#=Z#+VAL(A$)
- 140 NEXT:NEXT
- 150 IF Z#=13508 THEN RESTORE:GOTO 180
- 160 PRINT "Error. Check the last number in"
- 170 PRINT "each DATA statement; then redo.":END
- 180 FOR B=1 TO 7:FOR C=1 TO 16:READ A$:TTL=TTL+VAL("&H"+A$)
- 190 NEXT
- 200 READ S:IF S=TTL THEN 220
- 210 PRINT "DATA error in line";B*10+260:END
- 220 TTL=0:NEXT:RESTORE
- 230 OPEN "SETCLOCK.COM" AS #1 LEN=1:FIELD #1,1 AS D$
- 240 FOR B=1 TO 7:FOR C=1 TO 16:READ A$
- 250 LSET D$=CHR$(VAL("&H"+A$)):PUT #1:NEXT:READ DUMMY$:NEXT
- 260 LSET D$=CHR$(36):PUT #1:CLOSE:PRINT "SETCLOCK.COM created."
- 270 DATA B8,FF,FF,8E,D8,80,3E,0E,00,FC,75,34,B4,2A,CD,21,2137
- 280 DATA 91,B3,64,F6,F3,86,E0,91,91,E8,2F,00,91,92,E8,2A,2405
- 290 DATA 00,92,B4,05,CD,1A,B4,2C,CD,21,91,E8,1D,00,91,B2,1753
- 300 DATA 00,92,E8,16,00,92,B4,03,CD,1A,B0,00,B4,4C,CD,21,1630
- 310 DATA BA,60,01,B4,09,CD,21,B0,01,EB,F1,8A,DC,D4,0A,C0,2135
- 320 DATA E4,04,0A,C4,86,C3,D4,0A,C0,E4,04,0A,E0,8A,C3,C3,2175
- 330 DATA 43,50,55,20,69,73,20,6E,6F,74,20,61,6E,20,41,54,1273
-
-
- SETCLOCK.SCR:
-
- E 100 B8,FF,FF,8E,D8,80,3E,0E,00,FC,75,34,B4,2A,CD,21
- E 110 91,B3,64,F6,F3,86,E0,91,91,E8,2F,00,91,92,E8,2A
- E 120 00,92,B4,05,CD,1A,B4,2C,CD,21,91,E8,1D,00,91,B2
- E 130 00,92,E8,16,00,92,B4,03,CD,1A,B0,00,B4,4C,CD,21
- E 140 BA,60,01,B4,09,CD,21,B0,01,EB,F1,8A,DC,D4,0A,C0
- E 150 E4,04,0A,C4,86,C3,D4,0A,C0,E4,04,0A,E0,8A,C3,C3
- E 160 "CPU is not an AT$"
- RCX
- 71
- N SETCLOCK.COM
- W
- Q
-