TempleOSCD_140715.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:09 +02:00
1 parent 7ef616a20e
commit 64f679eeb9
1095 files changed
+24814 -221011

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
#include "/Accts/Adam3bPkgs"
#include "/Apps/MusicOrgan/Load"
#include "/Apps/Psalmody/Load"
Cd("HOME");;
#include "/Accts/TS/TSAdam"
#include "/Accts/TS/TSSortHeader"
#include "/Accts/TS/TSDistro"
#include "/Accts/TS/TSHolySpirit"
Cd("HOME");;
+30 -8
View File
@@ -9,10 +9,11 @@ U0 FillInTime()
}
Bool MyPutKey(I64 ch,I64 sc)
{ //ch=ASCII; sc=scancode
{//ch=ASCII; sc=scan_code
//See $LK,"Char",A="HI:Char"$ for definition of scan codes.
//See $LK,"Keyboard Handling",A="FI:::/Doc/KeyBoard.TXT"$
//See $LK,"Key Allocations",A="FI:::/Doc/KeyAlloc.TXT"$.
//See $LK,"Keyboard Devices",A="HI:Keyboard Devices/System"$.
//You can customize keys. This routine
//is called before the main editor
@@ -21,8 +22,8 @@ Bool MyPutKey(I64 ch,I64 sc)
//Return TRUE if you completely
//handled the key.
I64 i,sc2=sc.u8[0];
U8 *st1,*st2;
if (SC_F1<=sc2<=SC_F10 &&
sc&SCF_ALT &&
@@ -80,7 +81,7 @@ Bool MyPutKey(I64 ch,I64 sc)
"$$FG$$";
}
break;
case SC_F7:
case SC_F6:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("Misc/Insert My URL");
@@ -93,6 +94,18 @@ Bool MyPutKey(I64 ch,I64 sc)
FillInTime;
}
break;
case SC_F7:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("God Book Passage");
} else {
//$LK,"::/Adam/God/HSNotes.TXT"$
FifoU8Flush(god.fifo);
GodBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
if (sc & SCF_SHIFT)
GodBooksPassage("HOME/Archive/Text/*");
}
break;
}
return TRUE;
} else {
@@ -131,8 +144,17 @@ Bool MyPutKey(I64 ch,I64 sc)
SetKeyDesc("Edit/Put Link to Cur Pos on Clipboard");
else {
ClipboardDel;
DocPrint(sys_clipboard_doc,"$$LK,\"FL:%s,%d\"$$",
DocPut->filename.name,DocPut->cur_entry->y+1);
st1=FileNameAbs(Define("ST_BIBLE_FILE"));
st2=FileNameAbs(DocPut->filename.name);
if (!StrCmp(st1,st2)) {
Free(st1);
st1=BibleLine2Verse(DocPut->cur_entry->y+1,',');
DocPrint(sys_clipboard_doc,"$$LK,\"BF:%s\"$$",st1);
} else
DocPrint(sys_clipboard_doc,"$$LK,\"FL:%s,%d\"$$",
st2,DocPut->cur_entry->y+1);
Free(st1);
Free(st2);
}
return TRUE;
case 'L':
@@ -179,13 +201,13 @@ Bool MyPutKey(I64 ch,I64 sc)
if (sc&SCF_KEY_DESC)
SetKeyDesc("JukeBox(TAD)");
else
JukeBox("::/Accts/TS/TAD/MusicOrgan");
JukeBox("::/Accts/TS/TAD/Psalmody");
return TRUE;
case 'P':
if (sc&SCF_KEY_DESC)
SetKeyDesc("JukeBox(Examples)");
else
JukeBox("::/Apps/MusicOrgan/Examples");
JukeBox("::/Apps/Psalmody/Examples");
return TRUE;
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
U0 UserStartUp()
{ //Run each time a user a spawned
{//Run each time a user a spawned
DocTermNew;
Type("::/Doc/Start.TXT");
LBts(&Fs->display_flags,DISPLAYf_SHOW);
@@ -23,7 +23,7 @@ U0 UserStartUp()
}
U0 SrvStartUp()
{ //Run each time a srv task is spawned.
{//Run each time a srv task is spawned.
DocTermNew;
LBts(&Fs->display_flags,DISPLAYf_SHOW);
WinToTop;
+3 -3
View File
@@ -5,9 +5,9 @@ HashTablePurge(adam_task->hash_table);
#help_index "Misc"
public F64 os_version=2.03;
F64 os_version=2.11;//Operating system version.
#include "AdamExt.HPP"
#include "AdamExts.HPP"
#include "Math2a"
#include "Training"
#include "Utils2a"
@@ -30,7 +30,7 @@ Cd("::/Adam");;
#include "Win2b"
#include "Dbg2a"
Cd("::/Adam/Doc");;
Cd("::/Adam/DolDoc");;
#include "Doc"
LBts(&sys_run_level,RLf_DOC);
Binary file not shown.
-6
View File
@@ -1,6 +0,0 @@
$TR,"Adam"$
$ID,2$$TR,"SysMsgFlags"$
$ID,2$sys_msg_flags[0]=0;
$ID,-2$$TR,"SysRegVer"$
$ID,2$registry_version=2.030;
$ID,-2$$ID,-2$
-15
View File
@@ -1,15 +0,0 @@
OptOn(OPTf_WARN_PAREN);
OptOn(OPTf_WARN_DUP_TYPES);
SetTypeMatic(0);
local_time_offset=-7*60*60*CDATE_FREQ; //Pacific
//$AN,"",A="mouse_move_scale"$adjust these to set mouse move scale
mxx_scale=0.5;
myy_scale=0.5;
mzz_scale=5.0; //wheel
//don't change these
mxx_prescale=mxx/mxx_scale;
myy_prescale=myy/myy_scale;
mzz_prescale=mzz/mzz_scale;
-199
View File
@@ -1,199 +0,0 @@
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
Do Not Edit! -->
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 FOLDED ADD_DATE="1374957505">Accounts</H3>
<DL><p>
<DT><A HREF="https://www.annualcreditreport.com/cra/index.jsp" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >AnnualCreditReport</A>
<DT><A HREF="http://software.intel.com/partner/app/dashboard" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Dashboard Intel® Developer Zone</A>
<DT><A HREF="http://www.dell.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://i.dell.com/images/global/branding/dellecomicon.ico" >Dell Laptops, Desktop Computers, Monitors, Printers & PC Accessories</A>
<DT><A HREF="https://www.mymedicare.gov/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >mymedicare.gov Portal of Personalized Medicare Information</A>
<DT><A HREF="https://www.paypal.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Send Money, Money Transfer - PayPal</A>
<DT><A HREF="http://www.socialsecurity.gov/onlineservices/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.socialsecurity.gov/favicon.ico" >Social Security Online What You Can Do Online</A>
<DT><A HREF="http://www.wellsfargo.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Wells Fargo Home Page</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1389105117">Commonly Quoted</H3>
<DL><p>
<DT><A HREF="http://www.youtube.com/watch?v=eB5VXJXxnNU" ADD_DATE="1381134432" LAST_VISIT="1386666617" LAST_MODIFIED="1389105618" ICON_URI="http://s.ytimg.com/yts/img/favicon_32-vflWoMFGx.png" >Ali G Homo Sapien</A>
<DT><A HREF="http://www.wired.com/magazine/2010/11/mf_ticketmaster/all/1" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Everyone Hates Ticketmaster — But No One Can Take It Down Magazine</A>
<DT><A HREF="http://stevehanov.ca/blog/index.php?id=56" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >How a programmer reads your resume (comic) - Steve Hanov's Programming Blog</A>
<DT><A HREF="http://wayback.archive.org/web/*/www.losethos.com" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://wayback.archive.org/favicon.ico" >Internet Archive (LoseThos)</A>
<DT><A HREF="http://waybackmachine.org/*/http://www.simstructure.hare.com" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Internet Archive (SimStructure)</A>
<DT><A HREF="http://www.youtube.com/watch?v=Dd7FixvoKBw" ADD_DATE="1379786905" LAST_VISIT="1386666617" LAST_MODIFIED="1389105613" ICON_URI="http://s.ytimg.com/yts/img/favicon_32-vflWoMFGx.png" >Key Peele #1</A>
<DT><A HREF="http://www.youtube.com/watch?v=VHG_Gv_zLY4" ADD_DATE="1384979305" LAST_VISIT="1386666617" LAST_MODIFIED="1389105621" ICON_URI="http://s.ytimg.com/yts/img/favicon_32-vflWoMFGx.png" >Key Peele #2</A>
<DT><A HREF="http://lmgtfy.com/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://lmgtfy.com/favicon.ico" >Let me google that for you</A>
<DT><A HREF="http://unusedino.de/ec64/technical/project64/mapping_c64.html" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://unusedino.de/favicon.ico" >Mapping The C64</A>
<DT><A HREF="http://www.youtube.com/watch?feature=player_embedded&v=nj6DK_WX7Yc#!" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://s.ytimg.com/yt/favicon-refresh-vfldLzJxy.ico" >The Magic of CES - YouTube#!</A>
<DT><A HREF="http://www.noob.us/humor/the-office-dwight-faces-nerd-torture-of-the-highest-form/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://www.noob.us/favicon.ico" >The Office - Dwight faces nerd torture of the highest form</A>
<DT><A HREF="http://www.youtube.com/watch?v=HRPDO63rI1E" ADD_DATE="1381122671" LAST_VISIT="1386666617" LAST_MODIFIED="1389105665" ICON_URI="http://s.ytimg.com/yts/img/favicon_32-vflWoMFGx.png" >The Prisoner</A>
<DT><A HREF="http://www.youtube.com/watch?v=o_eSwq1ewsU" ADD_DATE="1381122683" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://s.ytimg.com/yts/img/favicon-vfldLzJxy.ico" >There... Are... Four... Lights! - YouTube</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1374957505">Downloads</H3>
<DL><p>
<DT><A HREF="http://www.ccs64.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Commodore 64 Emulator</A>
<DT><A HREF="http://ffmpeg.zeranoe.com/builds/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >FFmpeg</A>
<DT><A HREF="http://www.dandans.com/Full-Video-Audio-Mixer.htm" ADD_DATE="1375786853" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.dandans.com/webico.ico" >Full Video Audio Mixer, Mix & Merge Audio and Video, Extract & Remove Audio from Video</A>
<DT><A HREF="http://www.winimage.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Gilles Vollant software</A>
<DT><A HREF="https://www.virtualbox.org/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Oracle VM VirtualBox</A>
<DT><A HREF="http://www.qb64.net/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >QB64</A>
<DT><A HREF="http://www.phatcode.net/downloads.php?id=280" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >turbo assembler 5 (tasm)</A>
<DT><A HREF="http://www.vmware.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >VMware Virtualization Software for Desktops, Servers & Virtual Machines for Public and Private Cloud Solutions</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1374957505">Games</H3>
<DL><p>
<DT><A HREF="http://www.classicempire.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >EMPIRE, Wargame of the Century (tm) index</A>
<DT><A HREF="http://www.freeciv.net/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Freeciv.net - online multiplayer strategy game</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1389102772">Links</H3>
<DL><p>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1374957505">Media Streams</H3>
<DL><p>
<DT><A HREF="http://www.bbc.co.uk/?ok" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >BBC - bbc.co.uk homepage - Home of the BBC on the Internet</A>
<DT><A HREF="http://www.bbc.co.uk/iplayer/console/bbc_world_service" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >BBC iPlayer - Listen live - BBC World Service</A>
<DT><A HREF="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Free Online Course Materials Electrical Engineering and Computer Science MIT OpenCourseWare</A>
<DT><A HREF="http://ocw.mit.edu/OcwWeb/web/home/home/index.htm" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Free Online Course Materials MIT OpenCourseWare</A>
<DT><A HREF="http://www.gametrailers.com/news.php" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Gametrailers.com - Video Games News, Game Trailers News</A>
<DT><A HREF="http://www.komp.com/" ADD_DATE="1389413520" LAST_VISIT="1389413520" LAST_MODIFIED="1389413520" >komp Homepage - LV Portal - Homepage</A>
<DT><A HREF="http://openclassroom.stanford.edu/MainFolder/HomePage.php" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >OpenClassroom</A>
<DT><A HREF="http://webcast.berkeley.edu/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >webcast.berkeley UC Berkeley Video and Podcasts for Courses & Events</A>
<DT><A HREF="http://www.xtremeradio.com/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >X107.5 X-treme Radio Las Vegas, NV - Homepage</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1374957504">Misc</H3>
<DL><p>
<DT><A HREF="http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >140 Google Interview Questions Seattle Interview Coach</A>
<DT><A HREF="http://blog.smartbear.com/programming/7-silly-programming-challenges-to-do-for-fun/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1389105588" ICON_URI="http://blog.smartbear.com/wp-content/uploads/dynamik-gen/theme/images/favicon.png" >7 Silly Programming Challenges to Do for Fun</A>
<DT><A HREF="http://petr-mitrichev.blogspot.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://petr-mitrichev.blogspot.com/favicon.ico" >Algorithm problems for dummies Petr Mitrichev's blog</A>
<DT><A HREF="http://www.youtube.com/watch?v=p-_RHRAzUHM" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Flying with the fastest birds on the planet Peregrine Falcon & Gos Hawk - Animal Camera - BBC - YouTube</A>
<DT><A HREF="http://harkavagrant.com/index.php?id=296" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://harkavagrant.com/favicon.ico" >Hark, a vagrant 296</A>
<DT><A HREF="http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1389102608" ICON_URI="http://www.tldp.org/favicon.ico" >Linux Filesystem Hierarchy</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1374957504">People</H3>
<DL><p>
<DT><A HREF="http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/" ADD_DATE="1377013922" LAST_VISIT="1386666616" LAST_MODIFIED="1389102919" ICON_URI="http://www.altdevblogaday.com/favicon.ico" >Carmack #AltDevBlog</A>
<DT><A HREF="http://scpd.stanford.edu/knuth/index.jsp" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Computer Musings by Professor Donald E. Knuth Stanford University Online</A>
<DT><A HREF="http://www-cs-faculty.stanford.edu/~knuth/index.html" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Don Knuth's Home Page</A>
<DT><A HREF="http://www.insight.org/site/PageServer" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Insight For Living Chuck Swindoll's Bible-teaching via articles, books, audio, and devotionals</A>
<DT><A HREF="http://torvalds-family.blogspot.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Linus' blog</A>
<DT><A HREF="http://www.hawking.org.uk/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Stephen Hawking - Home</A>
<DT><A HREF="http://www.escapistmagazine.com/articles/view/editorials/zeropunctuation" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >The Escapist Zero Punctuation</A>
<DT><A HREF="http://www.thegatesnotes.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >The Gates Notes</A>
<DT><A HREF="http://www.linuxfoundation.org/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.linuxfoundation.org/sites/www.linuxfoundation.org/themes/opensourcery/favicon.ico" >The Linux Foundation</A>
<DT><A HREF="http://www.slingshotchannel.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >The Slingshot Channel's Official Website</A>
<DT><A HREF="http://pdos.csail.mit.edu/6.828/2012/xv6.html" ADD_DATE="1388187282" LAST_VISIT="1388187282" LAST_MODIFIED="1388187282" >Xv6, a simple Unix-like teaching operating system</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1374957504">Research</H3>
<DL><p>
<DT><H3 FOLDED ADD_DATE="1389105041">Operating Systems</H3>
<DL><p>
<DT><A HREF="http://stochastix.wordpress.com/2009/01/31/distance-between-two-words/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1389106385" ICON_URI="http://1.gravatar.com/blavatar/97f8320d71ee1387cf94dbb722633e25?s=16" >Distance between two words « Reasonable Deviations</A>
<DT><A HREF="http://misc.aspell.net/wiki/English_Dictionaries" ADD_DATE="1384796381" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >English Dictionaries - AspellWiki</A>
<DT><A HREF="http://help.yahoo.com//l/us/yahoo/smallbusiness/webhosting/gftp/ftps-04.html#g" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://help.yahoo.com/favicon.ico" >How to setup FTPS tool - Yahoo! Small Business Help</A>
<DT><A HREF="http://msdn.microsoft.com/en-us/library/windows/hardware/ff559006(v=vs.85).aspx" ADD_DATE="1375962144" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://msdn.microsoft.com/Areas/Epx/Themes/Windows/Content/Winlogo_favicon.ico" >IDENTIFY_DEVICE_DATA structure (Windows Drivers)</A>
<DT><A HREF="http://arstechnica.com/information-technology/2012/10/linux-foundation-to-offer-signed-solution-for-uefi-secure-boot-conundrum/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Linux Foundation to offer signed solution for UEFI Secure Boot conundrum Ars Technica</A>
<DT><A HREF="http://www.linuxfoundation.org/news-media/blogs/browse/2012/10/linux-foundation-uefi-secure-boot-system-open-source" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Linux Foundation UEFI Secure Boot System for Open Source The Linux Foundation</A>
<DT><A HREF="http://www.pcworld.com/article/2011669/linux-foundation-unveils-a-new-solution-for-win-8-secure-boot.html" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Linux Foundation unveils a workaround for Win 8 Secure Boot PCWorld</A>
<DT><A HREF="http://academicearth.org/courses/operating-systems-and-system-programming" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Operating Systems and System Programming Berkeley Video Course</A>
<DT><A HREF="http://partedmagic.com/doku.php" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >start – Parted Magic</A>
</DL><p>
<DT><A HREF="http://www.hongkiat.com/blog/pixel-art-tutorials/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://mediatemplestatic.hongkiat.netdna-cdn.com/logo/hkdc/favicon.ico" >30 Excellent Pixel Art Tutorials For Pixel Lovers</A>
<DT><A HREF="http://bigocheatsheet.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Big-O Algorithm Complexity Cheat Sheet</A>
<DT><A HREF="https://www.circuitlab.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >CircuitLab sketch, simulate, and share your circuits</A>
<DT><A HREF="http://www.sparknotes.com/writing/style/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Grammar, Usage, and Style Guide SparkNotes Ultimate Style Ultimate Style</A>
<DT><A HREF="http://imgur.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://imgur.com/favicon.ico" >imgur the simple image sharer</A>
<DT><A HREF="http://software.intel.com/en-us/" ADD_DATE="1386626088" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://software.intel.com/sites/all/themes/isn3/favicon.ico" >Intel® Developer Zone</A>
<DT><A HREF="http://www.archive.org/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Internet Archive Digital Library of Free Books, Movies, Music & Wayback Machine</A>
<DT><A HREF="http://www.netlib.org/lapack/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >LAPACK — Linear Algebra PACKage</A>
<DT><A HREF="http://www.gutenberg.org/wiki/Main_Page" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://www.gutenberg.org/favicon.ico" >Main Page - Gutenberg</A>
<DT><A HREF="http://www.moreofit.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1389102467" ICON_URI="http://www.moreofit.com/favicon.ico" >moreofit - Website Similarity Search Engine</A>
<DT><A HREF="http://www.peoplesmart.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1389105190" ICON_URI="http://www.peoplesmart.com/favicon.ico" >People Search & Background Checks by Name, Phone, Email or Address - PeopleSmart</A>
<DT><A HREF="http://promo.net/pg/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >PROJECT GUTENBERG OFFICIAL HOME SITE - INDEX -- Free Books On-Line -</A>
<DT><A HREF="http://validator.w3.org/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >The W3C Markup Validation Service</A>
<DT><A HREF="http://www.whorush.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >WHORush.com, your source for information on domains</A>
<DT><A HREF="http://www.wolframalpha.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >WolframAlpha Computational Knowledge Engine</A>
<DT><A HREF="http://youtubetime.com/" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >YouTube Time</A>
<DT><A HREF="http://www.metacrawler.com/info.metac/dog/index.htm" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >[ MetaCrawler® ]</A>
<DT><A HREF="http://validator.w3.org/check?uri=http%3A%2F%2Flynx.isc.org%2Findex.html" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >[Valid] Markup Validation of http--lynx.isc.org-index.html - W3C Markup Validator</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1374957503">Spiritual</H3>
<DL><p>
<DT><A HREF="http://www.biblegateway.com/passage/?search=1+Corinthians+14&version=NIV" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1389330204" ICON_URI="http://static5.bgcdn.com/favicon.ico?ca05b3df" >1 Corinthians 14 NIV - Intelligibility in Worship Follow the - Bible Gateway</A>
<DT><A HREF="http://qrng.anu.edu.au/NIST.php" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://qrng.anu.edu.au/favicon.ico" >ANU Quantum Random Number Server</A>
<DT><A HREF="http://www.generatedata.com/" ADD_DATE="1383350304" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >generatedata.com</A>
<DT><A HREF="https://qrng.physik.hu-berlin.de/download" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >QRNG Service - Download</A>
<DT><A HREF="http://random.irb.hr/index.php" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://random.irb.hr/favicon.ico" >Quantum Random Bit Generator Service</A>
<DT><A HREF="http://www.randomnumbers.info/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Random Numbers Info</A>
<DT><A HREF="http://www.random.org/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://www.random.org/favicon.ico" >RANDOM.ORG - True Random Number Service</A>
<DT><A HREF="https://www.fourmilab.ch/hotbits/secure_generate.html" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="https://www.fourmilab.ch/favicon.ico" >Request HotBits (Secure Server)</A>
<DT><A HREF="http://www.theyshootpictures.com/gf1000_all1000films.htm" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >TSPDT - The 1,000 Greatest Films (Full List)</A>
<DT><A HREF="http://www.usccb.org/" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://www.usccb.org/favicon.ico" >United States Conference of Catholic Bishops</A>
<DT><A HREF="http://virtual-notary.org/" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1387238161" ICON_URI="http://virtual-notary.org/static/favicon.png" >Virtual-Notary</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1374957503">TempleOS Business</H3>
<DL><p>
<DT><A HREF="http://betanews.com/" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://betanews.com/wp-content/themes/betanews/favicon.ico" >BetaNews</A>
<DT><A HREF="http://www.devmaster.net/forums/" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >DevMaster.net Forums - Powered by vBulletin</A>
<DT><A HREF="http://www.gamedev.net/" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >GameDev.net - all your game development needs</A>
<DT><A HREF="http://www.majorgeeks.com/" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://www.majorgeeks.com/favicon.ico" >MajorGeeks.com - Download Freeware and Shareware Computer Utilities</A>
<DT><A HREF="http://www.youtube.com/watch?v=6WgOWrT1yyI&feature=youtu.be&a" ADD_DATE="1381667845" LAST_VISIT="1386666617" LAST_MODIFIED="1387406101" ICON_URI="http://s.ytimg.com/yts/img/favicon_32-vflWoMFGx.png" >Mum Tries Out TempleOS 1.06 (2013) - YouTube</A>
<DT><A HREF="http://www.businessconsultingabc.com/Feedback.html" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://www.businessconsultingabc.com/wp-content/themes/business-consulting-abc/favicon.ico" >Send Us Feedback Email ABC Business Consulting ABC Business Consulting</A>
<DT><A HREF="http://www.sparrowos.com/" ADD_DATE="1375793135" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://www.sparrowos.com/favicon.ico" >Sparrow Operating System</A>
<DT><A HREF="http://www.losethos.com/" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" ICON_URI="http://www.losethos.com/favicon.ico" >The LoseThos Operating System</A>
<DT><A HREF="http://www.google.com/webmasters/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.google.com/favicon.ico" >Webmasters – Google</A>
</DL><p>
<DT><H3 FOLDED ADD_DATE="1389105242">Uncommon</H3>
<DL><p>
<DT><A HREF="http://irc.netsplit.de/channels/details.php?room=%23%23programming&net=freenode" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1389102778" ICON_URI="http://irc.netsplit.de/favicon.ico" >##programming freenode - Chat Room on IRC - irc.netsplit.de</A>
<DT><A HREF="http://politicalhumor.about.com/library/bl-political-cartoons.htm" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >2012 Political Cartoons - Best Political Cartoons of 2012</A>
<DT><A HREF="http://english.aljazeera.net/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >AJE - Al Jazeera English</A>
<DT><A HREF="http://www.amazon.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1389106076" ICON_URI="http://www.amazon.com/favicon.ico" >amazon.com Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more</A>
<DT><A HREF="http://www.huffingtonpost.com/" ADD_DATE="1386981098" LAST_VISIT="1386981098" LAST_MODIFIED="1386981098" ICON_URI="http://www.huffingtonpost.com/favicon.ico" >Breaking News and Opinion on The Huffington Post</A>
<DT><A HREF="http://www.dailyrotation.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >DAILY ROTATION</A>
<DT><A HREF="http://www.dzone.com/links/index.html" ADD_DATE="1378720139" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.dzone.com/favicon.ico" >dzone.com - fresh links for developers</A>
<DT><A HREF="http://www.hackforums.net/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Hack Forums</A>
<DT><A HREF="http://hckrnews.com/" ADD_DATE="1377987384" LAST_VISIT="1386666616" LAST_MODIFIED="1387840046" ICON_URI="http://hckrnews.com/img/touch/apple-touch-icon.png" >hckr news - Hacker News sorted by time</A>
<DT><A HREF="http://www.shellcity.net/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1389105474" ICON_URI="http://www.shellcity.net/favicon.ico" >http--www.shellcity.net-</A>
<DT><A HREF="http://chat.icq.com/icqchat/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >ICQ Chat Rooms - ICQ.com</A>
<DT><A HREF="http://iopscience.iop.org/1367-2630" ADD_DATE="1374957505" LAST_VISIT="1386666617" LAST_MODIFIED="1389105799" ICON_URI="http://iopscience.iop.org/favicon.ico" >iopscience Journal of Physics</A>
<DT><A HREF="http://www.irc.org/links.html" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >IRC.org</A>
<DT><A HREF="http://www.haaretz.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Israel News - Haaretz Israeli News source</A>
<DT><A HREF="https://lobste.rs/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1389102792" ICON_URI="https://lobste.rs/favicon.ico" >Lobsters</A>
<DT><A HREF="http://www.microsoft.com/isapi/redir.dll?prd=ie&pver=6&ar=IStart" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >MSN.com</A>
<DT><A HREF="http://www.physorg.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >PhysOrg.com - Science News, Technology, Physics, Nanotechnology, Space Science, Earth Science, Medicine</A>
<DT><A HREF="http://www.chess.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Play Chess Online - Free Chess Games at Chess.com</A>
<DT><A HREF="http://gogloom.com/DIR?cat=84126&catdesc=Programming" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Programming CHAT ROOMS - Online CHAT!</A>
<DT><A HREF="http://royal.pingdom.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Royal Pingdom</A>
<DT><A HREF="http://www.infopackets.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >Tech News Daily - Infopackets.com</A>
<DT><A HREF="http://www.techbeta.org/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >TechBeta Free and open source software for Windows, Mac OS X, Linux, iPhone, and Mobile</A>
<DT><A HREF="http://www.techcrunch.com/" ADD_DATE="1374957503" LAST_VISIT="1386666617" LAST_MODIFIED="1386666617" >TechCrunch</A>
<DT><A HREF="http://www.tomshardware.com/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Tom's Hardware Hardware News, Tests and Reviews</A>
<DT><A HREF="http://news.yahoo.com/" ADD_DATE="1374957505" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://news.yahoo.com/favicon.ico" >Yahoo! News - Latest News & Headlines</A>
<DT><A HREF="http://www.yahoo.com/" ADD_DATE="1374957504" LAST_VISIT="1386666617" LAST_MODIFIED="1389106215" ICON_URI="http://l.yimg.com/rz/l/favicon.ico" >Yahoo!</A>
</DL><p>
<DT><A HREF="http://www.4chan.org/" ADD_DATE="1375781470" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://s.4cdn.org/image/favicon.ico" >4chan</A>
<DT><A HREF="http://arstechnica.com/index.ars" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Ars Technica</A>
<DT><A HREF="http://dictionary.reference.com/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://static.sfdict.com/dictcloud/favicon.ico" >Dictionary</A>
<DT><A HREF="http://www.drudgereport.com/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >DRUDGE</A>
<DT><A HREF="http://www.facebook.com/home.php" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Facebook</A>
<DT><A HREF="https://www.google.com/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="https://www.google.com/favicon.ico" >Google</A>
<DT><A HREF="http://news.ycombinator.com/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Hacker News</A>
<DT><A HREF="http://www.knpr.org/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.knpr.org/favicon.ico" >Nevada Public Radio</A>
<DT><A HREF="http://beacon.nist.gov/home" ADD_DATE="1383959013" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >NIST Randomness Beacon (Prototype Implementation) - NIST</A>
<DT><A HREF="http://forum.osdev.org/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://forum.osdev.org/favicon.ico" >OSDev.org • Index page</A>
<DT><A HREF="http://www.osnews.com/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.osnews.com/favicon.ico" >OSNews is Exploring the Future of Computing</A>
<DT><A HREF="http://www.pixeljoint.com/forum/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.pixeljoint.com/favicon.ico" >Pixel Joint Forum</A>
<DT><A HREF="http://popurls.com/" ADD_DATE="1378004893" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://popurls.com/favicon.ico" >popurls the genuine news aggregator for the latest web buzz</A>
<DT><A HREF="http://www.reddit.com/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666968" ICON_URI="http://www.redditstatic.com/icon.png" >reddit.com</A>
<DT><A HREF="http://slashdot.org/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://slashdot.org/favicon.ico" >slashdot News for nerds, stuff that matters</A>
<DT><A HREF="http://stackoverflow.com/" ADD_DATE="1381508264" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://cdn.sstatic.net/stackoverflow/img/favicon.ico" >Stack Overflow</A>
<DT><A HREF="http://www.templeos.org/logs/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.templeos.org/favicon.ico" >TempleOS Index of -logs</A>
<DT><A HREF="http://www.templeos.org/Wb/Accts/TS/Wb2/Rants/TAD/TADRants.html" ADD_DATE="1389595518" LAST_VISIT="1389595518" LAST_MODIFIED="1389595518" ICON_URI="http://www.templeos.org/favicon.ico" >Terry Davis' Rants</A>
<DT><A HREF="http://www.templeos.org/" ADD_DATE="1375628480" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://www.templeos.org/favicon.ico" >The Temple Operating System</A>
<DT><A HREF="https://twitter.com/" ADD_DATE="1378394318" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="https://abs.twimg.com/favicons/favicon.ico" >Twitter</A>
<DT><A HREF="http://www.wikipedia.org/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" ICON_URI="http://bits.wikimedia.org/favicon/wikipedia.ico" >Wikipedia</A>
<DT><A HREF="http://smallbusiness.yahoo.com/services/index.php?crumb=eynoh/GoPXd" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386666616" >Yahoo! Small Business</A>
<DT><A HREF="http://www.youtube.com/" ADD_DATE="1374957503" LAST_VISIT="1386666616" LAST_MODIFIED="1386677085" ICON_URI="http://s.ytimg.com/yts/img/favicon_32-vflWoMFGx.png" >YouTube - Broadcast Yourself</A>
</DL><p>
-115
View File
@@ -1,115 +0,0 @@
//Be sure to Adam Include this.
#help_index "Comm"
#define COM1_BASE 0x3F8
#define COM2_BASE 0x2F8
#define COM3_BASE 0x3E8
#define COM4_BASE 0x2E8
#define UART_THR 0
#define UART_RDR 0
#define UART_BRDL 0
#define UART_IER 1
#define UART_BRDH 1
#define UART_IIR 2
#define UART_LCR 3
#define UART_MCR 4
#define UART_LSR 5
#define UART_MSR 6
I64 comm_base[5]={0,0x3F8,0x2F8,0x3E8,0x2E8};
CFifoU8 *comm_fifos[5]={NULL,NULL,NULL,NULL,NULL};
interrupt U0 CommInt3Handler()
{
I64 base=comm_base[2];
if (comm_fifos[2] && (InU8(base+UART_IIR) & 0xFE)==8) //RX IRQ
FifoU8Ins(comm_fifos[2],InU8(base+UART_RDR));
base=comm_base[4];
if (comm_fifos[4] && (InU8(base+UART_IIR) & 0xFE)==8) //RX IRQ
FifoU8Ins(comm_fifos[4],InU8(base+UART_RDR));
OutU8(0x20,0x20);
}
interrupt U0 CommInt4Handler()
{
I64 base=comm_base[1];
if (comm_fifos[1] && (InU8(base+UART_IIR) & 0xFE)==8) //RX IRQ
FifoU8Ins(comm_fifos[1],InU8(base+UART_RDR));
base=comm_base[3];
if (comm_fifos[3] && (InU8(base+UART_IIR) & 0xFE)==8) //RX IRQ
FifoU8Ins(comm_fifos[3],InU8(base+UART_RDR));
OutU8(0x20,0x20);
}
IntEntrySet(0x23,&CommInt3Handler);
IntEntrySet(0x24,&CommInt4Handler);
public U0 CommInit8n1(I64 port,I64 baud)
{
I64 base=comm_base[port];
PUSHFD
CLI
if (comm_fifos[port])
FifoU8Del(comm_fifos[port]);
comm_fifos[port]=FifoU8New(256);
OutU8(base+UART_LCR,0); //Set for IER
OutU8(base+UART_IER,0); //DIsable all IRQ
OutU8(base+UART_LCR,0x80); //Enable baud rate control
OutU8(base+UART_BRDL,(0x180/(baud/300)) & 0xFF); //LSB
OutU8(base+UART_BRDL,(0x180/(baud/300)) / 256); //MSB
OutU8(base+UART_LCR,3); // 8-none-1
InU8(base+UART_RDR); //read garbage
InU8(base+UART_LSR);
OutU8(base+UART_MCR,4);
OutU8(base+UART_IER,0); //DIsable all IRQ
OutU8(base+UART_MCR,0xA); //out2 and rts
OutU8(0x21,InU8(0x21) & (0xFF-0x18)); //Enable 8259 IRQ 3 & 4
OutU8(base+UART_IER,1); //Enable RX IRQ
POPFD
}
public U0 CommBusyPutChar(I64 port,U8 b)
{
I64 base=comm_base[port];
while (!(InU8(base+UART_LSR) & 0x20))
Yield;
OutU8(base+UART_THR,b);
while (!(InU8(base+UART_LSR) & 0x20))
Yield;
}
public U0 CommBusyPutS(I64 port,U8 *st)
{
I64 base=comm_base[port];
U8 b;
while (b=*(st++)) {
while (!(InU8(base+UART_LSR) & 0x20))
Yield;
OutU8(base+UART_THR,b);
}
while (!(InU8(base+UART_LSR) & 0x20))
Yield;
}
public U0 CommBusyWriteBlk(I64 port,U8 *buf,I64 count)
{
I64 base=comm_base[port];
while (count--) {
while (!(InU8(base+UART_LSR) & 0x20))
Yield;
OutU8(base+UART_THR,*(buf++));
}
while (!(InU8(base+UART_LSR) & 0x20))
Yield;
}
#help_index ""
-245
View File
@@ -1,245 +0,0 @@
* Backward SHIFT-F3 is broken
* Exception msgs in Adam look bad
3sGCGCqCCe2G3EE2G3qDetDEFsDBDB
* $LK,"Mem32DevAlloc",A="MN:Mem32DevAlloc"$() is broken. Devices should be in free spot of E820 report.
* $$DA-U64+I16
* SPRITES in CMD Line code.
* get rid of clusters once RedSea
* Might want to move kernel code out of low 2Meg.
* F2 Macro on TestSuite
* PSect search all tables if not found very well.
* Bug: HI:Math/CD3
* asm LIST NOLIST bug
* Bible ranges.
* Current Bible position to link on clipboard.
* No way to clear +Hold entries
---------------------
$$=-CTASK_NEG_OFFSET
offset(CTask.addr)==0
Spawn(): CAlloc()
TaskFinishOff(): Free()
CSysFixedArea.adam
Looks like task_flags,locked_flags cause problems with neg offset.
---------------------
* $$CM+LE+RE is nasty
* Wenceslas in TestSuite crashes, long time ago
* 12/26/13 Mountain in TestSuite didn't run right. Turned yellow, did nothing.
* FAQ frontloaded
COMPILER
* Postpone LocalVar Init until last possible moment. (in case RETURN)
* PtrArith MUL SIZE -->QueIns(MUL)?
* QueRem(IC_NOP)?
* Fix return result for GrBlot, ect.
* Tour TestSuite on 256Meg NoMP runs out of mem. Leak,too?
* CTRL-R transform individual elements
* Size zero files don't copy out from VMware.
* FileMgr header
* ATA/ATAPI ID in VMware, when not booted to CD? I forgot.
* I use fixed-point in $LK,"Circle",A="MN:Circle"$(), $LK,"Ellipse",A="MN:Ellipse"$(), $LK,"GrRot",A="MN:GrRot"$(), $LK,"GrMulMat",A="MN:GrMulMat"$() and others.
God says I might want to change to float.
$LK,"::/Demo/Lectures/FixedPoint.CPP"$.
$LK,"::/Demo/Lectures/FixedPointAdvanced.CPP"$.
* DOCF_DBL_DOLLARS in reindention
* # in reindention
* reindent $LK,"DocRecalc",A="MN:DocRecalc"$().skip_soft_cr
* HexEdit with odd size, ASCII cannot be edited.
* clean-up addDev pmt
* Might want to convert some Preempt() to Cli
* Music organ hangs when cursoring around. Haven't seen in while.
* $LK,"Plain",A="MN:Plain"$() might be better not saving $LK,"CH_CURSOR",A="MN:CH_CURSOR"$.
* TRANSPARENT might not work with line ROPF_DITHER
* It would be nice if $LK,"U",A="MN:U"$() NOP were better.
* unhandled exception on MP message gets overwritten by WinMgr
* Cmd to enable/disable compiler warnings
* What if we had a type for either F64 or I64, like Print -- no conversion.
* What if we had a ... that did do conversion, if we have one that doesn't.
* fix documentation problem -- remembering 0 terminator in str or not for $$DA
* GetS, crazy putkey code
* editor page formatting is FUBAR
* $LK,"gr_screen_image",A="MN:gr_screen_image"$
>Might want to do ZOOM in U8 graphics and convert screen capture to U8
>Might want to reverse bit order
* return vals for grrect, grblot, grputchar?
* collisions for grrect, grblot, grputchar?
* Race condition in FlatTops.CPP.Z torpedo
* {Lock|Rep}{Seg|2E=NotBr|3E=Br}{OP}{ADD}{REX}
* Virtual Box MP reboot
* Std local var names
* EIT_ABS_ADDR 64
//After Egypt possible future ideas
//$LK,"Numbers,13:33",A="BF:Numbers,13:33"$ scouts
//$LK,"Numbers,21:8",A="BF:Numbers,21:8"$ snakes
* GrEdit: Move sidebar selected elems.
- Be careful of multipt elems.
* GrEdit: Strip origin shift cmds.
* GrEditBitMap, grabscroll?
* extern of fun with dft arg of str?
* We kinda need a routine to return how much free memory, so that applications can plan a big alloc.
* FileMgr bad with lots of files.
* This $LK,"Fs->catch_except=TRUE",A="FF:::/Kernel/SrvCmd.CPP,Fs->catch_except=TRUE"$ causes problems because it catches divide and out-of-mem. Not sure what to do, yet.
* $LK,"MPStart",A="MN:MPStart"$() free old task memory. (Prolly never gonna do anything about this.)
* $LK,"sys_var_init_flag",A="MN:sys_var_init_flag"$ local vars.
* sprite shift pts, ctrl pt for ellipse/polygon w,h is off when rotated.
* Window mgr needs to do DOC operations on posted messages from mouse. Works for $LK,"SetIP",A="MN:SetIP"$(), though.
* Add local vars to sym table in $LK,"Dbg",A="MN:Dbg"$()? (maybe)
* $LK,"Bible sized nodes",A="FF:::/Adam/Doc/DocRecalc2b.CPP,->tag+i"$
* Mouseinstall throws exceptions, doesn't work, investigate Mouse $LK,"0x9FC30",A="FF:::/Kernel/KbdMouse/Mouse.CPP,9FC"$
* get kbd lights working.
* Might have issue with compiler exceptions and restoring lex.hash tables.
* Generates two compiler error messages for expressions in statements.
* release semaphores or break lock sema,usb_td
* Fix Mom's secondary CD-ROM, dad's primary
* pmtstr in install didn't like focus change
*$FG,2$U0 Main()
{
U0 (*fp_old_draw_input_ptr)(CDC *dc,I64 x,I64 y)=fp_draw_input_ptr;
}$FG$
* What about local variable array/struct initialization.
* Demo $LK,"ToHtml",A="MN:ToHtml"$().
* Del short name in FAT32--currently I do not check to see if I have generated a unique short name and one can delete multiple files accidentally. Generating unique short names is a pain in the ass because you have to scan the whole directory. I think I just truncate the name instead of "Program~1" or whatever. S081130-0001.BMP crashed windows--two identical short names.
* OVERSTRIKE at cmd line with menu macro.
* $FG,2$lock{}$FG$ warning on invalid modes.
* Local array vars-->reg.
* $LK,"DCF_SYMMETRY",A="MN:DCF_SYMMETRY"$, before transformation? (Currently it's after)
* all graphics clipping -- screen y+top<0 for top<0
* Maybe convert graphics to float
* Warn unnecessary typecast
* compiler F32
* preempt(OFF) during graphic clipping?
* compiler optimization heap_glbls with added offset
* AOT-compile extern glblvar references.
* extern glbl var in AOT module on data heap.
* Might make FAT32 read in contiguous chunks.
* make Clamp(),Min(),Max() asm routines.
* Might make CSprite flood fill operate on a separate bitmap and blotted at the end.
* autofile popup of popup
* <CTRL-R> delete subsprite in menu near others
* consider changing domenu so a real <ESC> on menu item doesn't select (<SPACE BAR> sends <ESC> followed by <SPACE BAR> or something)
* puts3 with depth buf? might not do this
* make task queins and querem safe for multicore cycling through tasks (fwd).
* make better heapwalk, do something with _CFG_HEAP_DBG.
* log to file--would be inefficient--load-in whole file, modify and write out. Useful, but not very efficient (TempleOS file system has no grow-file ability. Created when FAT patent was an issue and wanted absly nothing people could sue me for.)
* APIC2
* import intel datasheets, somehow?
* Get better dictionary, good spell checker.
* WordStat/Man Jmp for user code.
* Might make DskView show drive colors.
* Might do utility to set drive colors, making a tree entry in Adam 3 using registry-like routines... or registry I guess.
* New Editor widgets
* Make use of flag potential in SysFilesFind and possibly CFileAccess
* implement fixed pos files
* new HolyC language features
* better debugging
* Too much preemption turned off?
* Look for mem leaks.
* Move stuff out of Kernel module.
* $LK,"ROP_XOR",A="MN:ROP_XOR"$ with pen_width>1 is broken.
* RGB wrong in BMP files.
* use width and height in line clipping for pen_width>1 or blot.
* SIMD transformation
* test removable media id (critical for resident files)
* add field overflow U8 "t='*'"
* Implement fmt codes into Get
* Date Input
* Default date fmt
* 16 bit Unassembly is bad--very low priority
* more signed int disassembly
* support r4u8 by adding 0x40 byte
* static var off of data heap.
* Might want to use U32*U32 multiplication.
* could add "const" to not set LF_NOT_CONST flag for trig, etc.
* do r,rm ICCmp like ICBrCmp
* could make glblvar imports use TY_RIP_DISP32.
* PUSH_CMP allocs reg R9 or whatever
* Might be problem with NOP in OPT pass1 for NO_PUSH in expressions besides assignments. Is ShiftNoPush fully implemented?
* NOP1 might need to have diff ic_data's
* in divequal, it assumes about ebx
* error/warning line nums
* ASM branch out warning of range off by 1 line--use lx->last_line_num
* Switch statement with sparse cases (low priority)
* maybe inline functions?
* Use of more floating-point stk?
* More aggressive in this routine $LK,"CmpF2PushPop",A="MN:CmpF2PushPop"$() with types besides MOV and F64.
* !dbl ~dbl
* &=, |= can overflow with Bts Btr on small data types
* num lock comes on with break key
* sort options for findfiles
* recalc_start could be more accurate before recalculating?
* Maybe, get rid of $LK,"0x20000",A="FF:::/Compiler/CmpMain.CPP,0x20000"$ in compiler.
* $TX,"WWW.OSDEV.ORG",HTML="http://www.osdev.org"$
* $FG,4$$TX,"KeyPeele#1",HTML="http://www.youtube.com/watch?v=Dd7FixvoKBw"$$FG$
* $FG,4$$TX,"KeyPeele#2",HTML="http://www.youtube.com/watch?v=VHG_Gv_zLY4"$$FG$
* $FG,4$$TX,"ThePrisoner",HTML="http://www.youtube.com/watch?v=HRPDO63rI1E"$$FG$
* $FG,4$$TX,"WestWorld",HTML="http://www.youtube.com/watch?v=LcL3eP0Hfy4"$$FG$
* $FG,4$$TX,"Picard:FourLights",HTML="http://www.youtube.com/watch?v=o_eSwq1ewsU"$$FG$
* $FG,4$$TX,"Dwight:NerdTorture",HTML="http://www.noob.us/humor/the-office-dwight-faces-nerd-torture-of-the-highest-form"$$FG$
* $FG,4$$TX,"AliG:Homosapiens",HTML="http://www.youtube.com/watch?v=eB5VXJXxnNU&t=2m20s"$$FG$
* $FG,4$$TX,"Dumb Guards",HTML="http://www.youtube.com/watch?v=OdKa9bXVinE"$$FG$
* $FG,4$$TX,"Mapping the Commodore 64",HTML="http://unusedino.de/ec64/technical/project64/mapping_c64.html"$$FG$
* Holy Grail: Lmq5PxHpLNw 1:28:27
-34
View File
@@ -1,34 +0,0 @@
$TR,"Adam"$
$ID,2$$TR,"SysMsgFlags"$
$ID,2$sys_msg_flags[0]=0x53;
$ID,-2$$TR,"SysRegVer"$
$ID,2$registry_version=2.030;
$ID,-2$$ID,-2$$TR,"TempleOS"$
$ID,2$$TR,"DiningStars"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"EagleDive"$
$ID,2$I64 best_score=2;
$ID,-2$$TR,"BlackDiamond"$
$ID,2$I64 best_score=35;
$ID,-2$$TR,"CastleFrankenstein"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"ZoneOut"$
$ID,2$F64 best_score=95.3249;
$ID,-2$$TR,"Varoom"$
$ID,2$F64 best_score=11.8623;
$ID,-2$$TR,"BugBird"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"TimeOut"$
$ID,2$I64 best_score=0;
$ID,-2$$TR,"RawHide"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"KeepAway"$
$ID,2$I64 best_score0=0,best_score1=9999;
$ID,-2$$TR,"XCaliber"$
$ID,2$I64 best_score=70;
I64 msg_flags=1;
$ID,-2$$TR,"Wenceslas"$
$ID,2$F64 best_score=9999.0000;
$ID,-2$$TR,"BulgeBomber"$
$ID,2$I64 best_score=45;
$ID,-2$$ID,-2$
+85 -35
View File
@@ -57,23 +57,23 @@ Bool ChkDrvModelSerial(U8 drv_let,U8 *model,U8 *serial)
}
#define SLOP BLK_SIZE
U0 TSBootDrv1()
U0 TSBootRescueDrv1()
{
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
bfh(I64)+=bfh->file_size-1;
DefinePrint("TS_BOOT_DRV_START","0x%X",CeilI64(SYS_KERNEL_END+SLOP,BLK_SIZE));
DefinePrint("TS_BOOT_DRV_END", "0x%X",FloorI64(
DefinePrint("TS_BOOT_RESCUE_DRV_START","0x%X",CeilI64(SYS_KERNEL_END+SLOP,BLK_SIZE));
DefinePrint("TS_BOOT_RESCUE_DRV_END", "0x%X",FloorI64(
(BOOT_RAM_LIMIT-(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4<<4-
(bfh(I64)-SYS_KERNEL_END)-SLOP,BLK_SIZE));
DefinePrint("CFG_BOOT_DRV_FILE","\"/Temp/BootDrv.BIN.Z\"");
} TSBootDrv1;
DefinePrint("CFG_BOOT_RESCUE_DRV_FILE","\"/Temp/BootRescueDrv.BIN.Z\"");
} TSBootRescueDrv1;
U0 TSBootDrv2()
U0 TSBootRescueDrv2()
{
DefinePrint("CFG_BOOT_DRV","\"a10x%X\n0x%X\n\"",TS_BOOT_DRV_START,
(TS_BOOT_DRV_END-TS_BOOT_DRV_START)/BLK_SIZE);
DefinePrint("CFG_BOOT_DRV_START","\"0x%X\"",TS_BOOT_DRV_START);
} TSBootDrv2;
DefinePrint("CFG_BOOT_RESCUE_DRV","\"a10x%X\n0x%X\n\"",TS_BOOT_RESCUE_DRV_START,
(TS_BOOT_RESCUE_DRV_END-TS_BOOT_RESCUE_DRV_START)/BLK_SIZE);
DefinePrint("CFG_BOOT_RESCUE_DRV_START","\"0x%X\"",TS_BOOT_RESCUE_DRV_START);
} TSBootRescueDrv2;
U0 TSEmployeeSet()
{
@@ -86,9 +86,10 @@ U0 TSEmployeeSet()
U0 TSBlogDirSet()
{
CDate cdt=Now;
CDateStruct ds;
Date2Struct(&ds,Now+local_time_offset);
DefinePrint("TS_BLOG_DIR","\"/Accts/TS/Wb2/Rants/%s/%04d/%02d\"",
TS_EMPLOYEE,Year(cdt),Month(cdt));
TS_EMPLOYEE,ds.year,ds.mon);
} TSBlogDirSet;
#define CID_DFT 0
@@ -103,7 +104,6 @@ U0 TSIDComputer()
/* My TAD8 computer died. It had two hard drives. You could
boot it directly or from VMware with a physical drive.
CMemE820 *m20=SYS_MEM_E820;
if (IsDrvVMware('D') && DrvMaxBlk('D')==0x575466EF)
ts_cid=CID_TAD8_VM; //VMware boot of TAD8
@@ -135,7 +135,7 @@ U0 TSInit()
if (ts_cid==CID_TAD8) {
DefinePrint("TS_HDS","\"DEI\"");
DefinePrint("TS_MASTER_BOOT_DRVS","\"I\"");
} else { //CID_TAD8_VM
} else {//CID_TAD8_VM
DefinePrint("TS_HDS","\"DE\"");
DefinePrint("TS_MASTER_BOOT_DRVS","\"\"");
}
@@ -149,7 +149,7 @@ U0 TSInit()
case CID_DFT:
DefinePrint("CFG_ACCT","\"\nTS/TAD\n\"");
DefinePrint("CFG_RAM_DRVS","\"b1\nScale2Mem(2048,0x40000)\n\"");
if (sys_auto_mount_ide_cnt) {
if (dsk.auto_mount_ide_cnt) {
//If AutoMount was successful, No need to manually mount in next compile
DefinePrint("CFG_HARD_DRVS","\"\"");
DefinePrint("CFG_CDROM_DRVS","\"\"");
@@ -186,7 +186,7 @@ U0 TSInit()
DefinePrint("TS_MASTER_BOOT_DRVS","\"D\"");
DefinePrint("TS_MAIN_DRV","\"D\"");
DefinePrint("TS_BAK_DRV","\"E\"");
DefinePrint("TS_BOOT_DRV","\"A\"");
DefinePrint("TS_BOOT_RESCUE_DRV","\"A\"");
DefinePrint("TS_RAM_DRV","\"B\"");
DefinePrint("TS_WIN_DRV","\"\"");
DefinePrint("TS_CDROM_DRV","\"T\"");
@@ -197,7 +197,7 @@ U0 TSInit2()
{
DefinePrint("TS_MAIN_DRV_LET","'%s'",TS_MAIN_DRV);
DefinePrint("TS_BAK_DRV_LET","'%s'",TS_BAK_DRV);
DefinePrint("TS_BOOT_DRV_LET","'%s'",TS_BOOT_DRV);
DefinePrint("TS_BOOT_RESCUE_DRV_LET","'%s'",TS_BOOT_RESCUE_DRV);
DefinePrint("TS_RAM_DRV_LET","'%s'",TS_RAM_DRV);
DefinePrint("TS_WIN_DRV_LET","'%s'",TS_WIN_DRV);
DefinePrint("TS_CDROM_DRV_LET","'%s'",TS_CDROM_DRV);
@@ -206,7 +206,7 @@ U0 TSInit2()
Bool ts_has_main_drv =ToBool(StrLen(TS_MAIN_DRV)),
ts_has_bak_drv =ToBool(StrLen(TS_BAK_DRV)),
ts_has_boot_drv =ToBool(StrLen(TS_BOOT_DRV)),
ts_has_boot_rescue_drv =ToBool(StrLen(TS_BOOT_RESCUE_DRV)),
ts_has_ram_drv =ToBool(StrLen(TS_RAM_DRV)),
ts_has_win_drv =ToBool(StrLen(TS_WIN_DRV)),
ts_has_cdrom_drv=ToBool(StrLen(TS_CDROM_DRV));
@@ -215,8 +215,8 @@ if (ts_has_main_drv)
SetDrvTextAttr(TS_MAIN_DRV_LET, WHITE <<4|BLUE);
if (ts_has_bak_drv)
SetDrvTextAttr(TS_BAK_DRV_LET, WHITE <<4|RED);
if (ts_has_boot_drv)
SetDrvTextAttr(TS_BOOT_DRV_LET, BLUE <<4|BROWN);
if (ts_has_boot_rescue_drv)
SetDrvTextAttr(TS_BOOT_RESCUE_DRV_LET, BLUE <<4|BROWN);
if (ts_has_ram_drv)
SetDrvTextAttr(TS_RAM_DRV_LET, BLUE <<4|YELLOW);
if (ts_has_win_drv)
@@ -234,9 +234,8 @@ if (ts_has_cdrom_drv)
#define TS_CFG "\n" CFG_RAM_DRVS CFG_CDROM_DRVS CFG_HARD_DRVS CFG_ACCT CFG_DSK_CACHE CFG_OPTS
#define TS_MENU_CFG "\n" CFG_RAM_DRVS CFG_CDROM_DRVS CFG_HARD_DRVS "\n\n" CFG_DSK_CACHE CFG_OPTS
#define TS_CDROM_CFG "Tb1\n0x20000\nt3 \n\nTS\n\nAutoMountIDE\nDT\n"
#define TS_CDROM_DBG_CFG "A" CFG_BOOT_DRV "b1\nScale2Mem(2048,0x40000)\n\n\n\n"\
"DontProbe\nBootDrv\n" TS_MAIN_DRV ":" CFG_BOOT_DRV_FILE "\n" CFG_BOOT_DRV_START "\n\n"
#define TS_CDROM_DBG_CFG "A" CFG_BOOT_RESCUE_DRV "b1\nScale2Mem(2048,0x40000)\n\n\n\n"\
"DontProbe\nBootRescueDrv\n" TS_MAIN_DRV ":" CFG_BOOT_RESCUE_DRV_FILE "\n" CFG_BOOT_RESCUE_DRV_START "\n\n"
//$BK,1$Change these, too...$BK,0$
//$MA-X+PU,"STD_DISTRO_CDROM_CFG",LM="F(\"STD_DISTRO_CDROM_CFG\");View;"$
//$LK,"Install Acct",A="FF:::/Accts/Install/DoOnce.CPP,MakeOSPrtBootInstall"$
@@ -244,8 +243,7 @@ if (ts_has_cdrom_drv)
Bool frame_grabber_on=FALSE;
#define VIDEO_FRAME_RATE 8
U0 FrameGrabberTask(I64)
{
/**** TO MAKE MOVIE ****
{/**** TO MAKE MOVIE ****
TempleOS
<ALT-SHIFT-V>
@@ -267,29 +265,33 @@ Boot Windows
Silent(ON); //no output to screen
MkDir("::/Temp/ScreenShots");
while (frame_grabber_on) {
SPrint(buf,"::/Temp/ScreenShots/VID%05d.BMP.Z",frame_num++);
StrPrint(buf,"::/Temp/ScreenShots/VID%05d.BMP.Z",frame_num++);
StrCpy(buf2,buf);
BMPFileCaptureScreen(buf);
while (TRUE) {
end_time+=1.0/VIDEO_FRAME_RATE;
if (end_time<tS) {
SPrint(buf,"::/Temp/ScreenShots/VID%05d.BMP.Z",frame_num++);
StrPrint(buf,"::/Temp/ScreenShots/VID%05d.BMP.Z",frame_num++);
Copy(buf2,buf);
} else
break;
}
SleepUntil(sys_jiffies+(end_time-tS)*JIFFY_FREQ);
SleepUntil(cnts.jiffies+(end_time-tS)*JIFFY_FREQ);
}
}
U0 CopyVideo()
I64 CopyVideo()
{
I64 result=0;
if (ts_has_bak_drv) {
Del(TS_BAK_DRV ":/Temp/*.SND");
SndFileCreate(TS_BAK_DRV ":/Temp/Audio",0.23,0.0,WF_SQUARE,0.45,0.35);
DelTree(TS_BAK_DRV ":/Temp/ScreenShots");
CopyTree("::/Temp/ScreenShots",TS_BAK_DRV ":/Temp/ScreenShots");
result=Unzip(TS_BAK_DRV ":/Temp/ScreenShots/*.Z");
}
"$$BK,1$$Files Copied:%d$$BK,0$$ Time:%8.3fm\n",result,result/60.0/VIDEO_FRAME_RATE;
return result;
}
public U0 FrameGrabberToggle()
@@ -300,13 +302,13 @@ public U0 FrameGrabberToggle()
if (frame_grabber_on) {
frame_grabber_on=FALSE;
Snd(0);
wallpaper_record_on=snd_record=FALSE;
wall->record=snd.record=FALSE;
Sleep(1000);
CopyVideo;
} else {
frame_grabber_on=TRUE;
Spawn(&FrameGrabberTask,NULL,"Frame Grabber");
wallpaper_record_on=snd_record=TRUE;
wall->record=snd.record=TRUE;
Snd(0);
}
}
@@ -345,7 +347,7 @@ U0 JukeSongsPut(U8 *dir,I64 start_song,I64 end_song)
tempde=tempde->next;
}
DirLstDel(tempde1);
DirTreeDel(tempde1);
}
public U0 JukeLines(I64 start_line,I64 end_line)
@@ -353,10 +355,10 @@ public U0 JukeLines(I64 start_line,I64 end_line)
WordStat;
if (!frame_grabber_on)
FrameGrabberToggle;
JukeSongsPuppet("::/Apps/MusicOrgan/Examples",,start_line*5,end_line*5);
JukeSongsPuppet("::/Apps/Psalmody/Examples",,start_line*5,end_line*5);
if (frame_grabber_on)
FrameGrabberToggle;
JukeSongsPut("::/Apps/MusicOrgan/Examples",start_line*5,end_line*5);
JukeSongsPut("::/Apps/Psalmody/Examples",start_line*5,end_line*5);
}
public U0 ChkAll()
@@ -389,7 +391,7 @@ public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
best_score=MAX_I64;
best_ch=0;
ptr=&gr_font[32*FONT_HEIGHT];
ptr=&text.font[32*FONT_HEIGHT];
for (ch=32;ch<127;ch++) {
diff_image=*ptr++ ^ cur_char_image;
score=0;
@@ -438,3 +440,51 @@ public U0 BMP2TXT(U8 *_in_name,U8 *_out_name=NULL)
Free(in_name);
Free(out_name);
}
U0 DblSpaceScanFile(U8 *filename)
{
CDoc *doc=DocRead(filename);
I64 i;
CDocEntry *doc_e=doc->root.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_NEW_LINE &&
doc_e->next->type_u8==DOCT_NEW_LINE &&
doc_e->next->next->type_u8==DOCT_NEW_LINE) {
i=0;
while (doc_e->type_u8==DOCT_NEW_LINE) {
i++;
doc_e=doc_e->next;
}
"%02d:",i;
PutFileLink(doc->filename.name,doc_e->y);
'\n';
} else
doc_e=doc_e->next;
}
DocDel(doc);
}
U0 DblSpaceScanLst(CDirEntry *tempde)
{
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr & RS_ATTR_DIR) {
if (tempde->sub) {
"Scanning Directory: %s\n",tempde->full_name;
DblSpaceScanLst(tempde->sub);
}
} else
DblSpaceScanFile(tempde->full_name);
DirEntryDel(tempde);
tempde=tempde1;
}
}
public U0 DblSpaceScan(U8 *files_find_mask="*",U8 *fu_flags=NULL)
{
I64 f=0;
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r+T");
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
DblSpaceScanLst(FilesFind(files_find_mask,f));
}
+140 -154
View File
@@ -1,11 +1,11 @@
//The CFG defines are $LK,"Here",A="FI:::/Demo/AcctExample/TSAdam.CPP"$.
U8 TSPmtDrv()
U8 TSGetDrv()
{
I64 result;
"Drive (%s):",TS_HDS;
result=ToUpper(GetChar);
NewLine;
'\n';
return result;
}
@@ -37,8 +37,8 @@ U0 TSCopyDrv(U8 src,U8 dst)
Fmt(dst,,FALSE,PT_FAT32);
SPrint(buf_s,"%c:/",src);
SPrint(buf_d,"%c:/",dst);
StrPrint(buf_s,"%c:/",src);
StrPrint(buf_d,"%c:/",dst);
CopyTree(buf_s,buf_d);
DocClear;
@@ -46,13 +46,13 @@ U0 TSCopyDrv(U8 src,U8 dst)
TSMakeOSPrtBootInstall(dst);
}
U0 TSPmtCopyDrv()
U0 TSPromptAndCopyDrv()
{
I64 src,dst;
"$$RED$$\nCopy Src Drive:\n$$FG$$";
src=TSPmtDrv;
src=TSGetDrv;
"$$RED$$\nCopy Dst Drive:\n$$FG$$";
dst=TSPmtDrv;
dst=TSGetDrv;
TSCopyDrv(src,dst);
}
@@ -73,28 +73,7 @@ public U0 CursorRem(U8 *files_find_mask="*")
Touch(tempde->full_name,"",,tempde->datetime);
tempde=tempde->next;
}
DirLstDel(tempde1);
}
public U0 CursorTopFile(U8 *filename)
{
CDoc *doc;
doc=DocRead(filename,DOCF_PLAIN_TEXT);
doc->cur_entry=doc->root.next;
DocWrite(doc);
DocDel(doc);
}
public U0 CursorTop(U8 *files_find_mask="*")
{
I64 fuf_flags=0;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
CDirEntry *tempde=FilesFind(files_find_mask,fuf_flags),*tempde1=tempde;
while (tempde) {
CursorTopFile(tempde->full_name);
Touch(tempde->full_name,"",,tempde->datetime);
tempde=tempde->next;
}
DirLstDel(tempde1);
DirTreeDel(tempde1);
}
U0 UncollapseFile(U8 *filename,I64 *)
@@ -115,24 +94,24 @@ U0 Uncollapse(U8 *files_find_mask="*",U8 *fu_flags=NULL)
Touch(tempde->full_name,"",,tempde->datetime);
tempde=tempde->next;
}
DirLstDel(tempde1);
DirTreeDel(tempde1);
}
public U0 CopySongs(U8 threshold='7')
{
CDoc *s;
CDocEntry *doc_e;
CDirEntry *tempde=FilesFind("/Accts/TS/TAD/MusicOrgan/*.CPP*",FUF_CLUSTER_ORDER),*tempde1=tempde;
DelTree("/Apps/MusicOrgan/Examples");
MkDir("/Apps/MusicOrgan/Examples");
CDirEntry *tempde=FilesFind("/Accts/TS/TAD/Psalmody/*.CPP*",FUF_CLUSTER_ORDER),*tempde1=tempde;
DelTree("/Apps/Psalmody/Examples");
MkDir("/Apps/Psalmody/Examples");
while (tempde) {
s=DocRead(tempde->full_name);
doc_e=s->root.next;
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[2]>=threshold)
Copy(tempde->full_name,"/Apps/MusicOrgan/Examples");
Copy(tempde->full_name,"/Apps/Psalmody/Examples");
tempde=tempde->next;
}
DirLstDel(tempde1);
DirTreeDel(tempde1);
}
U0 DistroPrep()
@@ -158,49 +137,54 @@ U0 DistroPrep()
DelTree("/Demo/AcctExample");
CopyTree("/Accts/TS","/Demo/AcctExample");
DelTree("/Demo/AcctExample/TAD/MusicOrgan");
DelTree("/Demo/AcctExample/TAD/Psalmody");
DelTree("/Demo/AcctExample/Wb2");
Del("/Demo/AcctExample/TAD/Test*");
DelTree("/Demo/AcctExample/TAD");
CursorTop("/*");
//Once in a while, do these:
// TSSortHeaders;
// DocOpt("/*");
// DblSpaceScan("/*");
CursorRem("/*");
DelTree("/Demo/*.BI*");
S2T("/*","+r+S");
DocOpt("/*");
Move(WSD_DEF_FILENAME,WSD_DEF_FILENAME_Z);
}
U0 MakeBootDrvFile()
U0 MakeBootRescueDrvFile()
{
try
PrtChk(Drv2Prt(TS_BOOT_DRV_LET));
PrtChk(Drv2Prt(TS_BOOT_RESCUE_DRV_LET));
catch {
Fs->catch_except=TRUE;
Auto(CFG_BOOT_DRV "\n");
Auto(CFG_BOOT_RESCUE_DRV "\n");
Mount;
}
CBlkDev *bdev=Drv2BlkDev(TS_BOOT_DRV_LET);
Fmt(TS_BOOT_DRV_LET,,FALSE,PT_REDSEA);
CBlkDev *bdev=Drv2BlkDev(TS_BOOT_RESCUE_DRV_LET);
Fmt(TS_BOOT_RESCUE_DRV_LET,,FALSE,PT_REDSEA);
MkDir(TS_BOOT_DRV ":/Compiler");
Copy(TS_MAIN_DRV ":/Compiler/Compiler.BIN.Z", TS_BOOT_DRV ":/Compiler");
Copy(TS_MAIN_DRV ":/Compiler/OpCodes.TXT.Z", TS_BOOT_DRV ":/Compiler");
Copy(TS_MAIN_DRV ":/Compiler/CmpDefs.HPP.Z", TS_BOOT_DRV ":/Compiler");
Copy(TS_MAIN_DRV ":/Compiler/Cmp.HPP.Z", TS_BOOT_DRV ":/Compiler");
MkDir(TS_BOOT_RESCUE_DRV ":/Compiler");
Copy(TS_MAIN_DRV ":/Compiler/Compiler.BIN.Z", TS_BOOT_RESCUE_DRV ":/Compiler");
Copy(TS_MAIN_DRV ":/Compiler/OpCodes.TXT.Z", TS_BOOT_RESCUE_DRV ":/Compiler");
Copy(TS_MAIN_DRV ":/Compiler/CmpDefs.HPP.Z", TS_BOOT_RESCUE_DRV ":/Compiler");
Copy(TS_MAIN_DRV ":/Compiler/Cmp.HPP.Z", TS_BOOT_RESCUE_DRV ":/Compiler");
MkDir(TS_BOOT_DRV ":/Kernel");
Copy(TS_MAIN_DRV ":/Kernel/*.HPP*", TS_BOOT_DRV ":/Kernel");
Copy(TS_MAIN_DRV ":/Kernel/Adam1*", TS_BOOT_DRV ":/Kernel");
CopyTree(TS_MAIN_DRV ":/Kernel/Dsk", TS_BOOT_DRV ":/Kernel/Dsk");
MkDir(TS_BOOT_RESCUE_DRV ":/Kernel");
Copy(TS_MAIN_DRV ":/Kernel/*.HPP*", TS_BOOT_RESCUE_DRV ":/Kernel");
Copy(TS_MAIN_DRV ":/Kernel/Adam1*", TS_BOOT_RESCUE_DRV ":/Kernel");
CopyTree(TS_MAIN_DRV ":/Kernel/Dsk", TS_BOOT_RESCUE_DRV ":/Kernel/Dsk");
MkDir(TS_BOOT_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Accts/TS/DbgAdam2.CPP.Z", TS_BOOT_DRV ":/Adam/Adam2.CPP.Z");
Copy(TS_MAIN_DRV ":/Adam/AdamExt.HPP.Z", TS_BOOT_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Adam/Math2a.CPP.Z", TS_BOOT_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Adam/Training.CPP.Z", TS_BOOT_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Adam/Utils2a.CPP.Z", TS_BOOT_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Adam/MathODE.CPP.Z", TS_BOOT_DRV ":/Adam");
MkDir(TS_BOOT_RESCUE_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Accts/TS/DbgAdam2.CPP.Z", TS_BOOT_RESCUE_DRV ":/Adam/Adam2.CPP.Z");
Copy(TS_MAIN_DRV ":/Adam/AdamExts.HPP.Z", TS_BOOT_RESCUE_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Adam/Math2a.CPP.Z", TS_BOOT_RESCUE_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Adam/Training.CPP.Z", TS_BOOT_RESCUE_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Adam/Utils2a.CPP.Z", TS_BOOT_RESCUE_DRV ":/Adam");
Copy(TS_MAIN_DRV ":/Adam/MathODE.CPP.Z", TS_BOOT_RESCUE_DRV ":/Adam");
FileWrite(TS_MAIN_DRV ":" CFG_BOOT_DRV_FILE,bdev->RAM_dsk,(bdev->max_blk+1)<<BLK_SIZE_BITS);
FileWrite(TS_MAIN_DRV ":" CFG_BOOT_RESCUE_DRV_FILE,bdev->RAM_dsk,(bdev->max_blk+1)<<BLK_SIZE_BITS);
}
U0 MakeSymFiles()
@@ -280,10 +264,10 @@ I64 MakeLineRepFile()
DocPrint(doc,"DefinePrint(\"DD_TEMPLEOS_LOC\",\"%,d\");\n",result);
DocPrint(doc,"DefinePrint(\"DD_TEMPLEOS_LOC_OFFICIAL\",\"%,d\");\n",official);
st=MPrint("%,d",result);
st=MStrPrint("%,d",result);
DefineLoad("DD_TEMPLEOS_LOC",st);
Free(st);
st=MPrint("%,d",official);
st=MStrPrint("%,d",official);
DefineLoad("DD_TEMPLEOS_LOC_OFFICIAL",st);
Free(st);
@@ -295,7 +279,15 @@ I64 MakeLineRepFile()
}
U0 TSDistroPrep()
{
{/*This is the Trivial Solution internal company distro. Only run this on a
virtual machine, not bare metal hardware because it's settings could cause
problems. The hard drive must be partitioned. Install Std Distro, then
install this on top.
>$LK,"TSInstall",A="FF:::/Demo/AcctExample/TSDistro.CPP,TSInstall"$;
>$LK,"TSUpgrade",A="FF:::/Demo/AcctExample/TSDistro.CPP,TSUpgrade"$;
See $LK,"MakeDistrosAndBackUp",A="FF:::/Demo/AcctExample/TSDistro.CPP,MakeDistrosAndBackUp"$() to reproduce the ISO's in $FG,4$E:/Wb$FG$. It makes this
website, too.
*/
Drv(TS_MAIN_DRV_LET);
DistroPrep;
Auto(TS_CDROM_CFG);
@@ -303,20 +295,52 @@ U0 TSDistroPrep()
DelTree(TS_DISTRO_DIR);
CopyTree(TS_MAIN_DRV ":/",TS_DISTRO_DIR "/");
}
U0 MakeTSDistro()
{
TSDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSTS_SIZE",
"Download $TX,"TempleOS V2.10",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1f MB)",
0.1*(10*Size(TS_ISO_NAME,"+s")/1024/1024));
Drv(TS_MAIN_DRV_LET);
}
U0 DbgDistroPrep()
{
if (ts_has_boot_drv) {
{/*This is a debug distro. The CDROM bootloader uses BIOS INT 0x13 0x42 to
load Kernel.BIN.C which has been modified to also hold a small RAM drive
(Drive A) that fits in the low 640k. The bootloader starts in real mode
and the kernel changes to long, 64-bit mode. It loads the 64-bit compiler
and assembler, compiles some, but not all, of the normal start-up scripts
and drops you off at the $LK,"Dbg",A="MN:Dbg"$ command-line where you can JIT compile,
use $LK,"EdLite",A="MN:EdLite"$ on RAM files, and use many of the other normal Kernel commands.
I could not fit all the normal start-up scripts into the small RAM drive,
so you do not have the window manager or normal document framework. You
should have many Gig of RAM to play with with RAM Drive B, a high memory
RAM drive, but you have only those few files. When I generate this distro,
I call $LK,"MakeBootDrvFile",A="FF:::/Demo/AcctExample/TSDistro.CPP,MakeBootRescueDrvFile"$.
*/
if (ts_has_boot_rescue_drv) {
Drv(TS_MAIN_DRV_LET);
DistroPrep;
MakeBootDrvFile;
MakeBootRescueDrvFile;
Auto(TS_CDROM_DBG_CFG);
MakeOSPrtBootInstall(TS_MAIN_DRV_LET,TS_CDROM_DRV_LET);
DelTree(TS_DISTRO_DIR);
CopyTree(TS_MAIN_DRV ":/",TS_DISTRO_DIR "/");
Del(TS_MAIN_DRV ":" CFG_BOOT_DRV_FILE);
Del(TS_MAIN_DRV ":" CFG_BOOT_RESCUE_DRV_FILE);
}
}
U0 MakeDbgDistro()
{
DbgDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSDBG_SIZE",
"Download $TX,"TempleOS V2.10",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1f MB)",
0.1*(10*Size(TS_ISO_NAME,"+s")/1024/1024));
Drv(TS_MAIN_DRV_LET);
}
U0 StdDistroPrep()
{
@@ -330,9 +354,22 @@ U0 StdDistroPrep()
Del(TS_DISTRO_DIR "/0000Boot/OldMBR.BIN.C");
Del(TS_DISTRO_DIR "/0000Boot/BootMHD2.BIN.C");
}
U0 MakeStdDistro()
{
StdDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
Drv(TS_MAIN_DRV_LET);
}
U0 LiteDistroPrep()
{
{/*Missing: Dictionary, Bible and TSZ Utility. Still 100% OpenSource.
Includes: x86_64 64BitMultiCoredKernel, 64BitCompiler, Assembler,
Unassembler, Debugger, Editor, VGAGraphics, Tools, BootLoaders,
Keyboard&Mouse, HardDrives, FAT32, Partitioner, CD/DVD, ISO9660FileCreator,
FileManager, WindowManager, PCSpeaker, Apps, Games, God-Oracle-App, Hymns,
Demos, Documentation.
*/
Drv(TS_MAIN_DRV_LET);
DistroPrep;
Auto(STD_DISTRO_CDROM_CFG);
@@ -348,9 +385,23 @@ U0 LiteDistroPrep()
Del(TS_DISTRO_DIR "/Misc/PCIDevices.TXT.Z");
Del(TS_DISTRO_DIR "/Misc/Bible.TXT.Z");
}
U0 MakeLiteDistro()
{
LiteDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSLITE_SIZE",
"Download $TX,"TempleOS V2.10",D="DD_OS_NAME_VERSION"$ - Lite Distro (%0.1f MB)",
0.1*(10*Size(TS_ISO_NAME,"+s")/1024/1024));
Drv(TS_MAIN_DRV_LET);
}
U0 UltraDistroPrep()
{
{/*Missing: Apps, Demos, Dictionary, Bible and TSZ Utility. Still 100% OpenSource.
Includes: x86_64 64BitMultiCoredKernel, 64BitCompiler, Assembler,
Unassembler, Debugger, Editor, VGAGraphics, Tools, BootLoaders,
Keyboard&Mouse, HardDrives, FAT32, Partitioner, CD/DVD, ISO9660FileCreator,
FileManager, WindowManager, PCSpeaker, Documentation.
*/
Drv(TS_MAIN_DRV_LET);
DistroPrep;
Auto(STD_DISTRO_CDROM_CFG);
@@ -370,39 +421,13 @@ U0 UltraDistroPrep()
Del(TS_DISTRO_DIR "/Misc/Bible.TXT.Z");
Del(TS_DISTRO_DIR "/Adam/God/Vocab.TXT.Z");
}
U0 MakeTSDistro()
{
TSDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
Drv(TS_MAIN_DRV_LET);
}
U0 MakeDbgDistro()
{
DbgDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
Drv(TS_MAIN_DRV_LET);
}
U0 MakeStdDistro()
{
StdDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
Drv(TS_MAIN_DRV_LET);
}
U0 MakeLiteDistro()
{
LiteDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
Drv(TS_MAIN_DRV_LET);
}
U0 MakeUltraDistro()
{
UltraDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_DISTRO_DIR "/*",,TS_DISTRO_DIR BOOT_DIR_KERNEL_BIN_C);
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
"Download $TX,"TempleOS V2.10",D="DD_OS_NAME_VERSION"$ - UltraLite Distro (%0.1f MB)",
0.1*(10*Size(TS_ISO_NAME,"+s")/1024/1024));
Drv(TS_MAIN_DRV_LET);
}
@@ -441,7 +466,7 @@ U0 MakeWebSite()
TSWebFile(tempde->full_name);
tempde=tempde->next;
}
DirLstDel(tempde1);
DirTreeDel(tempde1);
Drv(TS_MAIN_DRV_LET);
}
}
@@ -451,31 +476,31 @@ U0 FreshenWebDir(U8 *dirname)
CDirEntry *tempde,*tempde1;
U8 *src,*dst;
src=MPrint(TS_BAK_DRV ":/Wb%s/*",dirname);
src=MStrPrint(TS_BAK_DRV ":/Wb%s/*",dirname);
Del(src);
Free(src);
src=MPrint(TS_MAIN_DRV ":%s/*",dirname);
dst=MPrint(TS_BAK_DRV ":/Wb%s",dirname);
src=MStrPrint(TS_MAIN_DRV ":%s/*",dirname);
dst=MStrPrint(TS_BAK_DRV ":/Wb%s",dirname);
Copy(src,dst);
Free(src);
Free(dst);
src=MPrint(TS_BAK_DRV ":/Uncompressed%s/*",dirname);
src=MStrPrint(TS_BAK_DRV ":/Uncompressed%s/*",dirname);
Del(src);
Free(src);
src=MPrint(TS_MAIN_DRV ":%s/*",dirname);
dst=MPrint(TS_BAK_DRV ":/Uncompressed%s",dirname);
src=MStrPrint(TS_MAIN_DRV ":%s/*",dirname);
dst=MStrPrint(TS_BAK_DRV ":/Uncompressed%s",dirname);
Copy(src,dst);
Free(src);
Free(dst);
src=MPrint(TS_BAK_DRV ":/Wb%s/*",dirname);
src=MStrPrint(TS_BAK_DRV ":/Wb%s/*",dirname);
tempde=tempde1=FilesFind(src,FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
while (tempde) {
TSWebFile(tempde->full_name);
tempde=tempde->next;
}
DirLstDel(tempde1);
DirTreeDel(tempde1);
}
U0 MakeWebSitePartial()
@@ -488,47 +513,24 @@ U0 MakeWebSitePartial()
}
}
U0 TSUncompress()
I64 TSUncompress()
{
U8 *st;
CDirEntry *tempde,*tempde1;
I64 result=0;
if (ts_has_bak_drv) {
DelTree(TS_BAK_DRV ":/Uncompressed");
CopyTree(TS_MAIN_DRV ":/",TS_BAK_DRV ":/Uncompressed");
tempde=tempde1=FilesFind(TS_BAK_DRV ":/Uncompressed/*.Z",FUF_RECURSE|FUF_JUST_FILES|FUF_CLUSTER_ORDER);
while (tempde) {
st=StrNew(tempde->full_name);
StrLastRem(st,".");
Move(tempde->full_name,st);
Free(st);
tempde=tempde->next;
}
DirLstDel(tempde1);
result=Unzip(TS_BAK_DRV ":/Uncompressed/*.Z");
CursorRem(TS_BAK_DRV ":/Uncompressed/*");
}
"Files Copied:%d\n",result;
return result;
}
U0 UpdateISODocDefines()
{
DefinePrint("DD_TEMPLEOSTS_SIZE",
"Download $TX,"TempleOS V2.03",D="DD_OS_NAME_VERSION"$ - T.S. Company Internal Distro (%0.1f MB)",
0.1*(10*Size(TS_BAK_DRV ":/Wb/TempleOSTS.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSDBG_SIZE",
"Download $TX,"TempleOS V2.03",D="DD_OS_NAME_VERSION"$ - Debug Distro (%0.1f MB)",
0.1*(10*Size(TS_BAK_DRV ":/Wb/TempleOSDbg.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSCD_SIZE",
"Download $TX,"TempleOS V2.03",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1f MB)",
"Download $TX,"TempleOS V2.10",D="DD_OS_NAME_VERSION"$ - Standard Distro (%0.1f MB)",
0.1*(10*Size(TS_BAK_DRV ":/Wb/TempleOSCD.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSLITE_SIZE",
"Download $TX,"TempleOS V2.03",D="DD_OS_NAME_VERSION"$ - Lite Distro (%0.1f MB)",
0.1*(10*Size(TS_BAK_DRV ":/Wb/TempleOSLite.ISO","+s")/1024/1024));
DefinePrint("DD_TEMPLEOSULTRA_SIZE",
"Download $TX,"TempleOS V2.03",D="DD_OS_NAME_VERSION"$ - UltraLite Distro (%0.1f MB)",
0.1*(10*Size(TS_BAK_DRV ":/Wb/TempleOSUltra.ISO","+s")/1024/1024));
}
UpdateISODocDefines;
@@ -537,7 +539,7 @@ public U0 MakeDistrosAndBackUp()
{
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
progress4=*progress4_desc=0;
progress4_max=19;
progress4_max=12;
WordStat;
WinMax;
WinBorder;
@@ -549,26 +551,10 @@ public U0 MakeDistrosAndBackUp()
CopyTree(TS_MAIN_DRV ":/",TS_BAK_DRV ":/Wb"); progress4++;
DocClear;
MakeTSDistro; progress4++;
DocClear;
Copy(TS_ISO_NAME,TS_BAK_DRV ":/Wb/TempleOSTS.ISO"); progress4++;
MakeDbgDistro; progress4++;
DocClear;
Copy(TS_ISO_NAME,TS_BAK_DRV ":/Wb/TempleOSDbg.ISO"); progress4++;
MakeStdDistro; progress4++;
DocClear;
Copy(TS_ISO_NAME,TS_BAK_DRV ":/Wb/TempleOSCD.ISO"); progress4++;
MakeLiteDistro; progress4++;
DocClear;
Copy(TS_ISO_NAME,TS_BAK_DRV ":/Wb/TempleOSLite.ISO"); progress4++;
MakeUltraDistro; progress4++;
DocClear;
Copy(TS_ISO_NAME,TS_BAK_DRV ":/Wb/TempleOSUltra.ISO"); progress4++;
UpdateISODocDefines;
Cd(TS_MAIN_DRV ":/");
@@ -587,7 +573,7 @@ public U0 MakeDistrosAndBackUp()
public U0 TSMount()
{
if (!sys_auto_mount_ide_cnt) {
if (!dsk.auto_mount_ide_cnt) {
Auto(CFG_HARD_DRVS "\n");
Mount;
}
+64 -24
View File
@@ -1,5 +1,5 @@
U0 BadCodeJump()
{ //$LK,"::/Adam/God/HSNotes.TXT"$
{//$LK,"::/Adam/God/HSNotes.TXT"$
CDirEntry *tempde1=FilesFind("/*",FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUSTER_ORDER),
*tempde=tempde1;
I64 cnt=0,num;
@@ -17,12 +17,12 @@ U0 BadCodeJump()
while (tempde) {
num-=tempde->user_data;
if (num<0) {
st=MPrint("FL:%s,%d",tempde->full_name,-num);
st=MStrPrint("FL:%s,%d",tempde->full_name,-num);
break;
}
tempde=tempde->next;
}
DirLstDel(tempde1);
DirTreeDel(tempde1);
Ed(st);
Free(st);
}
@@ -30,15 +30,15 @@ U0 BadCodeJump()
public U8 *FileNameNumNext(U8 *files_find_mask,U8 *fmt)
{
CDirEntry *tempde=FilesFind(files_find_mask);
U8 *result=MPrint(fmt,FileCnt(tempde));
DirLstDel(tempde);
U8 *result=MStrPrint(fmt,FileCnt(tempde));
DirTreeDel(tempde);
return result;
}
U0 DCImgWrite(CDC *dc)
{
U8 *st=FileNameNumNext("::" TS_BLOG_DIR "/Img*","::" TS_BLOG_DIR "/Img%03d.BMP"),*st2;
st2=MPrint("http://www.templeos.org/Wb%s",st+2);
st2=MStrPrint("http://www.templeos.org/Wb%s",st+2);
BMPFileWrite(st,dc);
Free(st);
"$$HC,\"<img src=\\\"%s\\\" width=\\\"%d\\\" height=\\\"%d\\\" alt=\\\"\\\">\"$$\n",st2,dc->width,dc->height;
@@ -49,13 +49,13 @@ U0 BlogScreenShot()
{
Bool old_cursor=DocCursor;
CDC *dc1,*dc2;
U8 *old_fp_draw_input_ptr=fp_draw_input_ptr;
fp_draw_input_ptr=NULL;
U8 *old_fp_draw_input_ptr=gr.fp_draw_input_ptr;
gr.fp_draw_input_ptr=NULL;
WinMgrSync(2);
dc1=DCCaptureScreen;
dc2=DCExtract(dc1,0,FONT_HEIGHT,GR_WIDTH-1,GR_HEIGHT-1);
DCImgWrite(dc2);
fp_draw_input_ptr=old_fp_draw_input_ptr;
gr.fp_draw_input_ptr=old_fp_draw_input_ptr;
DCDel(dc1);
DCDel(dc2);
DocCursor(old_cursor);
@@ -66,7 +66,7 @@ U8 *WebBookMarks(U8 *filename="HOME/Archive/Bookmarks.html")
U8 *st;
CDocEntry *doc_e;
CDoc *doc=DocNew;
CLex *lx=LexNew(MPrint("#include \"%s\"",filename));
CLex *lx=LexNew(MStrPrint("#include \"%s\"",filename));
while (Lex(lx))
if (lx->token==TK_STR && *lx->cur_str(U32 *)=='http') {
DocPrint(doc,"$$MU-UL,\"%Q\",LE=0x%X$$\n",lx->cur_str,lx->cur_str);
@@ -74,7 +74,10 @@ U8 *WebBookMarks(U8 *filename="HOME/Archive/Bookmarks.html")
}
LexDel(lx);
st=StrNew(PopUpMenu(doc));
if ((st=PopUpMenu(doc))!=DOCM_CANCEL)
st=StrNew(st);
else
st=NULL;
doc_e=doc->root.next;
while (doc_e!=doc) {
@@ -202,7 +205,7 @@ U0 MyBibleLines(U8 *st,I64 num_lines,I64 radix,Bool modulo,Bool plus_one)
U8 *verse;
if (*st && (doc_out=DocPut)) {
i=A2I64(st,radix);
i=Str2I64(st,radix);
if (modulo) {
DocPrint(doc_out,"$TX,"(Modulo is just remainder.)",HTML="http://en.wikipedia.org/wiki/Modulo_operation"$\n");
@@ -228,7 +231,7 @@ U0 MyBibleLines(U8 *st,I64 num_lines,I64 radix,Bool modulo,Bool plus_one)
doc_in=DocNew;
BibleLines(doc_in,start,num_lines);
while (TRUE) { //Del leading blanks
while (TRUE) {//Del leading blanks
doc_e=doc_in->root.next;
if (doc_e==doc_in)
break;
@@ -239,7 +242,7 @@ U0 MyBibleLines(U8 *st,I64 num_lines,I64 radix,Bool modulo,Bool plus_one)
break;
}
}
while (TRUE) { //Del trailing blanks
while (TRUE) {//Del trailing blanks
doc_e=doc_in->cur_entry->last;
if (doc_e==doc_in)
break;
@@ -256,14 +259,19 @@ U0 MyBibleLines(U8 *st,I64 num_lines,I64 radix,Bool modulo,Bool plus_one)
}
}
#define NIST_TIME_OFFSET (5*3600-353)
#define NIST_TIME_OFFSET 17586
public U0 SyncNIST()
{
I64 i,j;
CDate d;
CDateStruct ds;
while (!ScanChar) {
"%d %d\n",
ToI64 ((Now-A2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET),
FloorI64((Now-A2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET,60);
d=Now;
Date2Struct(&ds,d);
i=ToI64((d-Str2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET);
j=FloorI64(i,60);
"%d %d %02d %02d\n",i,j,ds.sec,(60+ds.sec-(i-j))%60;
Sleep(100);
}
}
@@ -273,7 +281,7 @@ U0 FillInMyURL()
U8 *tag,*st,*st2;
CWebBibleForm *url=CAlloc(sizeof(CWebBibleForm));
url->timestamp=
FloorI64((Now-A2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET,60);
FloorI64((Now-Str2Date("1/1/1970"))/CDATE_FREQ+NIST_TIME_OFFSET,60);
switch (PopUpPickLst("NISTBeacon\0WebBible\0YouTube\0Imgur\0Wikipedia\0RandomNumbers.info\0"
"Random.org\0VirtualNotary\0Nist\0HotBits\0GenerateData\0WebBookMark\0")) {
case 0:
@@ -282,7 +290,7 @@ U0 FillInMyURL()
"HTML=\"http://beacon.nist.gov/home\"$$\n\n"
"$$TX,\"Guidelines for Talking with God\","
"HTML=\"http://www.templeos.org/Wb/Adam/God/HSNotes.html\"$$\n\n";
tag=MPrint("http://beacon.nist.gov/rest/record/%d",url->timestamp);
tag=MStrPrint("http://beacon.nist.gov/rest/record/%d",url->timestamp);
"$$TX,\"%Q\",HTML=\"%Q\"$$\n\n",tag,tag;
Free(tag);
MyBibleLines(url->special,20,16,TRUE,TRUE);
@@ -292,7 +300,7 @@ U0 FillInMyURL()
if (DocFormDo(url(CWebBibleForm *))) {
tag=url->special;
st2=URLPercentSpaces(url->special);
st=MPrint("http://www.biblegateway.com/passage/?search=%s&version=NIV",st2);
st=MStrPrint("http://www.biblegateway.com/passage/?search=%s&version=NIV",st2);
Free(st2);
if (*url->tag)
tag=url->tag;
@@ -303,7 +311,7 @@ U0 FillInMyURL()
case 2:
if (DocFormDo(url(CYouTubeForm *))) {
if (url->min || url->sec)
st=MPrint("%s&hl=enUS&start=%d",url->special,url->min*60+url->sec);
st=MStrPrint("%s&hl=enUS&start=%d",url->special,url->min*60+url->sec);
else
st=StrNew(url->special);
"$$HC,\"<object width=\\\"640\\\" height=\\\"520\\\"><param name=\\\"movie\\\" "
@@ -325,7 +333,7 @@ U0 FillInMyURL()
case 4:
if (DocFormDo(url(CWikipediaForm *))) {
tag=url->special;
st=MPrint("http://en.wikipedia.org/wiki/%s",url->special);
st=MStrPrint("http://en.wikipedia.org/wiki/%s",url->special);
if (*url->tag)
tag=url->tag;
"$$TX,\"%Q\",HTML=\"%Q\"$$",tag,st;
@@ -357,7 +365,7 @@ U0 FillInMyURL()
tag="http://virtual-notary.org";
"$$TX,\"%Q\",HTML=\"%Q\"$$\n",tag,tag;
tag="Here is the certificate";
st=MPrint("http://www.templeos.org/Certs/virtual-notary-cert-randomnum-%d.p12",url->cert);
st=MStrPrint("http://www.templeos.org/Certs/virtual-notary-cert-randomnum-%d.p12",url->cert);
"\n$$TX,\"%Q: %d\",HTML=\"%Q\"$$.\n\n",tag,url->cert,st;
Free(st);
MyBibleLines(url->special,20,10,FALSE,FALSE);
@@ -402,3 +410,35 @@ U0 FillInMyURL()
}
Free(url);
}
public U0 GodBooksPassage(U8 *files_find_mask,I64 len=512)
{//Make God pick a book passage. $LK+PU,"Holy Spirit Instructions",A="FI:::/Adam/God/HSNotes.TXT"$
CDirEntry *tempm=FilesFind(files_find_mask,FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT),
*tempm1=tempm;
I64 i=0;
U8 *st,*st2=NULL;
while (tempm) {
st=FileRead(tempm->full_name);
tempm->user_data=StrLen(st);
if (tempm->user_data>=len)
i+=tempm->user_data+1-len;
Free(st);
tempm=tempm->next;
}
i=(GodBits(24)*i)>>24;
tempm=tempm1;
while (tempm) {
if (!st2 && tempm->user_data>=len) {
i-=tempm->user_data+1-len;
if (i<0) {
st=FileRead(tempm->full_name);
st2=st+(tempm->user_data+1-len)+i;
st2[len]=0;
"%s\n",st2;
Free(st);
}
}
tempm=tempm->next;
}
DirTreeDel(tempm1);
}
+276
View File
@@ -0,0 +1,276 @@
class CSHEntry
{
CDocEntry *next,*last;
};
class CSHSection
{
CDocEntry *next,*last;
};
U8 *SHSkipDataType(U8 *st)
{
if (!st)
return NULL;
while (Bt(chars_bitmap_white_space,*st))
st++;
if (*st=='#')
return st;
while (Bt(chars_bitmap_alpha_numeric,*st))
st++;
while (Bt(chars_bitmap_white_space,*st))
st++;
while (*st=='*')
st++;
return st;
}
U8 *SHSkipLabel(U8 *st)
{
if (!st)
return NULL;
while (Bt(chars_bitmap_white_space,*st))
st++;
while (Bt(chars_bitmap_alpha_numeric,*st))
st++;
while (Bt(chars_bitmap_white_space,*st))
st++;
return st;
}
U8 *SHNewEntry(CDocEntry *doc_e,I64 *_type=NULL)
{
U8 *st;
if (doc_e->type_u8==DOCT_TEXT && (st=doc_e->tag)) {
if (!StrNCmp("#help_index",st,11)) {
if (_type) *_type=0;
return st+11;
} else if (!StrNCmp("#help_file",st,10)) {
if (_type) *_type=1;
return st+10;//'#' makes it first alphabetically.
} else if (!StrNCmp("import",st,6)) {
if (_type) *_type=2;
return st+6;
} else if (!StrNCmp("public import",st,13)) {
if (_type) *_type=2;
return st+13;
} else if (!StrNCmp("_import",st,7)) {
if (_type) *_type=2;
return SHSkipLabel(st+7);
} else if (!StrNCmp("public _import",st,14)) {
if (_type) *_type=2;
return SHSkipLabel(st+14);
} else if (!StrNCmp("_intern",st,7)) {
if (_type) *_type=3;
return SHSkipLabel(st+7);
} else if (!StrNCmp("public _intern",st,14)) {
if (_type) *_type=3;
return SHSkipLabel(st+14);
} else if (!StrNCmp("extern",st,6)) {
if (_type) *_type=4;
return st+6;
} else if (!StrNCmp("public extern",st,13)) {
if (_type) *_type=4;
return st+13;
} else if (!StrNCmp("_extern",st,7)) {
if (_type) *_type=4;
return SHSkipLabel(st+7);
} else if (!StrNCmp("public _extern",st,14)) {
if (_type) *_type=4;
return SHSkipLabel(st+14);
}
}
if (_type) *_type=-1;
return NULL;
}
I64 SHCompareEntry(CSHEntry *e1,CSHEntry *e2)
{
U8 *st1,*st2;
I64 t1,t2;
if (e1 && e2 && e1->next!=e1 && e2->next!=e2) {
if (e1->next->type_u8==DOCT_TEXT && e2->next->type_u8==DOCT_TEXT) {
st1=SHNewEntry(e1->next,&t1);
st2=SHNewEntry(e2->next,&t2);
if (t1!=t2)
return t1-t2;
else {
if (st1&&st2) {
st1=SHSkipDataType(st1);
st2=SHSkipDataType(st2);
if (st1&&st2)
return StrCmp(st1,st2);
else
return Sign(st1-st2);
} else
return Sign(st1-st2);
}
} else
return Sign(e1->next-e2->next);
} else
return Sign(e1-e2);
}
U0 SHSortSection(CSHSection *temps)
{
I64 i=0,cnt;
CSHEntry **a;
CDocEntry *doc_e,*doc_e1;
cnt=0;
doc_e=temps->next;
while (doc_e!=temps) {
if (SHNewEntry(doc_e))
cnt++;
doc_e=doc_e->next;
}
cnt++;
a=MAlloc(sizeof(CSHEntry *)*cnt);
for (i=0;i<cnt;i++) {
a[i]=MAlloc(sizeof(CSHEntry));
QueInit(a[i]);
}
i=0;
doc_e=temps->next;
while (doc_e!=temps) {
doc_e1=doc_e->next;
QueRem(doc_e);
if (SHNewEntry(doc_e))
i++;
QueIns(doc_e,a[i]->last);
doc_e=doc_e1;
}
QSortI64(a,cnt,&SHCompareEntry);
for (i=0;i<cnt;i++) {
doc_e=a[i]->next;
while (doc_e!=a[i]) {
doc_e1=doc_e->next;
QueRem(doc_e);
QueIns(doc_e,temps->last);
doc_e=doc_e1;
}
Free(a[i]);
}
Free(a);
}
U8 *SHNewSection(CDocEntry *doc_e)
{
U8 *st;
if (doc_e->type_u8==DOCT_TEXT && (st=doc_e->tag)) {
if (!StrNCmp(st,"#help_index",11))
return st+11;
}
return NULL;
}
I64 SHCompareSection(CSHSection *e1,CSHSection *e2)
{
I64 i1,i2;
U8 *st1,*st2;
if (e1 && e2 && e1->next!=e1 && e2->next!=e2) {
if (e1->next->type_u8==DOCT_TEXT && e2->next->type_u8==DOCT_TEXT) {
st1=SHNewSection(e1->next);
st2=SHNewSection(e2->next);
if (st1&&st2) {
if (StrMatch("\"\"",st1))
i1=1;
else
i1=0;
if (StrMatch("\"\"",st2))
i2=1;
else
i2=0;
if (i1!=i2)
return i1-i2;
else
return StrCmp(st1,st2);
} else
return Sign(st1-st2);
} else
return Sign(e1->next-e2->next);
} else
return Sign(e1-e2);
}
public U0 TSSortHeader(U8 *name)
{
CDoc *doc;
I64 i=0,cnt;
CSHSection **a;
CDocEntry *doc_e,*doc_e1;
if (!name || !*name || !FileFind(name))
return;
doc=DocRead(name,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
cnt=1;
doc_e=doc->root.next;
while (doc_e!=doc) {
if (SHNewSection(doc_e))
cnt++;
doc_e=doc_e->next;
}
a=MAlloc(sizeof(CSHSection *)*cnt);
for (i=0;i<cnt;i++) {
a[i]=MAlloc(sizeof(CSHSection));
QueInit(a[i]);
}
i=0;
doc_e=doc->root.next;
while (doc_e!=doc) {
doc_e1=doc_e->next;
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag && *doc_e->tag) {
QueRem(doc_e);
if (SHNewSection(doc_e))
i++;
QueIns(doc_e,a[i]->last);
} else
DocEntryDel(doc,doc_e);
doc_e=doc_e1;
}
QSortI64(a,cnt,&SHCompareSection);
for (i=0;i<cnt;i++) {
if (a[i]->next!=a[i]) {
SHSortSection(a[i]);
doc_e=a[i]->next;
while (doc_e!=a[i]) {
doc_e1=doc_e->next;
QueRem(doc_e);
QueIns(doc_e,doc->root.last);
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag) {
doc->cur_entry=doc_e;
doc->cur_data_col=StrLen(doc_e->tag);
DocPrint(doc,"\n");
}
doc_e=doc_e1;
}
if (i+1<cnt && a[i+1]->next!=a[i+1])
DocPrint(doc,"\n");
}
Free(a[i]);
}
Free(a);
DocWrite(doc);
DocDel(doc);
}
public U0 TSSortHeaders()
{
TSSortHeader("/Kernel/Adam1b.HPP.Z");
TSSortHeader("/Kernel/Adam1c.HPP.Z");
TSSortHeader("/Kernel/KExts.CPP.Z");
TSSortHeader("/Compiler/CmpExts.CPP.Z");
TSSortHeader("/Compiler/Cmp.HPP.Z");
TSSortHeader("/Adam/AdamExts.HPP.Z");
}
+20 -17
View File
@@ -1,25 +1,26 @@
/*
This is a JIT file, not AOT.
Asm labels can only be defined once
in a task. Hit F5 to spawn a new task
each time and run it.
/*Asm labels can only be defined once
in a task. <F5> will spawn a new task
each time, so you don't get redefine
error, like when repeatedly #including
it from the cmd line.
*/
asm {
//Opcodes are slightly different to make writing my x86_64 assembler easier.
//See $LK,"::/Compiler/OpCodes.TXT"$.
USE64 //Defaults to 64, but this is a good habit.
IMPORT Beep;
_BEEPS::
//You can always clobber RAX,RBX,RCX,RDX,R8,R9
//You can always clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
PUSH RBP
MOV RBP,RSP
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/Adam1a.HPP,SF_ARG1"$
@@05: PUSH RCX
//U0 Beep(I64 freq=500,Bool busy=FALSE)
//U0 $LK,"Beep",A="MN:Beep"$(I64 freq=500,Bool busy=FALSE)
PUSH FALSE //Do not busy (spin) wait
PUSH 500 //Hz
CALL Beep
@@ -27,33 +28,35 @@ _BEEPS::
LOOP @@05
POP RBP
//Return vals are in RAX
RET1 8
}
RET1 8 //Use special return. Pop one arg off of stack.
//HolyC return vals are in RAX. This function has no return value.
}
//_extern binds a asm sym to a function.
//My convention is to put an underscore
//on C callable routines.
//on C callable asm routines.
_extern _BEEPS U0 Beeps(I64 cnt);
I64 AsmAndC1()
{
I64 noreg i; //Normally this would be stored in a reg
//Check with $LK,"Uf",A="MN:Uf"$("AsmAndC1").
//Check by unassembling with $LK,"Uf",A="MN:Uf"$("AsmAndC1").
i=PmtI64("Num of beeps 1-5 (%d):",3,1,5);
i=GetI64("Num of beeps 1-5 (%d):",3,1,5);
Beeps(i);
asm {
//You can clobber RAX,RBX,RCX,RDX
//You can clobber RAX,RBX,RCX,RDX. The compiler expects that.
USE64 //Defaults to 64, but this is a good habit.
IMPORT Snd; //Import an not use & or don't import and use &Snd.
MOV RCX,&i[RBP] //You can clobber RAX,RBX,RCX,RDX.
//You better preserve the rest.
@@05: PUSH RCX
//U0 Snd(F64 freq);
//U0 $LK,"Snd",A="MN:Snd"$(F64 freq);
MOV RAX,RCX //freq=loop*100.0+100.0
IMUL2 RAX,100 //TempleOS uses nonstandard opcodes
@@ -66,7 +69,7 @@ USE64 //Defaults to 64, but this is a good habit.
CALL Snd
MOV RCX,time_stamp_freq>>3 //JIT Const. Simple delay loop
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop
@@10: LOOP @@10
POP RCX
+17 -15
View File
@@ -1,18 +1,18 @@
/*
This is a JIT file, not AOT.
Asm labels can only be defined once
in a task. Hit F5 to spawn a new task
each time and run it.
/*Asm labels can only be defined once
in a task. <F5> will spawn a new task
each time, so you don't get redefine
error, like when repeatedly #including
it from the cmd line.
*/
//This is to demo glbl var access.
//Glbs defined elsewhere can accessed too, like sys_jiffies.
//Glbs defined elsewhere can accessed too, like cnts.jiffies.
I64 glbl_hz=400,glbl_hz_step=100,glbl_hz_base=100;
asm {
//Opcodes are slightly different to make writing my x86_64 assembler easier.
//See $LK,"::/Compiler/OpCodes.TXT"$.
USE64 //Defaults to 64, but this is a good habit.
JIFFIES_MSG: DU8 "Jiffies:",0;
@@ -20,15 +20,15 @@ JIFFIES_MSG: DU8 "Jiffies:",0;
//See $LK,"::/Kernel/Str1a.CPP",A="FL:::/Kernel/Str1a.CPP,1"$ and $LK,"::/Kernel/Utils1a.CPP"$.
_BEEPS2::
//You can clobber RAX,RBX,RCX,RDX,R8,R9
//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
PUSH RBP
MOV RBP,RSP
MOV RCX,U64 SF_ARG1[RBP] //$LK,"SF_ARG1",A="FF:::/Kernel/Adam1a.HPP,SF_ARG1"$
PUSH U64 [&sys_jiffies]
PUSH U64 [&cnts.jiffies]
@@05: PUSH RCX
//U0 Beep(I64 freq=500,Bool busy=FALSE)
//U0 $LK,"Beep",A="MN:Beep"$(I64 freq=500,Bool busy=FALSE)
PUSH FALSE //Do not busy (spin) wait
PUSH U64 [&glbl_hz] //evaluated at run time
CALL &Beep
@@ -41,7 +41,7 @@ _BEEPS2::
POP RSI
POP RAX
SUB RAX,U64 [&sys_jiffies]
SUB RAX,U64 [&cnts.jiffies]
NEG RAX
CALL PUT_HEX_U64
MOV RAX,'\n'
@@ -52,24 +52,26 @@ _BEEPS2::
}
//My convention is to put an underscore
//on C callable routines.
//on C callable asm routines.
_extern _BEEPS2 U0 Beeps2(I64 cnt);
U0 AsmAndC2()
{
I64 reg R15 i;
i=PmtI64("$$PURPLE$$\n\nNum of beeps 1-5 (%d):$$FG$$",3,1,5);
i=GetI64("$$PURPLE$$\n\nNum of beeps 1-5 (%d):$$FG$$",3,1,5);
Beeps2(i);
asm {
LIST
//You can clobber RAX,RBX,RCX,RDX, but preserve the rest.
USE64 //Defaults to 64, but this is a good habit.
MOV RCX,R15 //You can clobber RAX,RBX,RCX,RDX. Preserve the rest.
@@05: PUSH RCX
//U0 Snd(F64 freq);
//U0 $LK,"Snd",A="MN:Snd"$(F64 freq);
MOV RAX,RCX //freq=loop*100.0+100.0
IMUL2 RAX,glbl_hz_step //evaluated at compile ttime
@@ -80,7 +82,7 @@ USE64 //Defaults to 64, but this is a good habit.
CALL &Snd //We can skip IMPORT with & if JIT compiling.
MOV RCX,time_stamp_freq>>3 //JIT Const. Simple delay loop.
MOV RCX,cnts.time_stamp_freq>>3 //JIT Const. Simple delay loop.
@@10: LOOP @@10
POP RCX
+9 -10
View File
@@ -1,23 +1,22 @@
/*
This is a JIT file, not AOT.
Asm labels can only be defined once
in a task. Hit F5 to spawn a new task
each time and run it.
/*Asm labels can only be defined once
in a task. <F5> will spawn a new task
each time, so you don't get redefine
error, like when repeatedly #including
it from the cmd line.
*/
U0 AsmAndC3()
{
I64 i;
for (i=0;i<3;i++) {
"Meaning of life:";
MOV AL,0x41
STC
ADC AL,0 //Round-about way to make the not special constant, 0x42.
ADC AL,0 //Round-about way to make the not-special constant, 0x42.
CALL PUT_HEX_U8
MOV RCX,time_stamp_freq>>5 //JIT Cosnt. Simple delay loop.
MOV RCX,cnts.time_stamp_freq>>5 //JIT Const. Simple delay loop.
@@1: LOOP @@1
MOV RAX,' What?\n'
CALL PUT_CHARS
'\n';
}
}
+6 -7
View File
@@ -1,9 +1,8 @@
/*
This is a JIT file, not AOT.
Asm labels can only be defined once
in a task. Hit F5 to spawn a new task
each time and run it.
/*Asm labels can only be defined once
in a task. <F5> will spawn a new task
each time, so you don't get redefine
error, like when repeatedly #including
it from the cmd line.
These are many useful kernel
routines $LK,"::/Kernel/Str1a.CPP",A="FF:::/Kernel/Str1a.CPP,PUT_CHARS"$
@@ -32,7 +31,7 @@ MY_WORLD_MSG:
DU8 "World\n",0;
//My convention is to put an underscore
//on C callable routines.
//on C callable asm routines.
_HELLO_WORLD::
PUSH RSI //See $LK,"REG_VARS_MASK",A="MN:REG_VARS_MASK"$ & $LK,"REG_NON_PTR_MASK",A="MN:REG_NON_PTR_MASK"$
MOV RCX,10
-1
View File
@@ -1,4 +1,3 @@
asm {
DIV_U64_BY_U64::
PUSH RBP
+3 -4
View File
@@ -1,5 +1,4 @@
/*
When I was a kid with a Commodore 64,
/*When I was a kid with a Commodore 64,
the 6502 chip had no multiply instruction
and this is how we had to do it, except,
I used more regs in this example.
@@ -10,7 +9,7 @@ asm {
USE64 //Defaults to 64, but this is a good habit.
//You can clobber RAX,RBX,RCX,RDX,R8,R9
//You can clobber RAX,RBX,RCX,RDX,R8,R9. The compiler expects that.
MUL_BY_HAND_U8_U8_TO_U16: //This is only for fun.
//8bit * 8bit-->16bit
@@ -48,7 +47,7 @@ _MUL_U64_U64_TO_U128::
};
//My convention is to put an underscore
//on C callable routines.
//on C callable asm routines.
_extern _MUL_BY_HAND_U8_U8_TO_U16 U16 MulU8(U8 n1,U8 n2);
class U128
+3 -3
View File
@@ -13,7 +13,7 @@ PUT_DEC_U64::
PUSH RSI //See $LK,"REG_VARS_MASK",A="MN:REG_VARS_MASK"$ & $LK,"REG_NON_PTR_MASK",A="MN:REG_NON_PTR_MASK"$
LEA RSI,-1[RBP] //Load addr of end of buffer.
//We picked RSI because of PUT_STR
//We'll move backward
//We'll move bwd
MOV U8 [RSI],0 //Terminator
TEST RAX,RAX //Special case -- zero
@@ -41,8 +41,8 @@ PUT_DEC_U64::
_DO_IT:: //The convention is C-callable routines have underscores.
MOV RAX,122333221
CALL PUT_DEC_U64
PUSH 1
CALL &NewLine //Print one carriage return
MOV RAX,'\n'
CALL PUT_CHARS
RET
}
-1
View File
@@ -4,7 +4,6 @@ Or, type $LK,"AutoFile",A="MN:AutoFile"$(filename);
See $LK,"AutoFile",A="FF:::/Doc/Glossary.TXT,AutoFile"$ in the glossary for more info.
*/
I64 i;
for (i=0;i<3;i++)
"Dir;\n";
+2 -2
View File
@@ -174,7 +174,7 @@
#define IC_MEMSET 0x92
#define IC_MEMSET_U16 0xC2
#define IC_MEMSET_U32 0xC3
#define IC_MEMSET_U64 0xC4
#define IC_MEMSET_I64 0xC4
#define IC_BR_ZERO 0x93
#define IC_BR_NOT_ZERO 0x94
@@ -216,7 +216,7 @@
#define IC_SWAP_U8 0xB5
#define IC_SWAP_U16 0xB6
#define IC_SWAP_U32 0xB7
#define IC_SWAP_U64 0xB8
#define IC_SWAP_I64 0xB8
#define IC_ABS_I64 0xB9
#define IC_SIGN_I64 0xBA
+2 -2
View File
@@ -1,7 +1,7 @@
/* This is not an AutoFile. It uses $LK,"AutoStr",A="MN:AutoStr"$
/* This is not an AutoFile. It uses $LK,"AutoStr",A="MN:AutoStr"$
to run text as though from an AutoFile.
This example shows how you can drive pop-up
This example shows how you can drive pop-up
windows.
*/
+1 -1
View File
@@ -5,7 +5,7 @@ See $LK,"AutoFile",A="FF:::/Doc/Glossary.TXT,AutoFile"$ in the glossary for more
Profiling does not $UL,1$require$UL,0$ autofiles.
*/
"$$RED$$ProfAll;$$FG$$\n";
"$$RED$$Prof;$$FG$$\n";
"$$RED$$//Collecting Data$$FG$$";
PressAKey;
"\n$$RED$$ProfRep;$$FG$$\n";
+2 -2
View File
@@ -4,10 +4,10 @@ U0 AFSetIPDemo()
WinBorder(ON);
l=Fs->pix_left+Fs->scroll_x;
t=Fs->pix_top+Fs->scroll_y;
SetIP(,,,FALSE,FALSE,FALSE); //Mouse unclicked
SetIP(,,,FALSE,FALSE); //Mouse unclicked
AFSetIP(,l-4,t-4);
AFSetIP(20,l+20,t+20,,TRUE);
SetIP(,,,FALSE,FALSE,FALSE);
SetIP(,,,FALSE,FALSE);
}
AFSetIPDemo;
+2 -4
View File
@@ -1,7 +1,5 @@
//This shows the $LK,"Carry",A="MN:Carry"$ function.
//It holds the CPU carry flag.
//$LK,"U",A="MN:U"$() Unassemble to make sure it is
//right.
//Shows the $LK,"Carry",A="MN:Carry"$ function. It holds the CPU carry flag.
//$LK,"U",A="MN:U"$() Unassemble to make sure it is right.
U0 BigCnt()
{
+11 -12
View File
@@ -1,12 +1,12 @@
//This demonstrates class meta data.
//Basically, we make use of the compiler's
//data about a class. We can add to the
//compilers data arbitrary items, either string or
//or int or F64 (if you typecast).
//This stuff is not high performance.
//Don't get carried away -- it might be slow.
/*Demonstrates class meta data.
Basically, we make use of the compiler's
data about a class. We can add to the
compilers data arbitrary items, either string or
or int or F64 (if you typecast).
This stuff is not high performance.
Don't get carried away -- it might be slow.
*/
U0 RankOut(I64 i)
{
@@ -27,9 +27,8 @@ class Test2Struct
I64 serial_num print_str "%6d" dft_val 123456;
};
U0 DumpStruct(U8 *_d,U8 *class_name=lastclass)
{//lastclass is keyword
{//lastclass is keyword. See $LK,"::/Demo/LastClass.CPP"$.
CHashClass *tempc=HashFind(class_name,Fs->hash_table,HTT_CLASS);
U8 *print_str;
I64 *q,dft_val;
@@ -53,7 +52,7 @@ U0 DumpStruct(U8 *_d,U8 *class_name=lastclass)
" default:%d",dft_val;
//This corrects for the ambiguity, allowing zero percentile.
if (MemberMetaFind("percentile",ml)) { //check if it exists
if (MemberMetaFind("percentile",ml)) {//check if it exists
//We could use the $LK,"CMemberLstMeta",A="MN:CMemberLstMeta"$ structure returned by
//$LK,"MemberMetaFind",A="MN:MemberMetaFind"$() and save a search.
percentile=MemberMetaData("percentile",ml)(F64);
@@ -62,7 +61,7 @@ U0 DumpStruct(U8 *_d,U8 *class_name=lastclass)
if (fp_output_fun=MemberMetaData("output_fun",ml))
(*fp_output_fun)(*q);
NewLine;
'\n';
ml=ml->next;
}
}
+5 -5
View File
@@ -1,11 +1,11 @@
"\n\n%D %T\n\n\n",Now,Now;
"Year:%d Month:%d Day:%d\n\n\n",Year,Month,Day;
CDateStruct ds;
Date2Struct(&ds,Now+local_time_offset);
CDate cdt=Now;
"Hour:%02d Minute:%02d Second:%02d\n\n\n",Hour24(cdt),Minute(cdt),Second(cdt);
"Hour:%02d Minute:%02d Second:%02d\n\n\n",ds.hour,ds.min,ds.sec;
"Day Name:%03tZ\n\n\n",WeekDay(cdt),"ST_DAYS_OF_WEEK";
"Day Name:%03tZ\n\n\n",ds.day_of_week,"ST_DAYS_OF_WEEK";
"Month Name:%03tZ\n\n\n",Month(cdt)-1,"ST_MONTHS";
"Month Name:%03tZ\n\n\n",ds.mon-1,"ST_MONTHS";
+3 -5
View File
@@ -1,19 +1,17 @@
/*
Press <CTRL-ALT-C> to break.
Press <CTRL-ALT-c> to break.
Rerun Program
Press <CTRL-ALT-D> to enter Dbg.
Press <CTRL-ALT-d> to enter Dbg.
> $LK,"Dr",A="MN:Dr"$; //Dump Regs
> $LK,"G2",A="MN:G2"$; //Cont program
Press <CTRL-ALT-D> to enter Dbg.
Press <CTRL-ALT-d> to enter Dbg.
> $LK,"Uf",A="MN:Uf"$("DbgDemo");
> $LK,"U",A="MN:U"$(_RIP);
See $LK,"Debugging",A="HI:Debugging"$
*/
U0 DbgDemo()
+2 -6
View File
@@ -1,13 +1,10 @@
/*
See $LK,"Define",A="HI:Char/Define"$.
*/
//See $LK,"Define",A="HI:Define"$.
//These might be in the Adam task.
DefineLoad("ST_YES_NO","(Yes or No)");
DefineLoad("ST_EXIT","Exit");
DefineLstLoad("ST_NO_YES_LST","No\0Yes\0");
//New strings might be loaded for each user
//to override.
@@ -18,7 +15,6 @@ if (YorN) {
DefineLstLoad("ST_NO_YES_LST","No\0Si\0");
}
Bool Quit()
{
Bool result;
@@ -26,7 +22,7 @@ Bool Quit()
I64 i;
while (TRUE) {
"%S %S?","ST_EXIT","ST_YES_NO";
st=MGetS;
st=GetStr;
i=DefineMatch(st,"ST_NO_YES_LST",LMF_IGNORE_CASE);
if (i>=0) {
result=i;
-38
View File
@@ -1,38 +0,0 @@
U0 CursorMovementDemo()
{
I64 i;
for (i=0;i<100;i++) {
"%03d ",i;
"$$CM,-4,1$$";
if (i%10==9)
"$$CM,4,-10$$";
}
//+LX is relative to left side.
//See <CTRL-L> with cursor-movement for all the flags.
//Check "Quote" to set-up a cmd for in quotes.
"$$CM+LX,0,+10$$\n";
}
CursorMovementDemo;
//The word-wrap Off and On cmds are
//$$WW,0$$ and $$WW,1$$.
//You might need $LK,"DocMax",A="MN:DocMax"$() to adjust
//the cmd line window buf size.
//It counts cmds, not lines.
//The +H flag will hold-onto an entry
//so it doesn't get pushed-out of the document.
//This is useful for a $$WW+H,1$$ cmd.
//See $LK,"::/Doc/Dollar.TXT"$ for documentation on
//all flags and cmds.
//Note: the default page length is 66 lines
//and branching back more than the page length
//will rst the column to 1. So, set page
//length to a large number if you want to
//branch back a long distance.
-44
View File
@@ -1,44 +0,0 @@
class FDStruct
{
//Use <CTRL-L> and select "Data" to generate the fmtstrs
//The number is the field from after the ':' to the end.
// See $LK,"Data Tag Width",A="FA:::/Adam/Doc/DocPlain.CPP,DataTagWidth"$.
F64 num1 fmtstr "$$DA-TRM,32,A=\"F64 1:%12.8f\"$$\n";
F64 num2 fmtstr "$$DA-TRM,32,A=\"F64 2:%12e\"$$\n";
I64 num3 fmtstr "$$DA-TRM,32,A=\"I64 1:0x%016X\"$$\n";
I64 num4 fmtstr "$$DA-TRM,32,A=\"I64 2:%12d\"$$\n";
U8 name[32] fmtstr "$$DA-P,31,A=\"Name :%s\"$$\n";
CDate datetime fmtstr "$$DA-TRM,32,A=\"Date :%8D\"$$\n";
};
U0 FormDemo()
{
FDStruct fds;
CDate cdt;
fds.num1=12.3e-4; //Set defaults
fds.num2=4.5e3;
fds.num3=0x1234;
fds.num4=-567;
StrCpy(&fds.name,"John");
cdt=Now;
fds.datetime=cdt;
if (DocFormDo(&fds)) {
"#1=%e\n",fds.num1;
"#2=%e\n",fds.num2;
"#3=%d\n",fds.num3;
"#4=%d\n",fds.num4;
"Name=%s\n",fds.name;
"Date=%D\n",fds.datetime;
} else
"Cancel\n";
"\n\nClassRep Example\n";
ClassRep(&fds);
//See also $LK,"ClassRepD",A="MN:ClassRepD"$().
}
FormDemo;
@@ -1,13 +1,12 @@
U8 *tSCB(CDoc *,CDocEntry *,CTask *mem_task)
{
//This routine is called by the window
//mgr things would get corrupted
{//This is called by the window mgr.
//Things would get corrupted
//if the window mgr used it's own
//heap, so we use the owning task's heap.
U8 *st=MAlloc(64,mem_task);
CDate cdt=tS*CDATE_FREQ;
//Doesn't have to be fixed width!!
SPrint(st,"%d=%T",cdt,cdt);
//Doesn't have to be fixed width!!
StrPrint(st,"%d=%T",cdt,cdt);
return st;
}
@@ -15,64 +14,51 @@ U8 *CurTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
{
U8 *st=MAlloc(64,mem_task);
CDate cdt=Now;
SPrint(st,"%D %T",cdt,cdt);
StrPrint(st,"%D %T",cdt,cdt);
return st;
}
U0 DoIt()
{
CDoc *bdoc=DocBorder,
*pdoc=DocPut;
CDoc *bdoc=DocBorder,*pdoc=DocPut;
CDocEntry *doc_e;
//We don't want an update between
//creating the CDocEntry and defining the
//callback, so we turn-off preemption.
Bool old_preempt=Preempt(OFF);
DocLock(bdoc);
DocBottom(bdoc); //Ins at the bottom
DocPrint(bdoc,"$$RED$$$$CM+BY+LX,5,-3$$");
//The $LK,"DocPrint",A="MN:DocPrint"$() routine returns the addr of the last entry.
doc_e=DocPrint(bdoc,"$$TX+TC,\" \"$$");
//The TC flag is "has tag callback".
//Flags are explained here:
// $LK,"::/Doc/Widget.TXT"$
// $LK,"::/Doc/Dollar.TXT"$
// $LK,"Dollar Flags",A="MN:DOCEf1_TAG"$
// $LK,"ST_DOC_FLAGS",A="FF:::/Adam/Doc/DocInit.CPP,ST_DOC_FLAGS"$
//$LK,"::/Doc/DolDocOverview.TXT"$ $LK,"::/Doc/Widget.TXT"$
//$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.CPP,ST_DOC_FLAGS"$
doc_e->tag_cb=&tSCB;
DocPrint(bdoc,"$$FG$$");
DocUnlock(bdoc);
//$BK,1$WARNING:$BK,0$ If you use the put_doc you
//run the risk of the user pressing
//<CTRL-T> or using the clipboard, both
//<CTRL-t> or using the clipboard, both
//of which will crash. So, you might want
//to use the border_doc.
DocLock(pdoc);
DocPrint(pdoc,"$$LTRED$$");
doc_e=DocPrint(pdoc,"$$TX+TC,\" \"$$");
doc_e->tag_cb=&CurTimeCB;
DocPrint(pdoc,"$$FG$$");
Preempt(old_preempt);
DocUnlock(pdoc);
//Send carriage return, new line, so
//that the timer string is not part
//of the next cmd on the cmd line.
NewLine;
'\n';
}
U0 UndoIt()
{
//Clear-out entries without a +H hold flag.
{//Clear-out entries without a +H hold flag.
DocClear(Fs->border_doc);
}
DoIt;
+46
View File
@@ -0,0 +1,46 @@
I64 MyLeftCB1(CDoc *,CDocEntry *)
{
I64 i;
for (i=500;i<1000;i+=25) {
Snd(i);
Sleep(10);
}
Snd(0);
return 0;
}
U0 ClickCallBack()
{
CDocEntry *doc_e;
DocLock(DocPut);
//The $LK,"DocPrint",A="MN:DocPrint"$() routine returns the addr of the last entry.
doc_e=DocPrint(DocPut,"\n$$MA+LC,\"Click Me\"$$ ");
//The LC flag is "has left callback".
//Flags are explained here:
//$LK,"::/Doc/DolDocOverview.TXT"$ $LK,"::/Doc/Widget.TXT"$
//$LK,"Dollar Flags",A="MN:DOCEf_TAG"$ $LK,"ST_DOC_FLAGS",A="FF:::/Adam/DolDoc/DocInit.CPP,ST_DOC_FLAGS"$
"(Not preserved when <CTRL-t> and back.)\n\n";
doc_e->left_cb=&MyLeftCB1;
DocUnlock(DocPut);
}
ClickCallBack;
I64 MyLeftCB2(CDoc *,CDocEntry *)
{
return cnts.jiffies;
}
U0 PopUpJiffiesCallBack()
{
CDoc *doc=DocNew;
CDocEntry *doc_e=DocPrint(doc,"\n\n\n$$BT+LC,\"Jiffies\"$$\n\n\n");
doc_e->left_cb=&MyLeftCB2;
"Current Jiffies:%d\n",PopUpMenu(doc);
DocDel(doc);
}
PopUpJiffiesCallBack;
PopUpJiffiesCallBack;
PopUpJiffiesCallBack;
+38
View File
@@ -0,0 +1,38 @@
U0 CursorMovementDemo()
{
I64 i;
for (i=0;i<100;i++) {
"%03d ",i;
"$$CM,-4,1$$";
if (i%10==9)
"$$CM,4,-10$$";
}
//+LX is relative to left side.
//See <CTRL-l> with cursor-movement for all the flags.
//Check "Quote" to set-up a cmd for in quotes.
"$$CM+LX,0,+10$$\n";
}
CursorMovementDemo;
/*The word-wrap Off and On cmds are
$$WW,0$$ and $$WW,1$$.
You might need $LK,"DocMax",A="MN:DocMax"$() to adjust
the cmd line window buf size.
It counts cmds, not lines.
The +H flag will hold-onto an entry
so it doesn't get pushed-out of the document.
This is useful for a $$WW+H,1$$ cmd.
See $LK,"::/Doc/DolDocOverview.TXT"$ for documentation on
all flags and cmds.
Note: the default page length is 66 lines
and branching back more than the page length
will rst the column to 1. So, set page
length to a large number if you want to
branch back a long distance.
*/
+17 -20
View File
@@ -1,22 +1,20 @@
/*
$$DA is the data widget.
-TRM flag is for var
width fields with a terminator
character.
+RD refreshes the data.
+UD updates the val when you edit it.
+U32 means the val is 4 bytes.
-U64 U64 is the default so we might
want to turn-it-off. Strings
use U64.
,32 sets the tag string width.
See $LK,"Data Tag Width",A="FA:::/Adam/Doc/DocPlain.CPP,DataTagWidth"$.
-P Means it is a string var, basically.
/*$$DA is the data widget.
-TRM flag is for var
width fields with a terminator
character.
+RD refreshes the data.
+UD updates the val when you edit it.
-P Means it is a string var, basically.
,32 sets the tag string width.
See $LK,"Data Tag Width",A="FA:::/Adam/DolDoc/DocPlain.CPP,DataTagWidth"$.
,RT=I16 means the val is 2 bytes.
See $LK,"DocDataFmt",A="MN:DocDataFmt"$() and $LK,"DocDataScan",A="MN:DocDataScan"$().
*/
I32 i;
I16 i=0;
U8 buf[8];
U0 UpdateGlblTask(I64)
@@ -27,7 +25,6 @@ U0 UpdateGlblTask(I64)
}
}
U0 DataDemo()
{
CDocEntry *doc_e;
@@ -49,8 +46,8 @@ U0 DataDemo()
"and you can modify the val.\n"
"However, changes happen immediately,\n"
"so it's tricky.\n\n";
//Use <CTRL-L> for the $$DA,$$ format.
doc_e=DocPrint(doc,"$$DA-TRM+RD+UD-U64+U32,32,A=\"%%12d\"$$\n");
//Use <CTRL-l> for the $$DA...$$ format.
doc_e=DocPrint(doc,"$$DA-TRM+RD+UD,32,RT=I16,A=\"%%7d\"$$\n");
doc_e->data=&i;
StrCpy(buf,"Terry");
@@ -1,13 +1,11 @@
/*
The +D flag causes a define-string
/*The +D flag causes a define-string
look-up and substitution.
It is available in the <CTRL-L> text-widget
It is available in the <CTRL-l> text-widget
menu under text entries for use in
documentation.
*/
*/
DefineLoad("COMPANY","Trivial Solutions");
"Company: $$TX,\"\",D=\"COMPANY\"$$\n";
@@ -17,9 +15,8 @@ DefinePrint("COMPANY_TIME","%T",Now);
#exe {
StreamPrint(
"#define COMPANY_AGE %0.1f\n",
(Now-A2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
(Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
};
"Age : $$TX,\"\",D=\"COMPANY_AGE\"$$ years\n";
"Time: $$TX,\"\",D=\"COMPANY_TIME\"$$\n";
File renamed without changes.
@@ -3,7 +3,7 @@ public U0 DocProfile(U8 *filename,I64 flags)
I64 i,*cmd_stats=CAlloc(sizeof(I64)*DOCT_NUM_TYPES),
*flags_stats=CAlloc(sizeof(I64)*64),
*type_flags_stats=CAlloc(sizeof(I64)*64);
//Note, word wrap is determined by
//Note: word wrap is determined by
//doc->win_task when a $LK,"CDoc",A="MN:CDoc"$ is recalculated
//use $LK,"DocRecalc",A="MN:DocRecalc"$().
CDoc *doc=DocRead(filename,flags);
@@ -14,7 +14,7 @@ public U0 DocProfile(U8 *filename,I64 flags)
while (doc_e!=doc) {
cmd_stats[doc_e->type_u8]++;
for (i=0;i<64;i++)
if (Bt(&doc_e->flags1,i))
if (Bt(&doc_e->de_flags,i))
flags_stats[i]++;
for (i=16;i<32;i++)
if (Bt(&doc_e->type,i))
@@ -26,7 +26,7 @@ public U0 DocProfile(U8 *filename,I64 flags)
"$$PURPLE$$-------%s-------\n",filename;
"$$GREEN$$The lowest byte of the 32-bit 'doc_e->type', '$$PURPLE$$doc_e->type.u8[0]$$GREEN$$', is cmd and accessed with the union '$$PURPLE$$doc_e->type_u8$$GREEN$$'. "
"See $$LK,\"CDocEntry\",A=\"MN:CDocEntry\"$$, "
"$$LK,\"Doc Type Defines\",A=\"MN:DOCT_TEXT\"$$ and $$LK,\"Doc Type Codes\",A=\"FF:::/Adam/Doc/DocInit.CPP,ST_DOC_CMDS\"$$.\n$$FG$$";
"$$LK,\"Doc Type Defines\",A=\"MN:DOCT_TEXT\"$$ and $$LK,\"Doc Type Codes\",A=\"FF:::/Adam/DolDoc/DocInit.CPP,ST_DOC_CMDS\"$$.\n$$FG$$";
for (i=0;i<DOCT_NUM_TYPES;i++)
if (cmd_stats[i])
"%4Z:%d\n",i,"ST_DOC_CMDS",cmd_stats[i];
@@ -39,8 +39,8 @@ public U0 DocProfile(U8 *filename,I64 flags)
if (type_flags_stats[i])
"%4d:%d\n",i,type_flags_stats[i];
"$$GREEN$$\n'$$PURPLE$$doc_e->flags1$$GREEN$$' is 64-bit. "
"See $$LK,\"Doc Flag Defines\",A=\"MN:DOCEf1_TAG\"$$ and $$LK,\"Doc Flag Codes\",A=\"FF:::/Adam/Doc/DocInit.CPP,ST_DOC_FLAGS\"$$.\n$$FG$$";
"$$GREEN$$\n'$$PURPLE$$doc_e->de_flags$$GREEN$$' is 64-bit. "
"See $$LK,\"Doc Flag Defines\",A=\"MN:DOCEf_TAG\"$$ and $$LK,\"Doc Flag Codes\",A=\"FF:::/Adam/DolDoc/DocInit.CPP,ST_DOC_FLAGS\"$$.\n$$FG$$";
for (i=0;i<64;i++)
if (flags_stats[i])
"%4Z:%d\n",i,"ST_DOC_FLAGS",flags_stats[i];
@@ -48,21 +48,21 @@ public U0 DocProfile(U8 *filename,I64 flags)
Free(cmd_stats);
Free(flags_stats);
PressAKey;
NewLine;
'\n';
}
/*See $LK,"TipOfDay",A="MN:TipOfDay"$.
//See $LK,"TipOfDay",A="MN:TipOfDay"$.
Note: Not all $LK,"CDocEntry",A="MN:CDocEntry"$'s are full-sized nodes.
Some are $LK,"MAlloc",A="MN:MAlloc"$ed with a smaller size to save
mem. They all have at least the size $LK,"CDocEntryBase",A="MN:CDocEntryBase"$.
//Note: Not all $LK,"CDocEntry",A="MN:CDocEntry"$'s are full-sized nodes.
//Some are $LK,"MAlloc",A="MN:MAlloc"$ed with a smaller size to save
//mem. They all have at least the size $LK,"CDocEntryBase",A="MN:CDocEntryBase"$.
Note: $LK,"CDocEntry",A="MN:CDocEntry"$'s should be allocated from the
heap of the owning task, doc->mem_task.
//Note: $LK,"CDocEntry",A="MN:CDocEntry"$'s should be allocated from the
//heap of the owning task, doc->mem_task.
//The flag arrays $LK,"doc_type_flags_form",A="MN:doc_type_flags_form"$, etc
//are useful.
The flag arrays $LK,"doldoc.type_flags_form",A="MN:CDolDocGlbls"$, etc
are useful.
*/
DocProfile("::/Doc/ChangeLog.TXT",0);
DocProfile("::/Doc/ChangeLog.TXT",DOCF_PLAIN_TEXT);
+47
View File
@@ -0,0 +1,47 @@
class FDStruct
{//Use <CTRL-l> and select "Data" to generate the fmtstrs
//The number is the field from after the ':' to the end.
//See $LK,"Data Tag Width",A="FA:::/Adam/DolDoc/DocPlain.CPP,DataTagWidth"$.
F64 num1 fmtstr "$$DA-TRM,32,RT=F64,A=\"F64 1:%12.8f\"$$\n";
F64 num2 fmtstr "$$DA-TRM,32,RT=F64,A=\"F64 2:%12e\"$$\n";
I64 num3 fmtstr "$$DA-TRM,32,A=\"I64 1:0x%016X\"$$\n";
I64 num4 fmtstr "$$DA-TRM,32,A=\"I64 2:%12d\"$$\n";
I64 type fmtstr "$$LS,D=\"ST_PERSON_TYPE\"$$\n";
U8 name[32] fmtstr "$$DA-P,31,A=\"Name :%s\"$$\n";
CDate datetime fmtstr "$$DA-TRM,32,A=\"Date :%8D\"$$\n";
Bool check fmtstr "$$CB,\"Check\"$$\n";
};
U0 FormDemo()
{
FDStruct fds;
DefineLstLoad("ST_PERSON_TYPE","Child\0Teen\0Adult\0");
fds.num1=12.3e-4; //Set defaults
fds.num2=4.5e3;
fds.num3=0x1234;
fds.num4=-567;
fds.type=1;
StrCpy(&fds.name,"John");
fds.datetime=Now;
fds.check=TRUE;
if (DocFormDo(&fds)) {
"#1\t=%e\n",fds.num1;
"#2\t=%e\n",fds.num2;
"#3\t=%d\n",fds.num3;
"#4\t=%d\n",fds.num4;
"Type\t=%s\n",DefineSub(fds.type,"ST_PERSON_TYPE");
"Name\t=%s\n",fds.name;
"Date\t=%D\n",fds.datetime;
"Check\t=%d\n",fds.check;
} else
"Cancel\n";
"\n\nClassRep Example\n";
ClassRep(&fds);
//See also $LK,"ClassRepD",A="MN:ClassRepD"$().
}
FormDemo;
@@ -2,9 +2,8 @@
//unless you rig them to send macros. Menu entries are
//about the same as buttons, but don't have a border.
I64 PopUpFreq()
{ //See also $LK,"PopUpRangeI64",A="MN:PopUpRangeI64"$()
{//See also $LK,"PopUpRangeI64",A="MN:PopUpRangeI64"$()
I64 i;
CDoc *doc=DocNew;
DocPrint(doc,"$$TX+CX,\"Set Freq\"$$\n" //Centered text
@@ -32,7 +31,7 @@ U0 MenuButton()
DocPut->flags|=DOCF_FORM;
do {
DocClear;
//Use <CTRL-L> to generate cursor movement expressions and check "Quote".
//Use <CTRL-l> to generate cursor movement expressions and check "Quote".
"$$CM+CX-RE,-4$$Menu Demo\n\n";
"$$LM,8$$"; //Set left margin
//These are buttons that return a val from a menu selection.
@@ -6,13 +6,12 @@
"UnderLine: $$UL,1$$Test$$UL,0$$\n\n"
"Link : $$LK,\"Genesis,1:1\",\"BF:Genesis,1:1\"$$\n\n\n"
"Button : $$BT-X,\"OKAY\",LE=1$$\n\n\n\n";
//You can do it this way if you like.
"\nSuper : 3$SY,-3$2$SY,0$=9\n\n"
"Sub : H$SY,3$2$SY,0$O\n\n"
//Can't see color because of syntax highlighting. Press <CTRL-T>
//Can't see color because of syntax highlighting. Press <CTRL-t>
"Color : $FG,4$Test$FG$\n\n"
"Blink : $BK,1$Test$BK,0$\n\n"
"Invert : $IV,1$Test$IV,0$\n\n"
@@ -20,5 +19,4 @@
//<CTRL-SHIFT-T> on this link to toggle individual commands.
"Link : $LK,"Genesis,1:1",A="BF:Genesis,1:1"$\n\n\n"
"Button : $BT,"OKAY",LE=1$\n\n\n\n";
@@ -1,5 +1,4 @@
/*
This uses $LK,"DocPrint",A="MN:DocPrint"$() because updates
/*Uses $LK,"DocPrint",A="MN:DocPrint"$() because updates
to within a tree while a tree is collapsed get
messed-up if "live" (like using ordinary Print.)
The insert point is confused by hiding of
@@ -8,7 +7,7 @@ Doc is taken off-line by disabling preemption so there
are no screen updates until all data has been inserted.
There is a special Doc function which is also
available to take an Doc off-line. See $LK,"DocPrintWhole",A="MN:DocPrintWhole"$.
available to take an Doc off-line. See $LK,"DocPrintAtomic",A="MN:DocPrintAtomic"$.
For this example, however, I wanted to use DocPrint
and disabled Preemption myself.
*/
@@ -18,7 +17,7 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr & _ATTR_DIR) {
if (tempde->attr & RS_ATTR_DIR) {
DocPrint(doc,"$$TR,\"\"$$");
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
tempde->name,tempde->full_name);
@@ -32,7 +31,7 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
tempde->name,tempde->full_name);
//Note there is also a routine
//to delete an entire CDirEntry tree.
//See $LK,"DirLstDel",A="MN:DirLstDel"$().
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
DirEntryDel(tempde);
tempde=tempde1;
}
@@ -1,5 +1,4 @@
/*
This scans the sym table and checks
/*Scans the sym table and checks
each $LK,"HTT_DEFINE_STR",A="MN:HTT_DEFINE_STR"$ entry to see if
it only occurs once in files.
@@ -10,42 +9,40 @@ $LK,"Grep",A="MN:Grep"$() returns a count of matches.
$LK,"FileOcc",A="MN:FileOcc"$() is $LK,"Grep",A="MN:Grep"$() with
output $LK,"Silent",A="MN:Silent"$().
*/
U0 UnusedDefineScan()
{
CDoc *old_put_doc,*old_display_doc,*doc;
I64 cnt=0;
CHashTable *tempht;
CHashTable *table;
CHash *temph;
CDocEntry *doc_e,*doc_e2;
Bool old_silent=IsSilent;
//Technically, we might want to
//turn-off preemption in case the
//table was modified.
//table were modified.
try {
tempht=Fs->hash_table;
while (tempht) {
temph=tempht->next_added;
while (temph!=tempht) {
table=Fs->hash_table;
while (table) {
temph=table->next_added;
while (temph!=table) {
if (temph->type&HTT_DEFINE_STR)
cnt++;
temph=temph->next_added;
}
tempht=tempht->next;
table=table->next;
}
progress1=0;
progress1_max=cnt;
StrCpy(progress1_desc,"Define Scan");
tempht=Fs->hash_table;
while (tempht) {
temph=tempht->next_added;
while (temph!=tempht) {
table=Fs->hash_table;
while (table) {
temph=table->next_added;
while (temph!=table) {
if (temph->type&HTT_DEFINE_STR) {
progress1++;
if (FileOcc(temph->str,"/*","+l-i+T")==1) {
@@ -62,7 +59,7 @@ U0 UnusedDefineScan()
"%s ",temph->str;
doc_e2=DocEntryCopy(doc,doc_e);
DocInsEntry(old_put_doc,doc_e2);
NewLine;
'\n';
}
doc_e=doc_e->next;
}
@@ -71,13 +68,13 @@ U0 UnusedDefineScan()
}
temph=temph->next_added;
}
tempht=tempht->next;
table=table->next;
}
} catch
PutExcept;
Silent(old_silent);
NewLine;
'\n';
ProgressBarsRst;
}
+12
View File
@@ -0,0 +1,12 @@
U0 BlkDevRep()
{//Block Device Report.
I64 i;
for (i=0;i<NUM_BLKDEVS;i++)
if (dsk.blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
ClassRep(&dsk.blkdevs[i]);//$LK,"ClassRep",A="MN:ClassRep"$() dumps any structure, automatically.
//The lastclass arg tells ClassRep the datatype.
//lastclass is a language feature of $LK,"HolyC",A="FI:::/Doc/HolyC.TXT"$.
//See $LK,"::/Demo/LastClass.CPP"$.
}
BlkDevRep;
+6 -10
View File
@@ -3,29 +3,25 @@
#define DB_ACCT_BLKS 1
class Acct
{ //Use <CTRL-L> to help generate fmtstrs.
{//Use <CTRL-l> to help generate fmtstrs.
U8 name[32] fmtstr "$$DA-P,32,A=\"Name:%s\"$$\n";
U8 addr[64] fmtstr "$$DA-P,64,A=\"Addr:%s\"$$\n";
U8 pad[DB_ACCT_BLKS*BLK_SIZE-64-32];
};
U0 InitDatabase()
{
CFile *f;
//Write new contiguous file
f=FOpen(DB_FILENAME,"w",DB_MAX_ACCT*DB_ACCT_BLKS);
{ //Write new contiguous file
CFile *f=FOpen(DB_FILENAME,"w",DB_MAX_ACCT*DB_ACCT_BLKS);
FClose(f);
}
U0 WriteAcct()
{
CFile *f;
Acct a;
I64 acctnum;
acctnum=PmtI64("Acct #",-1);
acctnum=GetI64("Acct #",-1);
if (0<=acctnum<DB_MAX_ACCT) {
MemSet(&a,0,BLK_SIZE);
if (DocFormDo(&a)) {
@@ -42,7 +38,7 @@ U0 ReadAcct()
Acct a;
I64 acctnum;
acctnum=PmtI64("Acct #",-1);
acctnum=GetI64("Acct #",-1);
if (0<=acctnum<DB_MAX_ACCT) {
f=FOpen(DB_FILENAME,"r");
FRBlks(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
@@ -59,7 +55,7 @@ U0 DatabaseDemo()
do {
"$$GREEN$$R$$FG$$ead acct, $$GREEN$$W$$FG$$rite acct or $$GREEN$$<SHIFT-ESC>$$FG$$:";
ch=ToUpper(GetChar);
NewLine;
'\n';
if (ch=='R') ReadAcct;
if (ch=='W') WriteAcct;
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
+1 -1
View File
@@ -23,7 +23,7 @@ U0 RawAccess(I64 drv_let=0)
p->size=bdev->max_blk-bdev->min_blk+1;
try {
blk=PmtI64("Blk to Read: ",old_offset,bdev->min_blk,bdev->max_blk);
blk=GetI64("Blk to Read: ",old_offset,bdev->min_blk,bdev->max_blk);
RBlks(p,buf,blk,1);
D(buf,BLK_SIZE);
} catch
+3 -3
View File
@@ -1,4 +1,4 @@
/* There is no FPrintF type function and no
/*There is no FPrintF type function and no
way to grow files. Therefore, use mem to
hold the file until you are done. The $LK,"CDoc",A="MN:CDoc"$
framework is convenient for this.
@@ -9,7 +9,7 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr & _ATTR_DIR) {
if (tempde->attr & RS_ATTR_DIR) {
DocPrint(doc,"$$TR,\"\"$$");
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
tempde->name,tempde->full_name);
@@ -23,7 +23,7 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
tempde->name,tempde->full_name);
//Note there is also a routine
//to delete an entire CDirEntry tree.
//See $LK,"DirLstDel",A="MN:DirLstDel"$().
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
DirEntryDel(tempde);
tempde=tempde1;
}
+35
View File
@@ -0,0 +1,35 @@
/*You probably don't need this. It makes a directory
tree into a flat contiguous memory chunk, suitable for
serial communication and rebuilds it into a tree on the
other end.
*/
U0 SerializeTree()
{
CDirEntry *tempde=FilesFind("/Demo/*.TXT*",FUF_RECURSE);
I64 size;
U8 *ptr;
CArcCompress *ac;
LineRep1(tempde); //We have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
LineRep2(DocPut,tempde);
"$$GREEN$$***************$$FG$$\n";
ptr=DirTreeSerialize(tempde,&size);
DirTreeDel(tempde);
D(ptr,size);
"$$GREEN$$***************:%7d$$FG$$\n",size;
ac=CompressBuf(ptr,size);
Free(ptr);
D(ac,ac->compressed_size);
"$$GREEN$$***************:%7d$$FG$$\n",size;
ptr=ExpandBuf(ac);
size=ac->expanded_size;
Free(ac);
D(ptr,size);
"$$GREEN$$***************:%7d$$FG$$\n",size;
tempde=DirTreeUnserialize(ptr);
LineRep2(DocPut,tempde); //We don't have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
DirTreeDel(tempde);
}
SerializeTree;
+5 -6
View File
@@ -3,8 +3,7 @@
//You can use $LK,"PutExcept",A="MN:PutExcept"$() in a catch statement
//and it will report args.
Bool Pmt(I64 i)
Bool Prompt(I64 i)
{
"%d ",i;
return YorN;
@@ -13,8 +12,8 @@ Bool Pmt(I64 i)
U0 D1()
{
"D1\n";
if (Pmt(1)) throw('Point1');
if (Pmt(2)) throw('Point2');
if (Prompt(1)) throw('Point1');
if (Prompt(2)) throw('Point2');
}
U0 D2()
@@ -22,7 +21,7 @@ U0 D2()
"D2\n";
try {
D1;
if (Pmt(4)) throw('Point4');
if (Prompt(4)) throw('Point4');
} catch {
"D2 handler\n"
"Ch:%c:%P\n",Fs->except_ch,Fs->except_caller1;
@@ -37,7 +36,7 @@ U0 Demo()
{
try {
D2;
if (Pmt(3)) throw('Point3');
if (Prompt(3)) throw('Point3');
} catch {
"Demo handler\n"
"Ch:%c:%P\n",Fs->except_ch,Fs->except_caller1;
+11 -14
View File
@@ -1,13 +1,13 @@
U0 Install()
{
gr_font[8*255+0]=0b00111100;
gr_font[8*255+1]=0b01000010;
gr_font[8*255+2]=0b10100101;
gr_font[8*255+3]=0b10000001;
gr_font[8*255+4]=0b11000011;
gr_font[8*255+5]=0b10111101;
gr_font[8*255+6]=0b01000010;
gr_font[8*255+7]=0b00111100;
text.font[8*255+0]=0b00111100;
text.font[8*255+1]=0b01000010;
text.font[8*255+2]=0b10100101;
text.font[8*255+3]=0b10000001;
text.font[8*255+4]=0b11000011;
text.font[8*255+5]=0b10111101;
text.font[8*255+6]=0b01000010;
text.font[8*255+7]=0b00111100;
}
Install;
@@ -18,7 +18,7 @@ Install;
//by the compiler and everything else.
//Enter them by holding ALT and
//pressing a 3 digit decimal number or
//press <CTRL-ALT-A>.
//press <CTRL-ALT-a>.
U0 SrcExample()
{
@@ -27,10 +27,7 @@ U0 SrcExample()
}
SrcExample;
//See $LK,"::/Demo/ScreenCodes.CPP"$
//$LK,"::/Demo/Graphics/CharGraphics.CPP"$,
//See $LK,"::/Demo/ScreenCodes.CPP"$, $LK,"::/Demo/Graphics/CharGraphics.CPP"$,
//and $LK,"::/Demo/Graphics/FontEd.CPP"$.
//See $LK,"chars_bitmap_alpha",A="MN:chars_bitmap_alpha"$, and
//$LK,"chars_bitmap_alpha_numeric",A="MN:chars_bitmap_alpha_numeric"$.
//See $LK,"chars_bitmap_alpha",A="MN:chars_bitmap_alpha"$ and $LK,"chars_bitmap_alpha_numeric",A="MN:chars_bitmap_alpha_numeric"$.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6 -14
View File
@@ -1,5 +1,4 @@
//This uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
AcctRegSetDftEntry("TempleOS/CastleFrankenstein","F64 best_score=9999;\n");
AcctRegExeBranch("TempleOS/CastleFrankenstein");
@@ -27,10 +26,8 @@ $SP,"<1>",BI=1$
#define MONSTER_SCALE 2.0
$SP,"<2>",BI=2$
@@ -78,7 +75,6 @@ $SP,"<1>",BI=1$
$SP,"<6>",BI=6$
@@ -87,8 +83,6 @@ $SP,"<1>",BI=1$
#define SCREEN_SCALE 512
#define PLOT_GRID_WIDTH 24
#define PLOT_GRID_HEIGHT 24
@@ -104,7 +98,7 @@ F64 man_
F64 t0,tf;
#define NUM_MONSTERS 16
#define NUM_MONSTERS 10
I64 monsters_left;
class Monster
{
@@ -136,7 +130,7 @@ Bool LOSPlot(U8 *,I64 x,I64 y,I64)
}
Bool LOS(I64 x1,I64 y1,I64 x2,I64 y2)
{ //Line of sight
{//Line of sight
return Line(NULL,x1*LOS_SCALE/SCREEN_SCALE,y1*LOS_SCALE/SCREEN_SCALE,0,
x2*LOS_SCALE/SCREEN_SCALE,y2*LOS_SCALE/SCREEN_SCALE,0,&LOSPlot);
}
@@ -357,7 +351,6 @@ U0 DrawIt(CTask *task,CDC *dc)
dc->color=LTCYAN;
GrPlot3(dc,2*(man_xx/SCREEN_SCALE),2*(map_height-1-man_yy/SCREEN_SCALE),0);
if (tf) {
dc->color=LTRED;
if (Blink)
@@ -401,14 +394,13 @@ U0 Fire()
}
}
U0 Init()
{
I64 i,x,y;
I64 min_map_x,max_map_x,min_map_y,max_map_y;
CDC *dc;
DocClear;
"$$BG,BLACK$$"; NewLine(TEXT_ROWS/2);
"$$BG,BLACK$$%h*c",TEXT_ROWS/2,'\n';
SpriteExtents($IB,"<1>",BI=1$,&min_map_x,&max_map_x,&min_map_y,&max_map_y);
map_width =(max_map_x-min_map_x+1)/MAP_SCALE+2;
@@ -482,7 +474,7 @@ U0 CleanUp()
}
U0 SongTask(I64)
{ //Song by Terry A. Davis
{//Song by Terry A. Davis
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
while (TRUE) {
@@ -531,7 +523,7 @@ U0 CastleFrankenstein()
"Play {"
" Restart(,'\n');"
" Fwd(,,SC_CURSOR_UP);"
" Backward(,,SC_CURSOR_DOWN);"
" Bwd(,,SC_CURSOR_DOWN);"
" Left(,,SC_CURSOR_LEFT);"
" Right(,,SC_CURSOR_RIGHT);"
" Fire(,CH_SPACE);"
Binary file not shown.
+18 -21
View File
@@ -2,7 +2,6 @@
//Giotto, a famous artist, drew a freehand circle as a portfolio for a job.
AcctRegSetDftEntry("TempleOS/CircleTrace","F64 best_score=999;\n");
AcctRegExeBranch("TempleOS/CircleTrace");
@@ -17,11 +16,9 @@ U0 SongTask(I64)
Play("hEDCARCDECR");
}
U0 DrawIt(CTask *task,CDC *)
U0 DrawIt(CTask *task,CDC *dc)
{
U8 buf[128];
SPrint(buf,"Error:%6.3f Time:%6.3f Score:%6.3f Best:%8.3f",avg_error,elapsed_time,score,best_score);
PlotWinStr(task,buf,BLACK<<4+WHITE,0,0);
GrPrint(dc,0,0,"Error:%6.3f Time:%6.3f Score:%6.3f Best:%8.3f",avg_error,elapsed_time,score,best_score);
}
#define CIRCLE_RADIUS 100
@@ -37,7 +34,7 @@ Bool CTPlot(CDC *dc,I64 x,I64 y,I64)
U0 CircleTrace()
{
I64 msg_code,p1,p2,x1,y1;
I64 msg_code,a1,a2,x1,y1;
F64 rad,t0,total_distance;
CDC *dc=DCAlias;
@@ -48,40 +45,40 @@ U0 CircleTrace()
cx=Fs->pix_width/2;
cy=Fs->pix_height/2;
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS-WIF_BORDER;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
DCFill;
dc->color=ROP_XOR+BLACK^COLOR_TRANSPARENT;
dc->color=ROP_XOR+BLACK^TRANSPARENT;
GrCircle(dc,cx,cy,CIRCLE_RADIUS);
do {
msg_code=GetMsg(&p1,&p2,
msg_code=GetMsg(&a1,&a2,
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN);
switch (msg_code) {
case MSG_KEY_UP:
break;
case MSG_IP_L_DOWN:
DCFill;
dc->color=ROP_XOR+BLACK^COLOR_TRANSPARENT;
dc->color=ROP_XOR+BLACK^TRANSPARENT;
GrCircle(dc,cx,cy,CIRCLE_RADIUS);
dc->color=ROP_XOR+RED^COLOR_TRANSPARENT;
dc->color=ROP_XOR+RED^TRANSPARENT;
t0=tS;
total_distance=0.001;
total_error=0;
x1=p1; y1=p2;
x1=a1; y1=a2;
do {
msg_code=ScanMsg(&p1,&p2,
msg_code=ScanMsg(&a1,&a2,
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
switch (msg_code) {
case MSG_IP_L_UP:
break;
case MSG_IP_MOVE:
if (x1!=p1 || y1!=p2) {
total_distance+=Sqrt(Sqr(x1-p1)+Sqr(y1-p2));
Line(dc,x1,y1,0,p1,p2,0,&CTPlot);
x1=p1;y1=p2;
if (x1!=a1 || y1!=a2) {
total_distance+=Sqrt(Sqr(x1-a1)+Sqr(y1-a2));
Line(dc,x1,y1,0,a1,a2,0,&CTPlot);
x1=a1;y1=a2;
//undo overlapping pixs on segments
GrPlot(dc,x1,y1);
rad=Sqrt(Sqr(x1-cx)+Sqr(y1-cy));
@@ -93,7 +90,7 @@ U0 CircleTrace()
avg_error=total_error/total_distance;
score=elapsed_time*avg_error;
//This $LK,"Sleep",A="MN:Sleep"$()s until the next time the
//$LK,"Sleep",A="MN:Sleep"$()s until the next time the
//window mgr task runs. The
//window mgr calls the UpdateWin() routine
//and places msgs in the que, so there's
@@ -101,7 +98,7 @@ U0 CircleTrace()
WinMgrSync;
} while (msg_code!=MSG_IP_L_UP);
music_mute=TRUE; Sleep(200);
music.mute=TRUE; Sleep(200);
if (total_distance>0.95*CIRCUMFERENCE) {
if (score<best_score) {
Snd(2000);Sleep(50);Snd(0);Sleep(50);
@@ -114,10 +111,10 @@ U0 CircleTrace()
} else {
Snd(100);Sleep(1000);
}
Snd(0); Sleep(200); music_mute=FALSE;
Snd(0); Sleep(200); music.mute=FALSE;
break;
}
} while (msg_code!=MSG_KEY_DOWN || p1!=CH_SHIFT_ESC && p1!=CH_ESC);
} while (msg_code!=MSG_KEY_DOWN || a1!=CH_SHIFT_ESC && a1!=CH_ESC);
GetMsg(,,1<<MSG_KEY_UP);
SettingsPop;
DCFill;
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -17,7 +17,7 @@ U0 PrintPattern(U8 *st)
I64 ch;
while (ch=*st++)
PrintDigit(ch);
NewLine;
'\n';
}
U0 Digits()
@@ -30,7 +30,7 @@ U0 Digits()
DocClear;
//Set default background and foreground
"$$WW,1$$$$BD,DKGRAY$$$$FD,WHITE$$"
"\nThis is a mem game. "
"\nThis is a memory game. "
"Try to remember the digits and enter them. "
"They are colored based on electrical "
"engineering color codes.\n";
+45 -29
View File
@@ -1,3 +1,6 @@
AcctRegSetDftEntry("TempleOS/DunGen","F64 best_score=9999;\n");
AcctRegExeBranch("TempleOS/DunGen");
//Set snap to 4 and width to 4
//if you edit this map.
@@ -20,26 +23,19 @@ $SP,"<2>",BI=2$
$SP,"<3>",BI=3$
$SP,"<4>",BI=4$ //This is a template you can copy and use to make a tile.
$SP,"<5>",BI=5$
$SP,"<6>",BI=6$
$SP,"<7>",BI=7$
$SP,"<8>",BI=8$
$SP,"<9>",BI=9$
@@ -48,10 +44,7 @@ $SP,"<10>",BI=10$
$SP,"<11>",BI=11$
$BG$
//These are indexed by color #.
$BG$//These are indexed by color #.
//See $LK,"COLORS",A="MN:RED"$.
U8 *tiles1[16]=
@@ -66,8 +59,6 @@ U8 *tiles2[16]=
NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL};
#define SCREEN_SCALE 24
#define SCREEN_WIDTH 24
#define SCREEN_HEIGHT 24
@@ -81,13 +72,16 @@ I64 man_x,man_y,man_dx,man_dy;
Bool man_attack;
F64 man_attack_t0;
#define NUM_MONSTERS 16
#define NUM_MONSTERS 10
I64 monsters_left;
class Monster
{
I64 x,y,dx,dy;
Bool dead,pad[7];
} monsters[NUM_MONSTERS];
F64 t0,tf;
#define LOS_SCALE 4
Bool LOSPlot(U8 *,I64 x,I64 y,I64)
@@ -99,17 +93,20 @@ Bool LOSPlot(U8 *,I64 x,I64 y,I64)
}
Bool LOS(I64 x1,I64 y1,I64 x2,I64 y2)
{ //Line of sight
{//Line of sight
return Line(NULL,x1*LOS_SCALE+LOS_SCALE/2,y1*LOS_SCALE+LOS_SCALE/2,0,
x2*LOS_SCALE+LOS_SCALE/2,y2*LOS_SCALE+LOS_SCALE/2,0,&LOSPlot);
}
U0 DrawIt(CTask *task,CDC *dc)
{
CDC *dc_t=DCAlias(gr_dc2,task);
I64 i,x,y,xx,yy,x1,y1,z1,color;
CDC *dc_t=DCAlias(gr.dc2,task);
I64 i,x,y,xx,yy,x1,y1,z1,color,
cx=task->pix_width/2,
cy=task->pix_height/2;
CD3I32 poly[4];
U8 **_tiles;
F64 tt;
if (Blink(5))
_tiles=tiles1;
@@ -141,7 +138,7 @@ U0 DrawIt(CTask *task,CDC *dc)
z1=0;
GrTransform(dc_t,&x1,&y1,&z1);
Sprite3(dc,x1,y1,z1,_tiles[color]);
} else { //If no tile defined, do solid color.
} else {//If no tile defined, do solid color.
poly[0].x=x*SCREEN_SCALE;
poly[0].y=y*SCREEN_SCALE;
poly[0].z=0;
@@ -228,8 +225,18 @@ U0 DrawIt(CTask *task,CDC *dc)
Sprite3(dc,x1,y1,z1,$IB,"<2>",BI=2$);
DCDel(dc_t);
}
if (tf) {
dc->color=LTRED;
if (Blink)
GrPrint(dc,cx-(FONT_WIDTH*14)/2,cy-FONT_HEIGHT/2,"Game Completed");
tt=tf;
} else {
dc->color=LTGREEN;
tt=tS;
}
GrPrint(dc,0,0,"Enemy:%d Time:%3.2f Best:%3.2f",monsters_left,tt-t0,best_score);
}
U0 Attack()
{
@@ -238,12 +245,17 @@ U0 Attack()
Noise(100,300,1000);
for (i=0;i<NUM_MONSTERS;i++) {
if (!monsters[i].dead &&
man_x+man_dx==monsters[i].x && man_y+man_dy==monsters[i].y)
man_x+man_dx==monsters[i].x && man_y+man_dy==monsters[i].y) {
monsters[i].dead=TRUE;
if (!--monsters_left) {
tf=tS;
if (tf-t0<best_score)
best_score=tf-t0;
}
}
}
}
U0 Init()
{
I64 i,x,y,minx,maxx,miny,maxy;
@@ -260,6 +272,14 @@ U0 Init()
map[y*map_width+x]=GrPeek(dc,x*MAP_SCALE,y*MAP_SCALE);
DCDel(dc);
man_attack_t0=tS;
man_attack=FALSE;
man_x=0;
man_y=4;
man_dx=0;
man_dy=0;
screen_x=0;
screen_y=0;
for (i=0;i<NUM_MONSTERS;i++) {
monsters[i].dead=FALSE;
monsters[i].dx=0;
@@ -269,14 +289,9 @@ U0 Init()
monsters[i].y=RandU64%(map_height-2)+1;
} while (!map[(monsters[i].y)*map_width+monsters[i].x]);
}
man_attack_t0=tS;
man_attack=FALSE;
man_x=0;
man_y=4;
man_dx=0;
man_dy=0;
screen_x=0;
screen_y=0;
monsters_left=NUM_MONSTERS;
tf=0;
t0=tS;
}
U0 CleanUp()
@@ -428,6 +443,7 @@ dg_done:
PutExcept;
SettingsPop;
MenuPop;
AcctRegWriteBranch("TempleOS/DunGen","F64 best_score=%5.4f;\n",best_score);
CleanUp;
}
+58 -97
View File
@@ -1,15 +1,7 @@
//This uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
//This program can be AOT compiled to a .BIN.Z or JIT.
//If AOT compiling, override the filename extention warning.
#ifaot
#include "::/Kernel/AOT.HPP"
I64 best_score=0; //Doesn't work yet for AOT
#else
AcctRegSetDftEntry("TempleOS/EagleDive","I64 best_score=0;\n");
AcctRegExeBranch("TempleOS/EagleDive");
#endif
//Keep these power of two so shift is used instead of multiply
//to index arrays.
@@ -50,7 +42,6 @@ class Fish
$SP,"<1>",BI=1$
@@ -68,22 +59,17 @@ U0 CriticalSectionEnd()
LBtr(&critical_section_flag,0);
}
//These are $BK,1$NOT$BK,0$ deallocated after the program ends,
//but I did them this way for your benefit
//so 2D array indexing is not done by hand.
//You can type "EagleDive;" at the command line
//to rerun without new allocations.
//Normally, just spawn a popup task,
//run it and kill it using an icon.
#ifaot
#exe {OptOn(OPTf_GLBLS_ON_DATA_HEAP);};
#endif
/*These are $BK,1$NOT$BK,0$ deallocated after the program ends,
but I did them this way for your benefit
so 2D array indexing is not done by hand.
You can type "EagleDive;" at the command line
to rerun without new allocations.
Normally, just spawn a popup task,
run it and kill it using an icon.
*/
I16 elevations[MAP_HEIGHT][MAP_WIDTH];
I32 normals[MAP_HEIGHT][MAP_WIDTH*2];
Panel *panels[MAP_HEIGHT][MAP_WIDTH*2];
#ifaot
#exe {OptOff(OPTf_GLBLS_ON_DATA_HEAP);};
#endif
I64 num_panels;
Panel *panel_root;
@@ -105,27 +91,16 @@ class MPCtrl {
U0 FSTransform(CDC *dc,I64 *x,I64 *y,I64 *z)
{
I64 zz;
//I accidentally made the Z coordinate sign backward
//from the fill-poly depth buf scheme, so it is negated at the end.
//Negative Z coordinates are the ones we want plotted.
GrRot(dc->r,x,y,z);
//We don't want divide by zero or make too monstrous foreground objects.
//The foreground object boundary is kinda crappy looking when
//you point toward the ground.
*z=-*z;
zz=*z+50;
*z=zz=-*z;
if (zz>0) {
//The divide causes "foreshortening" which makes the distance go to a vanishing point.
*x = *x * DISPLAY_SCALE/ zz;
*x = *x * DISPLAY_SCALE/ zz; //Foreshortening
*y = *y * DISPLAY_SCALE/ zz;
}
*x+=dc->x;
*y =dc->y-*y;
}
U0 CalcNormals()
{
/*The idea is that there are two tris
@@ -157,7 +132,6 @@ It works pretty well. It combines
more than it should, but that's good
because it would result in too many
panels.
*/
I64 i,j,k,dz1,dz2;
for (j=0;j<MAP_HEIGHT-1;j++) {
@@ -331,23 +305,10 @@ U0 MPDoPanels(CTask *task)
LBtr(&mp.init_not_done_flags,Gs->num);
}
U0 InitMap()
U0 InitElevations()
{
//We make a topographic data structure "elevations[][]"
//and convert it to panels. The conversion to panels leaves
//gaps the way I did it, but it looks good, except for sky leaking through
//There is no wrong way to pick colors if it looks good, unless
//you wanted to do lighting.
//"panels[][]" holds the flat and sloped panels for each spot, while
//"hstep_panels[][]" holds side panels in cases of step-like formations.
//They require a separate array because a single "elevation[][]" spot can
//have a panel on top and a panel on the side like stairs.
I64 i,j,l,k1,k2,x,y,xx,yy;
I64 i,j,l,x,y,xx,yy,x1,y1,x2,y2;
MemSet(elevations,0,sizeof(elevations));
MemSet(panels,0,sizeof(panels));
for (i=0;i<MAP_WIDTH*MAP_HEIGHT/128;i++) {
x=RandU32%MAP_WIDTH;
y=RandU32%MAP_HEIGHT;
@@ -357,27 +318,44 @@ U0 InitMap()
if (!l && RandU16<MAX_U16/4)
l=RandU16%(j+1);
if (l) {
for (k1=-j;k1<=j;k1++)
for (k2=-j;k2<=j;k2++) {
xx=x+k2; yy=y+k1;
if (0<=xx<MAP_WIDTH &&
0<=yy<MAP_HEIGHT)
elevations[yy][xx]+=MAP_SCALE/2;
}
l--;
x1=ClampI64(x-j,0,MAP_WIDTH-1);
x2=ClampI64(x+j,0,MAP_WIDTH-1);
y1=ClampI64(y-j,0,MAP_HEIGHT-1);
y2=ClampI64(y+j,0,MAP_HEIGHT-1);
for (yy=y1;yy<y2;yy++)
for (xx=x1;xx<x2;xx++)
elevations[yy][xx]+=MAP_SCALE/2;
l--;
}
}
}
xx=x/(MAP_SCALE*COORDINATE_SCALE);
yy=y/(MAP_SCALE*COORDINATE_SCALE);
z+=elevations[yy][xx]*COORDINATE_SCALE;
for (j=0;j<MAP_HEIGHT;j++)
for (i=0;i<MAP_WIDTH;i++)
if (elevations[j][i]<WATER_ELEVATION*MAP_SCALE)
elevations[j][i]=WATER_ELEVATION*MAP_SCALE;
}
U0 InitMap()
{/*We make a topographic data structure "elevations[][]"
and convert it to panels. The conversion to panels leaves
gaps the way I did it, but it looks good, except for sky leaking through
There is no wrong way to pick colors if it looks good, unless
you wanted to do lighting.
"panels[][]" holds the flat and sloped panels for each spot, while
"hstep_panels[][]" holds side panels in cases of step-like formations.
They require a separate array because a single "elevation[][]" spot can
have a panel on top and a panel on the side like stairs.
*/
I64 i,x,y,xx,yy;
InitElevations;
MemSet(panels,0,sizeof(panels));
xx=x/(MAP_SCALE*COORDINATE_SCALE);
yy=y/(MAP_SCALE*COORDINATE_SCALE);
z+=elevations[yy][xx]*COORDINATE_SCALE;
CalcNormals;
@@ -392,7 +370,6 @@ U0 InitMap()
panels_processed_bitmap=MAlloc((num_panels+7)>>3);
}
CDC *main_dc;
U0 DrawIt(CTask *,CDC *dc)
@@ -402,8 +379,6 @@ U0 DrawIt(CTask *,CDC *dc)
}
/*
$SP,"<2>",BI=2$
@@ -423,7 +398,6 @@ $SP,"<2>",BI=2$
$SP,"<3>",BI=3$
@@ -462,14 +436,12 @@ and render the panel for each square, marking-it done.
The depth buf is not locked in the graphic routines
so we get some glitches.
*/
I64 update_jiffy_limit;
U0 MPDrawIt(CTask *task,CDC *dc)
{
//This is identical to the previous routine but is run by core#1
I64 j,strip_width,*s2w,x1,y1,z1, xx,yy,
xh,yh,zh,yh2,xh2,x1h,y1h,x1wa,y1wa,x1wb,y1wb,
x3,y3,z3,
@@ -530,7 +502,7 @@ U0 MPDrawIt(CTask *task,CDC *dc)
yy+=y3;
}
if (Gs->num&1) { //alternate left-right,right-left
if (Gs->num&1) {//alternate left-right,right-left
yh2=-yh;
xh2=-xh;
} else {
@@ -550,10 +522,10 @@ U0 MPDrawIt(CTask *task,CDC *dc)
//Take half steps to cover whole grid.
xh>>=1; yh>>=1;
xh2>>=1; yh2>>=1;
for (strip_width=0;sys_jiffies<update_jiffy_limit;strip_width++) {
for (strip_width=0;cnts.jiffies<update_jiffy_limit;strip_width++) {
x1h=x1wa;
y1h=y1wa;
for (j=0;j<strip_height && sys_jiffies<update_jiffy_limit;j++) {
for (j=0;j<strip_height && cnts.jiffies<update_jiffy_limit;j++) {
x1=x1h>>8; y1=y1h>>8;
if (0<=x1<MAP_WIDTH && 0<=y1<MAP_HEIGHT) {
if ((tempp=panels[y1][x1*2]) && !LBts(panels_processed_bitmap,tempp->num)) {
@@ -637,8 +609,8 @@ U0 DrawHorizon(CDC *dc)
MemSet(p,0,sizeof(p));
if (x2<x1) {
SwapU64(&x1,&x2);
SwapU64(&y1,&y2);
SwapI64(&x1,&x2);
SwapI64(&y1,&y2);
}
if (!x1 && x2==dc->width-1) {
p[0].x=0;
@@ -663,8 +635,8 @@ U0 DrawHorizon(CDC *dc)
GrFillPoly3(dc,4,p);
} else {
if (y2<y1) {
SwapU64(&x1,&x2);
SwapU64(&y1,&y2);
SwapI64(&x1,&x2);
SwapI64(&y1,&y2);
}
if (!y1 && y2==dc->height-1) {
p[0].x=0;
@@ -692,7 +664,6 @@ U0 DrawHorizon(CDC *dc)
dc->depth_buf=old_db;
}
U0 BSPEagleDive()
{
CDC *dc=DCAlias(main_dc,Fs);
@@ -702,7 +673,7 @@ U0 BSPEagleDive()
F64 min_strip_width;
Fish *tempf;
update_jiffy_limit=sys_jiffies+JIFFY_FREQ/40;
update_jiffy_limit=cnts.jiffies+JIFFY_FREQ/40;
MemSet(panels_processed_bitmap,0,(num_panels+7)>>3);
xx=x/(MAP_SCALE*COORDINATE_SCALE);
@@ -713,10 +684,10 @@ U0 BSPEagleDive()
dc->color=bkcolor=BLACK;
if (!game_over) {
GrRect(dc,0,0,dc->width,dc->height);
music_mute=TRUE;
music.mute=TRUE;
Beep;
game_over=TRUE;
music_mute=FALSE;
music.mute=FALSE;
}
} else
bkcolor=BLUE;
@@ -782,8 +753,7 @@ U0 BSPEagleDive()
#define ANIMATE_MS 10
U0 AnimateTask(I64)
{
//This just steadily moves the airplane fwd.
{//Steadily moves the airplane fwd.
I64 *s2w,x1,y1,z1;
F64 t0=tS,mS;
Fish *tempf,*tempf1;
@@ -815,9 +785,9 @@ U0 AnimateTask(I64)
best_score=game_score;
QueRem(tempf);
Free(tempf);
music_mute=TRUE;
music.mute=TRUE;
Snd(1000); Sleep(200); Snd(0);
music_mute=FALSE;
music.mute=FALSE;
}
tempf=tempf1;
}
@@ -852,14 +822,10 @@ U0 TaskEndCB()
}
U0 SongTask(I64)
{ //Song by Terry A. Davis
#ifaot
Fs->task_end_cb=HashVal(HashFind("SndTaskEndCB",Fs->hash_table,HTT_FUN));
#else
{//Song by Terry A. Davis
Fs->task_end_cb=&SndTaskEndCB;
#endif
MusicSettingsRst;
music_stacatto_factor=0.2;
music.stacatto_factor=0.2;
while (TRUE) {
Play("3eBDEDBDEDFEEDFEED");
Play("BDEDBDEDFEEDFEED");
@@ -882,8 +848,6 @@ U0 Init(I64 _mp_cnt)
InitMap;
DCAllocDepthBuf(main_dc);
Fs->win_max_refresh=30.0;
strip_height=128;
è =-90.0*ã/180.0;
é1= 0.0*ã/180.0;
@@ -929,9 +893,6 @@ U0 EagleDive(I64 _mp_cnt=MP_MAX_PROCESSORS)
F64 pp,tt1,tt2;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
//We really can't afford to run at 60Hz. This is how often VGA
//memory is updated, not related to actual hardware refresh rates.
WordStat;
MenuPush(
"File {"
@@ -955,7 +916,7 @@ U0 EagleDive(I64 _mp_cnt=MP_MAX_PROCESSORS)
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
try //in case <CTRL-ALT-C> is pressed.
try //in case <CTRL-ALT-c> is pressed.
do {
if (ScanKey(&ch,&sc)) {
pp=è; tt1=é1; tt2=é2;
Binary file not shown.
+141 -32
View File
@@ -3,7 +3,8 @@
F64 game_speed,
launch_unit_x1,launch_unit_y1,launch_unit_x2,launch_unit_y2,launch_t,
return_unit_x1,return_unit_y1,return_unit_x2,return_unit_y2,return_t,
set_é_unit_x1,set_é_unit_y1,set_é_unit_x2,set_é_unit_y2,set_é_t;
set_é_unit_x1,set_é_unit_y1,set_é_unit_x2,set_é_unit_y2,set_é_t,
next_noise;
CTask *main_task;
#define OT_CARRIER 0
@@ -16,6 +17,16 @@ CTask *main_task;
#define OF_RETURNING 4
#define OF_SHOOTING 8
#define FIRE_WIDTH 56
#define FIRE_HEIGHT 16
#define FIRE_X_SCALE 0.5
#define FIRE_Y_SCALE 0.5
#define FIRE_COLORS 16
U8 fire_colors[FIRE_COLORS]={
YELLOW,YELLOW,LTRED,YELLOW, BLACK,YELLOW,RED,YELLOW,
YELLOW,BLACK,YELLOW,LTRED, RED,YELLOW,DKGRAY,YELLOW};
class Obj
{
Obj *next,*last;
@@ -34,6 +45,7 @@ class Obj
death_time,next_action_time;
I32 torpedos,max_torpedos;
F64 torpedos_range;
U8 fire[(FIRE_WIDTH*FIRE_HEIGHT+7)/8];
} obj_root;
class Torpedo
@@ -55,7 +67,6 @@ class Squadron : Obj
I64 action,dead_mask,total_mask;
} *squadrons;
U0 SquadronIns(Obj *o,Obj *pred)
{
Obj *succ=pred->next_in_squadron;
@@ -118,7 +129,6 @@ U0 ObjDel(Obj *tempo)
}
}
}
$BG,1$
@@ -148,6 +158,7 @@ CSprite *imgs[NUM_PLAYERS][OT_NUM_TYPES]={{$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i,j,k;
F64 d,cur_time=tS;
Obj *tempo;
Torpedo *tempt;
@@ -164,6 +175,17 @@ U0 DrawIt(CTask *task,CDC *dc)
while (tempo!=&obj_root) {
if (tempo->flags&OF_ACTIVE && tempo->flags&OF_SHIP) {
SpriteZ3B(dc,tempo->x,tempo->y,0,imgs[tempo->player][tempo->type],tempo->é+ã/2);
k=0;
for (j=0;j<FIRE_HEIGHT;j++)
for (i=0;i<FIRE_WIDTH;i++)
if (Bt(tempo->fire,k++)) {
dc->color=fire_colors[ToI64(k+10*tS)&(FIRE_COLORS-1)];
GrPlot(dc,tempo->x+FIRE_X_SCALE*(i-FIRE_WIDTH /2+(11*tS+i)%1.7)*Cos(tempo->é)-
FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(12*tS+j)%1.7)*Sin(tempo->é),
tempo->y+FIRE_Y_SCALE*(j-FIRE_HEIGHT/2+(19*tS+j)%1.7)*Cos(tempo->é)+
FIRE_X_SCALE*(i-FIRE_WIDTH /2+(13*tS+i)%1.7)*Sin(tempo->é));
}
if (Blink) {
dc->color=BLACK;
GrLine(dc,tempo->x+5,tempo->y,tempo->x+5+10,tempo->y);
@@ -231,11 +253,11 @@ U0 DrawIt(CTask *task,CDC *dc)
if (!num_alive[1]) {
dc->color=LTGREEN;
GrPrint(dc,task->pix_width>>1 -(FONT_WIDTH*14)/2-task->scroll_x,
task->pix_height>>1-FONT_HEIGHT/2-task->scroll_y,"Game Completed");
task->pix_height>>1-FONT_HEIGHT/2-task->scroll_y,"Game Completed");
} else {
dc->color=LTRED;
GrPrint(dc,task->pix_width>>1 -(FONT_WIDTH*9)/2-task->scroll_x,
task->pix_height>>1-FONT_HEIGHT/2-task->scroll_y,"Game Over");
task->pix_height>>1-FONT_HEIGHT/2-task->scroll_y,"Game Over");
}
}
Preempt(old_preempt);
@@ -250,6 +272,7 @@ U0 Init()
QueInit(&obj_root);
QueInit(&torpedo_root);
next_noise=tS;
Fs->scroll_x=0;
Fs->scroll_y=0;
game_speed=1.0;
@@ -387,8 +410,8 @@ Squadron *SquadronLaunch(I64 player,F64 x=MAX_F64,F64 y=MAX_F64)
if (player==0) {
launch_unit_x1=tempo->x;
launch_unit_y1=tempo->y;
launch_unit_x2=ipx-main_task->pix_left-main_task->scroll_x;
launch_unit_y2=ipy-main_task->pix_top -main_task->scroll_y;
launch_unit_x2=ip.pos.x-main_task->pix_left-main_task->scroll_x;
launch_unit_y2=ip.pos.y-main_task->pix_top -main_task->scroll_y;
launch_t=tS+0.5;
}
if (tempo->squadron>=0) {
@@ -403,7 +426,6 @@ Squadron *SquadronLaunch(I64 player,F64 x=MAX_F64,F64 y=MAX_F64)
return NULL;
}
Obj *ObjReturn(I64 player,F64 x,F64 y)
{
Obj *tempo;
@@ -456,8 +478,8 @@ Squadron *SquadronSet
if (player==0) {
set_é_unit_x1=tempo->x;
set_é_unit_y1=tempo->y;
set_é_unit_x2=ipx-main_task->pix_left-main_task->scroll_x;
set_é_unit_y2=ipy-main_task->pix_top -main_task->scroll_y;
set_é_unit_x2=ip.pos.x-main_task->pix_left-main_task->scroll_x;
set_é_unit_y2=ip.pos.y-main_task->pix_top -main_task->scroll_y;
set_é_t=tS+0.5;
}
if (tempo->squadron>=0) {
@@ -538,6 +560,44 @@ U0 AI(I64 player,F64 period)
}
}
U0 ShipDammage(Obj *tempo,F64 d)
{
I64 i,x=Rand*FIRE_WIDTH,y=Rand*FIRE_HEIGHT;
tempo->life_percent-=d;
while (d>0) {
if (!Bts(tempo->fire,y*FIRE_WIDTH+x))
d-=500.0/(FIRE_WIDTH*FIRE_HEIGHT);
else
d-=25.0/(FIRE_WIDTH*FIRE_HEIGHT);
i=RandI16&7;
x+=gr_x_offsets[i];
y+=gr_y_offsets[i];
while (x>=FIRE_WIDTH)
x-=FIRE_WIDTH;
while (x<0)
x+=FIRE_WIDTH;
while (y>=FIRE_HEIGHT)
y-=FIRE_HEIGHT;
while (y<0)
y+=FIRE_HEIGHT;
}
}
U0 ShipFix(Obj *tempo,F64 d)
{
tempo->life_percent+=d;
if (tempo->life_percent>=100.0) {
tempo->life_percent=100.0;
MemSet(tempo->fire,0,sizeof(Obj.fire));
return;
}
while (d>0)
if (Btr(tempo->fire,FIRE_WIDTH*FIRE_HEIGHT*Rand))
d-=400.0/(FIRE_WIDTH*FIRE_HEIGHT);
else
d-=20.0/(FIRE_WIDTH*FIRE_HEIGHT);
}
U0 Combat(F64 period)
{
F64 d;
@@ -566,11 +626,14 @@ U0 Combat(F64 period)
} else if (tempo->ship_guns>0 && d<tempo->ship_guns_range) {
tempo->flags|=OF_SHOOTING;
if (Rand<125.0*period) {
tempo1->life_percent-=tempo->ship_guns*Rand*period;
ShipDammage(tempo1,tempo->ship_guns*Rand*period);
if (Rand<10.0*period)
tempo1->fuel*=0.75*Rand+0.25;
}
Noise(100,75,200);
if (tS>next_noise) {
Noise(100,75,200);
next_noise=tS+0.1;
}
}
} else {
if (tempo->air_guns>0 && d<tempo->air_guns_range) {
@@ -580,7 +643,10 @@ U0 Combat(F64 period)
if (Rand<10.0*period)
tempo1->fuel*=0.75*Rand+0.25;
}
Noise(25,500,2000);
if (tS>next_noise) {
Noise(25,500,2000);
next_noise=tS+0.025;
}
}
}
}
@@ -606,11 +672,10 @@ U0 Combat(F64 period)
#define ANIMATE_FREQ 50
U0 AnimateTask(I64)
{ //Preemption is off after Spawn
{//Preemption is off after Spawn
Obj *tempo;
Torpedo *tempt,*tempt1;
F64 d,period;
I64 cnt=0;
while (TRUE) {
period=GAME_SPEED_SCALE*game_speed/ANIMATE_FREQ;
@@ -639,7 +704,7 @@ U0 AnimateTask(I64)
if (tS>tempt->timeout) {
tempo=tempt->target;
if (Rand<0.333333) {
tempo->life_percent-=150*Rand*Rand;
ShipDammage(tempo,150*Rand*Rand);
if (Rand<0.333333)
tempo->fuel*=0.75*Rand+0.25;
}
@@ -683,7 +748,7 @@ U0 AnimateTask(I64)
if (tempo->flags&OF_RETURNING)
tempo->dé+=Wrap(Arg(tempo->host->x-tempo->x,tempo->host->y-tempo->y)-(tempo->é+tempo->dé),-ã);
} else if (tempo->type==OT_CARRIER)
tempo->life_percent=Min(100.0,tempo->life_percent+2.5*period);
ShipFix(tempo,2.5*period);
}
tempo=tempo->next;
}
@@ -694,21 +759,22 @@ U0 AnimateTask(I64)
}
}
U0 FlatTops()
{
I64 p1,p2;
I64 a1,a2;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=BLUE<<4+WHITE;
WinMax;
WinBorder;
WordStat;
DocCursor;
DocClear;
PopUpOk("$$GREEN$${Left-Mouse}$$FG$$\t\tChange Course\n"
"$$GREEN$${Right-Mouse}$$FG$$\t\tLaunch Squadron\n"
"$$GREEN$${Right-Double-Mouse}$$FG$$\tReturn Squadron\n"
"$$GREEN$${Ctrl-Left Grab}$$FG$$\tScroll Screen\n");
Preempt(OFF),
WinBorder;
WordStat;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
@@ -720,18 +786,15 @@ U0 FlatTops()
" Slower(,'-');"
"}"
);
WinMax;
Fs->win_inhibit|=WIF_IP_L|WIF_IP_R;
Fs->win_inhibit|=WIF_SELF_IP_L|WIF_SELF_IP_R;
Init;
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
try {
while (TRUE)
switch(GetMsg(&p1,&p2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_IP_R_D_UP)) {
switch(GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_IP_R_D_UP)) {
case MSG_KEY_DOWN:
switch (p1) {
switch (a1) {
case '\n':
CleanUp;
Init;
@@ -748,13 +811,13 @@ U0 FlatTops()
}
break;
case MSG_IP_L_UP:
SquadronSeté(0,p1,p2);
SquadronSeté(0,a1,a2);
break;
case MSG_IP_R_UP:
SquadronLaunch(0,p1,p2);
SquadronLaunch(0,a1,a2);
break;
case MSG_IP_R_D_UP:
SquadronReturn(0,p1,p2);
SquadronReturn(0,a1,a2);
break;
}
nv_done:
@@ -767,8 +830,54 @@ nv_done:
}
FlatTops;
//Maybe use this in the future $SP,"<7>",BI=7$
r&úÿÿÿéÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿ ÿ ÿ ÿ ÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿr&úÿÿÿéÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ  ÿ ÿ ÿ ÿ ÿ ÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿb %üÿÿÿìÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿb %üÿÿÿìÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿ ÿÿÿÿ  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ0
þÿÿÿ
ÿÿÿÿ 0
þÿÿÿ
ÿÿÿÿ 
ÿÿÿÿ ƒ 6,çÿÿÿ,}i(U(U7Ôþÿÿ7Ôþÿÿºÿÿÿºÿÿÿdâÿÿÿíþÿÿ2ÿÿÿ2ÿÿÿíþÿÿíþÿÿ2ÿÿÿ2ÿÿÿíþÿÿi,çÿÿÿöÿÿÿ,öÿÿÿ}öÿÿÿi(öÿÿÿU(öÿÿÿUöÿÿÿ7öÿÿÿÔþÿÿ7öÿÿÿÔþÿÿºÿÿÿöÿÿÿºÿÿÿöÿÿÿdâÿÿÿöÿÿÿiöÿÿÿ        





      


   ,ìÿÿÿ,(Ôþÿÿ#ÔþÿÿÄÿÿÿÎÿÿÿÞþÿÿÓÿÿÿâÿÿÿÞþÿÿâÿÿÿ#âÿÿÿÓÿÿÿâÿÿÿ'ñÿÿÿâÿÿÿ'âÿÿÿ   
    




+5 -6
View File
@@ -61,7 +61,7 @@ U0 Init()
{
I64 i,x=0;
DocClear;
"$$BG,DKGRAY$$"; NewLine((TEXT_ROWS-1)/2);
"$$BG,DKGRAY$$%h*c",(TEXT_ROWS-1)/2,'\n';
speed=0;
distance=0;
road_trend=0;
@@ -76,10 +76,9 @@ U0 Init()
crash=FALSE;
}
U0 Halogen()
{
I64 p1,p2,ch=0,sc=0;
I64 a1,a2,ch=0,sc=0;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
Fs->text_attr=BLACK<<4+WHITE;
MenuPush(
@@ -103,9 +102,9 @@ U0 Halogen()
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
switch (ScanMsg(&p1,&p2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
switch (ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
case MSG_KEY_DOWN:
ch=p1;sc=p2;
ch=a1;sc=a2;
switch (ch) {
case '\n':
Init;
@@ -116,7 +115,7 @@ U0 Halogen()
}
break;
case MSG_KEY_UP:
ch=p1;sc=p2;
ch=a1;sc=a2;
if (!ch)
switch (sc.u8[0]) {
case SC_CURSOR_RIGHT:
+21 -25
View File
@@ -9,7 +9,6 @@ class MySpring:CSpring
CMathODE *ode=NULL;
U0 DrawIt(CTask *task,CDC *dc)
{
Bool old_suspend;
@@ -34,13 +33,10 @@ U0 DrawIt(CTask *task,CDC *dc)
Suspend(task,old_suspend);
}
U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
{
//The forces due to springs and drag are
//automatically handled by the
//ode code. We can add new forces
//here.
{//The forces due to springs and drag are
//automatically handled by the ode code.
//We can add new forces here.
F64 d,dd;
CD3 p;
MyMass *tempm1,*tempm2;
@@ -50,7 +46,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
tempm2=tempm1->next;
while (tempm2!=&ode->next_mass) {
D3Sub(&tempm2->state->x,&tempm1->state->x,&p);
dd=D3SqrNorm(&p);
dd=D3NormSqr(&p);
if (dd<=Sqr(tempm1->radius+tempm2->radius)) {
d=Sqrt(dd)+0.0001;
dd=10.0*Sqr(Sqr(Sqr(tempm1->radius+tempm2->radius)-dd));
@@ -106,7 +102,7 @@ U0 CleanUp()
U0 MassSpringDemo()
{
I64 msg_code,p1,p2;
I64 msg_code,a1,a2;
MyMass *tempm1=NULL,*tempm2=NULL;
PopUpOk("Left-Click to place mas\n"
@@ -116,20 +112,20 @@ U0 MassSpringDemo()
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
//This Preempt() eliminates a lot of hassles.
//The concern is about changing
//que links while the winmgr task
//is updating the ode or screen.
/*Preempt(OFF) eliminates a lot of hassles.
The concern is about changing
que links while the winmgr task
is updating the ode or screen.
//The Window mgr suspends this
//task while updating the ode. It
//will not be interrupted and with this
//preempt, we will not be interrupted.
//There is little downside to Preempt()
//since we will yield during GetMsg().
The Window mgr suspends this
task while updating the ode. It
will not be interrupted and with this
preempt, we will not be interrupted.
There is little downside to Preempt()
since we will yield during GetMsg().
*/
Preempt(OFF);
Fs->win_inhibit|=WIG_DBL_CLICK;
WordStat;
@@ -150,22 +146,22 @@ U0 MassSpringDemo()
try {
while (TRUE) {
msg_code=GetMsg(&p1,&p2,1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN);
switch (msg_code) {
case MSG_IP_L_DOWN:
PlaceMass(p1,p2);
PlaceMass(a1,a2);
break;
case MSG_IP_R_DOWN:
tempm1=MassFind(ode,p1,p2);
tempm1=MassFind(ode,a1,a2);
tempm2=NULL;
break;
case MSG_IP_R_UP:
if (tempm1 && (tempm2=MassFind(ode,p1,p2)) && tempm1!=tempm2)
if (tempm1 && (tempm2=MassFind(ode,a1,a2)) && tempm1!=tempm2)
PlaceSpring(tempm1,tempm2);
tempm1=tempm2=NULL;
break;
case MSG_KEY_DOWN:
switch (p1) {
switch (a1) {
case '\n':
CleanUp;
Init;
+18 -17
View File
@@ -1,28 +1,29 @@
//See $LK,"ExtScreenCodes",A="FA:::/Adam/Gr/GrScreen.CPP,ExtScreenCodes"$
//See $LK,"TextBase Layer",A="HI:TextBase Layer"$.
#define ATTR (BLACK<<12+WHITE<<8)
U32 text[TEXT_ROWS][TEXT_COLS];
U0 DrawIt(CTask *task,CDC *)
{
MemCpy(gr_text_base+TEXT_COLS,text,(TEXT_ROWS-1)*TEXT_COLS*sizeof(U32));
{ //$LK,"gr.text_base",A="MN:CGrGlbls"$ gets clear 60fps, so we must use our own permanent text array.
MemCpy(gr.text_base+TEXT_COLS,text,(TEXT_ROWS-1)*TEXT_COLS*sizeof(U32));
// You can copy it this way, if you like:
// I64 i,j;
// for (j=0;j<TEXT_ROWS;j++)
// for (i=0;i<TEXT_COLS;i++)
// PlotWinU8(task,text[j][i],i,j);
// TextChar(task,,i,j,text[j][i]);
PlotWinStr(task,"Draw a maze with left button.",ATTR>>8,0,0);
PlotWinStr(task,"Solve maze starting at right click.",ATTR>>8,0,1);
TextPrint(task,0,0,ATTR>>8,"Draw a maze with left button.");
TextPrint(task,0,1,ATTR>>8,"Solve maze starting at right click.");
}
#define STK_SIZE 2048
//We would put these as local vars
//In SolveMaze() except the system stk size
//is limited. The heap is the normal TempleOS
//technique, but it's a pain in this case.
//in SolveMaze() but the system stk size
//is limited, so it's a bad habit. The heap
//is the normal TempleOS technique, but
//it's a pain in this case.
I64 stk_ptr,
stk_x [STK_SIZE],
stk_y [STK_SIZE],
@@ -50,7 +51,7 @@ U0 SolveMaze(I64 x,I64 y)
text[y][x]='.'+ATTR;
x+=dir_x[dir];
y+=dir_y[dir];
//u8.[0] is the ASCII
//u8.[0] is the ASCII
if (text[y][x].u8[0]) {
x-=dir_x[dir];
y-=dir_y[dir];
@@ -68,7 +69,7 @@ U0 SolveMaze(I64 x,I64 y)
if (stk_ptr==STK_SIZE) return;
Sleep(100);
if (ScanChar)
ThrowBreak; //CTRL-ALT-C
ThrowBreak; //<CTRL-ALT-c>
}
}
}
@@ -84,18 +85,18 @@ U0 Maze()
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS-WIF_BORDER;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
try
do {
MemSet(text,0,sizeof(text));
while (!(ch=ScanChar)) {
//Input Ptr (mouse) text x,y coordinates.
x=iptx-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
y=ipty-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
if (ip_lb&&!win_grab_scroll)
//Input Ptr (mouse) text x,y coordinates.
x=ip.pos_text.x-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
y=ip.pos_text.y-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
if (ip.lb&&!winmgr.grab_scroll)
text[y][x]=CH_SPACE+ATTRF_INVERT+ATTR;
if (ip_rb&&!win_grab_scroll) {
if (ip.rb&&!winmgr.grab_scroll) {
text[y][x]='*'+ATTR;
SolveMaze(x,y);
ch=GetChar;
+4 -6
View File
@@ -7,7 +7,6 @@ class Drop
I32 x,y;
} drops[NUM_DROPS];
CDC *cur_dc;
U0 DrawFrame(CTask *task,CDC *dc)
@@ -22,7 +21,7 @@ U0 DrawFrame(CTask *task,CDC *dc)
dc->color=LTRED;
GrLine(dc,cx-100,cy-100,cx,cy);
GrLine(dc,cx+100,cy-100,cx,cy);
if (Bt(key_down_bitmap,sc_1)) {
if (Bt(kbd.down_bitmap,sc_1)) {
dc->color=WHITE;
GrRect(dc,cx-2,cy-2,5,5);
}
@@ -35,7 +34,7 @@ U0 DrawFrame(CTask *task,CDC *dc)
dc->color=LTRED;
GrLine(dc,cx-200,cy,cx,cy+100);
GrLine(dc,cx+200,cy,cx,cy+100);
if (Bt(key_down_bitmap,sc_2)) {
if (Bt(kbd.down_bitmap,sc_2)) {
dc->color=WHITE;
GrRect(dc,cx-2,cy+100-2,5,5);
}
@@ -72,7 +71,6 @@ U0 DrawIt(CTask *task,CDC *dc)
UpdateCurBase(task,dc);
}
U0 AnimateTask(I64)
{
I64 i,j,cur_drop=0,c1,c2,x0,y0,x1,y1,w,h;
@@ -165,8 +163,8 @@ U0 RainDrops()
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
cur_dc=DCNew(GR_WIDTH,GR_HEIGHT);
sc_1=A2ScanCode('1');
sc_2=A2ScanCode('2');
sc_1=Char2ScanCode('1');
sc_2=Char2ScanCode('2');
Init;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
DocCursor;
+22 -33
View File
@@ -1,4 +1,4 @@
//This uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
AcctRegSetDftEntry("TempleOS/RawHide","F64 best_score=9999;\n");
AcctRegExeBranch("TempleOS/RawHide");
@@ -10,8 +10,7 @@ F64 t0,tf;
#define MAP_BORDER 3
CDC *dc2;
$BG,10$
#define GE_COW 0
$BG,10$#define GE_COW 0
$SP,"<1>",BI=1$
@@ -25,16 +24,12 @@ $SP,"<2>",BI=2$
$SP,"<3>",BI=3$
#define GE_NUM 3
$BG$
class RHCSprite
{
U8 *img;
I64 min_x,max_x,min_y,max_y;
} rh_sprite[GE_NUM];
#define NUM_ANIMALS 128
class Animal
@@ -46,8 +41,7 @@ class Animal
Bool dead,pad[2];
} *a;
// ************************************
//************************************
#define COURSE_LEN (MAP_HEIGHT*2)
I32 *rx,*ry,*rw;
I64 river_lo,river_hi;
@@ -123,8 +117,7 @@ U0 RiverDel()
Free(rw);
}
// ************************************
//************************************
class RiverDrop
{
RiverDrop *next,*last;
@@ -186,10 +179,10 @@ U0 RiverDropsDraw(CDC *dc,I64 cx,I64 cy)
LBtr(&rd_lock,0);
}
// ************************************
//************************************
U0 DrawIt(CTask *task,CDC *dc)
{
static I64 last_ipx=0;
static I64 last_pos_x=0;
static Bool left=TRUE;
F64 t;
I64 i,
@@ -219,20 +212,19 @@ U0 DrawIt(CTask *task,CDC *dc)
dc->flags&=~(DCF_JUST_MIRROR|DCF_SYMMETRY);
}
if (ipx-last_ipx>0)
if (ip.pos.x-last_pos_x>0)
left=FALSE;
else if (ipx-last_ipx<0)
else if (ip.pos.x-last_pos_x<0)
left=TRUE;
if (left) {
dc->flags|=DCF_JUST_MIRROR|DCF_SYMMETRY;
GrSetSymmetry(dc,ipx-task->pix_left-task->scroll_x,0,ipx-task->pix_left-task->scroll_x,1);
GrSetSymmetry(dc,ip.pos.x-task->pix_left-task->scroll_x,0,ip.pos.x-task->pix_left-task->scroll_x,1);
}
Sprite3(dc,
ipx-task->pix_left-task->scroll_x,
ipy-task->pix_top -task->scroll_y,0,rh_sprite[GE_HORSE].img);
ip.pos.x-task->pix_left-task->scroll_x,
ip.pos.y-task->pix_top -task->scroll_y,0,rh_sprite[GE_HORSE].img);
dc->flags&=~(DCF_JUST_MIRROR|DCF_SYMMETRY);
last_ipx=ipx;
last_pos_x=ip.pos.x;
if (tf) {
dc->color=RED;
@@ -248,7 +240,6 @@ U0 DrawIt(CTask *task,CDC *dc)
GrPrint(dc,-task->scroll_x,-task->scroll_y,"Time:%7.2fs Best:%7.2fs",t,best_score);
}
U0 BuddySelect(I64 i)
{
I64 b,best_b=i,score,best_score=MAX_I64;
@@ -276,8 +267,8 @@ U0 AnimateTask(CTask *parent)
max_speed=ClampU64(max_speed,MAX_U32/3,200*MAX_U32);
cx=(MAP_WIDTH -parent->pix_width)/2,
cy=(MAP_HEIGHT-parent->pix_height)/2;
cursor_x=ipx+cx-parent->pix_left-parent->scroll_x;
cursor_y=ipy+cy-parent->pix_top -parent->scroll_y;
cursor_x=ip.pos.x+cx-parent->pix_left-parent->scroll_x;
cursor_y=ip.pos.y+cy-parent->pix_top -parent->scroll_y;
min_x=max_x=min_y=max_y=cnt=0;
stress=0;
for (i=0;i<NUM_ANIMALS;i++) {
@@ -320,7 +311,6 @@ U0 AnimateTask(CTask *parent)
tempa->dx+=0.1*(tempa1->dx-tempa->dx);
tempa->dy+=0.1*(tempa1->dy-tempa->dy);
//Add random movement, limit speed and dampen speed
tempa->dx=0.995*ClampI64(tempa->dx+RandI32/32,-max_speed,max_speed);
tempa->dy=0.995*ClampI64(tempa->dy+RandI32/32,-max_speed,max_speed);
@@ -362,13 +352,13 @@ U0 AnimateTask(CTask *parent)
if (!tf && (max_x-min_x)>>32<GR_WIDTH && (max_y-min_y)>>32<GR_HEIGHT) {
tf=tS;
music_mute=TRUE;
music.mute=TRUE;
Snd(2000);Sleep(200);Snd(0);Sleep(100);
if (tf-t0<best_score) {
best_score=tf-t0;
Snd(2000);Sleep(200);Snd(0);Sleep(100);
}
music_mute=FALSE;
music.mute=FALSE;
}
updates++;
@@ -388,7 +378,7 @@ U0 AnimateTask(CTask *parent)
}
U0 SongTask(I64)
{ //Randomly generated (by God :-)
{//Randomly generated (by God :-)
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
while (TRUE) {
@@ -399,7 +389,6 @@ U0 SongTask(I64)
}
}
U0 ReInit()
{
I64 i;
@@ -412,7 +401,7 @@ U0 ReInit()
dc2->pen_width=MAP_BORDER;
dc2->color=RED;
GrLineRect4(dc2,MAP_BORDER/2,MAP_BORDER/2,MAP_WIDTH-(MAP_BORDER+1)/2,MAP_HEIGHT-(MAP_BORDER+1)/2);
GrBorder(dc2,MAP_BORDER/2,MAP_BORDER/2,MAP_WIDTH-(MAP_BORDER+1)/2,MAP_HEIGHT-(MAP_BORDER+1)/2);
for (i=river_lo;i<=river_hi;i++)
RiverDropsNext(Fs);
@@ -463,7 +452,7 @@ U0 CleanUp()
U0 RawHide()
{
I64 msg_code,p1,p2;
I64 msg_code,a1,a2;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
PopUpOk(
"Coral the cattle into an area\n"
@@ -480,7 +469,7 @@ U0 RawHide()
"}"
);
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS-WIF_BORDER-WIF_GRAB_SCROLL-WIF_MENU;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
WinMax;
WordStat;
Preempt(OFF);
@@ -491,14 +480,14 @@ U0 RawHide()
Fs->draw_it=&DrawIt;
try {
while (TRUE) {
msg_code=GetMsg(&p1,&p2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_DOWN);
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_DOWN);
switch (msg_code) {
case MSG_IP_L_DOWN: //Doesn't do anything, yet.
break;
case MSG_IP_R_DOWN: //Doesn't do anything, yet.
break;
case MSG_KEY_DOWN:
switch (p1) {
switch (a1) {
case '\n':
ReInit;
break;
Binary file not shown.
Binary file not shown.
+4 -19
View File
@@ -11,22 +11,14 @@ class MySpring:CSpring
{
I64 type;
};
$BG,11$
$SP,"<1>",BI=1$
$SP,"<2>",BI=2$
$SP,"<3>",BI=3$
$BG$
@@ -42,8 +34,7 @@ $BG$
$SP,"<4>",BI=4,BP="::/Demo/Graphics/Camp.CPP.Z,Mountain"$ //Pointer to sprite in Camp.CPP.Z file
$SP,"<4>",BI=4,BP="::/Demo/Graphics/Mountain.CPP.Z,Mountain"$ //Pointer to sprite in $LK,"Mountain.CPP",A="FI:::/Demo/Graphics/Mountain.CPP"$ file
#define HOSE_RADIUS 3
#define LINK_SIZE 6
@@ -58,7 +49,6 @@ F64 nozzle_
CMathODE *ode=NULL;
F64 start_up_timeout;
U0 DrawIt(CTask *task,CDC *dc)
{
Bool old_suspend,first;
@@ -167,16 +157,12 @@ U0 DrawIt(CTask *task,CDC *dc)
Suspend(task,old_suspend);
}
U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *state,COrder2D3 *DstateDt)
{
//The forces due to springs and drag are
{//The forces due to springs and drag are
//automatically handled by the
//ode code. We can add new forces
//here.
nounusedwarn t,state,DstateDt;
// F64 d,dd;
// CD3 p;
MyMass *tempm1,*tempm2;
nounusedwarn tempm2;
@@ -244,8 +230,7 @@ U0 HoseNew()
}
U0 AnimateTask(I64)
{
//Preempt is off by default for new task
{//Preempt is off by default for new task
MyMass *tempm,*tempm1;
F64 dx,dy;
while (TRUE) {
@@ -310,7 +295,7 @@ U0 MoveNozzleTaskY(I64 sign)
U0 Init()
{
DocClear;
"$$BG,LTCYAN$$"; NewLine(GROUND_Y/FONT_HEIGHT);
"$$BG,LTCYAN$$%h*c",ToI64(GROUND_Y/FONT_HEIGHT),'\n';
//Allow hose to settle.
start_up_timeout=tS+0.5;
Binary file not shown.
+3 -4
View File
@@ -1,6 +1,5 @@
//Generate "Stadium.GRA.Z" from "Stadium.TXT.Z"
U0 StadiumGen()
{
U0 (*fp_old_update)(CDC *dc);
@@ -13,8 +12,8 @@ U0 StadiumGen()
Type("::/Demo/Games/Stadium/Stadium.TXT");
"$$CM,0,%d$$",TEXT_ROWS-3;
DocCursor(OFF);
fp_old_update=fp_final_screen_update; //hide mouse cursor
fp_final_screen_update=NULL;
fp_old_update=gr.fp_final_screen_update; //hide mouse cursor
gr.fp_final_screen_update=NULL;
WinMgrSync(2,TRUE);
dc2=DCCaptureScreen;
@@ -25,7 +24,7 @@ U0 StadiumGen()
DCDel(dc);
DocCursor(ON);
fp_final_screen_update=fp_old_update;
gr.fp_final_screen_update=fp_old_update;
DocClear;
}
Binary file not shown.
+9 -14
View File
@@ -35,20 +35,15 @@ U0 DrawBoard(I64 player)
break;
}
/*
ipx,ipy are input pointer (mouse) x,y.
ip_lb is mouse left button
*/
//ip.pos.x,ip.pos.y are input pointer (mouse) x,y.
//ip.lb is mouse left button
if (player==1)
DrawX(dc,ipx-Fs->pix_left,ipy-Fs->pix_top);
DrawX(dc,ip.pos.x-Fs->pix_left,ip.pos.y-Fs->pix_top);
else
DrawO(dc,ipx-Fs->pix_left,ipy-Fs->pix_top);
DrawO(dc,ip.pos.x-Fs->pix_left,ip.pos.y-Fs->pix_top);
DCDel(dc);
}
U0 TakeTurn(I64 player)
{
I64 i,x=0,y=0;
@@ -57,16 +52,16 @@ U0 TakeTurn(I64 player)
Beep(500);
else
Beep(1000);
while (!ip_lb) {
while (!ip.lb) {
DrawBoard(player);
WinMgrSync;
}
while (ip_lb) {
while (ip.lb) {
DrawBoard(player);
WinMgrSync;
}
x=ipx-Fs->pix_left;
y=ipy-Fs->pix_top;
x=ip.pos.x-Fs->pix_left;
y=ip.pos.y-Fs->pix_top;
i=(x-100)/100+(y-100)/100*3;
}
board[i]=player;
@@ -118,7 +113,7 @@ U0 TicTacToe()
{
WinMax; //Maximize window
DocClear; //Clear window text.
"$$GREEN$$CTRL-ALT-C$$FG$$ to exit.\n";
"$$GREEN$$CTRL-ALT-c$$FG$$ to exit.\n";
try
while (TRUE)
DoGame;
+5 -12
View File
@@ -1,4 +1,3 @@
@@ -8,7 +7,6 @@
$SP,"<2>",BI=2$
@@ -17,8 +15,6 @@
$SP,"<3>",BI=3$
@@ -50,7 +46,6 @@
$SP,"<5>",BI=5$
@@ -92,7 +87,6 @@
AcctRegSetDftEntry("TempleOS/Varoom","F64 best_score=9999;\n");
AcctRegExeBranch("TempleOS/Varoom");
@@ -201,7 +195,7 @@ U0 MPUpdateWin(CDC *dc2)
Bool draw;
CD3I32 poly[4];
TrackPoly *tempt;
CDC *dc=DCAlias(gr_dc2,task);
CDC *dc=DCAlias(gr.dc2,task);
GrIdentEqu(r);
GrRotYEqu(r,ã-c[0].é);
@@ -314,9 +308,9 @@ U0 DrawIt(CTask *task,CDC *dc)
while (mp_not_done_flags)
Yield;
if (Bt(key_down_bitmap,SC_CURSOR_LEFT))
if (Bt(kbd.down_bitmap,SC_CURSOR_LEFT))
è=-0.5;
else if (Bt(key_down_bitmap,SC_CURSOR_RIGHT))
else if (Bt(kbd.down_bitmap,SC_CURSOR_RIGHT))
è=0.5;
else
è=0;
@@ -363,7 +357,6 @@ U0 DrawIt(CTask *task,CDC *dc)
180+180/ã*Arg(c[0].p.x,c[0].p.z),100.0*distance/(2*ã*TRACK_INNER),s,best_score);
}
U0 AnimateTask(I64)
{
Car *tempc;
@@ -388,7 +381,7 @@ U0 AnimateTask(I64)
R2P(&m,&a,c[0].p.x,c[0].p.z);
if (!game_over && TRACK_INNER<=m<=TRACK_OUTER) {
for (i=1;i<NUM_CARS;i++)
if (D3I32SqrDist(&c[i].p,&c[0].p)<CAR_LENGTH*CAR_LENGTH>>1) {
if (D3I32DistSqr(&c[i].p,&c[0].p)<CAR_LENGTH*CAR_LENGTH>>1) {
game_over=TRUE;
Noise(500,50,100);
Sleep(500);
@@ -469,7 +462,7 @@ U0 Varoom()
SettingsPush(Fs,TSF_SAME_SONG); //See $LK,"SettingsPush",A="MN:SettingsPush"$
try {
Fs->text_attr=YELLOW<<4+BLUE;
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS-WIF_GRAB_SCROLL-WIF_MENU;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
WordStat;
WinMax;
WinBorder;
+8 -17
View File
@@ -19,7 +19,6 @@ AcctRegExeBranch("TempleOS/Wenceslas");
@@ -35,7 +34,6 @@ AcctRegExeBranch("TempleOS/Wenceslas");
$SP,"<5>",BI=5$
@@ -55,8 +53,6 @@ AcctRegExeBranch("TempleOS/Wenceslas");
$SP,"<6>",BI=6$
@@ -64,13 +60,8 @@ AcctRegExeBranch("TempleOS/Wenceslas");
$SP,"<7>",BI=7$
#define NUM_FLAKES 0x8000
class Flake
{
@@ -114,7 +105,7 @@ U0 DrawIt(CTask *task,CDC *dc)
dc->pen_width=1;
for (i=0;i<NUM_TREES;i++) {
if (trees[i].y<=h/2) { //Draw trees behind house
if (trees[i].y<=h/2) {//Draw trees behind house
if (trees[i].fire_frame_index) {
if (trees[i].fire_frame_index++&1)
img=$IB,"<4>",BI=4$;
@@ -131,7 +122,7 @@ U0 DrawIt(CTask *task,CDC *dc)
Sprite3(dc,w/2,h/2,0,$IB,"<7>",BI=7$);
for (i=0;i<NUM_TREES;i++) {
if (trees[i].y>h/2) { //Draw trees in front of house
if (trees[i].y>h/2) {//Draw trees in front of house
if (trees[i].fire_frame_index) {
if (trees[i].fire_frame_index++&1)
img=$IB,"<4>",BI=4$;
@@ -287,7 +278,7 @@ U0 Follow(CTask *,Peasant *tempp)
}
U0 AnimateTask(I64)
{//preempt off by default after Spawned
{//Preempt off by default after spawned.
Step *temps,*temps1;
Peasant *tempp;
I64 i,animate_cnt=0,w,h;
@@ -351,13 +342,13 @@ U0 AnimateTask(I64)
}
if (!not_stopped_cnt && !tf) {
tf=tS;
music_mute=TRUE;
music.mute=TRUE;
Snd(2000);Sleep(200);Snd(0);Sleep(100);
if (tf-t0<best_score) {
best_score=tf-t0;
Snd(2000);Sleep(200);Snd(0);Sleep(100);
}
music_mute=FALSE;
music.mute=FALSE;
}
snow_x+=RandU16%3-1;
@@ -379,8 +370,8 @@ U0 SongTask(I64)
{
Fs->task_end_cb=&SndTaskEndCB;
MusicSettingsRst;
music_tempo= 2.480;
music_stacatto_factor= 0.902;
music.tempo= 2.480;
music.stacatto_factor= 0.902;
while (TRUE) {
Play("3eCCCDCC2qG3eA2G3ABqCC");
Play("eCCCDCC2qG3eA2G3ABqCC");
@@ -464,7 +455,7 @@ Shall yourselves find blessing
PopUpOk("
$$PURPLE$$$$TX+CX,\"Winceslas Game\"$$$$FG$$
Start fires by pressing $$GREEN$$<SPACE BAR>$$FG$$
Start fires by pressing $$GREEN$$<SPACE>$$FG$$
on trees. (Yule logs)
Lead peasants to fires.
+6 -8
View File
@@ -23,8 +23,8 @@ U0 DrawIt(CTask *task,CDC *dc)
GrRect(dc,cx-BASE_SIZE+2,cy-BASE_SIZE+2,BASE_SIZE*2-4,BASE_SIZE*2-4);
dc->color=YELLOW;
GrLine(dc,balls[0].x,balls[0].y,
ipx-task->pix_left-task->scroll_x,
ipy-task->pix_top-task->scroll_y);
ip.pos.x-task->pix_left-task->scroll_x,
ip.pos.y-task->pix_top-task->scroll_y);
for (i=0;i<NUM_SPRINGS;i++)
GrLine(dc,springs[i].end1->x,springs[i].end1->y,
springs[i].end2->x,springs[i].end2->y);
@@ -51,7 +51,6 @@ U0 DrawIt(CTask *task,CDC *dc)
Snd(0);
}
U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
{
I64 i,j;
@@ -59,7 +58,7 @@ U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
CD3 p,p2;
CTask *task=ode->win_task;
D3SubEqu(D3Equ(&p2,ipx-task->pix_left-task->scroll_x,ipy-task->pix_top-task->scroll_y,0),
D3SubEqu(D3Equ(&p2,ip.pos.x-task->pix_left-task->scroll_x,ip.pos.y-task->pix_top-task->scroll_y,0),
&balls[0].state->x);
D3AddEqu(&balls[0].DstateDt->DxDt,D3MulEqu(&p2,STRETCH));
@@ -76,7 +75,7 @@ U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
for (i=0;i<NUM_BALLS;i++)
for (j=i+1;j<NUM_BALLS;j++) {
D3Sub(&balls[j].state->x,&balls[i].state->x,&p);
dd=D3SqrNorm(&p);
dd=D3NormSqr(&p);
if (dd<=(2*BALL_RADIUS)*(2*BALL_RADIUS)) {
if (t-collision_t>0.05) {
Noise(50,5000,6000);
@@ -103,7 +102,6 @@ U0 MyDerivative(CMathODE *ode,F64 t,COrder2D3 *,COrder2D3 *)
balls[0].DstateDt->DyDt-=Sqr(Sqr(Sqr((d+BALL_RADIUS)-task->pix_height)));
}
U0 Whap()
{
I64 i;
@@ -129,8 +127,8 @@ U0 Whap()
for (i=1;i<NUM_BALLS;i++)
D3Equ(&balls[i].x,
RandI16%500+Fs->pix_width>>1,RandI16%500+Fs->pix_height>>1,0);
balls[0].x=ipx-Fs->pix_left-Fs->scroll_x;
balls[0].y=ipy-Fs->pix_top-Fs->scroll_y;
balls[0].x=ip.pos.x-Fs->pix_left-Fs->scroll_x;
balls[0].y=ip.pos.y-Fs->pix_top-Fs->scroll_y;
for (i=0;i<NUM_BALLS;i++) {
balls[i].mass=1.0;
balls[i].drag_profile_factor=1.0;
Binary file not shown.
Binary file not shown.
+4 -22
View File
@@ -1,19 +1,5 @@
/*
This demonstrates dynamic initialization of
vars. It even works for AOT modules
because code is generated which runs at
$LK,"Load",A="MN:Load"$() time to initialize them.
This file is dual use -- you can JIT compile
it or AOT compile it. If you AOT compile
then override the filename extension warning.
Static vars are, essentually, global var.
*/
#ifaot
#include "::/Kernel/AOT.HPP"
#endif
//Demonstrates dynamic initialization of vars.
//Static vars are, essentually, global vars.
class Test
{
@@ -43,12 +29,8 @@ U0 Main1()
Main1;
/*
Now, we'll use the data heap glbl option
/*Now, we'll use the data heap glbl option
to force global vars onto the data heap.
You can't initialize heap glbls in a AOT
module.
You can turn the data heap flag
on and off within your programs, leaving
@@ -91,4 +73,4 @@ Main2;
#exe {OptOn(OPTf_GLBLS_ON_DATA_HEAP);};
#endif
NewLine;
'\n';
+4 -4
View File
@@ -9,12 +9,12 @@ U0 Main()
while (!ScanChar) {
DCDepthBufRst(dc);
GrSetSymmetry(dc,Fs->pix_width/2,Fs->pix_height/2,
ipx-Fs->pix_left-Fs->scroll_x,
ipy-Fs->pix_top-Fs->scroll_y);
ip.pos.x-Fs->pix_left-Fs->scroll_x,
ip.pos.y-Fs->pix_top-Fs->scroll_y);
dc->color=LTBLUE;
GrLine(dc,Fs->pix_width/2,Fs->pix_height/2,
ipx-Fs->pix_left-Fs->scroll_x,
ipy-Fs->pix_top-Fs->scroll_y);
ip.pos.x-Fs->pix_left-Fs->scroll_x,
ip.pos.y-Fs->pix_top-Fs->scroll_y);
GrIdentEqu(dc->r);
GrRotXEqu(dc->r,ê);
+5 -5
View File
@@ -1,21 +1,21 @@
U0 BSplineDemo()
{
CDC *dc=DCAlias;
I64 p1,p2,i=0,msg_code;
I64 a1,a2,i=0,msg_code;
CD3I32 c[64];
SettingsPush;
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS-WIF_BORDER;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
DocClear;
"Select ctrl points with left mouse. Right when finished.\n";
DCFill;
do {
msg_code=GetMsg(&p1,&p2,1<<MSG_IP_L_UP+1<<MSG_IP_R_UP);
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_R_UP);
if (msg_code==MSG_IP_L_UP) {
c[i].x=p1; c[i].y=p2; c[i].z=0;
c[i].x=a1; c[i].y=a2; c[i].z=0;
dc->color=GREEN;
GrCircle(dc,p1,p2,10);
GrCircle(dc,a1,a2,10);
i++;
}
} while (msg_code!=MSG_IP_R_UP);
+1 -1
View File
@@ -14,7 +14,7 @@ U0 Balloon()
OutU8(VGA_SC_INDEX,VGA_MAP_MASK);
OutU8(VGA_SC_DATA,0xF);
MemSetU64(0xA0000,0,640*480/64);
MemSetI64(0xA0000,0,640*480/64);
OutU8(VGA_SC_INDEX,VGA_MAP_MASK);
OutU8(VGA_SC_DATA,RED+GREEN+8);
+1 -1
View File
@@ -31,7 +31,7 @@ for (i=0;i<256;i+=4) {
U8 *tempg=DC2Sprite(img1);
Sprite(tempg);
Free(tempg);
NewLine(9);
"%h9c",'\n';
DCDel(img1);
DCDel(img2);
+7 -16
View File
@@ -1,4 +1,4 @@
//This uses $LK,"fixed-point-arithmetic",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
//Uses $LK,"fixed-point-arithmetic",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
I64 x[16],y[16],dx[16],dy[16];
@@ -18,11 +18,11 @@ U0 Init()
U0 Bounce()
{
CDC *dc=DCAlias;
I64 i,msg_code,p1,update;
I64 i,ch,update;
Init;
try { //Catch <CTRL-ALT-C>
while (TRUE) {
update=win_updates;
try {//Catch <CTRL-ALT-c>
do {
update=winmgr.updates;
do for (i=0;i<16;i++) {
dc->color=i;
GrPlot(dc,x[i].i32[1],y[i].i32[1]);
@@ -37,17 +37,8 @@ U0 Bounce()
dy[i]=-dy[i];
}
}
while (update==win_updates);
while (msg_code=ScanMsg(&p1,NULL,1<<MSG_KEY_DOWN|1<<MSG_RESIZE|1<<MSG_MOVE))
if (msg_code==MSG_KEY_DOWN) {
if (p1==CH_SHIFT_ESC || p1==CH_ESC)
goto bc_done;
else
Init;
} else
DCFill(dc);
}
bc_done:
while (update==winmgr.updates);
} while (!(ch=ScanChar) || (ch!=CH_SHIFT_ESC && ch!=CH_ESC));
} catch
PutExcept;
DCFill(dc);
+2 -2
View File
@@ -2,7 +2,7 @@ CDC *dc;
U0 DrawIt(CTask *,CDC *)
{//This technique is weird, but clever. In Box() we
//created an alias of the system $LK,"gr_dc2",A="MN:gr_dc2"$.
//created an alias of the system $LK,"gr.dc2",A="MN:CGrGlbls"$.
dc->pen_width=2;
dc->color=RED;
GrLine3(dc,-100,-100,-100, -100, 100,-100);
@@ -22,7 +22,7 @@ U0 DrawIt(CTask *,CDC *)
U0 Box()
{
F64 é=0,è=0,ê=0,s=1,s1=1.05;
dc=DCAlias(gr_dc2,Fs);
dc=DCAlias(gr.dc2,Fs);
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
DocClear;
Binary file not shown.
-1
View File
@@ -9,7 +9,6 @@ U0 ViewScreenCapture(U8 *filename)
DCDel(dc);
}
U0 Main()
{
"Capture screen...\n";
+4 -4
View File
@@ -14,7 +14,7 @@ U0 Cartesian()
"Enter algebraic equation to graph.\n"
"Example: y=2*x\n"
"y=";
if (st=MGetS) {
if (st=GetStr) {
if (*st) {
h=Fs->pix_width/2;
v=Fs->pix_height/2;
@@ -43,6 +43,6 @@ U0 Cartesian()
Cartesian;
/*$WW,1$
For better performance, compile the expression entered by the user one time with $LK,"LexExpression2Bin",A="MN:LexExpression2Bin"$() and use $LK,"Call",A="MN:Call"$(). See $LK,"::/Demo/CompileDemo.CPP"$.
*/
//For better performance, compile the expression entered by the
//user one time with $LK,"LexExpression2Bin",A="MN:LexExpression2Bin"$() and use $LK,"Call",A="MN:Call"$().
//See $LK,"::/Demo/CompileDemo.CPP"$.
+6 -9
View File
@@ -1,9 +1,7 @@
U8 *old_font=gr_font;
U8 *old_font=text.font;
// See $LK,"::/Kernel/Font8x8.CPP"$.
// See $LK,"::/Demo/ScreenCodes.CPP"$.
// See $LK,"::/Demo/ExtendedChars.CPP"$.
// See $LK,"::/Demo/Graphics/FontEd.CPP"$.
// See $LK,"::/Kernel/Font8x8.CPP"$, $LK,"::/Demo/ScreenCodes.CPP"$,
//$LK,"::/Demo/ExtendedChars.CPP"$, and $LK,"::/Demo/Graphics/FontEd.CPP"$.
U8 waves[8*4]={
0x00,0x11,0xAA,0x44,0x00,0x11,0xAA,0x44,
@@ -13,7 +11,7 @@ U8 waves[8*4]={
U0 AnimateEndCB()
{
gr_font=old_font;
text.font=old_font;
Exit;
}
@@ -22,14 +20,13 @@ U0 AnimateTask(I64)
I64 i;
U8 *font=MAlloc(256*8);
Fs->task_end_cb=&AnimateEndCB;
MemCpy(font,gr_font,256*8);
gr_font=font;
MemCpy(font,text.font,256*8);
text.font=font;
while (TRUE) {
MemCpy(font+CH_SPACE*FONT_HEIGHT,waves+8*(i++&0x3),8);
Sleep(100);
}
}
Spawn(&AnimateTask,NULL,"Animate",,Fs);
TaskRep;
+2 -3
View File
@@ -93,7 +93,7 @@ U0 TreeCommonAncestorFind(Node *root)
}
U0 TreeCommonAncestor()
{ //Make tree and find common ancestor to n1 & n2.
{//Make tree and find common ancestor to n1 & n2.
root=NULL;
n1=n2=common_ancestor=0;
@@ -111,8 +111,7 @@ U0 TreeCommonAncestor()
}
TreeCommonAncestor;
/*
Be careful with recursive routines in TempleOS
/*Be careful with recursive routines in TempleOS
because the stack does not grow and will overflow.
See $LK,"::/Demo/StkGrow.CPP"$.
-16
View File
@@ -1,16 +0,0 @@
U0 Main()
{
CDC *dc=DCAlias;
dc->color=RED+BLACK<<16+ROPF_DITHER;
GrCircle(dc,100,100,50);
GrLine(dc,10,10,280,70);
dc->color=RED+BLUE<<16+ROPF_DITHER;
GrFloodFill(dc,100,100);
dc->color=PURPLE+BLUE<<16+ROPF_DITHER;
GrRect(dc,20,20,100,100);
PressAKey;
DCFill;
DCDel(dc);
}
Main;
Loaded 100 of 1095 files, more files were not shown because too many files have changed in this diff. Show more