From e98c04584af5887c8370b532cd14c1d4fdfd0066 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Tue, 26 Sep 2023 12:59:46 -0400 Subject: [PATCH] renamed to Swine Meeper, title screen, readme --- mines.com | Bin 4327 -> 0 bytes readme.txt | 73 +++++++++++++++++++++++++++++++++++++++++ swine.com | Bin 0 -> 4662 bytes mines.jrt => swine.jrt | 66 ++++++++++++++++++++++++++++++++++--- 4 files changed, 134 insertions(+), 5 deletions(-) delete mode 100755 mines.com create mode 100755 readme.txt create mode 100755 swine.com rename mines.jrt => swine.jrt (74%) diff --git a/mines.com b/mines.com deleted file mode 100755 index 4f9444563a09de21838f7d2087e14c23a2eaec7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4327 zcmeHK|8Er65#M?H?RkU(9-K?vZp6Da13+!ly}6BDJuI@8AScILgk z^Mya5s^#_j%;(L_n>Rae_IdbgvI;u1H&3|D<8JeRw%ycD@2r$|RAx1iJ^>u@43ALOlDOu}`a)3(wHWPQn_9;g|tJt}99Iyfb1e?z}z$uCr)C&${=A zZ@M4h!uJoZyE1&${Wrm5n+Aq2xQa}$<;3tA*G7oC#|tj6>lyBLi%1+?cVKv*8-o#c zmC<5M7ULL~A4HXzUepn;E@G`kJlo?RmusW%{zLFj622kuW;r_G(c2Mv?62f{ufBdS z*XPP>AK}vL!tixjuP^qLdI{&$`sMnaI?v7}xjwpG!1qYSqyL3CTI@|sppLA^g_Z*> z1{-DCVu8}c`Veh_bSMVXl`wAn=$92Ms!G8f{clQeL=pwONI57=XM=pfFh~+TF-XHw zrB6;kK>Cp!L9_;*P@>(cr`M#kl~*a{VXKr&bC{}mLt+K54@hrm)D}isS(_bd{8nRr0CIU)ebv{qPU##TbH9NR#gXtD$s3=Kl~g;o zX<=0q{Y5oed#&(JUjzRHE36I-d%K!Y&!ENjePvmDtWlnx_%6~{ku_Mmn_rP)4hoR0^!L!L~dSWQOXO>DPJOe-k*rSpF~ zMdM!%{`n0Wd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2L20WFQ+pA diff --git a/readme.txt b/readme.txt new file mode 100755 index 0000000..0d9ffa8 --- /dev/null +++ b/readme.txt @@ -0,0 +1,73 @@ + S W I N E M E E P E R + ======================= +Created for the DOS COM Game Jam 2023 +https://itch.io/jam/dos-com-game-jam + +Technical Details +----------------- +This source repository contains a full development toolchain for creating +DOS COM programs in Forth and assembly. This toolchain was written in a +custom Forth dialect originally built for Neut Tower[1]; through a fairly +involved bootstrapping process it is now completely capable of rebuilding +itself. Every byte of every .COM file in this repository has been generated +from the included 8086 assembler, including the .COM file of the assembler. + +We start with MINIJORT.EXE, compiled with Borland Turbo C++ from MINIJORT.C +and MAIN.C. This is a stripped-down version of the Jorth engine that Neut +Tower[1] was built with, and the only part of this project that existed in +any form before August 14, 2023. (I started early on the jam because I +basically knew what I wanted to implement, and I knew that getting _anything_ +playable by the end of September with the absurd plan I had in mind was +going to be a long shot.) MINIJORT.EXE is a simple Forth interpreter that +loads BOOT.JOR and then reads the rest of its input from stdin. + +We then use MiniJort to generate TINYJORT.COM. This is done by piping the +contents of TINYBOOT.JRT to MiniJort. TINYBOOT loads some common definitions +from DEFS.JRT and the assembler from TARGET.JRT and ASM.JRT, then executes +TINYJORT.JRT, which assembles a second Forth interpreter that understands +a substantially similar vocabulary as MiniJort, with some improvements. +TinyJort internally embeds the definitions from BOOT.JOR and is entirely +self-contained. + +We could load TINYBOOT into TINYJORT.COM to rebuild itself, but one of the +big advantages of TinyJort over MiniJort is that TinyJort is trivially +capable of adding more definitions to itself and then writing out a new +.COM file with those definitions already loaded. So the next step is to use +TinyJort to build ASSEMBLE.COM, which is just TinyJort with the basic defs +and assembler pre-loaded, ready to get to work as soon as you launch it, +saving precious seconds of build time. TINYJORT.JRT can be loaded directly +into ASSEMBLE.COM in order to produce a byte-exact copy of TINYJORT.COM. + +REBUILD.BAT automates the process of bootstrapping TinyJort, and includes +a check to ensure that both Jorts produce the same .COM file. REASM.BAT +regenerates TINYJORT.COM and ASSEMBLE.COM using TINYJORT.COM and +ASSEMBLE.COM and is much faster. + +But that's not enough Forth interpreters yet! This tooling would allow us +to write assembly code _using_ Forth, and it would allow us to _extend_ +TinyForth to produce another Forth interpreter, but it does not yet allow +us to generate .COM files, written in Forth, that do not include extraneous +data like the Forth dictionary and the assembler. Since the .COM format is +limited to 64kb, space is at a premium. The final custom Forth interpreter +is ZIPOFF.COM and ZIPSTUB.SEG. + +Why ZipOff? Imagine a pair of Jorts - these are the Forth interpreter, +assembler, and extended runtime. Now imagine extending these Jorts into +full-on Jeans, by bringing in the definitions of the code that needs to +actually be included in the final product. When the two pieces are together, +the host Jorts can take advantage of the immediate interactive development +workflow of Forth, calling out to words defined in the final .COM, and +providing useful debugging tools not needed for the final product. But once +the development cycle is complete, the legs of the Jeans can be jettisoned - +zipped off, if you will - and... worn on their own, I guess? The metaphor +breaks down a little bit here. The point is that the target .COM file is +minimal and completely self-sufficient. + +Yo dawg, I heard you liked Forth, so I wrote a Forth interpreter in Forth +that I used to implement another Forth. + +THIS, finally, is the tool we use to build games and demos with. Importing +SWINE.JRT into ZipOff produces SWINE.COM; importing DIRTRECT.JRT produces +DIRTRECT.COM, and so forth. + +[1] https://spindleyq.itch.io/neut-tower/ diff --git a/swine.com b/swine.com new file mode 100755 index 0000000000000000000000000000000000000000..ca90f54c7491ef0318f897d7d3dd25a02408608c GIT binary patch literal 4662 zcmeHK|5H@g6@TZxFT3pSd;3LerwJ0wv}A)Bine}B^E8G+G!#Xc>H^|4+XB#&GmBBn>pAzn1>zsj zp9(zg=bU%$`F77e_rCsb$SOFXxqis1zi-vwU2{`Awy{XsSi~ar%9^-lJaSluD(kU= zg7Vf#r}bD63JR=g!*IQ0Yw0jCseQdeP?I4DCP*gW7^#;E3kwP&7rERkP*T!dFAdLW zeuQ+|GR@P{X5N5Sp=l>@(cRFxFmjZ`HmJCwwQ|^Mvkt+>5aOI32$hP7=O9#7URo}Q z>qt~AC@;l7E_Mg$QW22MB3GtbKVh8jVvd zXJ~jvZ{7L+%hneJJ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N2^V3338R;MQpUvPbEJ=8Xu;GV~! zsFIf>#n2@K?+>&@NjQhW#o(KI6!N87T%IX<7bYQF5{JhQPZV?;??F6Z;|~!3-o{Cw zl8eF1dLhn@L#_T5ouZ?%h`}%Q8G0Pn>I*oJJf$Lu!JB$D^0({D^-iAd6kaB%KqIUP z^OFKir7{&1X%lZ(U}+MMI6`7Hr&AXP&uKlx51c8d2v?R~O$J-#3J=PEXWxP5-Ap z!Ej|PFz7vPfL|H2jX118tCI{mB}Q(0Sg2um!`N>0$|E(`VO($l>vPghd>1ECz)7q$ z+Jm2>(lU1p&Ko;XDg}McI9wl=slk1)4CSalh&~g+{gcFcrX3#eb|DhlYH-IjvKlva z7dk6zITqa_2{$lNca5=L9T#hk_pY&p_pK2RS9+6B!~Lm8w9^&E839iWh&pOa_LArG z&>Gp=Zfuh`8&sYNZ{?_+)sC`M5>!AbUKp9YcOCGi_i`LIp$>{V;eDOwNcg_fwHWu~ zGB@e`%uCjf8e83QxMf?UURZ-UQheRsIB343#&h0PUYaZ3kjAh3E@Ad=VD@r+l! zUyEv3sUn|bNiN)t5P9|+!Z0Fn@`6|&d%OXx8=Xm{VE?e)dML`1=v%6rZzjFsp+2=|Xvs<=@UyesS_jfh0VP-+t*Y!1B81U#ZJ} z_W2iIkQOZeah?5vmltS}r2xs$*+CYGLup$WD8$AU3Zy+bshn0MeD@k}IZ>E^sc=b4 zu}&({%iDh1bz9Nqckx*qXk-m|qoq4+Lm<8G?HrkKp19^c2*3L!Lk@l^YwR73gWiy1)rwhUuL*;M@y%6P)Ii?ye1!(bOkTYg7 SpZiu|Ah0wLhbP7?gZ~13ktrzv literal 0 HcmV?d00001 diff --git a/mines.jrt b/swine.jrt similarity index 74% rename from mines.jrt rename to swine.jrt index 757253e..a526537 100755 --- a/mines.jrt +++ b/swine.jrt @@ -87,9 +87,9 @@ var theme countcolors + b@ dup 0 colvar = if drop col-grid else fg! then ; { :timm deftheme CREATE >t >t >t >t >t >t DOES} theme ! ; -( cursor grid block mine flag bg ) - blue white black black red lgray deftheme win31 - white yellow black black yellow red deftheme hotdog +( cursor grid block mine flag bg ) + blue white black magenta red lgray deftheme win31 + white yellow black lmagenta yellow red deftheme hotdog win31 @@ -97,7 +97,7 @@ win31 NEIGHBOUR-MASK & dup col-count dup if [ key 0 lit ] + else drop [ key lit ] then draw-char ; : draw-flag ( -- ) col-flag 0x0d draw-char ; -: draw-mine ( -- ) col-mine 0x0f draw-char ; +: draw-mine ( -- ) col-mine 0xec draw-char ; : draw-block ( -- ) col-block 0xb1 draw-char ; : draw-revealed ( b -- ) dup FMINE & if draw-mine drop else draw-neighbour-count then ; @@ -207,4 +207,60 @@ IN-PROGRESS bvar, game-state ' start ' main redefine -{ s" mines.com" writecom } +( title menu ) +array title-text t", SWINE MEEPER" + +: emptych? ( ch -- f ) dup 32 = swap 0 = or ; +: drawdot? ( st -- f ) dup b@ emptych? swap 1+ b@ emptych? or not ; + +: dot 7 draw-char ; +: sp 32 draw-char ; +: spacer ( st -- ) sp drawdot? if dot else sp then sp ; + +: draw-spaced-text ( st -- ) + begin dup b@ dup while draw-char dup spacer 1+ repeat drop drop ; + +2 cells const menu-optsize +2 const menu-size +array menu-options menu-optsize menu-size * allot + +: menu-option ( iopt -- p ) menu-optsize * menu-options + ; +: defmenu ( cp name iopt -- ) menu-option dup >rot ! cell + ! ; + +' start s" Start Game" 0 defmenu +' terminate s" Quit" 1 defmenu + +0 var, menu-selected + +: menu-activate menu-selected @ menu-option cell + @ execute ; + +: draw-selection ( iopt -- ) + menu-selected @ = if draw-mine else sp then sp ; +: draw-option ( iopt -- ) white fg! menu-option @ draw-text ; +: draw-menu + 33 10 textxy! + textx 0 begin dup menu-size < while + dup draw-selection dup draw-option 1+ nextline over textx! repeat + drop drop ; + +: draw-title + blue bg! yellow fg! 32 fill-page + 17 3 textxy! title-text draw-spaced-text + draw-menu ; + +: menu-selected! ( i -- ) + dup 0 >= over menu-size < and if menu-selected ! else drop then ; +: menu-selected+! ( di -- ) menu-selected @ + menu-selected! ; + +: await-menu + wait-key key>scan + dup %esc = if terminate then + dup %up = if -1 menu-selected+! then + dup %down = if 1 menu-selected+! then + %enter = if menu-activate then ; + +: title draw-title begin await-menu draw-menu again ; + +' title ' main redefine + +{ s" swine.com" writecom }