Thread View: comp.sources.apple2
1 messages
1 total messages
Started by Jonathan A. Chandross
Fri, 31 May 1991 15:34
v001SRC049: time -- Print Current Time
Author: Jonathan A. Chandross
Date: Fri, 31 May 1991 15:34
Date: Fri, 31 May 1991 15:34
185 lines
4383 bytes
4383 bytes
Submitted-by: Andy Werner (st6934@siucvmb.bitnet)
Posting-number: Volume 1, Source:49
Archive-name: util/hyperc/time/time
Architecture: ANY_2
Version-number: 1.00
Print out the time under HyperC. No-frills, shows how to use
ProDOS MLI calls under HyperC.
Enjoy.
=Read.Me
-
-time
-Version 1.00
-
-Time Utility for HyperC
-This is freeware. It's also a learning tool to see how HyperC works.
-The included files are :
-
-cclib : Script file to compile unlinked C files
-time.c : C source for time utility
-getime.a : Assembly source for ProDOS MLI time call
-date.a : Assembly source to unpack date after calling ProDOS MLI time
-mk : pseudo-make script to link compiled but unlinked files
-
-Use cclib to compile time.c and use asm65 to compile the assembler files.
-
-For example, to compile getime.a, type :
-
-asm65 -o time.o time.a
-
-Use mk to link all the files ending with .o. Type mk.
-
-Examine the script files to see if they point to the correct subdirectories.
-Adjust them to suit your setup. You can compile time.c down to native code
-(or emulated for you IIgs people...) by editing ccn and deleting the lnk
-phase at the end of that script and renaming the edited file ccnlib for ex-
-ample. I have not tried this at this time but I assume it will work.
-
-The time file as it stands can be placed in your bin subdirectory. When you
-type time at the keyboard, the program will respond by displaying the time
-and date. This program assumes you have a clock-calendar attached to your
-system. This program attempts to mimic the time() function of UNIX and ANSI C.
-As I'm not on a UNIX site I'd like to get feedback from those of you who are.
-I'm also interested in writing an asctime() function and mimicing clk_tck.
-
-You can send your comments to me at:
-
- Andy Werner
- st6934@siucvmb.bitnet
- March 18, 1991.
-
-ProDOS is a trademark of Apple Computer, Inc.
-UNIX is a trademark(?) of A.T.T.
-HyperC is a trademark of the WSM Group, Inc.
-
=Manifest
-
-Read.Me
-cclib
-date.a
-getime.a
-mk
-time.c
-
=cclib
-;
-; batch file for compiling C programs...
-; NOTE: Do NOT specify the ".c" ending the source filename!
-;
-/csys/bin/ppf -i |/csys/hdrs/ -o $1.p $1.c
-/csys/bin/hyperc -o $1.s $1.p
-rm $1.p
-/csys/bin/asmcp -o $1.o $1.s
-
-
-
=date.a
-;
-; unpack date
-; by Andy Werner
-; march 12,1991
-;
-
-.entry _unpack_date
- _unpack_date:
- lda 0xbf90
- and #0x1f ; mask : 0001 1111
- sta _day
- lda 0xbf91
- lsr a
- sta _year
- lda 0xbf90
- and #0xe0 ; mask : 1110 0000
- lsr a
- lsr a
- lsr a
- lsr a
- lsr a
- sta _month
- lda 0xbf91
- and #0xfe ; mask : 1111 1110
- asl a
- asl a
- asl a
- clc
- adc #_month
- sta _month
- rts
-
- .data
- .entry _year
-_year:
- .byte 00
-
- .entry _month
-_month:
- .byte 00
-
- .entry _day
-_day:
- .byte 00
-
=getime.a
-
-; time.a
-; prodos mli call to set the time
-;
-prodos = 0xbf00
-time = 0x82
-
-.entry _get_time
-
-_get_time:
-
- jsr prodos
- .byte time
- .word 0000
- rts
-
-
-
-
=mk
-;
-; Script file to make time utility.
-; examine the script to make sure that your utilities and libraries
-; can be found by this script. Adjust accordingly.
-;
-/csys/bin/lnk -l |/csys/libs/ -a -o time &s.o time.o getime.o date.o &libc
-
=time.c
-
-/* time.cc
- * call prodos time
- * use anchored variables to print time
- * this is a test
- */
-
-#include <std.h>
-
-EXTERN VOID get_time();
-EXTERN VOID pack_date();
-
-EXTERN CHAR year;
-EXTERN CHAR month;
-EXTERN CHAR day;
-
-CHAR hour @0xbf93;
-CHAR minute @0xbf92;
-
-VOID main()
-
-{
-
- get_time();
- printf("The time is %02d:%02d\n",hour,minute);
- unpack_date();
- printf("The date is %02d/%02d/%02d\n",month, day, year);
- exit();
-
-}
+ END OF ARCHIVE
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads