<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Mon, 11 Aug 2008 01:40:52 +0100
From   : jgh@... (Jonathan Graham Harston)
Subject: Master 128 century correction

"Raf" wrote:
> P.S. I would appreciate any assistance or suggestions
>  for improvements.
 
1: There is almost never any reason why a *command should prompt
the user to enter parameters. They should be read from the command
line itself. Otherwise, how can you use them programatically?
Consider the following program:
 
DEFPROCsetcentury(C$)
OSCLI "CENTURY "+C$
ENDPROC
 
It won't work. You end up with abominations like:
 
DEFPROCsetcentury(C$)
PRINT "When prompted, press ";LEFT$(C$,1);" then ";RIGHT$(C$,1)
OSCLI "CENTURY"
ENDPROC
 
Not only is it more programatically cleaner, but it's easier to do:
 
LDA #1:LDY #0:LDX #zp:JSR OSARGS  :\ Get address of command line
 
\ Command line is at (zp),Y, increment Y to step through line
\ eg, the following echos the line
.echo
LDA (zp),Y:JSR OSASCI
INY:CMP #13:BNE echo
RTS
 
2: You don't need to read the RTC hardware manually yourself, when
there is code already existing in the machine to do it for you.
Rather than intercept OSWORD 14 and do everything, pass the call on
the the MOS, and modify the returned data if it needs modifying,
something like:
 
.newosword
CMP #14:BNE newosword14
.oldosword
JMP (oldword)
.newosword14
STX &F0:STY &F1
LDY #0:LDA (&F0),Y:PHA :\ Save subcall number
LDY &F1:JSR oldosword
PLA:CMP #0:BNE newoswordexit
LDY #11:LDA #ASC"2":STA (&F0),Y :\ Overwrite century
INY:LDA #ASC"0":STA (&F0),Y
.newoswordexit
LDX &F0:LDY &F1:LDA #14
RTS
 
Also, with you code, reading the real time clock *displays* *it*
*to* *screen*!!!!!! Try doing T$=TIME$. It displays the time!!!!
 
-- 
J.G.Harston - jgh@...                - mdfs.net/User/JGH
**** DO NOT EMPLOY MARREN BUILDERS/ROOFERS, SHEFFIELD ****
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>