home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OS9_6X09
/
SYSMODS
/
RTC_Disto_RGB_Utils.lzh
/
setclk.a
< prev
next >
Wrap
Text File
|
1989-03-13
|
4KB
|
157 lines
nam SetClk
ttl RGB Computer Systems Clock Set Program
* Sets RGB or DISTO Real Time Clock Chip
* Copyright (C) 1989 by RGB Computer Systems
ifp1
use /dd/DEFS/DefsFile
endc
ClkType equ 0 0=RGB, 1=DISTO <--Change this for your clock type
ifeq ClkType
* RGB RTClock register equates
RtcWrite equ $ff75 write clock data
RtcRead equ $ff76 read clock data
RtcCtrl equ $ff77 write register select
else
* DISTO RTClock register equates
RtcWrite equ $ff50 write clock data
RtcRead equ $ff50 read clock data
RtcCtrl equ $ff51 write register select
endc
Mod Size,Name,Prgrm+Objct,ReEnt+1,Entry,Stack
InBuf rmb 20 Line input buffer
OutBuf rmb 16 Clock set buffer
rmb 200+240 stack & parameter space
Stack equ .
Name fcs /SetClk/
fcb 1 edition byte
Entry lda ,x+ get a possible parameter
cmpa #13 end of line?
beq Setup yes, go set clock
cmpa #'- optional dash?
beq Entry yes, allow it
cmpa #'? help needed?
bne Setup no, ignore & continue
lda #2 error path
leax HelpMsg,pcr help message
ldy #HelpSize byte count
OS9 I$Write send out data
lbcs Exit exit if error
lbra OK no error
Setup leax P1,pcr point to prompt
ldd #('C*256)+'R comparison bytes
cmpa ,x+ was it hacked?
lbne Error yes, exit
leax P2,pcr point to prompt
cmpb ,x+ was it hacked?
lbne Error yes, exit
lda #1 std out
leax Prompt,pcr point to prompt
ldy #PSize size of text
OS9 I$Write write it out
bcs Exit exit if error
* Erase the existing buffer
ldb #16 erasing 16 bytes
leax OutBuf,u point to buffer
ClrBuf clr ,x+ erase it
decb count down
bne ClrBuf go again
* Now we get operator input
clra std input
leax InBuf,u input buffer
ldy #20 allow 20 characters max
OS9 I$ReadLn get input line
bcs Exit exit if error
leay -1,y no entry?
beq Exit nope, just leave
* Setup control register defaults first
ldb #3 setting up last 3
leax DefData,pcr point to default register data
leay OutBuf,u point to output buffer
SetDef lda ,x+ get a byte
sta ,y+ put a byte into output buffer
decb count down
bne SetDef go again
* Now parse info from line input buffer
ldb #13 going to move 13 bytes
leax InBuf,u point to input buffer
Loop lda ,x+ get a byte
cmpa #13 c/r?
beq Done yes, write out info
cmpa #32 space?
beq Loop yes, skip it
cmpa #': colon used?
beq Loop yes, skip it
cmpa #'/ slash used?
beq Loop yes, skip it
cmpa #'. dot used?
beq Loop yes, skip it
cmpa #', comma used?
beq Loop yes, skip it
cmpa #'0 legal?
blo Error no
cmpa #'9 legal?
bhi Error no
sta ,y+ put parsed character in buffer
decb count down
bne Loop go again
Done ldb #$0f last register number
leax OutBuf,u point to data
Loop2 stb RtcCtrl select register
lda ,x+ get RTC info
anda #$0f convert to BCD
sta RtcWrite set clock
decb count down
bpl Loop2 go if more
* "Rest" bit is set, now select 24 hr. mode
lda #$0f last register
sta RtcCtrl select control register
lda #%00000101 24 hr. plus rest
sta RtcWrite write it in
anda #%00000100 mask off "rest" bit
sta RtcWrite write it in (locks clock mode)
OK clrb no errors
Exit OS9 F$Exit leave
Error comb set carry
ldb #E$IllArg illegal argument error
bra Exit exit with error
Prompt fcb $0a,$0d
P1 fcc "Copyright (c) 1989"
fcb $0a,$0d
P2 fcc "RGB Computer Systems"
fcb $0a,$0d,$0a,$0d
fcc " w yy/mm/dd hh:mm:ss"
fcb $0a,$0d
fcc "Time ? "
PSize equ *-Prompt
HelpMsg fcb $07,$0a,$0d
fcc /Syntax: SETCLK [-?]/
fcb $0a,$0d
ifeq ClkType
fcc /Usage : Use to set the RGB Real Time Clock/
else
fcc /Usage : Use to set the DISTO Real Time Clock/
endc
fcb $0a,$0d,$0a,$0d
fcc / Please enter data in the following format:/
fcb $0a,$0d,$0a,$0d
fcc / W = Day of the Week (Sunday=0)/
fcb $0a,$0d
fcc / YY = Year, last 2 digits/
fcb $0a,$0d
fcc / MM = Month (January=01)/
fcb $0a,$0d
fcc / DD = Day (First day=01)/
fcb $0a,$0d
fcc / HH = Hour (Midnight=00)/
fcb $0a,$0d
fcc / MM = Minutes (First=00)/
fcb $0a,$0d
fcc / SS = Seconds (First=00)/
fcb $0a,$0d
HelpSize equ *-HelpMsg
DefData fcb %00000001 set "rest" bit (reg $0f)
fcb %00000100 1 second period (reg $0e)
fcb %00000000 no hold or irq (reg $0d)
emod
Size equ *
end