Too many to remember.

This commit is contained in:
Bill Chatfield 2015-10-09 11:26:41 -04:00
parent 6648236fb6
commit 9a2b9e747c
31 changed files with 1688 additions and 1045 deletions

871
.map Normal file
View File

@ -0,0 +1,871 @@
Modules list:
-------------
alarmclock.o:
CODE Offs=000000 Size=0001B9 Align=00001 Fill=0000
RODATA Offs=000000 Size=000038 Align=00001 Fill=0000
BSS Offs=000000 Size=00000A Align=00001 Fill=0000
thclock.o:
CODE Offs=0001B9 Size=0002F1 Align=00001 Fill=0000
RODATA Offs=000038 Size=000041 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(_file.o):
DATA Offs=000000 Size=00001E Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(_hextab.o):
RODATA Offs=000079 Size=000010 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(_longminstr.o):
RODATA Offs=000089 Size=00000C Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(_oserror.o):
BSS Offs=00000A Size=000001 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(_printf.o):
CODE Offs=0004AA Size=0003A5 Align=00001 Fill=0000
BSS Offs=00000B Size=00002B Align=00001 Fill=0000
DATA Offs=00001E Size=000003 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(_scanf.o):
CODE Offs=00084F Size=000770 Align=00001 Fill=0000
RODATA Offs=000095 Size=000008 Align=00001 Fill=0000
BSS Offs=000036 Size=000042 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(_seterrno.o):
CODE Offs=000FBF Size=000009 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(addeqsp.o):
CODE Offs=000FC8 Size=000011 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(addysp.o):
CODE Offs=000FD9 Size=00000E Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(along.o):
CODE Offs=000FE7 Size=000012 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(axlong.o):
CODE Offs=000FF9 Size=000012 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(callmain.o):
CODE Offs=00100B Size=000017 Align=00001 Fill=0000
BSS Offs=000078 Size=000004 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(cgetc.o):
CODE Offs=001022 Size=000012 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(clrscr.o):
/home/bill/opt/cc65/lib/apple2enh.lib(compl.o):
CODE Offs=001034 Size=000009 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(condes.o):
CODE Offs=00103D Size=00000C Align=00001 Fill=0000
DATA Offs=000021 Size=000025 Align=00001 Fill=0000
INIT Offs=000000 Size=00000C Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(cout.o):
LOWCODE Offs=000000 Size=00000A Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(crt0.o):
CODE Offs=001049 Size=000012 Align=00001 Fill=0000
RODATA Offs=00009D Size=000007 Align=00001 Fill=0000
BSS Offs=00007C Size=000003 Align=00001 Fill=0000
DATA Offs=000046 Size=000003 Align=00001 Fill=0000
STARTUP Offs=000000 Size=00006A Align=00001 Fill=0000
INIT Offs=00000C Size=00004E Align=00001 Fill=0000
ZPSAVE Offs=000000 Size=00001A Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(ctype.o):
RODATA Offs=0000A4 Size=000100 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(decaxy.o):
CODE Offs=00105B Size=000009 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(decsp1.o):
CODE Offs=001064 Size=000009 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(decsp3.o):
CODE Offs=00106D Size=00000D Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(decsp4.o):
CODE Offs=00107A Size=00000D Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(decsp6.o):
CODE Offs=001087 Size=00000D Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(dosdetect.o):
BSS Offs=00007F Size=000001 Align=00001 Fill=0000
INIT Offs=00005A Size=000014 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(errno.o):
CODE Offs=001094 Size=000018 Align=00001 Fill=0000
BSS Offs=000080 Size=000002 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(exehdr.o):
EXEHDR Offs=000000 Size=000004 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(fgetc.o):
CODE Offs=0010AC Size=000084 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(filedes.o):
CODE Offs=001130 Size=000016 Align=00001 Fill=0000
DATA Offs=000049 Size=000020 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(fmisc.o):
CODE Offs=001146 Size=000044 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(fwrite.o):
CODE Offs=00118A Size=00007B Align=00001 Fill=0000
BSS Offs=000082 Size=000002 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(home.o):
LOWCODE Offs=00000A Size=00000A Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(icmp.o):
CODE Offs=001205 Size=00002E Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(incsp1.o):
CODE Offs=001233 Size=000007 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(incsp2.o):
CODE Offs=00123A Size=000015 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(incsp3.o):
CODE Offs=00124F Size=000005 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(incsp4.o):
CODE Offs=001254 Size=000005 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(incsp5.o):
CODE Offs=001259 Size=000005 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(incsp6.o):
CODE Offs=00125E Size=000005 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(incsp8.o):
CODE Offs=001263 Size=000005 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(isdigit.o):
CODE Offs=001268 Size=00000F Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(isspace.o):
CODE Offs=001277 Size=00000F Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(isxdigit.o):
CODE Offs=001286 Size=00000F Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(jmpvec.o):
DATA Offs=000069 Size=000003 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(kbhit.o):
CODE Offs=001295 Size=000009 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(ladd.o):
CODE Offs=00129E Size=000024 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(ldaxi.o):
CODE Offs=0012C2 Size=00000D Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(ldaxsp.o):
CODE Offs=0012CF Size=000009 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(leaaxsp.o):
CODE Offs=0012D8 Size=00000C Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(lmul.o):
CODE Offs=0012E4 Size=00005C Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(lneg.o):
CODE Offs=001340 Size=00001E Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(longjmp.o):
CODE Offs=00135E Size=000030 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(lpush.o):
CODE Offs=00138E Size=000021 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(ltoa.o):
CODE Offs=0013AF Size=0000AF Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(makebool.o):
CODE Offs=00145E Size=000031 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(mli.o):
BSS Offs=000084 Size=000012 Align=00001 Fill=0000
DATA Offs=00006C Size=000016 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(mul.o):
CODE Offs=00148F Size=000045 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(mul8.o):
CODE Offs=0014D4 Size=00003A Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(mulax10.o):
CODE Offs=00150E Size=000019 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(oserror.o):
CODE Offs=001527 Size=000016 Align=00001 Fill=0000
RODATA Offs=0001A4 Size=000030 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(popsreg.o):
CODE Offs=00153D Size=00000F Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(printf.o):
CODE Offs=00154C Size=000033 Align=00001 Fill=0000
BSS Offs=000096 Size=000001 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(push1.o):
CODE Offs=00157F Size=000005 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(pusha.o):
CODE Offs=001584 Size=000016 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(pushax.o):
CODE Offs=00159A Size=00001A Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(pushwsp.o):
CODE Offs=0015B4 Size=00001C Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(puts.o):
CODE Offs=0015D0 Size=000065 Align=00001 Fill=0000
DATA Offs=000082 Size=000001 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(rdkey.o):
LOWCODE Offs=000014 Size=00000A Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(read.o):
CODE Offs=001635 Size=00005A Align=00001 Fill=0000
INIT Offs=00006E Size=000005 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(regswap2.o):
CODE Offs=00168F Size=000016 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(return0.o):
CODE Offs=0016A5 Size=000004 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(rwcommon.o):
CODE Offs=0016A9 Size=000041 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(scanf.o):
CODE Offs=0016EA Size=000033 Align=00001 Fill=0000
BSS Offs=000097 Size=000001 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(setjmp.o):
CODE Offs=00171D Size=000026 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(staspidx.o):
CODE Offs=001743 Size=000016 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(staxsp.o):
CODE Offs=001759 Size=00000B Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(strlen.o):
CODE Offs=001764 Size=000016 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(strlower.o):
CODE Offs=00177A Size=000028 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(sub.o):
CODE Offs=0017A2 Size=000014 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(tolower.o):
CODE Offs=0017B6 Size=000010 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(toupper.o):
CODE Offs=0017C6 Size=000010 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(udiv.o):
CODE Offs=0017D6 Size=00004F Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(umod.o):
CODE Offs=001825 Size=000011 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(ungetc.o):
CODE Offs=001836 Size=00002E Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(vfprintf.o):
CODE Offs=001864 Size=000060 Align=00001 Fill=0000
DATA Offs=000083 Size=000008 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(vfscanf.o):
CODE Offs=0018C4 Size=000033 Align=00001 Fill=0000
DATA Offs=00008B Size=000006 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(write.o):
CODE Offs=0018F7 Size=00006A Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(zerobss.o):
INIT Offs=000073 Size=000023 Align=00001 Fill=0000
/home/bill/opt/cc65/lib/apple2enh.lib(zeropage.o):
ZEROPAGE Offs=000000 Size=00001A Align=00001 Fill=0000
Segment list:
-------------
Name Start End Size Align
----------------------------------------------------
EXEHDR 000000 000003 000004 00001
ZEROPAGE 000080 000099 00001A 00001
STARTUP 000803 00086C 00006A 00001
LOWCODE 00086D 00088A 00001E 00001
CODE 00088B 0021EB 001961 00001
RODATA 0021EC 0023BF 0001D4 00001
DATA 0023C0 002450 000091 00001
ZPSAVE 002451 00246A 00001A 00001
BSS 00246B 002502 000098 00001
INIT 002503 00259C 00009A 00001
Exports list by name:
---------------------
COUT 00086D RLA HOME 000877 RLA
RDKEY 000881 RLA __BSS_RUN__ 00246B RLA
__BSS_SIZE__ 000098 REA __CONSTRUCTOR_COUNT__ 000002 REA
__CONSTRUCTOR_TABLE__ 002599 RLA __DESTRUCTOR_COUNT__ 000000 REA
__DESTRUCTOR_TABLE__ 0023C0 RLA __EXEHDR__ 000001 REA
__HIMEM__ 009600 REA __INIT_RUN__ 002503 RLA
__INIT_SIZE__ 00009A REA __LCADDR__ 00D400 REA
__LCSIZE__ 000C00 REA __LC_LAST__ 00D400 RLA
__LC_START__ 00D400 RLA __LOADADDR__ 000803 REA
__LOADSIZE__ 001CE8 REA __MOVE_LAST__ 00009A RLA
__MOVE_START__ 000000 RLA __STACKSIZE__ 000800 REA
__STARTUP_RUN__ 000803 RLA __STARTUP__ 000001 REA
__ZPSAVE_RUN__ 002451 RLA __ctype 002290 RLA
__directerrno 00191F RLA __dos_type 0024EA RLA
__errno 0024EB RLA __hextab 002265 RLA
__longminstr 002275 RLA __mappederrno 001927 RLA
__oserror 002475 RLA __osmaperrno 001DB2 RLA
__printf 000E28 RLA __scanf 0010DA RLA
__seterrno 00184A RLA __setjmp 001FA8 RLA
_add_one_second 000AF4 RLA _cgetc 0018AD RLA
_clrscr 000877 RLA _ferror 0019F4 RLA
_fgetc 001937 RLA _fwrite 001A15 RLA
_isdigit 001AF3 RLA _isspace 001B02 RLA
_isxdigit 001B11 RLA _kbhit 001B20 RLA
_longjmp 001BE9 RLA _ltoa 001C56 RLA
_main 000A1C RLA _print_time 000CB4 RLA
_printf 001DD7 RLA _puts 001E5B RLA
_read 001EC0 RLA _read_interactively 000A44 RLA
_reprint_time 000D04 RLA _scanf 001F75 RLA
_stdin 0023D8 RLA _stdout 0023DA RLA
_strlen 001FEF RLA _strlower 002005 RLA
_tolower 002041 RLA _toupper 002051 RLA
_ultoa 001CAD RLA _ungetc 0020C1 RLA
_vfprintf 002126 RLA _vfscanf 00214F RLA
_write 002182 RLA addeqysp 001855 RLA
addysp 001865 RLA addysp1 001864 RLA
aulong 001872 RLA axlong 00188B RLA
axulong 001884 RLA booleq 001CEF RLA
callmain 001896 RLA callmli 00242C RLA
complax 0018BF RLA decaxy 0018E6 RLA
decsp1 0018EF RLA decsp3 0018F8 RLA
decsp4 001905 RLA decsp6 001912 RLA
donelib 0018C8 RLA fdtab 002409 RLA
getfd 0019BB RLA incsp1 001ABE RLA
incsp2 001ACC RLA incsp3 001ADA RLA
incsp4 001ADF RLA incsp5 001AE4 RLA
incsp6 001AE9 RLA incsp8 001AEE RLA
initdostype 00255D LAI initlib 002503 RLA
initprompt 002571 LAI jmpvec 002429 RLA
ldax0sp 001B5A RLA ldaxi 001B4D RLA
ldaxidx 001B4F RLA ldaxysp 001B5C RLA
leaa0sp 001B63 RLA mliparam 0024EF RLA
mul8x16 001D61 RLA mul8x16a 001D6C RLA
mulax10 001D99 RLA negeax 001BCB RLA
popax 001AC5 RLA popsreg 001DC8 RLA
ptr1 000088 RLZ ptr2 00008A RLZ
ptr3 00008C RLZ ptr4 00008E RLZ
push1 001E0A RLA pusha 001E13 RLA
pusha0 001E27 RLA pushax 001E29 RLA
pusheax 001C22 RLA pushwysp 001E41 RLA
regbank 000094 RLZ regsave 000084 RLZ
regswap2 001F1A RLA return0 001F30 RLA
rwcommon 001F45 RLA rwepilog 001F68 RLA
rwprolog 001F34 RLA sp 000080 RLZ
sreg 000082 RLZ staspidx 001FCE RLA
stax0sp 001FE4 RLA staxysp 001FE6 RLA
tmp1 000090 RLZ tmp2 000091 RLZ
tmp3 000092 RLZ tmp4 000093 RLZ
tosaddeax 001B2F RLA tosicmp0 001A90 RLA
tosmuleax 001B75 RLA tossuba0 00202D RLA
tosudiva0 002061 RLA tosudivax 002063 RLA
tosumoda0 0020B0 RLA tosumulax 001D1A RLA
udiv16 002072 RLA zerobss 002576 RLA
Exports list by value:
----------------------
__DESTRUCTOR_COUNT__ 000000 REA __MOVE_START__ 000000 RLA
__EXEHDR__ 000001 REA __STARTUP__ 000001 REA
__CONSTRUCTOR_COUNT__ 000002 REA sp 000080 RLZ
sreg 000082 RLZ regsave 000084 RLZ
ptr1 000088 RLZ ptr2 00008A RLZ
ptr3 00008C RLZ ptr4 00008E RLZ
tmp1 000090 RLZ tmp2 000091 RLZ
tmp3 000092 RLZ tmp4 000093 RLZ
regbank 000094 RLZ __BSS_SIZE__ 000098 REA
__INIT_SIZE__ 00009A REA __MOVE_LAST__ 00009A RLA
__STACKSIZE__ 000800 REA __LOADADDR__ 000803 REA
__STARTUP_RUN__ 000803 RLA COUT 00086D RLA
HOME 000877 RLA _clrscr 000877 RLA
RDKEY 000881 RLA _main 000A1C RLA
_read_interactively 000A44 RLA _add_one_second 000AF4 RLA
__LCSIZE__ 000C00 REA _print_time 000CB4 RLA
_reprint_time 000D04 RLA __printf 000E28 RLA
__scanf 0010DA RLA __seterrno 00184A RLA
addeqysp 001855 RLA addysp1 001864 RLA
addysp 001865 RLA aulong 001872 RLA
axulong 001884 RLA axlong 00188B RLA
callmain 001896 RLA _cgetc 0018AD RLA
complax 0018BF RLA donelib 0018C8 RLA
decaxy 0018E6 RLA decsp1 0018EF RLA
decsp3 0018F8 RLA decsp4 001905 RLA
decsp6 001912 RLA __directerrno 00191F RLA
__mappederrno 001927 RLA _fgetc 001937 RLA
getfd 0019BB RLA _ferror 0019F4 RLA
_fwrite 001A15 RLA tosicmp0 001A90 RLA
incsp1 001ABE RLA popax 001AC5 RLA
incsp2 001ACC RLA incsp3 001ADA RLA
incsp4 001ADF RLA incsp5 001AE4 RLA
incsp6 001AE9 RLA incsp8 001AEE RLA
_isdigit 001AF3 RLA _isspace 001B02 RLA
_isxdigit 001B11 RLA _kbhit 001B20 RLA
tosaddeax 001B2F RLA ldaxi 001B4D RLA
ldaxidx 001B4F RLA ldax0sp 001B5A RLA
ldaxysp 001B5C RLA leaa0sp 001B63 RLA
tosmuleax 001B75 RLA negeax 001BCB RLA
_longjmp 001BE9 RLA pusheax 001C22 RLA
_ltoa 001C56 RLA _ultoa 001CAD RLA
__LOADSIZE__ 001CE8 REA booleq 001CEF RLA
tosumulax 001D1A RLA mul8x16 001D61 RLA
mul8x16a 001D6C RLA mulax10 001D99 RLA
__osmaperrno 001DB2 RLA popsreg 001DC8 RLA
_printf 001DD7 RLA push1 001E0A RLA
pusha 001E13 RLA pusha0 001E27 RLA
pushax 001E29 RLA pushwysp 001E41 RLA
_puts 001E5B RLA _read 001EC0 RLA
regswap2 001F1A RLA return0 001F30 RLA
rwprolog 001F34 RLA rwcommon 001F45 RLA
rwepilog 001F68 RLA _scanf 001F75 RLA
__setjmp 001FA8 RLA staspidx 001FCE RLA
stax0sp 001FE4 RLA staxysp 001FE6 RLA
_strlen 001FEF RLA _strlower 002005 RLA
tossuba0 00202D RLA _tolower 002041 RLA
_toupper 002051 RLA tosudiva0 002061 RLA
tosudivax 002063 RLA udiv16 002072 RLA
tosumoda0 0020B0 RLA _ungetc 0020C1 RLA
_vfprintf 002126 RLA _vfscanf 00214F RLA
_write 002182 RLA __hextab 002265 RLA
__longminstr 002275 RLA __ctype 002290 RLA
__DESTRUCTOR_TABLE__ 0023C0 RLA _stdin 0023D8 RLA
_stdout 0023DA RLA fdtab 002409 RLA
jmpvec 002429 RLA callmli 00242C RLA
__ZPSAVE_RUN__ 002451 RLA __BSS_RUN__ 00246B RLA
__oserror 002475 RLA __dos_type 0024EA RLA
__errno 0024EB RLA mliparam 0024EF RLA
__INIT_RUN__ 002503 RLA initlib 002503 RLA
initdostype 00255D LAI initprompt 002571 LAI
zerobss 002576 RLA __CONSTRUCTOR_TABLE__ 002599 RLA
__HIMEM__ 009600 REA __LCADDR__ 00D400 REA
__LC_LAST__ 00D400 RLA __LC_START__ 00D400 RLA
Imports list:
-------------
COUT (cout.o):
read.o apple2/read.s(10)
write.o apple2/write.s(9)
HOME (home.o):
clrscr.o apple2/clrscr.s(8)
RDKEY (rdkey.o):
read.o apple2/read.s(10)
__BSS_RUN__ ([linker generated]):
zerobss.o common/zerobss.s(8)
__BSS_SIZE__ ([linker generated]):
zerobss.o common/zerobss.s(8)
__CONSTRUCTOR_COUNT__ ([linker generated]):
condes.o runtime/condes.s(18)
__CONSTRUCTOR_TABLE__ ([linker generated]):
condes.o runtime/condes.s(18)
__DESTRUCTOR_COUNT__ ([linker generated]):
condes.o runtime/condes.s(19)
__DESTRUCTOR_TABLE__ ([linker generated]):
condes.o runtime/condes.s(19)
__EXEHDR__ (exehdr.o):
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(7)
__HIMEM__ ([linker generated]):
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(19)
__INIT_RUN__ ([linker generated]):
crt0.o apple2/crt0.s(13)
__INIT_SIZE__ ([linker generated]):
crt0.o apple2/crt0.s(13)
__LCADDR__ ([linker generated]):
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(21)
__LCSIZE__ ([linker generated]):
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(21)
__LC_LAST__ ([linker generated]):
crt0.o apple2/crt0.s(12)
__LC_START__ ([linker generated]):
crt0.o apple2/crt0.s(12)
__LOADADDR__ ([linker generated]):
exehdr.o apple2/exehdr.s(9)
__LOADSIZE__ ([linker generated]):
exehdr.o apple2/exehdr.s(9)
__MOVE_LAST__ ([linker generated]):
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(14)
__MOVE_START__ ([linker generated]):
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(14)
__STACKSIZE__ ([linker generated]):
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(19)
__STARTUP_RUN__ ([linker generated]):
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(13)
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(12)
__STARTUP__ (crt0.o):
alarmclock.o alarmclock.s(13)
__ZPSAVE_RUN__ ([linker generated]):
crt0.o apple2/crt0.s(14)
[linker generated] /home/bill/opt/cc65/cfg/apple2enh.cfg(13)
__ctype (ctype.o):
tolower.o common/tolower.s(8)
strlower.o common/strlower.s(13)
isxdigit.o /home/bill/opt/cc65/cc65/asminc/ctype.inc(9)
isspace.o /home/bill/opt/cc65/cc65/asminc/ctype.inc(9)
isdigit.o /home/bill/opt/cc65/cc65/asminc/ctype.inc(9)
toupper.o common/toupper.s(8)
__directerrno (errno.o):
read.o /home/bill/opt/cc65/cc65/asminc/errno.inc(10)
write.o /home/bill/opt/cc65/cc65/asminc/errno.inc(10)
__dos_type (dosdetect.o):
mli.o apple2/mli.s(7)
__errno (errno.o):
_seterrno.o /home/bill/opt/cc65/cc65/asminc/errno.inc(7)
__hextab (_hextab.o):
ltoa.o common/ltoa.s(10)
__longminstr (_longminstr.o):
ltoa.o common/ltoa.s(10)
__mappederrno (errno.o):
rwcommon.o /home/bill/opt/cc65/cc65/asminc/errno.inc(10)
write.o /home/bill/opt/cc65/cc65/asminc/errno.inc(10)
__oserror (_oserror.o):
rwcommon.o /home/bill/opt/cc65/cc65/asminc/errno.inc(7)
read.o /home/bill/opt/cc65/cc65/asminc/errno.inc(7)
errno.o /home/bill/opt/cc65/cc65/asminc/errno.inc(7)
__osmaperrno (oserror.o):
errno.o /home/bill/opt/cc65/cc65/asminc/errno.inc(8)
__printf (_printf.o):
vfprintf.o common/vfprintf.s(10)
__scanf (_scanf.o):
vfscanf.o common/_scanf.inc(17)
__seterrno (_seterrno.o):
ungetc.o /home/bill/opt/cc65/cc65/asminc/errno.inc(9)
fwrite.o /home/bill/opt/cc65/cc65/asminc/errno.inc(9)
fmisc.o /home/bill/opt/cc65/cc65/asminc/errno.inc(9)
errno.o /home/bill/opt/cc65/cc65/asminc/errno.inc(9)
_scanf.o ../libwrk/apple2enh/_scanf.s(16)
__setjmp (setjmp.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(14)
_add_one_second (thclock.o):
alarmclock.o alarmclock.s(21)
_cgetc (cgetc.o):
alarmclock.o alarmclock.s(19)
_clrscr (clrscr.o):
alarmclock.o alarmclock.s(17)
_ferror (fmisc.o):
vfscanf.o common/vfscanf.s(9)
_fgetc (fgetc.o):
vfscanf.o common/vfscanf.s(9)
_fwrite (fwrite.o):
vfprintf.o common/vfprintf.s(10)
_isdigit (isdigit.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(17)
_isspace (isspace.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(18)
_isxdigit (isxdigit.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(19)
_kbhit (kbhit.o):
alarmclock.o alarmclock.s(18)
_longjmp (longjmp.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(15)
_ltoa (ltoa.o):
_printf.o common/_printf.s(12)
_main (alarmclock.o):
callmain.o runtime/callmain.s(11)
_print_time (thclock.o):
alarmclock.o alarmclock.s(22)
_printf (printf.o):
thclock.o thclock.s(13)
alarmclock.o alarmclock.s(14)
_puts (puts.o):
alarmclock.o alarmclock.s(15)
_read (read.o):
fgetc.o ../libwrk/apple2enh/fgetc.s(14)
_read_interactively (thclock.o):
alarmclock.o alarmclock.s(20)
_reprint_time (thclock.o):
alarmclock.o alarmclock.s(23)
_scanf (scanf.o):
thclock.o thclock.s(14)
_stdin (_file.o):
scanf.o common/scanf.s(10)
_stdout (_file.o):
puts.o ../libwrk/apple2enh/puts.s(13)
printf.o common/printf.s(8)
_strlen (strlen.o):
_printf.o common/_printf.s(13)
puts.o ../libwrk/apple2enh/puts.s(15)
_strlower (strlower.o):
_printf.o common/_printf.s(13)
_tolower (tolower.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(20)
_toupper (toupper.o):
thclock.o thclock.s(15)
alarmclock.o alarmclock.s(16)
_ultoa (ltoa.o):
_printf.o common/_printf.s(12)
_ungetc (ungetc.o):
vfscanf.o common/vfscanf.s(9)
_vfprintf (vfprintf.o):
printf.o common/printf.s(8)
_vfscanf (vfscanf.o):
scanf.o common/scanf.s(10)
_write (write.o):
fwrite.o common/fwrite.s(10)
puts.o ../libwrk/apple2enh/puts.s(16)
addeqysp (addeqsp.o):
alarmclock.o alarmclock.s(432)
addysp (addysp.o):
incsp8.o runtime/incsp8.s(8)
incsp6.o runtime/incsp6.s(8)
incsp3.o runtime/incsp3.s(8)
fwrite.o common/fwrite.s(11)
scanf.o common/scanf.s(10)
printf.o common/printf.s(8)
incsp5.o runtime/incsp5.s(8)
incsp4.o runtime/incsp4.s(8)
thclock.o thclock.s(459)
addysp1 (addysp.o):
sub.o runtime/sub.s(8)
lmul.o runtime/lmul.s(8)
ladd.o runtime/ladd.s(8)
aulong (along.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
axlong (axlong.o):
_printf.o common/_printf.s(11)
axulong (axlong.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_printf.o common/_printf.s(11)
booleq (makebool.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
callmain (callmain.o):
crt0.o apple2/crt0.s(11)
callmli (mli.o):
rwcommon.o apple2/mli.inc(131)
write.o apple2/mli.inc(131)
complax (compl.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
decaxy (decaxy.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
decsp1 (decsp1.o):
fgetc.o ../libwrk/apple2enh/fgetc.s(94)
alarmclock.o alarmclock.s(432)
decsp3 (decsp3.o):
thclock.o thclock.s(459)
decsp4 (decsp4.o):
lpush.o runtime/lpush.s(11)
alarmclock.o alarmclock.s(432)
decsp6 (decsp6.o):
_printf.o common/_printf.s(11)
thclock.o thclock.s(459)
donelib (condes.o):
crt0.o apple2/crt0.s(10)
fdtab (filedes.o):
read.o apple2/filedes.inc(13)
write.o apple2/filedes.inc(13)
getfd (filedes.o):
rwcommon.o apple2/filedes.inc(14)
incsp1 (incsp1.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
alarmclock.o alarmclock.s(432)
incsp2 (incsp2.o):
popsreg.o runtime/popsreg.s(8)
staspidx.o runtime/staspidx.s(8)
puts.o ../libwrk/apple2enh/puts.s(78)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
incsp3 (incsp3.o):
fgetc.o ../libwrk/apple2enh/fgetc.s(94)
incsp4 (incsp4.o):
alarmclock.o alarmclock.s(432)
incsp5 (incsp5.o):
thclock.o thclock.s(459)
incsp6 (incsp6.o):
fwrite.o common/fwrite.s(11)
vfprintf.o common/vfprintf.s(9)
incsp8 (incsp8.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
initlib (condes.o):
crt0.o apple2/crt0.s(10)
jmpvec (jmpvec.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
ldax0sp (ldaxsp.o):
thclock.o thclock.s(459)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
ldaxi (ldaxi.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
ldaxidx (ldaxi.o):
thclock.o thclock.s(459)
thclock.o thclock.s(459)
ldaxysp (ldaxsp.o):
fwrite.o common/fwrite.s(11)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
puts.o ../libwrk/apple2enh/puts.s(78)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
alarmclock.o alarmclock.s(432)
leaa0sp (leaaxsp.o):
fgetc.o ../libwrk/apple2enh/fgetc.s(94)
thclock.o thclock.s(459)
mliparam (mli.o):
rwcommon.o apple2/mli.inc(130)
write.o apple2/mli.inc(130)
mul8x16 (mul8.o):
mul.o runtime/mul.s(8)
mul8x16a (mul8.o):
mul.o runtime/mul.s(8)
mulax10 (mulax10.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
negeax (lneg.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
popax (incsp2.o):
ungetc.o common/ungetc.s(10)
rwcommon.o apple2/rwcommon.s(6)
ltoa.o common/ltoa.s(9)
longjmp.o common/longjmp.s(8)
_printf.o common/_printf.s(11)
popsreg (popsreg.o):
mul8.o runtime/mul8.s(9)
mul.o runtime/mul.s(9)
umod.o runtime/umod.s(8)
udiv.o runtime/udiv.s(8)
ptr1 (zeropage.o):
ungetc.o common/ungetc.s(11)
strlower.o common/strlower.s(14)
setjmp.o common/setjmp.s(8)
rwcommon.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
read.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
mulax10.o runtime/mulax10.s(9)
ltoa.o common/ltoa.s(11)
longjmp.o common/longjmp.s(9)
lmul.o runtime/lmul.s(9)
fwrite.o common/fwrite.s(14)
fmisc.o common/fmisc.s(9)
_scanf.o ../libwrk/apple2enh/_scanf.s(11)
_printf.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
zerobss.o common/zerobss.s(9)
write.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
vfprintf.o common/vfprintf.s(11)
umod.o runtime/umod.s(9)
udiv.o runtime/udiv.s(9)
strlen.o common/strlen.s(8)
staspidx.o runtime/staspidx.s(9)
scanf.o common/scanf.s(11)
puts.o ../libwrk/apple2enh/puts.s(11)
printf.o common/printf.s(9)
ldaxi.o runtime/ldaxi.s(8)
thclock.o thclock.s(11)
ptr2 (zeropage.o):
strlower.o common/strlower.s(14)
rwcommon.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
read.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
ltoa.o common/ltoa.s(11)
longjmp.o common/longjmp.s(9)
_printf.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
write.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
ptr3 (zeropage.o):
read.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
ltoa.o common/ltoa.s(11)
lmul.o runtime/lmul.s(9)
vfscanf.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(12)
ptr4 (zeropage.o):
mul8.o runtime/mul8.s(10)
mul.o runtime/mul.s(10)
lmul.o runtime/lmul.s(9)
umod.o runtime/umod.s(9)
udiv.o runtime/udiv.s(9)
push1 (push1.o):
_printf.o common/_printf.s(11)
vfprintf.o common/vfprintf.s(9)
pusha (pusha.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
thclock.o thclock.s(459)
pusha0 (pushax.o):
push1.o runtime/push1.s(8)
fgetc.o ../libwrk/apple2enh/fgetc.s(94)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
puts.o ../libwrk/apple2enh/puts.s(78)
thclock.o thclock.s(459)
pushax (pushax.o):
fwrite.o common/fwrite.s(11)
fgetc.o ../libwrk/apple2enh/fgetc.s(94)
callmain.o runtime/callmain.s(11)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_printf.o common/_printf.s(11)
scanf.o common/scanf.s(10)
puts.o ../libwrk/apple2enh/puts.s(78)
printf.o common/printf.s(8)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
alarmclock.o alarmclock.s(432)
pusheax (lpush.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
_printf.o common/_printf.s(11)
pushwysp (pushwsp.o):
fwrite.o common/fwrite.s(11)
vfprintf.o common/vfprintf.s(9)
puts.o ../libwrk/apple2enh/puts.s(78)
thclock.o thclock.s(459)
thclock.o thclock.s(459)
regbank (zeropage.o):
regswap2.o runtime/regswap2.s(8)
fgetc.o ../libwrk/apple2enh/fgetc.s(10)
_scanf.o ../libwrk/apple2enh/_scanf.s(10)
_printf.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(14)
regsave (zeropage.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(10)
regswap2 (regswap2.o):
fgetc.o ../libwrk/apple2enh/fgetc.s(94)
return0 (return0.o):
fmisc.o common/fmisc.s(8)
rwcommon (rwcommon.o):
read.o apple2/read.s(9)
write.o apple2/write.s(8)
rwepilog (rwcommon.o):
write.o apple2/write.s(8)
rwprolog (rwcommon.o):
read.o apple2/read.s(9)
write.o apple2/write.s(8)
sp (zeropage.o):
sub.o runtime/sub.s(9)
setjmp.o common/setjmp.s(8)
regswap2.o runtime/regswap2.s(8)
popsreg.o runtime/popsreg.s(9)
lpush.o runtime/lpush.s(12)
longjmp.o common/longjmp.s(9)
lmul.o runtime/lmul.s(9)
ladd.o runtime/ladd.s(9)
icmp.o runtime/icmp.s(9)
fgetc.o ../libwrk/apple2enh/fgetc.s(10)
_scanf.o ../libwrk/apple2enh/_scanf.s(10)
_printf.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(11)
vfscanf.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(11)
vfprintf.o common/vfprintf.s(11)
staxsp.o runtime/staxsp.s(8)
staspidx.o runtime/staspidx.s(9)
scanf.o common/scanf.s(11)
pushwsp.o runtime/pushwsp.s(8)
pushax.o runtime/pushax.s(8)
pusha.o runtime/pusha.s(8)
printf.o common/printf.s(9)
leaaxsp.o runtime/leaaxsp.s(8)
ldaxsp.o runtime/ldaxsp.s(8)
incsp2.o runtime/incsp2.s(8)
incsp1.o runtime/incsp1.s(8)
decsp6.o runtime/decsp6.s(8)
decsp4.o runtime/decsp4.s(8)
decsp3.o runtime/decsp3.s(8)
decsp1.o runtime/decsp1.s(8)
crt0.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(11)
addysp.o runtime/addysp.s(8)
addeqsp.o runtime/addeqsp.s(8)
thclock.o thclock.s(10)
alarmclock.o alarmclock.s(10)
sreg (zeropage.o):
popsreg.o runtime/popsreg.s(9)
mul8.o runtime/mul8.s(10)
mul.o runtime/mul.s(10)
ltoa.o common/ltoa.s(11)
lpush.o runtime/lpush.s(12)
lneg.o runtime/lneg.s(11)
lmul.o runtime/lmul.s(9)
ladd.o runtime/ladd.s(9)
icmp.o runtime/icmp.s(9)
axlong.o runtime/axlong.s(8)
along.o runtime/along.s(8)
_scanf.o ../libwrk/apple2enh/_scanf.s(10)
_printf.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(11)
udiv.o runtime/udiv.s(9)
staspidx (staspidx.o):
thclock.o thclock.s(459)
stax0sp (staxsp.o):
thclock.o thclock.s(459)
alarmclock.o alarmclock.s(432)
staxysp (staxsp.o):
thclock.o thclock.s(459)
alarmclock.o alarmclock.s(432)
tmp1 (zeropage.o):
ungetc.o common/ungetc.s(11)
mul.o runtime/mul.s(10)
ltoa.o common/ltoa.s(11)
ladd.o runtime/ladd.s(9)
decaxy.o runtime/decaxy.s(8)
_printf.o /home/bill/opt/cc65/cc65/asminc/zeropage.inc(13)
staspidx.o runtime/staspidx.s(9)
tmp2 (zeropage.o):
lmul.o runtime/lmul.s(9)
tmp3 (zeropage.o):
lmul.o runtime/lmul.s(9)
tmp4 (zeropage.o):
lmul.o runtime/lmul.s(9)
tosaddeax (ladd.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
tosicmp0 (icmp.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
tosmuleax (lmul.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
tossuba0 (sub.o):
_scanf.o ../libwrk/apple2enh/_scanf.s(1058)
tosudiva0 (udiv.o):
thclock.o thclock.s(459)
tosudivax (udiv.o):
fwrite.o common/fwrite.s(12)
tosumoda0 (umod.o):
thclock.o thclock.s(459)
tosumulax (mul.o):
fwrite.o common/fwrite.s(12)
udiv16 (udiv.o):
umod.o runtime/umod.s(8)
zerobss (zerobss.o):
crt0.o apple2/crt0.s(9)

BIN
.noslotclock.c.swp Normal file

Binary file not shown.

BIN
.swp Normal file

Binary file not shown.

BIN
.trace.c.swp Normal file

Binary file not shown.

View File

@ -1,160 +0,0 @@
#include <stdio.h> /* printf, scanf */
#include <stdbool.h> /* bool */
#include <string.h> /* strerror */
#include <time.h> /* time_t, time, localtime */
#include <ctype.h> /* toupper */
#include <errno.h> /* errno */
#include "12hourclk.h"
#define TIME_ERR_RESULT ((time_t) -1)
#define LOCALTIME_ERR_RESULT NULL
#define ERR_MSG_SIZE 128
static void set_err_msg(char *prefix, int errno);
static char G_err_msg[ERR_MSG_SIZE];
static char *meridiem_text(meridiem_t m)
{
if (m == ANTE_MERIDIEM) {
return "am";
}
else {
return "pm";
}
}
bool set_clock(twleve_hour_clock_t *clock, struct tm *t)
{
clock->seconds = t->tm_sec;
clock->minutes = t->tm_min;
if (t->tm_hour == 0) {
clock->hours = 12;
clock->meridiem = ANTE_MERIDIEM;
}
else if (t->tm_hour < 12) {
clock->meridiem = ANTE_MERIDIEM;
}
else if (t->tm_hour == 12) {
clock->meridiem = POST_MERIDIEM;
}
else {
clock->hours = t->tm_hour - 12;
clock->meridiem = POST_MERIDIEM;
}
return true;
}
void set_err_msg(char *what_failed, int err_code)
{
snprintf(G_err_msg, ERR_MSG_SIZE, "%s: %s", what_failed, strerror(err_code));
}
bool load_system_time(twleve_hour_clock_t *clock)
{
time_t now;
bool is_successful = false; /* It will not be successful until it is. */
struct tm *curr_time;
if (time(&now) != TIME_ERR_RESULT)
if ((curr_time = localtime(&now)) != LOCALTIME_ERR_RESULT)
is_successful = set_clock(clock, curr_time);
else
set_err_msg("Localtime function failed", errno);
else
set_err_msg("Time function failed", errno);
return is_successful;
}
void read_interactively(twleve_hour_clock_t *clock)
{
char meridiem_input[3];
printf("Hour:");
scanf("%2ui", &(clock->hours));
printf("Minute:");
scanf("%2ui", &(clock->minutes));
printf("AM or PM:");
scanf("%2s", meridiem_input);
clock->seconds = 0;
if (toupper(meridiem_input[0]) == 'A') {
clock->meridiem = ANTE_MERIDIEM;
}
else {
clock->meridiem = POST_MERIDIEM;
}
}
void add_one_second(twleve_hour_clock_t *clock)
{
if (clock->seconds < 59) {
++(clock->seconds);
}
else {
clock->seconds = 0;
if (clock->minutes < 59) {
++(clock->minutes);
}
else {
clock->minutes = 0;
if (clock->hours < 11) {
++(clock->hours);
}
else if (clock->hours == 11) {
++(clock->hours);
if (clock->meridiem == ANTE_MERIDIEM) {
clock->meridiem = POST_MERIDIEM;
}
else {
clock->meridiem = ANTE_MERIDIEM;
}
}
else {
clock->hours = 1;
}
}
}
}
void add_seconds(twleve_hour_clock_t *clock, uint8_t seconds)
{
uint16_t sum;
uint16_t minutes_carry;
uint16_t hours_carry;
sum = ((uint16_t) clock->seconds) + ((uint16_t) seconds);
if (sum >= 60) {
minutes_carry = sum / 60;
clock->seconds = sum % 60;
sum = ((uint16_t) clock->minutes) + minutes_carry;
if (sum >= 60) {
hours_carry = sum / 60;
clock->minutes = sum % 60;
sum = ((uint16_t) clock->hours) + hours_carry;
if (sum >= 12) {
}
}
else {
clock->minutes = sum;
}
}
else {
clock->seconds = sum;
}
}
void print_time(twleve_hour_clock_t *clock)
{
printf("%2u:%02u:%02u %2s", clock->hours, clock->minutes, clock->seconds, meridiem_text(clock->meridiem));
}
void reprint_time(twleve_hour_clock_t *clock)
{
printf("\b\b\b\b\b\b\b\b\b\b\b");
print_time(clock);
}

View File

@ -1,25 +0,0 @@
#ifndef TWELVE_HOUR_CLOCK_H
#define TWELVE_HOUR_CLOCK_H
#include <stdint.h> /* uint8_t */
typedef enum {
ANTE_MERIDIEM, POST_MERIDIEM
} meridiem_t;
typedef struct {
uint8_t hours;
uint8_t minutes;
uint8_t seconds;
meridiem_t meridiem;
} twleve_hour_clock_t;
extern void read_interactively(twleve_hour_clock_t *clock);
extern bool load_system_time(twleve_hour_clock_t *clock);
extern void add_one_second(twleve_hour_clock_t *clock);
extern void add_seconds(twleve_hour_clock_t *clock, uint8_t seconds);
extern void print_time(twleve_hour_clock_t *clock);
extern void reprint_time(twleve_hour_clock_t *clock);
#endif

Binary file not shown.

Binary file not shown.

View File

@ -10,8 +10,8 @@ ifndef CC65_TARGET
CC65_TARGET:=apple2enh
endif
PGM=alarmclk
OBJS=alarmclk.o 12hourclk.o clkfreq.o
PGM=alarm.clock
OBJS=alarm.clock.o time.o noslotclock.o prodos.o trace.o
PGM2=calibrate
OBJS2=calibrate.o
@ -20,11 +20,11 @@ CC=cl65
AS=ca65
LD=ld65
CFLAGS=-t $(CC65_TARGET) -O
CFLAGS=-t $(CC65_TARGET) -O -DTRACE
ASFLAGS=-t $(CC65_TARGET)
LDFLAGS=-t $(CC65_TARGET)
DISK_VOL=alarmclk
DISK_VOL=ALARM.CLOCK
DISK=$(DISK_VOL).dsk
AC=java -jar lib/AppleCommander-1.3.5.14.jar
@ -32,19 +32,17 @@ MKDISK=$(AC) -pro140 $(DISK) $(DISK_VOL)
########################################
all: $(DISK)
$(DISK): $(PGM) $(PGM2)
$(AC) -d $(DISK) $<
$(AC) -cc65 $(DISK) $< BIN < $<
$(AC) -d $(DISK) $(PGM2)
$(AC) -cc65 $(DISK) $(PGM2) BIN < $(PGM2)
all: $(PGM) $(PGM2)
$(PGM): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
$(AC) -d $(DISK) $@
$(AC) -cc65 $(DISK) $@ BIN < $@
$(PGM2): $(OBJS2)
$(CC) $(LDFLAGS) -o $@ $^
$(AC) -d $(DISK) $@
$(AC) -cc65 $(DISK) $@ BIN < $@
# Compile and assemble rules use the defuault rules after CC and CFLAGS
# are set.

View File

@ -3,67 +3,64 @@
#include <stdbool.h> /* true */
#include <ctype.h> /* toupper */
#include <conio.h> /* clrscr, kbhit */
#include <time.h> /* time_t, struct tm */
#include "12hourclk.h"
extern void ClockFreq();
extern uint8_t Ticks[4];
#include "noslotclock.h"
#include "time.h"
#include "trace.h"
#define CLOCK_FREQUENCY 1023000L
#define CYCLES_PER_NOOP 2
#define NOOPS_PER_SEC 511500
#define CTRL_C '\x03'
#define ESC '\x1B'
#define FMTD_TIME_SIZE 16
void read_inputs(void);
void elapse_one_second(void);
void sleep_one_second(void);
void do_nothing_for_one_second(void);
void run_clock(void);
static twleve_hour_clock_t curr_time;
static twleve_hour_clock_t alarm_time;
static struct tm G_Current_Time;
static struct tm G_Alarm_Time;
void main(void)
{
ClockFreq();
printf("%c%c.%c%c%c%c%c%c MHz\n",
Ticks[0] & 0x70,
Ticks[0] & 0x07,
Ticks[1] & 0x70,
Ticks[1] & 0x07,
Ticks[2] & 0x70,
Ticks[2] & 0x07,
Ticks[3] & 0x70,
Ticks[3] & 0x07);
TRACE_ENTER("main");
load_driver();
clrscr();
read_inputs();
clrscr();
printf("\nAlarm Time: ");
print_time(&alarm_time);
print_12_hour_time(&G_Alarm_Time);
printf("\nCurrent Time: ");
run_clock();
TRACE_EXIT("main");
}
void read_inputs()
{
if (! load_system_time(&curr_time)) {
puts("Current Time");
read_interactively(&curr_time);
}
TRACE_ENTER("read_inputs");
read_time(&G_Current_Time);
puts("Alarm Time");
read_interactively(&alarm_time);
read_time_interactively(&G_Alarm_Time);
TRACE_EXIT("read_inputs");
}
void run_clock()
{
char c;
print_time(&curr_time);
TRACE_ENTER("run_clock");
print_12_hour_time(&G_Current_Time);
while (true) {
elapse_one_second();
add_one_second(&curr_time);
reprint_time(&curr_time);
sleep_one_second();
reprint_12_hour_time(&G_Current_Time);
if (kbhit()) {
c = cgetc();
if (c == ESC || toupper(c) == 'Q' || c == CTRL_C) {
@ -72,16 +69,35 @@ void run_clock()
}
}
}
TRACE_EXIT("run_clock");
}
void elapse_one_second()
/**
* Waits for one second. Modifies the global G_Current_Time.
*/
void sleep_one_second()
{
int i;
time_t old_time;
TRACE_ENTER("sleep_one_second");
old_time = mktime(read_time(&G_Current_Time));
while (mktime(read_time(&G_Current_Time)) <= old_time) {
do_nothing_for_one_second();
}
TRACE_EXIT("sleep_one_second");
}
void do_nothing_for_one_second()
{
int i = 0;
int max_loops;
TRACE_ENTER("do_nothing_for_one_second");
max_loops = NOOPS_PER_SEC / 250;
for (i = 0; i < max_loops; ++i) {
for ( ; i < max_loops; ++i) {
asm("nop");
asm("nop");
asm("nop");
@ -333,5 +349,6 @@ void elapse_one_second()
asm("nop");
asm("nop");
}
TRACE_EXIT("do_nothing_for_one_second");
}

View File

@ -1,515 +0,0 @@
;
; File generated by cc65 v 2.15 - Git 6f24c07
;
.fopt compiler,"cc65 v 2.15 - Git 6f24c07"
.setcpu "65C02"
.smart on
.autoimport on
.case on
.debuginfo off
.importzp sp, sreg, regsave, regbank
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
.macpack longbranch
.forceimport __STARTUP__
.import _printf
.import _puts
.import _toupper
.import _clrscr
.import _kbhit
.import _cgetc
.import _read_interactively
.import _load_system_time
.import _add_one_second
.import _print_time
.import _reprint_time
.import _ClockFreq
.import _Ticks
.export _read_inputs
.export _elapse_one_second
.export _run_clock
.export _main
.segment "RODATA"
L0009:
.byte $25,$63,$25,$63,$2E,$25,$63,$25,$63,$25,$63,$25,$63,$25,$63,$25
.byte $63,$20,$4D,$48,$7A,$0A,$00
L001F:
.byte $0A,$41,$6C,$61,$72,$6D,$20,$54,$69,$6D,$65,$3A,$20,$20,$20,$00
L0024:
.byte $0A,$43,$75,$72,$72,$65,$6E,$74,$20,$54,$69,$6D,$65,$3A,$20,$00
L002C:
.byte $43,$75,$72,$72,$65,$6E,$74,$20,$54,$69,$6D,$65,$00
L0031:
.byte $41,$6C,$61,$72,$6D,$20,$54,$69,$6D,$65,$00
L004B := L0009+22
.segment "BSS"
_curr_time:
.res 5,$00
_alarm_time:
.res 5,$00
; ---------------------------------------------------------------
; void __near__ read_inputs (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _read_inputs: near
.segment "CODE"
lda #<(_curr_time)
ldx #>(_curr_time)
jsr _load_system_time
jsr bnega
jeq L0028
lda #<(L002C)
ldx #>(L002C)
jsr _puts
lda #<(_curr_time)
ldx #>(_curr_time)
jsr _read_interactively
L0028: lda #<(L0031)
ldx #>(L0031)
jsr _puts
lda #<(_alarm_time)
ldx #>(_alarm_time)
jsr _read_interactively
rts
.endproc
; ---------------------------------------------------------------
; void __near__ elapse_one_second (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _elapse_one_second: near
.segment "CODE"
jsr decsp4
ldx #$07
lda #$FE
ldy #$00
jsr staxysp
ldx #$00
lda #$00
ldy #$02
jsr staxysp
L0050: ldy #$03
jsr ldaxysp
jsr pushax
ldy #$03
jsr ldaxysp
jsr tosltax
jne L0053
jmp L0051
L0053: nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
ldy #$02
ldx #$00
lda #$01
jsr addeqysp
jmp L0050
L0051: jsr incsp4
rts
.endproc
; ---------------------------------------------------------------
; void __near__ run_clock (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _run_clock: near
.segment "CODE"
jsr decsp1
lda #<(_curr_time)
ldx #>(_curr_time)
jsr _print_time
jmp L003A
L0038: jsr _elapse_one_second
lda #<(_curr_time)
ldx #>(_curr_time)
jsr _add_one_second
lda #<(_curr_time)
ldx #>(_curr_time)
jsr _reprint_time
jsr _kbhit
tax
jeq L003A
jsr _cgetc
ldy #$00
sta (sp),y
ldy #$00
ldx #$00
lda (sp),y
cmp #$1B
jsr booleq
jne L0046
ldy #$00
ldx #$00
lda (sp),y
ldx #$00
jsr _toupper
cpx #$00
bne L0048
cmp #$51
L0048: jsr booleq
jne L0046
ldy #$00
ldx #$00
lda (sp),y
cmp #$03
jsr booleq
jne L0046
ldx #$00
lda #$00
jeq L0049
L0046: ldx #$00
lda #$01
L0049: jeq L003A
lda #<(L004B)
ldx #>(L004B)
jsr _puts
jmp L0039
L003A: jmp L0038
L0039: jsr incsp1
rts
.endproc
; ---------------------------------------------------------------
; void __near__ main (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _main: near
.segment "CODE"
ldy #$00
jsr _ClockFreq
lda #<(L0009)
ldx #>(L0009)
jsr pushax
ldx #$00
lda _Ticks
ldx #$00
and #$70
jsr pushax
ldx #$00
lda _Ticks
ldx #$00
and #$07
jsr pushax
ldx #$00
lda _Ticks+1
ldx #$00
and #$70
jsr pushax
ldx #$00
lda _Ticks+1
ldx #$00
and #$07
jsr pushax
ldx #$00
lda _Ticks+2
ldx #$00
and #$70
jsr pushax
ldx #$00
lda _Ticks+2
ldx #$00
and #$07
jsr pushax
ldx #$00
lda _Ticks+3
ldx #$00
and #$70
jsr pushax
ldx #$00
lda _Ticks+3
ldx #$00
and #$07
jsr pushax
ldy #$12
jsr _printf
jsr _clrscr
jsr _read_inputs
jsr _clrscr
lda #<(L001F)
ldx #>(L001F)
jsr pushax
ldy #$02
jsr _printf
lda #<(_alarm_time)
ldx #>(_alarm_time)
jsr _print_time
lda #<(L0024)
ldx #>(L0024)
jsr pushax
ldy #$02
jsr _printf
jsr _run_clock
rts
.endproc

17
ascii.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef ASCII_CODES_H
#define ASCII_CODES_H
#define NULLCHAR '\x00'
#define STARTHDR '\x01'
#define STARTTXT '\x02'
#define ENDTXT '\x03'
#define ENDTRANS '\x04'
#define ENQUIRY '\x05'
#define ACK '\x06'
#define BELL '\x07'
#define ESCAPE '\x1b'
#define BACKSPC '\x08'
#define DELETE '\x7f'
#endif

View File

@ -1,9 +0,0 @@
/* This file is only here to make clkfreq.s load successfully. */
#include "clkfreq.h"
void main()
{
clkfreq();
}

BIN
clkfreq

Binary file not shown.

View File

@ -1,10 +0,0 @@
#ifndef CLKFREQ_H
#define CLKFREQ_H
#include <stdint.h> /* uint8_t */
extern void clkfreq(void);
extern uint8_t ticks[4];
#endif

218
clkfreq.s
View File

@ -1,218 +0,0 @@
.setcpu "65C02"
.smart on
.autoimport on
.case on
.debuginfo off
.importzp sp, sreg, regsave, regbank
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
.macpack longbranch
.forceimport __STARTUP__
.import _fputc
.import _stdout
.export _Ticks
.export _ClockFreq
rgConfig = $6000 ; write: D6=1 - NMI is off, D6=0 - NMI is on
rgStatus = $6000 ; read: D6=0 - UART is busy
rgTxD = $5000 ; write: data to send via UART
vcNMI = $FFFA
Refresh = 450 ; NMI rate in Hz
.segment "CODE"
.proc _ClockFreq: near
.segment "CODE"
ldx #<NMI ; installing the NMI vector
ldy #>NMI
stx vcNMI
sty vcNMI+1
lda #$40 ; on start NMI is off
sta InUse
Again:
lda #0
sta Flag
sta _Ticks ; initializing counter
sta _Ticks+1
sta _Ticks+2
sta _Ticks+3
lda #$FE ; initializing NMI counter (zeropoint minus 2 ticks)
sta Timer
lda #$FF
sta Timer+1
lda InUse ; turn on NMI
and #$BF
sta rgConfig
sta InUse
L1: bit Flag ; waiting for zeropoint minus 1 tick
bpl L1
lda #0
sta Flag
L2: bit Flag ; waiting for true zeropoint
bpl L2
lda #0
sta Flag
Main: ; main counting cycle
;number of ticks per command sum of ticks
; v v
lda _Ticks ;4
clc ;2 6
sed ;2 8
adc #$53 ;2 10
sta _Ticks ;4 14
lda _Ticks+1 ;4 18
adc #0 ;2 20
sta _Ticks+1 ;4 24
lda _Ticks+2 ;4 28
adc #0 ;2 30
sta _Ticks+2 ;4 34
lda _Ticks+3 ;4 38
adc #0 ;2 40
sta _Ticks+3 ;4 44
cld ;2 46
bit Flag ;4 50
bpl Main ;3 53
lda #0 ;2
sta Flag ;4 6
lda _Ticks ;4 10
clc ;2 12
sed ;2 14
adc #$95 ;2 16
sta _Ticks ;4 20
lda _Ticks+1 ;4 24
adc #0 ;2 26
sta _Ticks+1 ;4 30
lda _Ticks+2 ;4 34
adc #0 ;2 36
sta _Ticks+2 ;4 40
lda _Ticks+3 ;4 44
adc #0 ;2 46
sta _Ticks+3 ;4 50
cld ;2 52
lda Timer ;4 56
cmp #<Refresh ;2 58
bne Main ;3 61 + 34 (from NMI ISR) = 95
lda Timer+1 ; 4
cmp #>Refresh ; 2
bne Main ; 3
lda InUse ; turn off NMI
ora #$40
sta rgConfig
sta InUse
; Output
ldx #0 ; send first string to the host
L3: lda Mes1,x
beq L4
jsr PutChar
inx
jmp L3
L4: lda _Ticks+3
pha
lsr
lsr
lsr
lsr
beq L5 ; delete non-significant zero (clock < 10MHz)
jsr PrintDigit
L5: pla
and #15
jsr PrintDigit
lda #'.' ; decimal point
jsr PutChar
lda _Ticks+2
jsr PrintTwoDigits
lda _Ticks+1
jsr PrintTwoDigits
lda _Ticks
jsr PrintTwoDigits
ldx #0 ; send second string to the host
L6: lda Mes2,x
beq L7
jsr PutChar
inx
jmp L6
L7:
rts
.endproc
PrintTwoDigits:
pha
lsr
lsr
lsr
lsr
jsr PrintDigit
pla
and #15
jsr PrintDigit
rts
PrintDigit:
ora #$30
jsr PutChar
rts
PutChar:
; The character should be in the Accumulator
ldx #$00
jsr pushax
lda _stdout
ldx _stdout+1
jsr _fputc
rts
Send:
bit rgStatus
bvc Send
sta rgTxD
rts
.segment "RODATA"
Mes1:
.byte 13
.byte "Current clock frequency is "
.byte 0
Mes2:
.byte " MHz"
.byte 0
.segment "DATA"
_Ticks: .res 4,0 ; uint8_t _Ticks[4]
Timer: .res 2,0 ; uint16_t Timer
InUse: .byte 0 ; uint8_t InUse
Flag: .byte 0 ; uint8_t Flag
.segment "CODE"
; Called when an non-maskable interrupt occurs.
; 1. Increments Timer
; 2. Sets the high bit in Flag to 1
;
NMI: ;6
pha ;3 9
inc Timer ;6 15
bne L8 ;3 18
inc Timer+1 ; 5
L8: lda #$80 ;2 20
sta Flag ;4 24
pla ;4 28
rti ;6 34

87
noslotclock.c Normal file
View File

@ -0,0 +1,87 @@
#include <stdio.h> /* fprintf, stderr */
#include <stdbool.h> /* bool, true, false */
#include <stdint.h> /* uint8_t */
#include <time.h> /* struct tm */
#include "noslotclock.h"
#include "prodos.h"
#include "trace.h"
#define NSC_STRING_RESULT_ADDR 0x0280 /* String result, Ends at 0x0291 */
#define NSC_STRING_RESULT_LEN 12 /* The length of the above result */
#define NSC_UPDATE_SUB_ADDR 0x030B /* Start address of update subroutine */
typedef struct {
uint8_t year; /* 0..99 */
uint8_t month; /* 1..12 */
uint8_t day_of_month; /* 1..31 */
uint8_t day_of_week; /* 1..7 */
uint8_t hour; /* 0..23 */
uint8_t min; /* 0..59 */
uint8_t sec; /* 0..59 */
uint8_t hundredths_of_sec; /* 0..99 */
} no_slot_clock_time_t;
static const no_slot_clock_time_t *nsc = (no_slot_clock_time_t *) 0x0303;
static const char *nsc_absent_addr = (char *) 0x0304;
static bool is_nsc_absent(void);
static void read_time_from_nsc(void);
static void read_time_from_nsc()
{
TRACE_ENTER("read_time_from_nsc");
asm("jsr %w", NSC_UPDATE_SUB_ADDR);
TRACE_EXIT("read_time_from_nsc");
}
/**
* load_driver must be called first.
*/
static bool is_nsc_absent()
{
TRACE_ENTER("is_nsc_absent");
read_time_from_nsc();
TRACE_EXIT("is_nsc_absent");
return nsc_absent_addr[0] == NULL;
}
bool load_driver()
{
bool status = false;
TRACE_ENTER("load_driver");
if (run_basic_system_command("BLOAD READ.TIME")) {
/* Check for a missing NSC. */
if (! is_nsc_absent()) {
fprintf(stderr, "The No-Slot Clock hardware is missing");
status = true;
}
}
TRACE_RET_BOOL("load_driver", status);
return status;
}
/**
* The setup function must be called first.
*/
struct tm *read_time(struct tm *t)
{
/* Reload the current time from the No-Slot Clock into memory. */
read_time_from_nsc();
/* Transfer loaded values into a standard C struct tm. */
t->tm_sec = nsc->sec;
t->tm_min = nsc->min;
t->tm_hour = nsc->hour;
t->tm_mday = nsc->day_of_month;
t->tm_mon = nsc->month - 1;
t->tm_year = nsc->year + 100;
t->tm_wday = nsc->day_of_week == 7 ? 0 : nsc->day_of_week;
t->tm_yday = 0;
t->tm_isdst = 0;
return t;
}

10
noslotclock.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef NOSLOTCLOCK_H
#define NOSLOTCLOCK_H
#include <stdbool.h>
extern bool load_driver(void);
extern struct tm *read_time(struct tm *t);
#endif

176
old/old-time.c Normal file
View File

@ -0,0 +1,176 @@
#include <stdio.h> /* printf, scanf */
#include <stdbool.h> /* bool */
#include <string.h> /* strerror */
#include <time.h> /* time_t, time, localtime */
#include <ctype.h> /* toupper */
#include <errno.h> /* errno */
#include <stdlib.h> /* atoi */
#include "time.h"
#define TIME_ERR_RESULT ((time_t) -1)
#define LOCALTIME_ERR_RESULT NULL
#define ERR_MSG_SIZE 128
static const char *AM="AM";
static const char *PM="PM";
static char *to_upper_case(char *s);
static void set_err_msg(char *prefix, int errno);
static void copy_struct_tm(struct tm *dest, struct tm *src);
static const char *convert_24_hour_to_meridiem(uint8_t hours);
static uint8_t convert_12_hour_to_24_hour(uint8_t twelve_hour, char *meridiem);
static void convert_24_hour_to_12_hour(uint8_t twenty_four_hour, uint8_t *twelve_hour, char const **meridiem);
static char G_err_msg[ERR_MSG_SIZE];
void copy_struct_tm(struct tm *dest, struct tm *src)
{
dest->tm_sec = src->tm_sec;
dest->tm_min = src->tm_sec;
dest->tm_hour = src->tm_hour;
dest->tm_mday = src->tm_mday;
dest->tm_mon = src->tm_mon;
dest->tm_year = src->tm_year;
dest->tm_wday = src->tm_wday;
dest->tm_yday = src->tm_wday;
dest->tm_isdst = src->tm_isdst;
}
static const char *convert_24_hour_to_meridiem(uint8_t hours)
{
if (hours < 12) {
return AM;
}
else {
return PM;
}
}
static uint8_t convert_12_hour_to_24_hour(uint8_t twelve_hour, char *meridiem)
{
uint8_t twenty_four_hour;
/* Default */
twenty_four_hour = twelve_hour;
/* Special cases */
if (strcmp(meridiem, AM) == 0) {
if (twelve_hour == 12) {
twenty_four_hour = 0;
}
}
else if (twelve_hour < 12) {
twenty_four_hour = twelve_hour + 12;
}
return twenty_four_hour;
}
void convert_24_hour_to_12_hour(uint8_t twenty_four_hour, uint8_t *twelve_hour, char const **meridiem)
{
if (twenty_four_hour == 0) {
*twelve_hour = 12;
}
else if (twenty_four_hour < 12) {
*meridiem = AM;
}
else if (twenty_four_hour == 12) {
*meridiem = PM;
}
else {
*twelve_hour = twenty_four_hour - 12;
*meridiem = PM;
}
}
void set_err_msg(char *what_failed, int err_code)
{
snprintf(G_err_msg, ERR_MSG_SIZE, "%s: %s", what_failed, strerror(err_code));
}
bool load_system_time(struct tm *t)
{
time_t now;
struct tm *now_breakdown;
bool success = false;
if (time(&now) != TIME_ERR_RESULT) {
if ((now_breakdown = localtime(&now)) != LOCALTIME_ERR_RESULT) {
copy_struct_tm(t, now_breakdown);
success = true;
}
else {
perror("Localtime failed");
}
}
else {
perror("Time function failed");
}
return success;
}
char *to_upper_case(char *s)
{
size_t i;
for (i = 0; s[i] != '\0'; ++i) {
s[i] = toupper(s[i]);
}
return s;
}
void read_time_interactively(struct tm *t)
{
char line[4];
int8_t hour;
int8_t min;
printf("Hour:");
hour = atoi(fgets(line, sizeof(line), stdin));
printf("Minute:");
min = atoi(fgets(line, sizeof(line), stdin));
printf("AM or PM:");
fgets(line, sizeof(line), stdin);
t->tm_hour = convert_12_hour_to_24_hour(hour, line);
t->tm_min = min;
t->tm_sec = 0;
}
void add_one_second(struct tm *t)
{
if (t->tm_sec < 59) {
++(t->tm_sec);
}
else {
t->tm_sec = 0;
if (t->tm_min < 59) {
++(t->tm_min);
}
else {
t->tm_min = 0;
if (t->tm_hour < 23) {
++(t->tm_hour);
}
else {
t->tm_hour = 0;
}
}
}
}
void print_12_hour_time(struct tm *t)
{
uint8_t hour;
const char *meridiem;
convert_24_hour_to_12_hour(t->tm_hour, &hour, &meridiem);
printf("%2hu:%02d:%02d %2s", hour, t->tm_min, t->tm_sec, meridiem);
}
void reprint_12_hour_time(struct tm *t)
{
printf("\b\b\b\b\b\b\b\b\b\b\b");
print_12_hour_time(t);
}

27
old/old-time.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef TWELVE_HOUR_CLOCK_H
#define TWELVE_HOUR_CLOCK_H
#include <stdint.h> /* uint8_t */
typedef enum meridiem {
ANTE_MERIDIEM, POST_MERIDIEM
} meridiem;
typedef struct {
/* Bit fields */
unsigned int seconds : 5; /* Stores 0..31, need 0..59 */
unsigned int minutes : 6; /* Stores 0..63, need 0..59 */
unsigned int hours : 6; /* Stores 0..31, need 0..23 */
unsigned int day : 5; /* Stores 0..31, need 1..31 */
unsigned int month : 4; /* Stores 0..16, need 1..12 */
unsigned int year : 7; /* Stores 0..127, need 0..99 */
} unused_clock;
extern void read_time_interactively(struct tm *t);
extern bool load_system_time(struct tm *t);
extern void add_one_second(struct tm *t);
extern void print_12_hour_time(struct tm *t);
extern void reprint_12_hour_time(struct tm *t);
#endif

92
old/old_funcs.c Normal file
View File

@ -0,0 +1,92 @@
void add_one_second(clock *clock)
{
if (clock->seconds < 59) {
++(clock->seconds);
}
else {
clock->seconds = 0;
if (clock->minutes < 59) {
++(clock->minutes);
}
else {
clock->minutes = 0;
if (clock->hours < 11) {
++(clock->hours);
}
else if (clock->hours == 11) {
++(clock->hours);
if (clock->meridiem == ANTE_MERIDIEM) {
clock->meridiem = POST_MERIDIEM;
}
else {
clock->meridiem = ANTE_MERIDIEM;
}
}
else {
clock->hours = 1;
}
}
}
}
/**
* Doesn't work for all cases, but is not needed right now.
*/
void add_seconds(clock *clock, uint8_t seconds)
{
uint16_t sum;
uint16_t minutes_carry;
uint16_t hours_carry;
sum = ((uint16_t) clock->seconds) + ((uint16_t) seconds);
if (sum >= 60) {
minutes_carry = sum / 60;
clock->seconds = sum % 60;
sum = ((uint16_t) clock->minutes) + minutes_carry;
if (sum >= 60) {
hours_carry = sum / 60;
clock->minutes = sum % 60;
sum = ((uint16_t) clock->hours) + hours_carry;
if (sum >= 12) {
}
}
else {
clock->minutes = sum;
}
}
else {
clock->seconds = sum;
}
}
void old_print(clock *clock)
{
printf("%2u:%02u:%02u %2s", clock->hours, clock->minutes, clock->seconds, convert_24_hour_to_meridiem(clock->hours));
}
void add_one_second(struct tm *t)
{
if (t->tm_sec < 59) {
++(t->tm_sec);
}
else {
t->tm_sec = 0;
if (t->tm_min < 59) {
++(t->tm_min);
}
else {
t->tm_min = 0;
if (t->tm_hour < 23) {
++(t->tm_hour);
}
else {
t->tm_hour = 0;
}
}
}
}

View File

@ -1,37 +0,0 @@
;
; File generated by cc65 v 2.15 - Git 6f24c07
;
.fopt compiler,"cc65 v 2.15 - Git 6f24c07"
.setcpu "65C02"
.smart on
.autoimport on
.case on
.debuginfo off
.importzp sp, sreg, regsave, regbank
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
.macpack longbranch
.forceimport __STARTUP__
.import _stdout
.import _fputc
.export _main
; ---------------------------------------------------------------
; void __near__ main (void)
; ---------------------------------------------------------------
.segment "CODE"
.proc _main: near
.segment "CODE"
ldx #$00
lda #$41
jsr pushax
lda _stdout
ldx _stdout+1
jsr _fputc
rts
.endproc

50
prodos.c Normal file
View File

@ -0,0 +1,50 @@
#include <string.h> /* size_t */
#include "prodos.h"
#include "symbols.h"
#include "trace.h"
/*
char *turn_on_high_bits(char *s)
{
size_t i = 0;
for ( ; s[i] != '\0'; ++i) {
s[i] |= '\x80';
}
return s;
}
*/
bool run_basic_system_command(const char *command)
{
size_t i = 0;
bool finished_successfully = false;
TRACE_ENTER_STR("run_basic_system_command", (char *) command);
for ( ; command[i] != '\0'; ++i) {
/* Set the high bit and copy into the input buffer. */
INPBUF[i] = command[i] | '\x80';
}
/* Append carriage return with high bit set. */
INPBUF[i] = '\x8d';
TRACE_MSG("About to JSR DOSCMD");
asm("JSR %w", DOSCMD); /* %w is for a "word" value. */
asm("BIT %w", KBDSTRB); /* Clear strobe. */
/* If the command failed, the carry flag is set and register A has the
error code. */
asm("BCS %g", doscmd_error_handler);
finished_successfully = true;
goto finished;
doscmd_error_handler:
TRACE_MSG("About to JSR PRERR");
asm("JSR %w", PRERR); /* Prints the error. */
asm("CLC"); /* Required or bad stuff happens. */
finished:
TRACE_RET_BOOL("run_basic_system_command", finished_successfully);
return finished_successfully;
}

32
prodos.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef PRODOS_H
#define PRODOS_H
#include <stdbool.h> /* bool */
/* C99 specifies that char can be either signed or unsigned. In cc65 it is
unsigned. This can be tested by checking if CHAR_MIN is either negative
or zero.
With cc65 an 8-bit byte is represented by a char. The 6502 is byte-
addressable, so a memory address is represented by a char pointer
(char *) which is a 16-bit value. */
#define INPBUF ((char *) 0x0200)
#define DOSCMD 0xBE03
/* #define PRERR 0xBE0C */
#define PRERR 0xFF2D
#define COUT 0xFDED
#define KBD ((char *) 0xC000)
#define KBDSTRB 0xC010
#define VECTOUT ((char **) 0xbe30)
#define VECTIN ((char **) 0xbe32)
#define KBDSTRB_ON() (*KBDSTRB & '\x80')
#define SET_KBDSTRB() *KBDSTRB |= '\x80'
#define CLR_KBDSTRB()
extern bool run_basic_system_command(const char *command);
#endif

6
putc.c
View File

@ -1,6 +0,0 @@
#include <stdio.h>
void main(void)
{
putc('A', stdout);
}

25
putc.s
View File

@ -1,25 +0,0 @@
.file "putc.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq stdout(%rip), %rax
movq %rax, %rsi
movl $65, %edi
call _IO_putc
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (GNU) 5.1.1 20150618 (Red Hat 5.1.1-4)"
.section .note.GNU-stack,"",@progbits

6
symbols.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef APPLE2_ADDRESSES_H
#define APPLE2_ADDRESSES_H
#endif

154
time.c Normal file
View File

@ -0,0 +1,154 @@
#include <stdio.h> /* printf, scanf */
#include <stdbool.h> /* bool */
#include <string.h> /* strerror */
#include <time.h> /* time_t, time, localtime */
#include <ctype.h> /* toupper */
#include <errno.h> /* errno */
#include <stdlib.h> /* atoi */
#include "time.h"
#define TIME_ERR_RESULT ((time_t) -1)
#define LOCALTIME_ERR_RESULT NULL
#define ERR_MSG_SIZE 128
static const char *AM="AM";
static const char *PM="PM";
static char *to_upper_case(char *s);
static void set_err_msg(char *prefix, int errno);
static void copy_struct_tm(struct tm *dest, struct tm *src);
static const char *convert_24_hour_to_meridiem(uint8_t hours);
static uint8_t convert_12_hour_to_24_hour(uint8_t twelve_hour, char *meridiem);
static void convert_24_hour_to_12_hour(uint8_t twenty_four_hour, uint8_t *twelve_hour, char const **meridiem);
static char G_err_msg[ERR_MSG_SIZE];
void copy_struct_tm(struct tm *dest, struct tm *src)
{
dest->tm_sec = src->tm_sec;
dest->tm_min = src->tm_sec;
dest->tm_hour = src->tm_hour;
dest->tm_mday = src->tm_mday;
dest->tm_mon = src->tm_mon;
dest->tm_year = src->tm_year;
dest->tm_wday = src->tm_wday;
dest->tm_yday = src->tm_wday;
dest->tm_isdst = src->tm_isdst;
}
static const char *convert_24_hour_to_meridiem(uint8_t hours)
{
if (hours < 12) {
return AM;
}
else {
return PM;
}
}
static uint8_t convert_12_hour_to_24_hour(uint8_t twelve_hour, char *meridiem)
{
uint8_t twenty_four_hour;
/* Default */
twenty_four_hour = twelve_hour;
/* Special cases */
if (strcmp(meridiem, AM) == 0) {
if (twelve_hour == 12) {
twenty_four_hour = 0;
}
}
else if (twelve_hour < 12) {
twenty_four_hour = twelve_hour + 12;
}
return twenty_four_hour;
}
void convert_24_hour_to_12_hour(uint8_t twenty_four_hour, uint8_t *twelve_hour, char const **meridiem)
{
if (twenty_four_hour == 0) {
*twelve_hour = 12;
}
else if (twenty_four_hour < 12) {
*meridiem = AM;
}
else if (twenty_four_hour == 12) {
*meridiem = PM;
}
else {
*twelve_hour = twenty_four_hour - 12;
*meridiem = PM;
}
}
void set_err_msg(char *what_failed, int err_code)
{
snprintf(G_err_msg, ERR_MSG_SIZE, "%s: %s", what_failed, strerror(err_code));
}
bool load_system_time(struct tm *t)
{
time_t now;
struct tm *now_breakdown;
bool success = false;
if (time(&now) != TIME_ERR_RESULT) {
if ((now_breakdown = localtime(&now)) != LOCALTIME_ERR_RESULT) {
copy_struct_tm(t, now_breakdown);
success = true;
}
else {
perror("Localtime failed");
}
}
else {
perror("Time function failed");
}
return success;
}
char *to_upper_case(char *s)
{
size_t i;
for (i = 0; s[i] != '\0'; ++i) {
s[i] = toupper(s[i]);
}
return s;
}
void read_time_interactively(struct tm *t)
{
char line[4];
int8_t hour;
int8_t min;
printf("Hour:");
hour = atoi(fgets(line, sizeof(line), stdin));
printf("Minute:");
min = atoi(fgets(line, sizeof(line), stdin));
printf("AM or PM:");
fgets(line, sizeof(line), stdin);
t->tm_hour = convert_12_hour_to_24_hour(hour, line);
t->tm_min = min;
t->tm_sec = 0;
}
void print_12_hour_time(struct tm *t)
{
uint8_t hour;
const char *meridiem;
convert_24_hour_to_12_hour(t->tm_hour, &hour, &meridiem);
printf("%2hu:%02d:%02d %2s", hour, t->tm_min, t->tm_sec, meridiem);
}
void reprint_12_hour_time(struct tm *t)
{
printf("\b\b\b\b\b\b\b\b\b\b\b");
print_12_hour_time(t);
}

14
time.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef TWELVE_HOUR_CLOCK_H
#define TWELVE_HOUR_CLOCK_H
#include <stdint.h> /* uint8_t */
#include <time.h> /* time_t */
extern void read_time_interactively(struct tm *t);
extern bool load_system_time(struct tm *t);
extern void add_one_second(struct tm *t);
extern void print_12_hour_time(struct tm *t);
extern void reprint_12_hour_time(struct tm *t);
#endif

59
trace.c Normal file
View File

@ -0,0 +1,59 @@
#include <stdio.h>
#include "trace.h"
static void open(void);
static void close(void);
static FILE *t;
static char mode[2] = {'w', '\0'};
static void open()
{
t = fopen(TRACE_FILE_NAME, mode);
if (t == NULL) {
perror(TRACE_FILE_NAME);
}
mode[0] = 'a';
}
static void close()
{
if (fclose(t) == EOF) {
perror(TRACE_FILE_NAME);
}
}
void trace_enter(char *func_name)
{
open();
fprintf(t, "Entering %s\n", func_name);
close();
}
void trace_enter_str(char *func_name, char *str_param)
{
open();
fprintf(t, "Entering %s(%s)\n", func_name, str_param);
close();
}
void trace_exit(char *func_name)
{
open();
fprintf(t, "Exiting %s\n", func_name);
close();
}
void trace_ret_bool(char *func_name, bool bool_param)
{
open();
fprintf(t, "Exiting %s with %d\n", func_name, bool_param);
close();
}
void trace_msg(const char *message)
{
open();
fprintf(t, "%s\n", message);
close();
}

38
trace.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef TRACE_H
#define TRACE_H
#ifdef TRACE
#include <stdbool.h> /* bool */
#define TRACE_FILE_NAME "trace"
extern void trace_enter(char *func_name);
extern void trace_enter_str(char *func_name, char *str_param);
extern void trace_exit(char *func_name);
extern void trace_ret_bool(char *func_name, bool bool_param);
extern void trace_msg(const char *msg);
#define TRACE_ENTER(f) trace_enter(f)
#define TRACE_ENTER_STR(f, s) trace_enter_str(f, s)
#define TRACE_EXIT(f) trace_exit(f)
#define TRACE_RET_BOOL(f, b) trace_ret_bool(f, b)
#define TRACE_MSG(m) trace_msg(m)
#else
#define TRACE_ENTER(f)
#define TRACE_ENTER_STR(f, s)
#define TRACE_EXIT(f);
#define TRACE_RET_BOOL(f, b)
#define TRACE_MSG(m)
#define trace_enter(f)
#define trace_enter_str(f, s)
#define trace_exit(f);
#define trace_ret_bool(f, b)
#define trace_msg(m)
#endif
#endif