0001                                   Aiwnios.com
0002 
0003   Welcome to Aiwnios.com,the best server on earth. I will show you how  to do 
0004 cool stuff like write compilers and make games. I will write articles time to 
0005 time,but first let me tell you about myself.
0006 
0007   My name is Clayton and I like compilers alot.I wrote Aiwnios which is a  HolyC 
0008 compiler that runs on 64,bit arm and X86_64 and it's Travis Scott lit.I will 
0009 explain it in detail how it works,the first part is the lexer. I'm not a unix 
0010 pro but here are my notes Unix Notes or my Jain Notes.
0011 
0012   Here is a link to the User Guide if you want to know how to use aiwnios. Or 
0013 maybe you are here for the blog
0014 
0015   Checkout My FlashCards app and flash cards for the latest in nroots Greek 
0016 Quest(download the ISO and MountFile it in Aiwnios to use it).
0017 
0018   Irc Server
0019 
0020 aiwnios.com 6667
0021 Turn off SSL before connecting in your client
0022 Dont send anything important over the IRC server
0023 
0024 
0025                            Kralech Compiler Tutorial
0026 
0027   I dont know where my life will end up but I have a compiler. This is certian. 
0028 I did it. I will show others how to do it. This is a good way when you are 
0029 right. A compiler turns source code into action that your computer understands. 
0030 Knowing how to compile is a good way to milk a computer to the max
0031 
0032 
0033 <1>
0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 Click Links to see source code and Videos 0058 0059 Lesson 1: The Lexer 0060 Lexers turn raw data (such as source code ) into tokens a motherfucking 0061 compiler can use. Dont make a compiler without a lexer or you will have to 0062 juggle lots of meaningless symbols 0063 Lesson 2: The Parser 0064 A compiler must turn tokens into meaningful constructs that the compiler will 0065 use. Representing the reality of the source data is key (representation) when 0066 generating machine code. 0067 0068 Lesson 3: Register Allocation Pt.1 0069 Registers are values that live in your computer. Values in in registers,and 0070 sometimes they die. Here we see which values are living and dead at what points 0071 in time 0072 0073 Lesson 4: Reg Allocation Pt.2: Graph Coloring 0074 0075 Compilers have a finite number of registers. We must use the registers in a good 0076 fashion to generate good machine code. 0077 -] Registers Poem 0078 0079 I hate the scare-registered program 0080 For it lacks a wham. 0081 As the heated graph... 0082 One cant help but laugh, 0083 For one is too poor,the other too dumb 0084 0085 Lesson 5: Reg Allocation Pt.3: Using Less Registers 0086 Registers are finite,forms are not. A value may be in register R10 at one 0087 point,RDI at another 0088 Lesson 6: . Reg Allocation Pt.4: Assigning temporary registers 0089 Lesson 7: Reg GENERATING MOTHERFUCKIN MACHINE CODE 0090 0091 0092 Shitpit Pt.3 0093 0094 7-17-24 Pt.1 0095 0096 PT_TRACE_ME is strange because all execve's happing on a pid will trigger a 0097 TRAP(you can execve multiple times tcsh->program->other). Its fuckin weird. I am 0098 closer than ever to having MrChrootBSD have proper ptrace support. 0099 0100 7-13-24 Pt.1 0101 0102 I will worked on the user management for the server,but its not there yet. Im 0103 going to make ptrace work under MrChrootBSD. Im 21 Savage Boomin'. 0104 0105 7-9-24 Pt.3 0106 0107 I am tired. I will sleep. 0108 0109 7-9-24 Pt.2 0110 0111 If I marrry a dumb bitch who has improper mentality and I divorce her for 0112 having improper ideas it is justified in the same way we worship movie actors. 0113 We worship movie actors not for their earth vessels but the roles they play on 0114 screen. In the same way I seek true mentality,I dont fucking care about someone 0115 personaly. 0116 0117 7-9-24 Pt.1 0118 0119 Choices are only measured by alteratives. I am only pretending to have 0120 morality it seems. I only have fear. There are no worthwhile alternatives. 0121 0122 7-8-24 Pt.1 0123 0124 I have a secret plan to run FreeBSD programs on that fucking peguin OS. No VM 0125 needed. Ill be frank. Linux lets me intercept the syscalls or even ignore them 0126 with SYSEMU(and set the registers and do something else instread of a syscall). 0127 0128 -] Hopes for Linux 0129 0130 -] Same TLS ABI 0131 0132 The thread local storage needs to be the same 0133 0134 -] No checking ELF-branding 0135 0136 Load the fucking FreeBSD ELFs. 0137 0138 -] Allow me to ld_preload a 'shims.so' 0139 0140 I will need the address of the syms too. 0141 0142 0143 If I get these you bet your ass Daemonic Peguins will rise. This is a secret 0144 violatile project so dont get too excited. 0145 <2>
0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 7-7-24 Pt.3 0168 0169 If I marry a woman it is because she has proper ideas. If she looses proper 0170 thinking then I will divorce her because she is a dumb bitch. Praise God that I 0171 am not intrested in marriage. I am a parasite who doesnt want to procreate. In 0172 order for someone to win someone has to loose. I choose to loose because I will 0173 not cause the pain of winning. 0174 0175 Talking to me is like talking to Donald Trump. Donald Trump is all the 0176 transfer and politics of power. I seriously dont fucking care about your 0177 passions. Everyone thinks thoughts they dont share because most of them arent 0178 retards who have shitpits. No filter mentality. 0179 0180 Im not a misogynist becuase I choose not to interact with women for 0181 reproductive purposes. The world doesnt need more retard-lets running around. 0182 0183 0184 7-7-24 Pt.2 0185 0186 I should make an "aiwnios apps" thing. Like a standalone execuable version of 0187 aiwnios programs. 0188 0189 7-7-24 Pt.1 0190 0191 There is too much death in the world but I feel I am forced to smile because 0192 there is no alterative and I will face retaliation for not smilling. I see 0193 little difference between a human dying and an ant. I love ants. Humans will 0194 take a fact and masturbate with it until they die. This is called self-delusion. 0195 America founded on death? Drink beer and eat burgers. America is founded on 0196 death therefore to honor people who died for freedoom you must drink beer and 0197 eat burgers. 0198 0199 It is impolite to bring up unpleasant truths. I can say an unpleasant truth 0200 that everyone is thinking,and I will suffer for the thing everyone thinks. Like 0201 if someones say "have you thought about killing yourself". I have been doing 0202 this for a long time but if I say "yes" then you get put in a retard zoo. 0203 Physical death is ok for americans to make video games about but word death is 0204 unspeakable in a nation that is free from "blasphemy". 0205 0206 I think about killing myself everyday. This is word death. There are 0207 priorities other than dying by you cannot escape the black and white boolean 0208 cure of "word-death" that is defined by saying something that is true. 0209 0210 I am sorry for living in this world. I dont know how monks come up with great 0211 peices of art. They probably secretly think about coool things when they are 0212 suppost to be meditating. 0213 0214 7-6-24 Pt.1 0215 0216 I have a raging headache. 0217 0218 7-5-24 Pt.1 0219 0220 Gunna learn spnaish. 0221 0222 7-4-24 Pt.3 0223 0224 Truama is probably something I expirence(d) in some way. Like when people get 0225 raped they have truama. In Silent Hill 2 the main charactor is actually a 0226 murderer with amnesia. The reason I say this is because my truama is partly my 0227 own fualt unlike getting raped. My parents were garbage humans but I will not 0228 list thier errors out of respect. The only pain in my control is the pain I 0229 give. I used to be a Muslim and people hated me but I actually believed I would 0230 go to hell if I didnt believe. My parents thought it was because I was retarded. 0231 I have been described as retarded for a long time. 0232 0233 If I could profit from truama instead of suffer for it,it would be a no 0234 brainer. I call myself a retard alot. It is funny to me. It isnt even a cope 0235 with the nihilism of my own existence,it's just funny. I profit from calling 0236 myself a retard. 0237 0238 Some people say it is obligitory to overcome truama. I dont know why 0239 considering truama doesnt go away. I think about how retarded Islam is everyday. 0240 I will for a long time. I can try to stop myself but I dont think it helps. 0241 0242 One time I saw a person at the DMV and he made a joke about being retarded. It 0243 was funny. I find no offense or ill intent in what he said. If you are suppost 0244 to overcome truama then I should have "been pained by it",but no,it was funny. 0245 0246 I legidmently dont even know what it means to overcome trauma. Like when 0247 people leave relgions ,zealots assume they have no peace but this is not the 0248 case sometimes. Life goes on. Maybe letting go of the pain and realized it is 0249 retarded is the answer. 0250 0251 0252 7-4-24 Pt.2 0253 0254 Windows bugged out on the lowercase 'c' key. I have to reboot my windows 0255 machine.Redacted: Windows allows shortcut icons to have hot keys when installed 0256 and I accently alaised 'c' to "Make a new boot directory for Aiwnios 0257 0258 7-4-24 Pt.1 0259 0260 Im working on a Quest system for the FrogsEngine. I will make it so you go on 0261 quests like collect peices of shit to sell at BurgerHut as Assburgers. Im 0262 demeneted. I imagine everything in the is reality comes at a cost. Will it be 0263 worth it to express myself? In stores there is a fixed price on stuff,in life 0264 there isnt. Time to find out. 0265 0266 7-3-24 Pt.1 0267 WHO THE FUCK PUT ADS ON https://timecube.online/. Fucking poo poo brains. You 0268 ruined nice piece of art. 0269 7-2-24 Pt.1 0270 0271 I dont know if have learned anything in life other than about compilers. About 0272 10 years ago I was in a retard house and I still am. I really wonder if I have 0273 learned anything. Just in the same way mercy is synonymous with 0274 gullibilty,being "free-sprited" is a synonym for being an immorral poo poo 0275 brain. I cannot look in the mirror and see a man. 0276 0277 I think I hallucinate facts sometimes. I sometimes imagine myself speaking 0278 spanish but I dont know spanish. This is called Mirsha Manayog(mixing truth with 0279 falsehood in one's mind). 0280 0281 7-1-24 Pt.2 Bool-7 0282 0283 -] Types of bodies 0284 0285 -] AudarikSharir 0286 0287 Physical earth body capable of attaining Liberation. 0288 0289 -] VaikriyaSharir 0290 0291 God/Demon body 0292 0293 -] AharakSharir 0294 0295 Space body that travels in space in search of Tirhankaras. 0296 0297 -] Taizas Sharir 0298 0299 Fire body. Can change colors and act like spirits 0300 0301 -] Karman Sharir 0302 0303 A body that accomponies a soul during a new death/birth 0304 0305 0306 0307 7-1-24 Pt.1 0308 0309 I fucked up snapd on linux and now I cant use firefox. The apt version in 0310 ubuntu is aliased to the snap version. Im now stuck using dillo. 0311 0312 I get this when I run firefox. 0313 0314 /user.slice/user-1000.slice/session-3.scope is not a snap cgroup 0315 6-30-24 Pt.4 0316 0317 Part of growth is doing what you are capable of doing. Donald Trump has "the 0318 secret". I do not have the secret so it is best I dont strive for someone else's 0319 secret but to use my own secret sauce. I feel like I am wasting time 0320 volenteering alot so I should quit to pursue my own expressive ambitions. There 0321 is only 1 of me so I should express him. 0322 0323 6-30-24 Pt.3 0324 0325 I will redact my dark humor. It is optimal to not feed poo poo brains. I have 0326 a problem. 0327 0328 6-30-24 Pt.2 0329 0330 [Redacted]. 0331 0332 6-30-24 Pt.1 0333 0334 Truth is only as effective as it is practical. I am thinking about the retard 0335 word now. Is it pracitcal. I was wondering about proto-truths. What goes on in 0336 the mind of an artist before he delivers a truth. This is probably more 0337 intresting than the truth itself. 0338 0339 Proto-Truths make artists appear more human when exposed. Saying the n word 0340 makes you appear more human because it shows your confusion. 0341 0342 6-29-24 Pt.3 0343 0344 This website looks lit and contraversal: https://maxkarson.com/. Im watching 0345 the video section. 0346 0347 6-29-24 Pt.2 0348 0349 If no one speaks truth another famine may happen where the Truth is lost. I 0350 dont know if it is self censorship is good because when people censored 0351 themselves great knowledge was lost with death. 0352 0353 If this is true I will need to say racial slurs on aiwnios.com and beat my 0354 dick to Jordan Peterson. Is self-censorship a virtue? When I think I think of 0355 unthinkable things like the n word because it is funny. 0356 0357 I will introspect on this next Samayika session. 0358 0359 6-29-24 Pt.1 0360 0361 Ye is a good rapper. I was optimizing the smalltalk engine. I am just trying 0362 to remove dumb shit. I just have to make assigning into members less dumb then I 0363 will be done micro-optimzing. 0364 0365 I dont know when it got cool to write all game logic in a scripting 0366 language(Smalltalk-80). I will do it anyway. Probably was a retarded(?) idea. No 0367 stopping now. 0368 0369 I am plannin on using silent-NANs of IEE754 to do lit stuff. I will allocate a 0370 massive memory chunk for the game,then I will the 50 bit left-over room(of 0371 silent NANs) for real shit. No more AsF64/FrogNumNew necessary. 0372 0373 0374 6-28-24 Pt.1 0375 0376 The SmallTalk engine is still the bottleneck of the FrogsEngine. Graphics take 0377 like no time relativley speaking 0378 0379 6-27-24 Pt.1 0380 0381 Donald Trump needs to shit on the table during to debate. This will even the 0382 playing feild considering Biden shits himself every day. By Donald Trump 0383 shitting on the desk he will make the coprophilia reddit(Shit eating fetish 0384 reddit) be the new "thedonald" of reddit for 2024. 0385 0386 Reddit fucked me over with 0387 A) Making me make a account to view porn on it and 0388 B) Removing "thedonald" subreddit 0389 0390 6-27-24 Pt.0 0391 0392 Hey whats up, you can now show off your cool IBM Code Page 437 art and show 0393 off your cool symbols and shit with the latest commit in DolNet. Here is an 0394 example 0395 0396 //┌──────────┐ 0397 //│ π⌠ │ 0398 //│ │cos²ΘdΘ│ 0399 //│-π⌡ │ 0400 //└──────────┘ 0401 0402 You can view this directly in the live DolDoc viewer AND your browser thanks to 0403 UTF-8. It might have alignment issues on the Web though, keep that in mind 0404 0405 6-25-24 Pt.2.5 Ammended 0406 0407 I made the Thing use line numbers instead of File anchors and it runs 0408 smoothly. See the Help index here. /SmallTalkHelp.DD 0409 0410 6-25-24 Pt.2 0411 0412 I made a SmallTalk Help index but it generates fuckin massive HTML,also takes 0413 like over a few minutes to generate on the Thinkpad 0414 0415 6-25-24 Pt.1 0416 0417 im on my phone waiting yo come home from work. This sucks now. Yesterday 0418 poaying Quake3 i saw cool wster effects for the grpahocs. i may have to make the 0419 water in the game look cool. Like there water layers would move around alot and 0420 it was multilayered. 0421 0422 i dont know much about graphics. i uses to keep track of the on screen 0423 geometry but i just use z buffering now. Im ashamed of my poopy graphics code. 0424 Like maybe im romanicizing quake2s performance but consideringn it runs on 0425 software renderer its insanely fast . Probably cuz it uses BSP which divides the 0426 level into rooms.(sort of). 0427 0428 6-24-24 Pt.3 0429 0430 The God/Allah entity likes to make people feel like they are chosen. It is 0431 very easy to love God/Allah and it is a shortcut to liberation. You dont have to 0432 be a good person or know anything. Ill elloborate. All you have to do is believe 0433 in God and you can be a poo poo brain because you are chosen. Anyone can go 0434 crazy and go to heaven by actin like a poo poo brain. 0435 0436 There is no sense of worthyness in Islam. There is no sense of being worthy 0437 enough to do something because you can just do it,nothing is off-limits in terms 0438 of practice. 0439 0440 In Jainism,it is improper to go apeshit. You are not allowed to just become a 0441 monk. Someone asked about this. In Ratnakaradana Sravakacara there are 11 steps 0442 you must do before you are worthy of being a monk. You cannot just decide to 0443 become a monk,not allowed. 0444 0445 Islam is a shortcut theology because the Quran is polemic against any form of 0446 abstract thinking about God. Islam rejects the trinity and other Gods because it 0447 is too simple. It takes out any level of abstraction and replaces it with 0448 "common-sense" things that most people think about God. This is why people feel 0449 chosen when they read it. It is because the theology is forcibly simplied to the 0450 point where unworthy people can understand it. 0451 0452 I am not worthy or choosen. 0453 0454 Even the Bible is better than the Quran in the sense that the Bible permits 0455 abstract thinking about God whereas the Quran is a (somewhat) straightforward 0456 text when it says things about heaven and hell. 0457 0458 The Quran also makes no sense. Read the second Surah and try summarizing it. 0459 You cannot becuase it jumps from topic to topic very fast with very little glue 0460 between the verses. It is not a linear narrative. It was not compiled into a 0461 book until later on,and the first revealed verse appears near the middile/end of 0462 the Quran. 0463 0464 It literaly is a "raw" unfiltered collection of direct-from-Allah sound bites 0465 that makes no sense when put into a book. I say straighfoward because it has no 0466 abstract thinking in it. 0467 0468 6-24-24 Pt.2 0469 0470 All pleasure comes at the expense of others. I cannot breath without killing 0471 bacteria. It is important to not have an abstract view of death when talking 0472 about killing oneself. Suicide is a painful process. Suicide is not synonymus 0473 with turning off a light. There are people who give up living with a clear 0474 heart. I am a creatin who cannot relate to pain. I am truly a coward for not 0475 paining myself. The least I can do is volenteer more. 0476 0477 I will try to learn the Pakrit version of Navakar Mantra tonight. 0478 0479 I looked at this: 0480 0481 Science without religion is lame and religion without science is blind 0482 - Einstein 0483 0484 6-24-24 Pt.1 0485 0486 Heres the deal. If Donald Trump doesnt come up with cool shit to say during 0487 the 2024 presidential debate,my vote wont be for the Donald Guy. This is going 0488 to be a hard battle because Hillary had an attitude to fuck with,but Biden 0489 bumbles about politics or something. 0490 0491 /*Censored Political Speech about Trump.*/ 0492 0493 Real talk. Donald is a hypocrite because he is all for "law and order" but he 0494 is a convicted felon but denies guilt. 0495 0496 6-23-24 Pt.2 0497 0498 I made a backup of my /usr which is symlink'ed in /lib(/usr/lib) so I have my 0499 shit in case something poo poo happens again(NO upgrading SID ok). Im glad I 0500 know how to use linux sort of. 0501 0502 I wasted loads of time re-flashing the storage for my sexy Lichee Pi 4A today. 0503 No commits today,I made this picture awhile ago(Echo) 0504 0505 6-23-24 Pt.1 0506 0507 I am feignin for food. Also I apt upgraded my RISC-V machine that was running 0508 debian SID it messed things up. SID is the offical debian for RISC-V machines. 0509 Looks like a sad time for RISC-V machines around the world. 0510 0511 Who the fuck even uses RISC-V except for big-techies and me? 0512 0513 I worked on SmallTalk-Serialization. It isnt there yet but I sent it to aiwnio 0514 s.com today so you can see it do next to nothing. 0515 0516 I have decided that the frogs will not talk in the game for now. 0517 0518 6-22-24 Pt.2 0519 0520 Being dis-illusioned with living is a virtue when you make others happy. Die 0521 to make someone else's dream come true. I will ask about volenteering more to 0522 make someone else's dream come true. If I make the pain of others a pleasuree to 0523 me then that will be problematic when I face retaliation. If I make others' 0524 pleasure a pleasure to me then it will be better. 0525 0526 If living is a pleasure then suicide isnt a good option. I should seek neither 0527 death or living so I am pleasured by existence. My life shouldnt belong to me 0528 anymore. Let me be a public fuck toy for others to play with who feels nothing. 0529 0530 Can you win? Either you incur someone's disrepect or you fight them for 0531 respect. Either way you will feel pain. It seems to win at life you just give up 0532 fighting to win. The only thing better than winning is not having a battle in 0533 the first place. 0534 0535 0536 6-22-24 Pt.1 Serialization 0537 0538 I worked on some lit serialization code for SmallTalk(Save.HC). 0539 0540 0541 6-19-24 Pt.2 Tadpole Emergency 0542 0543 I accidently poured flavored water into my tadpole bowl. I saved 1 but there 0544 is another lurking in the bowl I think. I was drinking flavored water and I had 0545 another water for the tadpoles but I made a mistake and put the wrong water in. 0546 I hope sink water doesnt kill him. I put him in a pitcher full of sink water 0547 0548 I accidently killed assloads of tadpoles the other day because it was hot 0549 outside and they died. 0550 0551 6-19-24 Pt.1 0552 0553 I went to burger king and i bought a vegan burger. It was good. I bought new 0554 shoes today too. I was asked about primordial things. I cannot answer such 0555 questions. What is the purpose of eating,for fun. People learn things to 0556 construct reality 0557 0558 6-18-24 Pt.3 0559 0560 A king can give away his kingdom at death time. This is good. What if the king 0561 becomes alive again and sees how silly the new ruler is. Would he do it again. 0562 Ceasing to exist would be a blessing in this case. The pain comes not from his 0563 good(giving away the kingdom)but because of his attachment to his kingdom. I 0564 will give up the TOOM 2 port just as the King renounces his attachment to the 0565 world. I will try to make the networking code decent. I love my work but I will 0566 give it up when it is ready. 0567 0568 6-18-24 Pt.2 0569 0570 Good people arent just remembered for the things they accomplished but for 0571 what good they brought to others. It is important to remember how people 0572 impacted the world around them before we can analyze themself 0573 0574 6-18-24 Pt.1 0575 0576 Its so hot outside so I cant get tea so my productivity will plumet. I cannot 0577 operate while being hot without tea. I was debugging the networked multiplayer. 0578 I was sending the client hashes and using that size for the final number of 0579 things to be sent from the server. This lead to "vanishing" things. 0580 0581 The multiplayer code will suck ass but will be fun. People play games is for 0582 fun. I really really hope latency is not going to be an issue 0583 0584 6-17-24 Pt.4 Bool-3 0585 -] Birth bodies 0586 0587 -] (Inside) Earth 0588 0589 Natural things like rocks 0590 0591 -] From Water 0592 0593 Tadpoles 0594 0595 -] From Fire 0596 0597 Fire bodies 0598 0599 -] From Air 0600 0601 Bacteria 0602 0603 -] From Plants 0604 0605 Plants 0606 0607 -] Moving 0608 0609 Humans/animals 0610 0611 0612 0613 0614 6-17-24 Pt.3 Bool-2 0615 0616 -] Cha Jiva Nikayah(Classes of living beings) 0617 0618 -] 1 Sense(Sense of touch/collision) 0619 0620 Earth,fire/water phenomon,Plants 0621 0622 -] 2 Sense creatures(Taste) 0623 0624 Worms 0625 0626 -] 3 Sense creatures(Smell) 0627 0628 Ants 0629 0630 -] 4 Sense creatures(Sight) 0631 0632 Flies 0633 0634 -] 5 Sense creatures(Hearing) 0635 0636 Humans 0637 0638 0639 0640 6-17-24 Pt.2 0641 0642 It is hard to find my Amazon books. I bought a book called 0643 The Mystery of Life: 25 Bol.Jainism Simplified in English. It was so hard to 0644 find in my amazon stuff. I have other books like OpenCL cookbook and 0645 Santa Conquers the Homophobes. I think in the eariler shitpits I would say 0646 whatever with no filter and it was true. I think that some people arent equiped 0647 to hear unpleasant truths so I will be more conversative in my ramblings. It is 0648 best to humble yourself. 0649 0650 I used to wonder why scripture makes reference to human desires while 0651 condemning human vices. It is because Truth is so hard to understand sometimes 0652 you have to be able to eat it in a way that tastes good. The same applies to the 0653 Shitpit. Expousing reality is benefical and it leaves little room for baises. 0654 The religion of the Tirhankaras is good at expousing reality. 0655 0656 6-17-24 Pt.1 Bool-1 0657 0658 -] States of Movement between Lives 0659 0660 -] Narak Gati 0661 0662 Hellish Poo Poo realm 0663 0664 -] Tiryach Gati 0665 0666 A abnormal confused reality comparable to human life 0667 0668 -] Manusha Gati 0669 0670 Transgere to a Human or Human-Like(Samaska) life,the only state that can 0671 obtain Moska 0672 0673 -] Deva Gati 0674 0675 A Godlike state of existence 0676 0677 0678 0679 6-16-24 Pt.2 0680 0681 Fuckin DolDoc fucked up my dollar signs and I lost some shitpit entries 0682 0683 0684 6-15-24 Pt.2 0685 0686 The only thing better than winning a fight is not having one. I am a big 0687 looser because I am not a winner. 0688 0689 6-15-24 Pt.1 0690 0691 Working on Doom is boring now. I have to implement the secret levels. Big 0692 boring. I cant wait to work on the frogs game again. 0693 0694 6-12-24 Pt.2 0695 0696 The Gihon server at aiwnios.com 6667 now uses CrossNetShims. You can probably 0697 run it on vinilla TempleOS. 0698 0699 6-12-24 Pt.1 0700 0701 Scientists use precise langauge,psychologists use abstract language. There is 0702 a clear disconnect. I have not seen psychologist so anything impressive. I have 0703 heard that bhuddists are a middle way. I dont know what this actually means. 0704 0705 People in distress hire lawyers to whine for them in precise langauge. In 0706 precise language I will say that "help" is in itself useless. Therapy only works 0707 becuase of the process of help and not the therapy itself. It you use magic to 0708 help you it is irrelevant if magic is acutally real because you are putting your 0709 faith in magic and that is what is causing you to change. 0710 0711 6-10-24 Pt.3 0712 0713 Enemies in TOOM can walk through each-other(it gets crowded). I will make them 0714 "bounce" off eachother in the future maybe 0715 0716 6-10-24 Pt.2 0717 TOTSE(Looks like a cool website). Its not goatse,its like an old text board that 0718 is pretty cool. 0719 0720 6-10-24 Pt.1 0721 0722 Kralech streamed porn during a twich stream. I laughed even though its bad. I 0723 optimized the TOOM collision code today. It's quite boring actually. I was 0724 iterating all of the things that needed colision. This is bad because if you 0725 have 100 things,that means you will do 100*100 things. I now ONLY use the thing 0726 grid(blockmap) when looking for things. It speeds things up alot. 0727 <3>
0728 0729 0730 0731 0732 0733 0734 0735 0736 0737 0738 0739 0740 0741 0742 0743 0744 0745 0746 Doom II has massive levels and its boring to play. I still have to balance the 0747 gameplay a bit. 0748 0749 0750 6-9-24 Pt.1 0751 0752 Billie Ellish is a depressed singer who says things that dperessed people want 0753 to hear with Good-Artistry. 0754 0755 My favorite singers are those who talk about poop/the n-word with good 0756 artistry. Not really good taste but idk. 0757 0758 -] Best signers 0759 0760 1 - London Yellow(Raps about poop) 0761 2 - Rucka Rucka Ali(Is a fan of racism but not a racist somehow) 0762 3 - Micheal Jackson(Good artistry) 0763 4 - Scarlxrd (Fuckin sick flows,but lacking in depth) 0764 0765 0766 Ill tell you a story though a comic 0767 Froggis
0768 0769 0770 0771 0772 0773 0774 0775 0776 0777 0778 0779 0780 0781 0782 0783 0784 0785 0786 0787 0788 0789 0790 0791 0792 0793 0794 0795 0796 0797 0798 0799 0800 0801 0802 0803 0804 0805 0806 0807 0808 0809 0810 0811 0812 0813 0814 0815 0816 0817 0818 0819 0820 0821 0822 0823 0824 0825 0826 0827 0828 0829 0830 0831 0832 0833 0834 0835 0836 0837 0838 0839 0840 0841 0842 0843 0844 0845 0846 0847 0848 0849 0850 0851 0852 0853 0854 0855 0856 0857 0858 6-8-24 Pt.2 0859 0860 Wtf 0861 0862 6-8-24 Pt.1 0863 0864 I live in a good country where I can do barley anything and live likee a king. 0865 I dont know why it seems suicide is so common here,but this isnt the point. 0866 Monks dont really do too much so its good. I am blessed enough to have a job 0867 where I feed homeless people and can think 0868 0869 Monks limit their travel. When I was a kid there were plants that would get 0870 stuck to me. They would attach themselves to me. Much in the same way a plant 0871 attaches its seeds to an animal,morals attach themselves to animals from travel. 0872 0873 If I was to quit getting tea everyday this would be good. Sticking your head 0874 underwater for swimming sounds fun until you run out of breath. I will practice. 0875 0876 6-7-24 Pt.2 0877 0878 -] Ratnakarandaka Sravak-acara notes Pt.1 0879 0880 -] The path to Nirvana is defined by 0881 0882 1 - Right Faith 0883 2 - Right knowledge 0884 3 - Right conduct 0885 -] Right Faith 0886 0887 Belief in the true Devas who are free from vices of the flesh and who 0888 are onmipotetent and who have true dharma. 0889 Gods are true only when they say the right things in an unbaised nature 0890 with no evil motives. Truth is clouded by biases therefore true Gods have 0891 to have no biases 0892 0893 Right Faith is above knowledge and conduct. A seed is not above the tree 0894 0895 -] Limbs of faith 0896 0897 1 - Belief in realities substances 0898 2 - Rejection of sense gratifaction as they lead to bad karmas 0899 3 - Love for monks 0900 4 - Rejection of poo poo brain morality 0901 5 - Dont corrupt truth 0902 6 - ??? 0903 7 - Have respect for monks and householders 0904 8 - Establish the glory of the Jain religion by doing cool stuff. 0905 0906 0907 -] Right Knowledge 0908 0909 True Knowledge is neither ineffective of exagerated. 0910 0911 -] Right Conduct 0912 0913 Ridding yourself of likes and dislikes is peace 0914 -] Anuvratas (minor vows) 0915 0916 1 - Avoid destruction of >=2 sensed beigns(anything beyond vegetables) 0917 2 - Dont make falsehood or say harmful truths 0918 3 - No stealing 0919 4 - No adultery 0920 5 - No buying assloads of shit 0921 6 - No wine and honey 0922 0923 -] Moolgunas (fundamental virtues) 0924 0925 Digvrata - Limit travel distance 0926 Dont eat roots and flowers and butter 0927 0928 0929 0930 0931 0932 0933 6-7-24 Pt.1 0934 0935 Here is a secret formula for making a TempleOS ram disk: 0936 0937 CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('A')); 0938 CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_RAM); 0939 bd->max_blk=0x10000; 0940 BlkDevAdd(bd,,TRUE,TRUE); 0941 Fmt('A'); 0942 0943 I want to make Aiwnios's files be put in a RAM disk,user files will be put in 0944 hard-disk or whatever,that way you cannot mess up the KernelA.HH 0945 6-6-24 Pt.2 0946 0947 "Transiton" means seperation from the past and the future. Is is fundamentary a 0948 seperation. In this possibly transitory journey I am on in life I am seperated by 0949 nature. Transition ends when you reach your goal. It is fallacious thinking to 0950 think things are acquired except through the self. You dont get knowledge by 0951 appearing in class in the same way therapists dont cure you. It only works if you 0952 believe in it. 0953 0954 I said that hope is composed of abstraction and heuristics. It is fundamentally 0955 an abstraction of truth that looks closer to a desired result. You are forcing 0956 reality to look like a desired outcome via hope. If something doesnt look 0957 right,just abstract the ill feelings out of it and it will look better. This is 0958 how hope works. 0959 0960 I gave up a long time ago on hope. It is better to confront a cruel reality than 0961 to abstract the truth out of truth and become a poo poo brain. 0962 0963 6-6-24 Pt.1 0964 0965 I accidently deleted the shitpit entry for today 0966 0967 5-28-24 Pt.1 0968 0969 A fool seeks validation of others while a learned man knows himself. I am 0970 working on a Temple-Chat thing that is an AI. Self control is black and white. 0971 Either you control yourself or not. Reality is a good religion to study and you 0972 can find it's scripture everywhere you look. I suppose the Tirhankaras wouldnt 0973 mind me studing algorithms becasue theyt are real. 0974 0975 I cannot control myself to turn off my brain because i want to study Machine 0976 Learning. My mind is racing,the world could be burning and I wouldnt care. Man Im 0977 fuckin zooted. 0978 0979 0980 0981 5-27-24 Pt.1 0982 0983 Im Pushin' P putting Quake2 from steam on a flash drive to play on the RISC-V 0984 machine. I once said I am a living legend. This is simply not the case. A educated 0985 person in kindegarden looks like a genius(by comparasion). I need to find the rest 0986 of the compiler clan.Im not sure where they are 0987 0988 In my life I used to play with transitors as a kid. I wanted to build robots. I 0989 guess you could say I was a genius,but in reality I simply had access to more 0990 imformation than other kids. Its not that hard to build and AND gate,or a NOT 0991 gate. Alternating Current was secrectly above my head. I never understood 0992 inductors. 0993 0994 Math is the real star of the show. Do you ever wonder how people come up with 0995 operational amplifiers and filters; It's through math. Ill give an example of a 0996 simple amplifier and how math is responsible for it 0997 <5>
0998 0999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 Edit: I have no idea how I worked the math of an operational amplififier at like 1016 12/13. I have become dumbers over the years. Time to stop pretending to be smart 1017 1018 5-26-24 Pt.2 1019 1020 Some people suffer for fame. I am not famous and even if I was I would not care. 1021 If you have seen the qualities of seeking attention you have seen whatever the 1022 fuck this is: 1023 <6>
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 Detioration of the senses and substance will occur. You will no longer be able 1045 to drink the Gamer Girl piss and bathwater. Dont carelessly misuse yourself while 1046 you are sensible. God will misuse you once your senses start to disappear and you 1047 will be unable to construct reality. I dont know if the target demographic for 1048 retarded Gamer Girl piss is old men or young men. I really dont know. 1049 1050 5-26-24 Pt.1 1051 1052 I heard autistic people cannot think abstractly easier. If I look at my notes 1053 they are not glued togheter or make any sense when viewed as a whole. They are not 1054 concrete(abstract). I am diagnosed with autism but I dont have it too bad. 1055 1056 You may be wondering about socialization. I have wrote before that beings are 1057 capable of receiving and giving love. This could apply to humanity at large as 1058 opposed to a small group of individuals. I do not care about anyone enough to 1059 marry them. I don't even care about them enough to serious talk to them,but I care 1060 enough to offer tea to homeless people and volenteer/work at food pantry for 1061 homeless people. I dont do this for money because I only get paid half of what I 1062 "work"(I volenteer the rest of the days). 1063 1064 See this section for why I am not Schitzophrenic. 1065 1066 5-25-24 Pt.2 1067 1068 Have you seen internal conflict. No? I have(self control). There are few if any 1069 outside oppressors. A room with a sexy RISC-V machine or other programmable 1070 machine is sexy is the same as the world to me. I wonder about the mentality of 1071 insane people. I used to belive God wanted me to wash myself alot but I was not 1072 insane becuase the Quran said so,therefore my "insane" OCD was based in a sort of 1073 reality. I was operating on bad info. I am not actually insane because I was 1074 operating on bad information as opposed to pure insanity. 1075 1076 Actually insne people(I imagine) are unable to different reality from thoughts. 1077 Insane people and "insane" people only appear the same on the outside. Hueristics 1078 are illrevelant here. 1079 1080 1081 5-25-24 Pt.1 1082 1083 Biases obscure reality. Try looking in the mirror and seeing an evil person. 1084 Morality seems to be used to justify sins more than it is used to condemn them. 1085 People eat food then it comes back out. This is self morality. True morality is 1086 not a by-product. 1087 1088 A facts is different than the reason is it being presented to you 1089 1090 5-23-24 Pt.1 1091 1092 People going full smart mode must not eat beans. There was a crow 2(?) days ago 1093 that wanted to enter my workplace,he flew into the window multiple and squaked and 1094 left his claw-marks on the window. Mr Crow tried to enter again at the front door. 1095 1096 What belongs to humans is in my hands,and what is the crow's is in his(?) claws. 1097 It is improper to take what belongs to the crow,and improper for the bird to enter 1098 my workplace,even though he is cute. 1099 1100 5-22-24 Pt.1 1101 1102 Things not to think about: 1103 <7>
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 Im not sure why this sounds like a good idea to me. They say sharing sins is a 1129 first step. Just as jucie has less taste when mixed with lots of water,sins become 1130 reduced when confessed. I asked StableDefusion to make a picture of a hedgehog 1131 made out of shit and cheetos but I didnt get a good result 1132 1133 5-21-24 Pt.4 1134 1135 I will reload the Smalltalk compiler. I wil use goto's instead of switch 1136 statements 1137 1138 5-21-24 Pt.3 1139 1140 We loose life when we loose senses(by death),to live we must remain sensible to 1141 live. I think of a severly retarded frog individual that has no snese of reality 1142 and does everthing that comes to mind. He looks like a meth addict. 1143 1144 I should make a archive of sexy content that demonstrates the in-sensibity of 1145 humans,like a "best of" list of crazyshit.com. I saw a guy smoking meth out of 1146 some fine plumbing dressed up like Super Mario. I swear the shit was fuckin lit. 1147 1148 5-21-24 Pt.2 1149 The Tirhankaras would not approve of deporting people but I cannot censor 1150 myself. The best person to deport to Africa is yourself sometimes. 1151 1152 5-21-24 Pt.1 1153 1154 Systematic deportation of mastrubators to Africa is a good way to solve the 1155 world's problems. Ill do research on how to run for President. I need to be 35 1156 years old. We need to assemble a Pornhub to Africa pipeline to fuel economic 1157 growth. Africa will benefit because they will have people to help fix poverty 1158 <8>
1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 5-20-24 Pt.5 1199 1200 It is improper to romanicize anything out of reach. Security is a virtue. If I 1201 lost everythng and I accept the situation I will have security. Hypothetical gains 1202 from "just try it" are no match for security. A hyptohetical gain is lesser than 1203 the actuall loss in aquiring such a gain. Doing what suites you and makes you 1204 happy is perfecty fine and doesnt need to be fixed 1205 1206 5-20-24 Pt.4 1207 1208 Delusion could be defined as holding a gun to someone's head and claiming 1209 victimhood for the victim disobeying him. If the victim obeys it is still 1210 delusion. They say forced non-murder isnt true peace. This is the socitey 1211 delusion 1212 1213 Societies are defined by sets of morals. A Society without morals is an 1214 oxymoron. 1215 1216 Good people sell cures.Bad people create problems then sell cures. It is common 1217 for people to advocate freedom then condemn the liberties of others. Religious 1218 freedoom is no more of an oxymoron than society liberty. No values == no morals. 1219 The only super power you get from morality is self control 1220 1221 It seems to me that people dont have true morals and are just pretending. If I 1222 say the n word then everyone will condemn me but I am literally on a literal level 1223 harming no one. Sweet words("dont say the n word") can motivate people to do good. 1224 Does evil brew in silence or numbers. 1225 1226 Religion is good at reminding people to have morals. Home and security guards 1227 evils. Its like visiting house that you no longer live in. 1228 1229 5-20-24 Pt.3 1230 1231 If you have even seen words,you probably dont remember the paper they were 1232 written on. Thats becuase it is way too easy to read words. You could even 1233 transliterate greek if I told you what the letters sounded like. Reading isnt the 1234 true virtue,understanding is. Why am I writing the things I write 1235 1236 Compasion comes in 2 forms,Self-helping and Self-Obstructing. Somtimes helping 1237 others helps you or hurts you. Rejecting compassion is garenteed to deny the 1238 possibly of benefit but accepting compasion can give you either or 1239 1240 5-20-24 Pt.2 1241 1242 I am not a f*g,maybe I am a fig so I might be plantsexual but I dont know how 1243 sexy lettuce is. I dont know if it is possible that plants have genderes 1244 1245 5-20-24 Pt.1 1246 1247 Members of the Heavens Gate cult dressed up as star trek charactors before 1248 pwning themselves. Sometimes reality is strange we have to do strange things to 1249 express reality. It is less narcasistic to accept a loss than to deny it. I am 1250 reflecting on my reality.It is an serious act,the only people seeing 1251 trajedy/confusion are outsiders 1252 1253 5-19-24 Pt.2 1254 1255 Abstracting the dying out of death is bad. Everyone wants what they lust for 1256 until they have it. Vice versa. The problem with good people isnt good people 1257 dying,rather its when death becomes an abstract and trajedy becomes just. 1258 1259 5-19-24 Pt.1 1260 1261 I am a creatin with little sense of direction,but with a Compiler and loads of 1262 time. Despite being true I will refuse to hear it from other. Just in the same way 1263 it is useless to reason with a wall,it is useless to explain compilers with 1264 outsiders. Likewise it is useless to reason with me about direction; This is not a 1265 choise made in ignorance though 1266 1267 A Goldfish does what is best for him,witihin his capacity. Whatever hypothetical 1268 gain will go over it's goofy goldfish brain. He is soley concerned with reality. 1269 Anyone thinking of hyptheticals alone isnt thinking about reality. Goldfish poo 1270 poo brains are good at reality studies. 1271 1272 My misadventures are focosed with reality and not hyptoheticals. A hyptohetical 1273 evil is lesser than the actuall evil in combaring a hypothetical evil. 1274 1275 Morality is over my head. It is not for me to decide. 1276 1277 5-13-24 Pt.1 1278 1279 It is a strange occurance to read something to complex to understand,it is 1280 stranger to understand it. Aquisition and understanding is a 2 fold activity 1281 1282 5-10-24 Pt.2 1283 1284 Dillo 3.1 is out,grab your bros 1285 1286 5-10-24 Pt.1 1287 1288 I will say that humility is knowling your place as the asker of questions. Gods 1289 I think have a degree of humility in awnsering questions. The planter doesnt ask 1290 the Sun God for rain and the Althete doesnt ask the Rain God for sun. I suppose 1291 the Gods know their place and we ought to know our place too 1292 The 1 God cannot awnser the prayers of both the farmer and the athlete. 1293 1294 You see,knowledge is reduction ,and reality consitutes knowledge. You cannot 1295 attain liberation without reduction and restaint from evil 1296 1297 Clayton 1298 1299 <nrootconauto@gmail.com>
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 WIP DOOM port 1338 I am working on a port of Doom that runs on Aiwnios(TOOM). 1339
1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 Compiler Part 1,The Lexer 1388 1389 The first part of the compiler is the lex. It turned the text from the source 1390 code into words(tokens) that the compiler understands. For example, 1391 "123" gets turned into a TK_I64. 1392 1393 In our lexer,we have CLexFile's which are blocks of text we read,this can we any 1394 piece of text,like a macro's definition or an #exe block or a file. We get the 1395 charactors out of the Lexer via LexGetChar,which will do things like free the old 1396 CLexFile if we reach the end of the stream. 1397 1398 Sometimes we want to put a charactor back into the stream. You can use CCF_USE_L 1399 AST_U16 to reuse the last charactor. For example,if we are looking for digits in 1400 the expression 123; and we hit the semicolon,we dont want to discard the semicolon 1401 that we just got,so we put it back into the lexer by setting CCF_USE_LAST_U16 1402 1403 1404 <11>
1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 Compiler Part 2,The Parser 1425 1426 The second part of the compiler is the the parser. At the heart of this parser 1427 (in AIWNIOS_PrsExp.HC) is the shunting yard algorithm. This uses Reverse Polish 1428 Notation. This is a form of stack notation that looks like this: 1429 1430 1431 1 2 + 3 4 + * 1432 1433 The operators come is the order that they are used,lets see again with some 1434 parenthesis 1435 1436 ((1 2 +) (3 4 +) *) 1437 1438 Pretty epic isn't it. 1439 1440 To generate this,I use a stack called CCmpCtrl->ps with a class of CPrsStk. 1441 There are 3 stacks in a CPrsStk. The first is the precedence stack,the second is 1442 pointers to the generated CRPN's. The final is tree nodes. 1443 1444 The algorithm works by immediately pushing numbers to the stack first. Operators 1445 are pushed to the Shunting yard stack. It looks like this 1446 1447 <12>
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 The first thing to do here is put the '+' operator on the stack. 1468 1469 <13>
1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 The next thing to do(after we push 2 to the output) is to check if + comes after 1490 *. + comes after the * so we push it to the output,then push * to the stack for 1491 later. We end up with something like this 1492 1493 <14>
1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 Once we are at the end of input(after we add 3). We add all the operators to the 1516 output 1517 1518 <15>
1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 Compiler Part 2,The Parser II 1539 1540 UNDER CONSTRUCTION 1541 1542 Compiler Part 3,The Code Generator 1543 1544 1545 The code generator in aiwnios is platform dependant and is written in C to make 1546 porting to new platforms easier(bootstrapping is done in C). There is an interface 1547 in AIWNIOS_CodeGen.HC to use the turn the Intermediate Codes from the HolyC parser 1548 into the C intermediate codes. 1549 1550 There are multiple phases to turning the intermeidate codes into machine code. 1551 The first phases are in optpass.c. This file is pretty simple and does things like 1552 constant folding(OptPassConstFold) and merging communitive operations(OptPassMerge 1553 Communitives). This is boring stuff ,but the epic part is in x86_64_backend.c(or a 1554 rm_backend.c for AARCH64). 1555 1556 The most important thing this file does is generate machine code,at the top of 1557 the file you will see functions that generate voluptuous X86 instructions for you. 1558 The second most important part is generating the temporary registers for the 1559 intermediate codes. 1560 1561 To do this,I imagine the CRPN's as a tree. Beacuse temporary registers are 1562 scare,we need to make good use of them. A good way to do this is to assign them to 1563 the leafs of the tree,and when we are done using them,we Pop them from our 1564 imaginary stack(computers loves stacks). 1565 1566 1567 <16>
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 The heavy lifting for this is done in PushTmpDepthFirst. This we recuse into the 1586 parse "Tree" and Push items once it's children are done. Items are popped when we 1587 are done with them. The PushTmp/PushTmpSpilled functions will automatically choose 1588 a temporary register based on how many temporary registers are used,or if none are 1589 availble a stack location will be choosed. 1590 1591 The fun part is at the __OptPassFinal function. This is basically a gaint switch 1592 statement that will generate the machine code from the intermediate codes. 1593 1594 This is done in 2 passes,the first pass is done to see how big the resulting 1595 source code is,and the second part is to actually generator the source code. In my 1596 code generator,I have code_misc's on some of the intermedaite codes like IC_GOTO. 1597 1598 Sometimes we want the address of a label,but we dont know it untill all the 1599 machine code is generated. You can have the compiler fill in the label at an 1600 offset in the machine code with CodeMiscAddRef(CCodeMisc*,I64 offset). At the end 1601 of our OptPassFinal function I fill in the holes with the label pointers. 1602 1603 1604 User-Guide 1605 1606 Runtime Part 1:Graphics I 1607 1608 Use the Fs->draw_it callback to draw something to the current window 1609 1610 1611 U0 DrawIt(CTask *,CDC *dc) { 1612 dc->color=BLUE; 1613 GrRect(dc,0,0,100,100); 1614 } 1615 Fs->draw_it=&DrawIt; 1616 1617 1618 1619 The first argument is a pointer to the CTask being drawn,and the second argument 1620 is a CDC drawing context,use some primitives to draw to the screen. 1621 1622 -] GrRect 1623 1624 GrRect(dc,200,200,100,100); 1625 1626 -] GrPlot(single pixel) 1627 1628 GrPlot(dc,200,200); 1629 1630 -] GrFillCircle 1631 1632 GrFillCircle(dc,100,100,50); 1633 1634 -] GrCircle 1635 1636 GrCircle(dc,100,100,50); 1637 1638 -] GrLine 1639 1640 GrLine(dc,100,100,0,0); 1641 1642 -] GrPrint 1643 1644 GrPrint(dc,100,100,"Hello World"); 1645 1646 -] GrBlot(copy dc to other dc) 1647 1648 GrBlot(dc,100,100,new); 1649 1650 -] DCClear 1651 1652 DCClear(dc); //Resets Z buffer 1653 1654 -] DCFill 1655 1656 DCFill(dc,COLOR); 1657 1658 1659 Runtime Part 1:Graphics Transformations and 3D graphics 1660 1661 TempleOS lets you do sexy stuff with the graphics like 3D graphics. At the heart 1662 of this is a transformation matrix. Im not a math genius but luckily for me there 1663 are functions for managing the math for me. Before we can use a transformation 1664 matrix,we need to set the DCF_TRANSFORMATION flag in CDC->flags. After wards you 1665 can use matrix functions to rotate your drawing things cordanates 1666 1667 1668 CDC *dc=DCNew(100,100); 1669 Mat4x4IdentEqu(dc->r); //Assign a identity matrix(No transformation) 1670 DCFill; 1671 dc->flags|=DCF_TRANSFORMATION; 1672 F64 rotx=0; 1673 for(;rotx<=2*pi;rotx+=(2*pi/100.)) { 1674 DCFill(dc); 1675 Mat4x4IdentEqu(dc->r); //Reset our transformation 1676 Mat4x4RotZ(dc->r,rotx); 1677 Mat4x4TranslationEqu(dc->r,50,50,0); 1678 dc->color=YELLOW; 1679 GrRect3(dc,0,0,0,50,50); 1680 DCFill; 1681 GrBlot(,100,100,dc); 1682 Sleep(33); 1683 } 1684 DCDel(dc); 1685 DCFill; 1686 1687 1688 Here are a list of (transformation) matrix goodies: 1689 -] Mat4x4RotX 1690 1691 //Rotates around the X axis,used for Y-flipping 1692 1693 -] Mat4x4RotY 1694 1695 //Rotates around the Y axis,used for X-flipping 1696 1697 -] Mat4x4RotZ 1698 1699 //Rotates around the Z axis,use general 2D rotations 1700 1701 -] Mat4x4Scale 1702 1703 //Zooms a matrix 1704 1705 -] Mat4x4TranslationEqu 1706 1707 Mat4x4TranslationEqu(mat,x,y,z); //Sets the cordantes of a matrix 1708 1709 -] Mat4x4TranslationAdd 1710 1711 Mat4x4TranslationAdd(mat,x,y,z); //Add to the cordantes of a matrix 1712 1713 -] Mat4x4MulXYZ 1714 1715 Mat4x4MulXYZ(mat,&x,&y,&z); //THIS WILL TRANSFORM THE CORDANTES BY THE MATRIX 1716 1717 1718 You may want to do general math on matricies too: 1719 -] Mat4x4IdentEqu 1720 1721 Mat4x4IdentEqu(mat); //This makes a normal matrix that doesnt do transofrmations 1722 1723 -] Mat4x4IdentNew 1724 1725 I64 *malloced=Mat4x4IdentNew; //This makes a normal matrix that doesnt do 1726 transofrmations 1727 1728 -] Mat4x4MulMat4x4Equ 1729 1730 Mat4x4MulMat4x4Equ(dst,a,b); //Multiplies a matrix to another matrix,ask a 1731 genius what this actually does 1732 1733 -] Mat4x4MulMat4x4New 1734 1735 I64 *malloced=Mat4x4MulMat4x4Nw(a,b); //Same as above but MAlloced 1736 1737 1738 Sometimes in your 3D adventures you may want to make sure you draw things in the 1739 distacne behind the things in the front. This is called Z-buffering. In TempleOS 1740 this is easy-peasy. Just call DCDepthBufAlloc(dc). This will handle your depths 1741 for you. 1742 1743 Here is a cube thing for you: 1744 1745 1746 CD3I32 poly[4]= {{-100,-100,-100},{100,-100,-100},{100,100,-100},{-100,100,-100}}; 1747 I64 colors[4]= {BLUE,YELLOW,GREEN,CYAN}; 1748 CDC *dc=DCNew(200,200); 1749 dc->r=Mat4x4IdentNew; 1750 DCDepthBufAlloc(dc); 1751 DCFill; 1752 dc->flags|=DCF_TRANSFORMATION; 1753 F64 rotx=0,roty; 1754 CD3I32 cube[6][6]; 1755 I64 i=0,i2=0; 1756 I64 *trans=Mat4x4IdentNew; 1757 for(rotx=0.; rotx<=(2.*pi)-1.; rotx+=2*pi/4.) { 1758 Mat4x4IdentEqu(trans); 1759 Mat4x4RotX(trans,rotx); 1760 Mat4x4RotY(trans,roty); 1761 for(i2=0; i2!=4; i2++) { 1762 MemCpy(&cube[i][i2],&poly[i2],sizeof(CD3I32)); 1763 Mat4x4MulXYZ(trans,&cube[i][i2].x,&cube[i][i2].y,&cube[i][i2].z); 1764 } 1765 i++; 1766 } 1767 for(rotx=0; rotx<=2*pi; rotx+=(2*pi/100.)) { 1768 DCFill(dc); 1769 DCDepthBufRst(dc); 1770 Mat4x4IdentEqu(dc->r); 1771 Mat4x4RotX(dc->r,rotx); 1772 Mat4x4RotY(dc->r,rotx); 1773 Mat4x4RotZ(dc->r,rotx); 1774 Mat4x4Scale(dc->r,.5); 1775 Mat4x4TranslationEqu(dc->r,0,0,3000); 1776 for(i2=0; i2!=6; i2++) { 1777 dc->color=colors[i2]; 1778 GrFillPoly3(dc,4,cube[i2]); 1779 } 1780 DCFill; 1781 GrBlot(,100,100,dc); 1782 Sleep(33); 1783 } 1784 DCDel(dc); 1785 DCFill; 1786 1787 1788 If you ran the above example,the cube looks flat,THIS IS BECUASE YOU NEED TO 1789 MAKE THINGS SHRINK IN THE DISTANCE 1790 1791 Let me introduce the CDC->transform callback: This callback will be called for 1792 every point that is rendered when DCF_TRANSFORMATION is enabled. To acheive the 1793 epic "shrinking effect",divide the X/Y coordinates by the Z coordanate times a 1794 scale distance Let's see an example: 1795 Heres an example: 1796 1797 1798 #define SCRN_SCALE 512 1799 U0 Transform(CDC *dc,I64 *x,I64 *y,I64 *z) 1800 { 1801 I64 zz; 1802 Mat4x4MulXYZ(dc->r,x,y,z); 1803 zz=SCRN_SCALE/3+*z; 1804 if (zz<1) zz=1; 1805 *x=SCRN_SCALE/2* *x/zz; 1806 *y=SCRN_SCALE/2* (*y)/zz; 1807 *x+=dc->x; 1808 *y+=dc->y; 1809 *z+=dc->z; 1810 } 1811 CDC *dc=DCAlias; 1812 dc->transform=&Transform; 1813 dc->flags|=DCF_TRANSFORMATION; 1814 I64 dist=0; 1815 dc->z=-60; 1816 for(dist=0;dist!=100;dist++) { 1817 Mat4x4TranslationEqu(dc->r,0,0,dist); 1818 dc->color=LTRED; 1819 GrRect3(dc,0,0,0,100,100); 1820 Refresh; 1821 DCFill; 1822 } 1823 1824 Runtime Part 1:Graphics Raster Operations 1825 1826 In TempleOS there are 16 colors,but you can mix them to make "new" colors. This 1827 is called dithering. To use dithering to use raster operations. This allows us to 1828 do things like make shading or invert the colors below what your drawing. Let's 1829 get started 1830 1831 1832 CDC *dc=DCAlias; 1833 I64 cnt; 1834 for(cnt=0;cnt!=100;cnt++) { 1835 dc->color=LTRED+YELLOW<<16+ROPF_DITHER; //Mix LTRED+YELLOW for Orange-ish color 1836 GrRect3(dc,0,0,0,100,100); 1837 Refresh; 1838 DCFill; 1839 } 1840 1841 1842 If you though that was cool,check out probability dithering. This will make a 1843 shading effect. You can change the percentage of what color gets used to make a 1844 shading of your choice.The CDC->dither_probability_u16 is a 16bit percentage of 1845 the the colors being used. If the dither_probability_u16 is 0,it will use 1846 dc->color,otherwise it will use dc->color.u8[2] if the probability is U16_MAX; 1847 1848 Let's rock(.u8[2] is 16 bits over): 1849 1850 CDC *dc=DCAlias; 1851 I64 cnt; 1852 for(cnt=0;cnt!=100;cnt++) { 1853 dc->color=BLACK; 1854 GrRect(dc,0,0,100,100); 1855 dc->color=LTRED+YELLOW<<16+ROPF_PROBABILITY_DITHER; 1856 dc->dither_probability_u16=U16_MAX*ToF64(cnt)/100.; 1857 GrFloodFill(dc,10,10); 1858 Refresh; 1859 DCFill; 1860 } 1861 DCDel(dc); 1862 1863 Runtime Part 2: Making Noises 1864 1865 TempleOS makes sounds that will bring you back to the days of Atari games. The 1866 simplest way to make a tone is Snd(23);(This higher the number the higher the 1867 pitch). Call "Snd;" to cancel the sound. 1868 1869 If you want to go the extra mile and make a bodacious explosioon sound,use Nois 1870 e(milliseconds,min_pitch,max_pitch);. Or if you want a jumping sound,use Sweep. 1871 1872 Runtime Part 3: Making Music 1873 1874 TempleOS let's you make some epic jams. To do this,we use the Music 1875 1876 A simple song looks like this: 1877 1878 Play("wChDqEeFwGwAwB"); 1879 1880 1881 There are special charactors that change the duration/properties of the notes,so 1882 without further ado,here is a list 1883 -] # 1884 1885 Make a note sharp(comes after the note) 1886 1887 -] w 1888 1889 When before a note,it makes it a whole note 1890 1891 -] h 1892 1893 Makes a half note 1894 1895 -] q 1896 1897 Makes a 1/4 note 1898 1899 -] e 1900 1901 Makes a tiny eigth note 1902 1903 1904 You can change the tempo of the music via the global vairable music.tempo(Be 1905 sure to reset the music's settings via MusicSettingsRst) 1906 1907 Try this: 1908 1909 1910 music.tempo=8; 1911 Play( 1912 "hEhEwEhChEwGqG" 1913 "wCqGqEqAqBqA#qAqGhEhGwAhFhGwEhChDqB" 1914 "wCqGqEqAqBqA#qAqGhEhGwAhFhGwEhChDqB" 1915 "hGhF#hFhD#wEqG#qAhCqAhChD" 1916 "hGhF#hFhD#wE.wC.wC.wC" 1917 "hGhF#hFhD#wEqG#qAhCqAhChDwD#wDwC" 1918 "hGhF#hFhD#wEqG#qAhCqAhChD" 1919 "hGhF#hFhD#wE.wC.wC.wC" 1920 "hGhF#hFhD#wEqG#qAhCqAhChDwD#wDwC" 1921 ); 1922 MusicSettingsRst; 1923 1924 Runtime Part 4: Meta-data and Reflection 1925 1926 HolyC is a mainly just in time language. This means when the code gets 1927 compiled,the information about the code is still in memory. This is great for 1928 having the code reflect on itself and saves a lot of time doing meanial things 1929 like serializing a class. The primary way to do this is via MetaData. This means 1930 data about the self. 1931 1932 To get the metadata of a class out of the compiler,we must use the CTask's hash 1933 table and do these steps 1934 1935 -] Step 1 1936 1937 Lookup the class by it's name CHashClass 1938 *findc=HashFind(cls,Fs->hash_table,HTT_CLASS); 1939 1940 -] Step 2 1941 1942 Lookup the class by it's name CMemberLst 1943 *member=MemberFind("member_name",findc); 1944 1945 -] Step 3 1946 1947 Lookup the meta data I64 meta_data=MemberMeta("META_DATA",member); 1948 1949 1950 1951 Perhaps an example will help: 1952 1953 class CMeta { 1954 I64 a fmt "A:%d\n"; 1955 I64 b fmt "B:%d\n"; 1956 F64 c fmt "C:%n\n"; 1957 }; 1958 CMeta abc={1,2,3}; 1959 U0 Main(U8 *ptr,U8 *cls=lastclass) { 1960 CHashClass *findc=HashFind(cls,Fs->hash_table,HTT_CLASS); 1961 CMemberLst *ml; 1962 U64 sf; 1963 if(!findc) return; 1964 ml=MemberFind("a",findc); 1965 sf=(ptr+ml->offset)[0](U64); 1966 if(MemberMetaFind("fmt",ml)) { 1967 Print(MemberMetaData("fmt",ml),sf); 1968 } 1969 } 1970 Main(&abc); //Here we use lastclass to get the class of abc 1971 1972 1973 If you want to make a form using meta data,you can use PopUpForm 1974 1975 1976 class CInput { 1977 //Be sure to use -P with strings 1978 U8 name[STR_LEN] format "\n"; 1979 I64 age format "\n"; 1980 Bool is_tall format "\n"; 1981 }; 1982 CInput inp; 1983 PopUpForm(&inp); 1984 "%s is %d years old\n",inp.name,inp.age; 1985 if(inp.is_tall) 1986 "Tall!\n"; 1987 1988 1989 Runtime Part 5: Filesystem 1990 1991 If you are used to using TempleOS,use the Cd("Folder"); to move into a folder. 1992 You can list the contents of the directory via Dir(".");("." is the current folder 1993 ). Sometimes you want your programs to be aware of the folders. Luckily for 1994 you,you have come to the right place 1995 1996 In TempleOS,each task has a current directory path in Fs->cur_dir(this doesnt 1997 include the drive letter). If you want the full path,use DirCur. 1998 1999 To make a file,use FileWrite("filename","text",4 /*text length*/);. When you 2000 want to read it use FilleRead("filename",&len); FileRead will always put a NULL 2001 terminator at the end of the file for your,so you can use it like a string. 2002 2003 Like C,in TempleOS you can read files in a stream,But in TempleOS,all file 2004 reads/writes act directly on the Hard-Disks sectors(Which are BLK_SIZE bytes big). 2005 You FOpen("filename","w") for writing FOpen("filename","r") for reading. To open a 2006 file for adding more data to it,use FOpen("filename","w+"). Lets see an example 2007 2008 2009 // 2010 // Files opened with FOpen MUST WRITE BLK_SIZE bytes at once 2011 // A BLK is the size of a hard-disk sector 2012 // 2013 CFile *file=FOpen("Database.BIN","w"); 2014 class CFileEnt { 2015 U8 name[STR_LEN]; 2016 U8 password[STR_LEN]; 2017 }; 2018 #assert sizeof(CFileEnt)<=BLK_SIZE 2019 CFileEnt clayton={"Clayton","123"}; 2020 CFileEnt root={"Root","toor"}; 2021 U8 buffer[BLK_SIZE]; 2022 MemCpy(buffer,&root,sizeof(CFileEnt)); 2023 FBlkWrite(file,buffer,0,1); //Write 1 blk at the first block(blk 0) 2024 MemCpy(buffer,&clayton,sizeof(CFileEnt)); 2025 FBlkWrite(file,buffer,1,1); //Write 1 blk at the second block(blk 1) 2026 FClose(file); 2027 // 2028 // Now we read 2029 // 2030 file=FOpen("Database.BIN","r"); 2031 CFileEnt user; 2032 while(FBlkRead(file,buffer,,1)) { 2033 MemCpy(&user,buffer,sizeof(CFileEnt)); 2034 "Got user \"%s\" with password \"%s\"\n",user.name,user.password; 2035 } 2036 FClose(file); 2037 2038 2039 Making and reading files is fun,but first you need to figure out where a file 2040 is. To do this use, . This will return a CDirEntry of the results(which may be 2041 multiple files). Assuming you are familiar with wildcards from Linux,DOS and CP/M. 2042 Look at this example 2043 2044 2045 FileWrite("abc.TXT","abc",3); 2046 FileWrite("def.TXT","def",3); 2047 FileWrite("ghi.TXT","ghi",3); 2048 CDirEntry *cur,*root=FilesFind("*.TXT",FUF_JUST_FILES); 2049 for(cur=root;cur!=NULL;cur=cur->next) { 2050 "I Found %s\n",cur->full_name; 2051 } 2052 DirEntryDel(root); 2053 2054 2055 A CDirEntry has much information about the directory structure. The most 2056 important is full_name which tells you the full name of the file as you may 2057 expect(name is the filename without the path). When you are done with a CDirEntry 2058 be sure to free the root data with . 2059 2060 To check if a file exists,you can use FileFind("file.HC") to check if a file 2061 exists. 2062 2063 Time to get to the nitty gritty. Has some epic flags you can use.Im not going to 2064 waste time with exposiiton,rather I will give you a table of flags 2065 2066 2067 -] FUF_RECURSE 2068 2069 This will search in the child folders for the pattern too 2070 2071 -] FUF_JUST_DIRS 2072 2073 Chooses only directories(folders) 2074 2075 -] FUF_JUST_FILES 2076 2077 Chooses only files 2078 2079 -] FUF_JUST_TXT 2080 2081 Chooses only text files 2082 2083 -] FUF_JUST_DD 2084 2085 Chooses only DolDoc files 2086 2087 -] FUF_JUST_SRC 2088 2089 Chooses only source files 2090 2091 -] FUF_Z_OR_NOT_Z 2092 2093 This will ignore Ziped named of files and just check as normal 2094 2095 -] FUF_FLATTEN_TREE 2096 2097 This will flatten a FUF_RECURSE tree for you conveince 2098 2099 2100 If you want to delete files,use DelTree("folder/files");,or if you just want to 2101 remove a fule use Del("file"); 2102 2103 There are 2 ways to make a folder,use Cd("a/b/c/d/e",TRUE); to make a path,or 2104 make a folder one at a time via DirMk("folder_name");. Copy your stuff via CopyTre 2105 e("old","new") or just a file via Copy("old","new"). 2106 2107 And by the way you can open a file chooser via PopUpPickFile("T:/"); 2108 2109 Runtime Part 6: Data structures(1 CQue) 2110 2111 TempleOS comes loaded with useful data structures but it may be confusing at 2112 first. The most important one is a CQue. This means a Circular Queue. It's likle a 2113 loop,ill draw a picture for you. 2114 2115 2116 2117 <17>
2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 As you can see(poorly drawn) is that each item has 2 pointers( the CQue->last 2128 and the CQue->next).The ->last pointer is the previous item in the chain,not the 2129 "last" one. 2130 2131 To make a new CQue,use QueInit on the item make both pointers point to the 2132 item,which means an empty CQue. You can insert items into the CQue via QueIns(to_i 2133 nsert,at). Perhaps an example will help you. 2134 2135 In our below example,I start at head and also end at head as the queue is 2136 ciruclar 2137 2138 2139 CQue *head=MAlloc(sizeof CQue),*one=MAlloc(sizeof CQue),*two=MAlloc(sizeof 2140 CQue),*cur; 2141 QueInit(head); 2142 QueIns(one,head); 2143 QueIns(two,one); 2144 for(cur=head->next;cur!=head;cur=cur->next) 2145 "Current element(excuding HEAD):%P\n",cur; 2146 QueDel(head); //Remove all items in the CQue 2147 Free(head); //QueDel doesnt Free the head 2148 2149 2150 To get the count of items in your queue use QueCnt(head). And to remove an item 2151 form the queue(not Free it),use QueRem which will detach the item from a queue 2152 2153 2154 CQue *head=MAlloc(sizeof CQue),*one=MAlloc(sizeof CQue),*two=MAlloc(sizeof 2155 CQue),*cur; 2156 QueInit(head); 2157 QueIns(one,head); 2158 QueIns(two,one); 2159 QueRem(one); //Detach one from the CQue 2160 Free(one); //Free it's data 2161 for(cur=head->next;cur!=head;cur=cur->next) 2162 "Current element(excuding HEAD):%P\n",cur; 2163 QueDel(head); //Remove all items in the CQue 2164 Free(head); //QueDel doesnt Free the head 2165 2166 2167 You can insert get the item count of the QueCnt(head) 2168 2169 Here is a reference section: 2170 -] QueInit(head) 2171 2172 Intialize the head of a queue 2173 2174 -] QueIns(to_ins,elem) 2175 2176 Insert an item after the elem 2177 2178 -] QueInsRev(to_ins,elem) 2179 2180 Insert an item before the elem 2181 2182 -] QueRem(elem) 2183 2184 Detach an item from the queue(doesnt free it) 2185 2186 -] QueDel(head) 2187 2188 Frees all items in the queue 2189 2190 -] QueCnt(head) 2191 2192 How many items in the queue(excluding the head) 2193 2194 2195 Runtime Part 7: Data structures 2(HashTable) 2196 2197 Hash tables are like dictionary data structures and each task has one in Fs->has 2198 h_table. Each CHash has a type and a str. 2199 2200 When you look up a hash from a hash-table you will need the type. For example,if 2201 we want to grab a define(HTT_DEFINE_STR) from our current task,we do: 2202 2203 #define FOO 123 2204 CHashDefineStr *def=HashFind("FOO",Fs->hash_table,HTT_DEFINE_STR); 2205 if(def) 2206 "%s\n",def->data; 2207 2208 We looked up foo with type HTT_DEFINE_STR. Sometimes we want to add things to a 2209 CHashTable. To do this we need to use HashAdd. 2210 2211 CHashDefineStr *d=CAlloc(sizeof(CHashDefineStr)); 2212 d->str=StrNew("Hello"); //Must allocate string on heap 2213 d->type=HTT_DEFINE_STR; 2214 d->data=StrNew("10"); 2215 HashAdd(d,Fs->hash_table); 2216 //We added the macro Hello into the hash table 2217 "%d\n",Hello; 2218 2219 2220 Sometimes you want to make your own hashtables. You can do this via HashTableNew 2221 (size). size MUST BE A POWER OF 2. 2222 2223 Any generic data in the hashtable should use type HTT_FRAME_PTR as HashTableDel 2224 doesnt try to make assuptions on how to free the data 2225 2226 Perhaps an example will help: 2227 2228 CHashTable *ht=HashTableNew(0x100); 2229 CHashGeneric *ent=CAlloc(sizeof CHashGeneric); 2230 ent->user_data0=1; 2231 ent->user_data1=2; 2232 ent->user_data2=3; 2233 ent->type=HTT_FRAME_PTR; 2234 ent->str=StrNew("look"); 2235 HashAdd(ent,ht); 2236 CHashGeneric *g=HashFind("look",ht,HTT_FRAME_PTR); 2237 "%d,%d,%d\n",g->user_data0,g->user_data1,g->user_data2; 2238 HashTableDel(ht); 2239 2240 2241 Here is a reference of hash table functions 2242 2243 -] HashAdd(item,table) 2244 2245 Adds an item to the hash table 2246 2247 -] HashRemDel(item,table) 2248 2249 Delete an item from the hash table 2250 2251 -] HashFind(str,table,type) 2252 2253 Find an item in the table 2254 2255 -] HashSingleTableFind(str,table) 2256 2257 Find an item in the table,but dont check parent task's thing 2258 2259 -] HashTableNew(sz) 2260 2261 Make new hashtable,sz must be a power of 2 2262 2263 2264 Runtime Part 8: Data structures 3(Fifo) 2265 2266 Fifo's mean "First In First Out" and do things like store key presses. The first 2267 key you press is the the first one you get out. They also have a maximum 2268 size,which means that if you get too many keys,the old ones will be discarded 2269 2270 It looks like this: 2271 <18>
2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 First create a FIFO with FifoI64New,Size must be a power of 2 2288 2289 CFifoI64 *fifoI64=FifoI64New(4); 2290 FifoI64Ins(fifoI64,1); 2291 FifoI64Ins(fifoI64,2); 2292 FifoI64Ins(fifoI64,3); 2293 2294 You can remove an item with FifoI64Rem. This takes a pointer and returns TRUE 2295 2296 CFifoI64 *fifoI64=FifoI64New(4); 2297 FifoI64Ins(fifoI64,1); 2298 FifoI64Ins(fifoI64,2); 2299 FifoI64Ins(fifoI64,3); 2300 I64 val; 2301 while(FifoI64Rem(fifoI64,&val)) 2302 "Got a %d\n",val; 2303 2304 2305 Here is a reference section 2306 2307 -] FifoI64New(sz) 2308 2309 Make a new fifo,sz must be a power of 2 2310 2311 -] FifoI64Flush(f) 2312 2313 Remove all the items from the fifo 2314 2315 -] FifoI64Cnt(f) 2316 2317 Get a count of all the items in the fifo 2318 2319 -] FifoI64Peek(f,&val) 2320 2321 Look at the next item in the fifo without removing it 2322 2323 -] FifoI64Del(f) 2324 2325 Free the fifo 2326 2327 -] FifoI64Rem(f,&val) 2328 2329 Remove an item from the fifo 2330 2331 -] FifoI64Ins(f,val) 2332 2333 Insert an item into the fifo 2334 2335 -] FifoU8Flush(f) 2336 2337 Remove all the items from the fifo 2338 2339 -] FifoU8Cnt(f) 2340 2341 Get a count of all the items in the fifo 2342 2343 -] FifoU8Peek(f,&val) 2344 2345 Look at the next item in the fifo without removing it 2346 2347 -] FifoU8Del(f) 2348 2349 Free the fifo 2350 2351 -] FifoU8Rem(f,&val) 2352 2353 Remove an item from the fifo 2354 2355 -] FifoU8Ins(f,val) 2356 2357 Insert an item into the fifo 2358 2359 -] FifoU8New(sz) 2360 2361 Make a new fifo,sz must be a power of 2 2362 2363 2364 Runtime Part 9: User Input 2365 2366 TempleOS lets you do lit stuff like click on things and use the keyboard. These 2367 events are passed through messages. We use GetMsg to get the messages,along with a 2368 message mask. 2369 2370 I64 x,y; 2371 U0 DrawIt(CTask *t,CDC *dc) { 2372 dc->color=RED; 2373 GrRect(dc,x,y,100,100); 2374 } 2375 U0 Run() { 2376 Fs->draw_it=&DrawIt; 2377 I64 m,x2,y2; 2378 while(TRUE) { 2379 m=GetMsg(&x2,&y2,1<<MSG_MS_MOVE+1<<MSG_MS_R_DOWN); 2380 if(m==MSG_MS_R_DOWN) 2381 break; 2382 x=x2; 2383 y=y2; 2384 Refresh; 2385 } 2386 } 2387 Run; 2388 2389 2390 Keyboard messages can be gotten via ScanKey(&ch,&sc). The first argument is the 2391 ASCII charactor,and the second one is the scancode. The scancode is the raw key 2392 being pressed and has flags in it. I'll give an example usage of the function 2393 first before I dive into details. 2394 2395 I64 x,y; 2396 U0 DrawIt(CTask*,CDC*dc) { 2397 dc->color=GREEN; 2398 GrRect(dc,x,y,100,100); 2399 } 2400 U0 Run() { 2401 Fs->draw_it=&DrawIt; 2402 I64 msg,sc,ch; 2403 for(;TRUE;) { 2404 if(ScanKey(&ch,&sc)) { 2405 if(sc&0xff==SC_ESC) break; 2406 if(sc&0xff==SC_CURSOR_UP) { 2407 y-=3; 2408 } else if(sc&0xff==SC_CURSOR_DOWN) { 2409 y+=3; 2410 } else if(sc&0xff==SC_CURSOR_LEFT) { 2411 x-=3; 2412 } else if(sc&0xff==SC_CURSOR_RIGHT) { 2413 x+=3; 2414 } 2415 } else { 2416 Refresh; 2417 } 2418 } 2419 } 2420 Run; 2421 2422 As you can see,I check the first 8 bits(0xff) of the scan code to test what key 2423 it is. There also flags on the scancode that tell you things like if the shift key 2424 is down etc. 2425 2426 The first byte of scancode is the key code,but the other bytes are flags which 2427 can be tested via the "&" operator 2428 2429 2430 I64 x,y; 2431 I64 color=GREEN; 2432 U0 DrawIt(CTask*,CDC*dc) { 2433 dc->color=color; 2434 GrRect(dc,x,y,100,100); 2435 dc->color=RED; 2436 } 2437 U0 Run() { 2438 Fs->draw_it=&DrawIt; 2439 I64 msg,sc,ch; 2440 for(;TRUE;) { 2441 if(ScanMsg(&ch,&sc,1<<MSG_KEY_UP|1<<MSG_KEY_DOWN)) { 2442 if(sc.u8[0]==SC_ESC) break; 2443 if(sc.u8[0]==SC_CURSOR_UP) { 2444 y-=3; 2445 } else if(sc.u8[0]==SC_CURSOR_DOWN) { 2446 y+=3; 2447 } else if(sc.u8[0]==SC_CURSOR_LEFT) { 2448 x-=3; 2449 } else if(sc.u8[0]==SC_CURSOR_RIGHT) { 2450 x+=3; 2451 } 2452 if(sc&SCF_CTRL) 2453 color=RED; 2454 else if(sc&SCF_SHIFT) 2455 color=YELLOW; 2456 else 2457 color=GREEN; 2458 } else { 2459 Refresh; 2460 } 2461 } 2462 } 2463 Run; 2464 2465 2466 Here's a list of scancode flags: 2467 2468 -] SCF_KEY_UP 2469 2470 The key was released 2471 2472 -] SCF_CTRL 2473 2474 The Ctrl key is down 2475 2476 -] SCF_SHIFT 2477 2478 The shift key is down 2479 2480 -] SCF_ALT 2481 2482 The alt key is down 2483 2484 -] SCF_CAPS 2485 2486 The Caps lock key is down 2487 2488 -] SCF_NUM 2489 2490 The NumLock key is kdown 2491 2492 -] SCF_SCROLL 2493 2494 Scroll Lock key is down 2495 2496 -] SCF_MS_L_DOWN 2497 2498 The left mouse is down 2499 2500 -] SCF_MS_R_DOWN 2501 2502 The right mouse is down 2503 2504 -] SCF_NO_SHIFT 2505 2506 There is no shift 2507 2508 2509 Here's a list of scancode keys: 2510 2511 -] SC_ESC 2512 2513 The escape key 2514 2515 -] SC_BACKSPACE 2516 2517 The backspace key 2518 2519 -] SC_TAB 2520 2521 The tab key 2522 2523 -] SC_ENTER 2524 2525 The enter key 2526 2527 -] SC_CTRL 2528 2529 The ctrl key 2530 2531 -] SC_ALT 2532 2533 The alt key 2534 2535 -] SC_CAPS 2536 2537 The caps lock key 2538 2539 -] SC_NUM 2540 2541 The num lock key 2542 2543 -] SC_SCROLL 2544 2545 The scroll lock key 2546 2547 -] SC_CURSOR_UP 2548 2549 The up key 2550 2551 -] SC_CURSOR_DOWN 2552 2553 The down key 2554 2555 -] SC_CURSOR_LEFT 2556 2557 The left key 2558 2559 -] SC_CURSOR_RIGHT 2560 2561 The right key 2562 2563 -] SC_PAGE_DOWN 2564 2565 The page down key 2566 2567 -] SC_PAGE_UP 2568 2569 The page up key 2570 2571 -] SC_HOME 2572 2573 The home key 2574 2575 -] SC_END 2576 2577 The end key 2578 2579 -] SC_INS 2580 2581 The insert key 2582 2583 -] SC_DELETE 2584 2585 The delete key 2586 2587 -] SC_F1-SC_F12 2588 2589 The Fxx keys 2590 2591 -] SC_PAUSE 2592 2593 The pause key 2594 2595 -] SC_GUI 2596 2597 The logo key 2598 2599 -] SC_PRTSCRN1 2600 2601 The print screen key 2602 2603 -] SC_PRTSCRN2 2604 2605 The print screen key 2606 2607 2608 I mentioned eariler about GetMsg,and I used ScanMsg. GetMsg waits for an 2609 event,but ScanMsg doesn't. There are also message codes 2610 2611 -] MSG_KEY_DOWN(ch,scancode) 2612 2613 A Key is put down 2614 2615 -] MSG_KEY_UP(ch,scancode) 2616 2617 A Key is release 2618 2619 -] MSG_MS_MOVE(x,y) 2620 2621 The mouse is moved 2622 2623 -] MSG_MS_L_DOWN(x,y) 2624 2625 The left button is down 2626 2627 -] MSG_MS_L_UP(x,y) 2628 2629 The left button is down 2630 2631 -] MSG_MS_R_DOWN(x,y) 2632 2633 The right button is down 2634 2635 -] MSG_MS_R_UP(x,y) 2636 2637 The right button is down 2638 2639 2640 Runtime Part 9: Multithreading 2641 2642 TempleOS is non-premptive. This means each Task has to manually tell the 2643 computer when to context swap. The way to do this and prevent freezing is to Yield 2644 2645 In TempleOS,spawning task's is easy,use the Spawn function 2646 2647 2648 U0 Foo(U8 *data) { 2649 Beep; 2650 } 2651 Spawn(&Foo,"Some_data","TaskName"); 2652 2653 2654 You can make a user terminal via User. You can talk to that task via XTalk 2655 2656 2657 CTask *u=User; 2658 XTalk(u,"\"Exiting in 5 seconds\\n\";\n"); //Be sure to put a semi-colon at the 2659 end as we are "the-user". 2660 Sleep(5000); 2661 XTalk(u,"Exit;\n"); 2662 2663 2664 Sometimes you want to wait for a task to die,to do this use DeathWait 2665 2666 2667 CTask *t=User; 2668 DeathWait(&t); //Note address of t 2669 Beep; //Will beep when you exit the User task 2670 2671 2672 There is also a BirthWait 2673 2674 2675 CTask *t=User; 2676 BirthWait(&t); //Note address of t 2677 Beep; //Will beep when you exit the User task 2678 2679 2680 To avoid race conditions we use locks. In TempleOS this is acheived through 2681 locked bit instructions with spinlocks. How it works is LBts will set the bit,and 2682 return the old value of the bit. We keep on setting the bit. If the old value is 2683 not set,it means we have access to the lock,otherwise we keep on looping. Be sure 2684 to reset the bit when you are done with LBtr. 2685 2686 2687 I64 beep_lock=0; 2688 U0 OneThread(I64 snd) { 2689 //This will spin until bit 0 is reset(look at the end of the function) 2690 while(LBts(&beep_lock,0)) //LBts has a side effect of setting the bit after it 2691 is checked 2692 Yield; //We are going to be beeping for awhile so Yield out control to other 2693 tasks 2694 Beep(snd); 2695 //We reset bit 0 of beep_lock to signify we are done with it. 2696 LBtr(&beep_lock,0); 2697 } 2698 I64 i; 2699 for(i;i!=10;i++) { 2700 Spawn(&OneThread,i*7+10); 2701 "Spawned a thread!!\n"; 2702 } 2703 2704 Runtime Part 10: Jobs 2705 2706 In TempleOS,each core has a seth_task. This task does lit stuff like run Jobs 2707 which can be created via TaskExe and you get the results via JobResGet 2708 2709 2710 CJob *job=TaskExe(Gs->seth_task,Fs,"1+1;;;",0); 2711 res=JobResGet(job); 2712 Kill(jobber); 2713 "I got %d\n",res; 2714 2715 With cpu_structs,you can spawn jobs on other cores 2716 2717 2718 CTask *parent_task=Fs; 2719 I64 core=0; 2720 //mp_cnt is the number of cpus 2721 CJob *jobs[mp_cnt]; 2722 for(core=0;core!=mp_cnt;core++) { 2723 jobs[core]=TaskExe(cpu_structs[core].seth_task,Fs, 2724 "Sleep(RandI64%1000);" 2725 "Gs->num;;", //Gs is the current CCPU for the core,->num is the cpu number 2726 0); 2727 } 2728 for(core=0;core!=mp_cnt;core++) { 2729 "Core %d return %d\n",core,JobResGet(jobs[core]); 2730 } 2731 2732 2733 If you want to have the parent task wait while a job runs,you can use the JOBf_W 2734 AKE_MASTER flag. 2735 2736 2737 CTask *parent_task=Fs; 2738 //Things ending in a lowecase f as bits(and need to be shifted to be flags) 2739 TaskExe(Gs->seth_task,parent_task,"Play(\"EGBDF\");",(1<<JOBf_WAKE_MASTER)); 2740 2741 Runtime Part 11: DolDoc 2742 2743 Most of the text you see on screen is from the DolDoc layout engine. It uses a 2744 series of dollar signs to set things like the text color and make elements. The 2745 are stored as a circular queue of CDocEntry's. The easyiest way to make a DolDoc 2746 element is to use DocPrint,use DocPut to get the current task's document. 2747 2748 2749 //BT is a button 2750 CDocEntry *de=DocPrint(DocPut,"\n\n$BT,\"Hello\"$\n\n"); 2751 2752 2753 As you can see,the DolDoc entries have a type and argument. They are surrounded 2754 by $'s. They can also have flags too. This let's you do things like center the 2755 text. Lets see an example: 2756 2757 2758 //TX is a text,+CX is the center flag 2759 CDocEntry *de=DocPrint(DocPut,"\n\n$TX+CX,\"Hello\"$\n\n"); 2760 2761 2762 DolDoc entries can also take an argument,Links use this to figure out where to 2763 go when you click them. Arguments for DolDoc entries come after the comma,some of 2764 the arguments are named and have the format "name=value" 2765 2766 2767 CDocEntry *de=DocPrint(DocPut,"\n\n$LK,\"Text\",A=\"FL:/PersonalMenu.DD\"$\n\n"); 2768 2769 2770 You can interact directly with the generated CDocEntrys. You can put things like 2771 callbacks into them. In our below example I set the left_cb function pointer to 2772 Beep2 and I tell the entry that it has a callback with DOCEF_LEFT_CB. 2773 2774 2775 I64 Beep2(CDoc *,CDocEntry *) { 2776 Beep; 2777 } 2778 CDocEntry *de=DocPrint(DocPut,"\n\n$BT+CX,\"Hello\"$\n\n"); 2779 de->de_flags|=DOCEF_LEFT_CB; 2780 de->left_cb=&Beep2; 2781 2782 2783 You can use the DocMenu function to get a value from your document. I use the LE 2784 for a left-click-expression. 2785 2786 2787 U0 CreateDialog() { 2788 CDocEntry *nums[3]; 2789 I64 i; 2790 DocClear(DocPut); 2791 "$TX+CX,\"Pick a number:\"$\n"; 2792 for(i=0;i!=3;i++) { 2793 nums[i]=DocPrint(DocPut,"\n\n$BT+CX,\"%d\",LE=%d$\n\n",i,i); 2794 } 2795 DocBottom(DocPut); 2796 switch(DocMenu(DocPut)) { 2797 start: 2798 DocClear(DocPut); 2799 case 0: 2800 "You picked nothing lol.\n"; 2801 break; 2802 case 1: 2803 "One is the one\n"; 2804 break; 2805 case 2: 2806 "Two is too good\n"; 2807 break; 2808 end: 2809 } 2810 } 2811 CreateDialog; 2812 2813 2814 You can use PopUpForm to use a class's meta data for making a menu. 2815 2816 2817 U0 CreateDialog() { 2818 class CInput { 2819 //Be sure to use -P with strings 2820 U8 name[STR_LEN] format "\n"; 2821 I64 age format "\n"; 2822 Bool is_tall format "\n"; //CB is a Check box 2823 }; 2824 CInput inp; 2825 PopUpForm(&inp); 2826 "%s is %d years old\n",inp.name,inp.age; 2827 if(inp.is_tall) 2828 "Tall!\n"; 2829 2830 2831 Yeah time for some reference section ehh: 2832 2833 -] TX 2834 2835 Text 2836 2837 -] CR 2838 2839 Newline 2840 2841 -] CU 2842 2843 Cursor pos,normally a ASCII #5 2844 2845 -] TB 2846 2847 Tab 2848 2849 -] CL 2850 2851 Clears all elements without the "+H" flag 2852 2853 -] PB 2854 2855 Page break 2856 2857 -] PL 2858 2859 Page length 2860 2861 -] LM 2862 2863 Left margin 2864 2865 -] RM 2866 2867 Right margin 2868 2869 -] HD 2870 2871 Header margin 2872 2873 -] FO 2874 2875 Footer margin 2876 2877 -] ID 2878 2879 Indent,use wit tree elements,and use with a negative number to un-indent 2880 2881 -] FD 2882 2883 Forground default color 2884 2885 -] BD 2886 2887 Background default color 2888 2889 -] PT 2890 2891 Command Line Prompt 2892 2893 -] WW 2894 2895 Use 1 to enable word wrap,use 0 to disable 2896 2897 -] UL 2898 2899 Use 1/0 to enable/disable underline 2900 2901 -] IV 2902 2903 Disable/enable Inverting of colors 2904 2905 -] BK 2906 2907 Burger Kind,just kidding,it's actually for blinking 2908 2909 -] SX 2910 2911 Shift the text by a amount of pixels 2912 2913 -] SY 2914 2915 Shift the text up/down by an amount of pixels 2916 2917 -] CB 2918 2919 Checkbox 2920 2921 -] LS 2922 2923 Major Lit Alert 2924 Use with the "D" argument to make a list(from a DefineListLoad),do this 2925 $LS,"potato",D="ST_BIBLE_BOOKS"$ 2926 Clicking on this will make a menu to pick an item from the list 2927 2928 -] MA 2929 2930 A macro,clicking on this will insert LM into the command line prompt 2931 2932 -] TR 2933 2934 A Tree wigdet,use this with ID to nest the tree's 2935 2936 -] HL 2937 2938 Turn HolyC syntax highting on/off 2939 2940 2941 Here is a reference section for the flags,they can be added/removed with +/-(For 2942 example you can do "$TX+CX+H,\"I have CX and H flags.\"$\n";) 2943 2944 -] H 2945 2946 Hold,this will prevent CL from deleting this element 2947 2948 -] L 2949 2950 This will make the element act as a link 2951 2952 -] TR 2953 2954 This will make the element act as a tree 2955 2956 -] LS 2957 2958 This will make the element act as a list 2959 2960 -] PU 2961 2962 This will make a macro run in a popup window 2963 2964 -] C 2965 2966 This will collapse a tree,use -C to uncollapse the tree 2967 2968 -] X 2969 2970 This will save and Exit after the macro is done 2971 2972 -] UD 2973 2974 Update data on typing 2975 2976 2977 Here is a reference section for the argument codes,use them like "$TX,T=\"123\"$" 2978 2979 -] T 2980 2981 Tag text,this is the text that gets displayed. 2982 2983 -] LEN 2984 2985 Sets the length of the DA element. 2986 2987 -] A 2988 2989 Sets the link location 2990 2991 -] LE 2992 2993 Left expression,runs an expression on left click 2994 2995 -] RE 2996 2997 Right expression,runs an expression on right click 2998 2999 -] LM 3000 3001 Left macro,runs text on left click 3002 3003 -] RM 3004 3005 Right macro,runs text on right click 3006 3007 -] RT 3008 3009 Raw type of DA 3010 3011 -] U 3012 3013 User data 3014 3015 -] SCX 3016 3017 Scroll x columns Makes a amazing scrolling effect 3018 3019 -] SX 3020 3021 Scroll x pixels 3022 3023 -] SY 3024 3025 Scroll y pixels 3026 3027 3028 Making links is easy,to do this we use "$LK,\"text\",A=\"BF:Acts,2:3\"$"; Here 3029 is a reference for the link codes: 3030 3031 -] FI 3032 3033 File index,FI="file" or FI="file,line" 3034 3035 -] FF 3036 3037 File Find,FF="file,text" 3038 3039 -] BF 3040 3041 Bible Find,BF="book,text". "text" can be a chapter/verse 3042 3043 -] HI 3044 3045 Help Index,HI="Help Index". Make help indexes via #help_index 3046 3047 -] A 3048 3049 Symbol address, takes a pointer A="0x11223344" 3050 3051 3052 Now a function reference: 3053 3054 -] DocBottom 3055 3056 Move to the bottom of the document 3057 3058 -] DocCenter 3059 3060 Make ->cur_entry be in the viewport 3061 3062 -] DocClear 3063 3064 Clear all elements except those with the +H flag 3065 3066 -] DocCollapse(collapsed,doc) 3067 3068 Collapse or un-collapse all trees in the document 3069 3070 -] DocDel 3071 3072 Delete a documents memory 3073 3074 -] DocEntryDel(doc,elem) 3075 3076 Deletes a document entry 3077 3078 -] DocEntryCopy(doc,elem) 3079 3080 Copy an element 3081 3082 -] DocInsDoc(to,from) 3083 3084 Insert a document into an other document 3085 3086 -] DocLock 3087 3088 Lock a document 3089 3090 -] DocUnlock 3091 3092 Unlock a document 3093 3094 -] DocRst 3095 3096 Reset the document 3097 3098 -] DocTop 3099 3100 Go to the top of the document 3101 3102 -] DocLineRead(filename,line) 3103 3104 Read a line from a file 3105 3106 -] DocLineWrite(filename,line,text) 3107 3108 Write a line into a file 3109 3110 -] DocRead(filename) 3111 3112 Read a document from a file 3113 3114 -] DocLoad(into_doc,ptr,len) 3115 3116 Read a document from memory into a docuemnt 3117 3118 -] DocSave(doc,len_ptr) 3119 3120 Save a document into memory 3121 3122 -] DocWrite(doc) 3123 3124 Save a document to disk. Filename is detirmnined by DocNew("filename"); 3125 3126 -] DocMenu 3127 3128 Interact with a document until a value is found 3129 3130 -] DocForm 3131 3132 Use a class's meta-data to make a form for you to fill out 3133 3134 -] DocNew(filename) 3135 3136 Make a new document that will be saved to filename 3137 3138 -] DocGR(doc,filename.GR) 3139 3140 Insert a .GR file into a document 3141 3142 -] DocPrint 3143 3144 Print text into a document 3145 3146 -] DocPut 3147 3148 Get the current document for a task 3149 3150 -] DocType(doc,filename) 3151 3152 Type a file into a document