diff --git a/footer2.tif b/footer2.tif deleted file mode 100755 index f3b0665..0000000 Binary files a/footer2.tif and /dev/null differ diff --git a/game.exe b/game.exe index a394d0f..00e8cd0 100755 Binary files a/game.exe and b/game.exe differ diff --git a/game.prj b/game.prj index 58563fb..0151b14 100755 Binary files a/game.prj and b/game.prj differ diff --git a/slide.c b/slide.c deleted file mode 100755 index 8516ff2..0000000 --- a/slide.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include "jorth.h" - -static int bgi_on = 0; -void bgi_shutdown() { - if (bgi_on) { - closegraph(); - bgi_on = 0; - } -} - -void bgi_init() { - int driver = VGA; - int mode = VGAHI; - if (!bgi_on) { - initgraph(&driver, &mode, NULL); - bgi_on = 1; - } -} - -void s_outtext() { - outtext(TOP().s); - DROP(1); -} - -void s_justify() { - settextjustify(TOP().i, TOP_TEXT); - DROP(1); -} - -void s_font() { - struct textsettingstype settings; - gettextsettings(&settings); - settextstyle(ST1().i, settings.direction, TOP().i); - DROP(2); -} - -void s_direction() { - struct textsettingstype settings; - gettextsettings(&settings); - settextstyle(settings.font, TOP().i, settings.charsize); - DROP(1); -} - -void s_moveto() { - moveto(ST1().i, TOP().i); - DROP(2); -} - -void s_pos() { - PUSHI(getx()); - PUSHI(gety()); -} - -void s_setcolor() { - setcolor(TOP().i); - DROP(1); -} - -void s_setbgcolor() { - setbkcolor(TOP().i); - DROP(1); -} - -void s_clear() { - cleardevice(); -} - -void slide_init() { - CDEF("bgi-on", bgi_init); - CDEF("bgi-off", bgi_shutdown); - CDEF("outtext", s_outtext); - CDEF("justify", s_justify); - CDEF("font", s_font); - CDEF("direction", s_direction); - CDEF("moveto", s_moveto); - CDEF("pos", s_pos); - CDEF("color!", s_setcolor); - CDEF("bg!", s_setbgcolor); - CDEF("wipe", s_clear); - atexit(bgi_shutdown); -} diff --git a/slide.h b/slide.h deleted file mode 100755 index a706ec9..0000000 --- a/slide.h +++ /dev/null @@ -1 +0,0 @@ -void slide_init(); \ No newline at end of file diff --git a/slide.jor b/slide.jor deleted file mode 100755 index 91a8612..0000000 --- a/slide.jor +++ /dev/null @@ -1,181 +0,0 @@ -( K E Y B O A R D ) -57 const ^SPACE -75 const ^LEFT -77 const ^RIGHT -51 const ^< -52 const ^> -31 const ^S -59 const ^F1 - -0 const BLACK -1 const BLUE -2 const GREEN -3 const CYAN -4 const RED -5 const MAGENTA -6 const BROWN -7 const LGRAY -8 const DGRAY -9 const LBLUE -10 const LGREEN -11 const LCYAN -12 const PINK -13 const LMAGENTA -14 const YELLOW -15 const WHITE - -: rungame - 0 player.state DRIVING f! - 1 showmouse ! - [ MODE-MOVE @ lit ] dup MODE-MOVE ! ' tick redefine - ' full-draw ' draw redefine - 12 11 tile>world player entity.pos! - bgi-off 320x200 loadportraits - s" pete.jor" loadfile - begin suspend again ; - -( S L I D E ) -var skip -var autoslide -: pause - skip @ not if - begin - suspend 0 - ^< key-pressed if drop 1 1 skip ! -1 autoslide ! then - ^> key-pressed if drop 1 1 skip ! 1 autoslide ! then - ^S key-pressed if drop 1 1 skip ! then - ^RIGHT key-pressed ^SPACE key-pressed or if drop 1 then - ^F1 key-pressed if rungame then - until - then ; - -defer write -: y pos swap drop ; -: nexty ( dy -- y ) y + ; -: writeline ( s x dy ) nexty world player entity.pos! - s" pete.jor" loadfile ; -:noname :| player yield done |; ' party redefine - 0 player.state DRIVING f! - 1 showmouse ! MODE-MOVE @ ' tick redefine - 12 11 tile>world player entity.pos! - loadportraits ; -:noname s" hide-footer" REPL send ; -:noname s" show-footer" REPL send ; -:noname :| player yield done |; ' party redefine - 1 player.state DRIVING f! E player entity.dir ! ; -:noname :| done |; dup ' party redefine ' entities redefine 0 showmouse ! ; -array demostates , , , , , , , -var demostate - -: enterdemostate - demostate @ cells demostates + @ execute ; - -: tick-nextslide - ^SPACE key-pressed if 1 demostate +! enterdemostate then ; - -: demotick - tick-nextslide - 0 ^LEFT key-down if 3 - then - ^RIGHT key-down if 3 + then - 0 ^UP key-down if 3 - then - ^DOWN key-down if 3 + then - player entity.y +! - player entity.x +! - tick-mapedit - tick-debounce ; - -: autoadvance autoslide @ not if 1 autoslide ! then ; -: demo ( endstate startstate -- ) - bgi-off 320x200 - ' full-draw ' draw redefine - ' demotick ' tick redefine - demostate ! enterdemostate - begin suspend dup demostate @ <= until drop - ' noop ' draw redefine - ' noop ' tick redefine - bgi-on autoadvance ; - -var demorepldone -: quit 1 demorepldone ! ; -: start-demorepl activate ' putc task-emit ! - s" .:: J O R T H ( jean forth) ::." type cr - begin receive loadstring s" ok" type cr again ; -task const DEMOREPL -array replbuf 256 allot - -: demorepl - bgi-off key-end 0 demorepldone ! - DEMOREPL start-demorepl suspend - begin replbuf gets DEMOREPL send suspend - demorepldone @ until - bgi-on key-start autoadvance ; - -array filenamebuf 13 allot -var filenameindex -: store-fn-char filenamebuf filenameindex @ + b! ; -: filename-emit - dup [ key lit ] != if - store-fn-char - 1 filenameindex +! - 0 store-fn-char - else drop then ; - -: slidefilename ( i -- s ) - task-emit @ - ' filename-emit task-emit ! - 0 filenameindex ! - s" slide" type - swap . - s" .jor" type - task-emit ! - filenamebuf ; - -var slidecount -var slideindex - -: skipto ( i -- ) - slideindex @ - autoslide ! 1 skip ! ; - -: fixindex - slideindex @ 0 < if slidecount @ 1 - slideindex ! else - slideindex @ slidecount @ >= if 0 slideindex ! then then ; - -: show ( i -- ) 0 skip ! 0 autoslide ! slidefilename loadjor ; -: nextslide - autoslide @ if - autoslide @ slideindex +! - else - begin - suspend - ^LEFT key-pressed ^< key-pressed or - if -1 else - ^RIGHT key-pressed ^SPACE key-pressed or ^> key-pressed or - if 1 else 0 then then - dup if dup slideindex +! then - until - then fixindex ; - -: slideshow activate blah - bgi-on ' noop ' draw redefine ' noop ' tick redefine - begin slideindex @ show nextslide again ; -task const SLIDESHOW -SLIDESHOW slideshow - -:noname - 0 begin dup slidefilename exists while 1 + repeat slidecount ! - :| tick-nextslide [ MODE-MOVE @ , ] |; MODE-MOVE ! -; ' onload redefine diff --git a/slide0.jor b/slide0.jor deleted file mode 100755 index 2441a9d..0000000 --- a/slide0.jor +++ /dev/null @@ -1,8 +0,0 @@ -MAGENTA bg! -goof -s" What A 30-Year" write -s" Old PC Can Teach" write -s" Us About Graphic" write -s" Design" write pause -BLUE bg! bullet -s" (just kidding)" write diff --git a/slide1.jor b/slide1.jor deleted file mode 100755 index 7d445c1..0000000 --- a/slide1.jor +++ /dev/null @@ -1,4 +0,0 @@ -header 320 180 moveto -s" Building Your Own Tools" write pause -bullet -s" Or, Be Moore Like Chuck" write diff --git a/slide10.jor b/slide10.jor deleted file mode 100755 index ccda40d..0000000 --- a/slide10.jor +++ /dev/null @@ -1,16 +0,0 @@ -header -s" Things Jorth is missing" write pause -bullet -s" * Garbage collection" write pause -s" * Dynamic memory allocation" write pause -s" * Garbage" write pause -s" * Memory safety" write pause -s" * Error reporting" write pause -s" * Static types" write pause -s" * Dynamic types" write pause -s" * Objects" write pause -s" * Polymorphic methods" write pause -s" * Closures" write pause -s" * Flow control (in the interpreter)" write pause -s" * Local variables" write pause -s" * Syntax" write diff --git a/slide11.jor b/slide11.jor deleted file mode 100755 index 2975928..0000000 --- a/slide11.jor +++ /dev/null @@ -1,10 +0,0 @@ -header -s" Things Jorth has" write -bullet -s" * An interactive embedded REPL" write pause -s" * Lightweight co-operative multitasking" write pause -s" * A C FFI" write pause -s" * An extensible compiler, defined in itself" write pause -s" * The ability to fit comfortably in 16kb of RAM" write pause -s" * An entire codebase I completely understand" write -s" and am willing to change to fit my problem" write diff --git a/slide12.jor b/slide12.jor deleted file mode 100755 index 38038b4..0000000 --- a/slide12.jor +++ /dev/null @@ -1,15 +0,0 @@ -header -s" Jorth Crash Course" write -s" Syntax & Semantics" write -bullet -s" * Read text until a space is encountered" write pause -s" * Look up word in dictionary" write pause -s" * If a definition is found: Execute it" write pause -s" * Otherwise: Parse it as a number" write pause -s" * Otherwise: Give up" write pause -s" * Postfix / Reverse Polish Notation" write -s" parameters and return values live on The Stack" write pause -s" * D E M O !" write pause -demorepl - - diff --git a/slide13.jor b/slide13.jor deleted file mode 100755 index fb38001..0000000 --- a/slide13.jor +++ /dev/null @@ -1,9 +0,0 @@ -header -s" Jorth Crash Course" write -s" The Jorth Virtual Machine" write -bullet -s" while (IP.p) {" write -s" W = *IP.p;" write -s" IP.p++;" write -s" W.p->f();" write -s" }" write diff --git a/slide14.jor b/slide14.jor deleted file mode 100755 index 5abd9b7..0000000 --- a/slide14.jor +++ /dev/null @@ -1,11 +0,0 @@ -header -s" Jorth Crash Course" write -s" Calling Conventions" write -bullet -s" void f_docolon() {" write -s" RPUSH(IP);" write -s" IP.p = W.p + 1;" write -s" }" write pause -s" void f_ret() { " write -s" IP = *RPOP();" write -s" }" write diff --git a/slide15.jor b/slide15.jor deleted file mode 100755 index d92987e..0000000 --- a/slide15.jor +++ /dev/null @@ -1,14 +0,0 @@ -header -s" Jorth Crash Course" write -s" Writing Jorth In Itself" write -bullet -s" : begin here ; immediate" write -s" : until ' BZ_ , , ; immediate" write pause -s" " write -s" : if ' BZ_ , here 0 , ; immediate" write -s" : then here swap ! ; immediate" write pause -s" " write -s" : ( begin key ')' = until ; immediate" write - - - diff --git a/slide16.jor b/slide16.jor deleted file mode 100755 index c9aface..0000000 --- a/slide16.jor +++ /dev/null @@ -1,8 +0,0 @@ -header -s" What Good Was It?" write -bullet -s" * Jorth soon spread to every part of the project" write pause -s" * C for the hardware, Jorth for everything else" write pause -s" * All game & drawing logic" write pause -s" * Map editing" write pause -6 4 demo \ No newline at end of file diff --git a/slide17.jor b/slide17.jor deleted file mode 100755 index e1738c9..0000000 --- a/slide17.jor +++ /dev/null @@ -1,9 +0,0 @@ -header -s" Entirely Intuitive Results" write -bullet -s" * Forth does not scale up" write pause -s" * Arranging postfix expressions without local" write -s" variables is hard" write pause -s" * It's too easy to fill 64kb of memory" write pause -s" * This would have been impossible without" write -s" the internet" write diff --git a/slide18.jor b/slide18.jor deleted file mode 100755 index eeedb12..0000000 --- a/slide18.jor +++ /dev/null @@ -1,16 +0,0 @@ -header -s" Counterintuitive Results" write -bullet -s" * Complicated Forth code is AWFUL..." write pause -s" ... which is a powerful force for simplicity" write pause -s" * Virtually ALL state is global..." write pause -s" ... which makes it all visible when debugging" write pause -s" ... and which lets code stay small and focussed" write pause -s" * Hard to tell what a word might do..." write pause -s" ... but this makes huge implementation" write -s" changes possible!" write pause -s" * The most flexible abstraction may be the tiniest" write pause -s" * It's easier to write my own!" write pause -s" * Map editor" write pause -s" * Music livecoding REPL (<300 LOC!)" write pause -s" * This presentation software (<200 LOC!)" write diff --git a/slide19.jor b/slide19.jor deleted file mode 100755 index 46f1c0b..0000000 --- a/slide19.jor +++ /dev/null @@ -1,4 +0,0 @@ -header -s" I should shut up now" write pause -goof CYAN bg! MAGENTA color! -s" Questions?" write \ No newline at end of file diff --git a/slide2.jor b/slide2.jor deleted file mode 100755 index f4be0f3..0000000 --- a/slide2.jor +++ /dev/null @@ -1,6 +0,0 @@ -header -s" Background" write -bullet -s" I decided to write a game" write pause -s" for a 30-year-old computer" write pause -s" on a 30-year-old computer" write diff --git a/slide3.jor b/slide3.jor deleted file mode 100755 index 4ae3119..0000000 --- a/slide3.jor +++ /dev/null @@ -1,6 +0,0 @@ -header -s" WHY?!" write pause -bullet -s" * I fell in love with MS-DOS" write pause -s" * I wanted to see if I could" write pause -s" * Learning is fun" write diff --git a/slide4.jor b/slide4.jor deleted file mode 100755 index 17971b0..0000000 --- a/slide4.jor +++ /dev/null @@ -1,30 +0,0 @@ -header -s" What were my restrictions?" write -bullet -s" * Turbo C++ 1.0 (C & assembler)" write pause -s" * 16-bit real-mode x86" write pause -pos s" * 640kb of RAM" write pause -moveto s" -----" write -pos s" * ~550-600kb of RAM" write pause -moveto s" ----------" write - s" * 64kb of code, 64kb of data," write - s" 256kb of video memory" write pause - s" * E" outtext -2 color! s" G" outtext -3 color! s" A " outtext -4 color! s" G" outtext -5 color! s" r" outtext -6 color! s" a" outtext -7 color! s" p" outtext -8 color! s" h" outtext -9 color! s" i" outtext -10 color! s" c" outtext -11 color! s" s" outtext -12 color! s" !" outtext -13 color! s" !" outtext -14 color! s" !" write -LCYAN color! -s" * 320x200 pixel resolution, 16 colours" write pause -s" * AdLib sound" write -s" * FM synthesis - no digital sampling" write pause -s" * All work done ON THE 286" write diff --git a/slide5.jor b/slide5.jor deleted file mode 100755 index e660fef..0000000 --- a/slide5.jor +++ /dev/null @@ -1,11 +0,0 @@ -header -s" How would I learn all this?" write -bullet -pos s" * StackOverflow" write pause -moveto s" -----------" write pause -s" * Graphics Programming Black Book" write -s" by Michael Abrash" write pause -s" * Teach Yourself Game Programming in 21 Days" write -s" by Andre LaMothe" write pause -s" * Commander Keen Dreams source code" write pause -s" * Google... sometimes helped" write diff --git a/slide6.jor b/slide6.jor deleted file mode 100755 index 035f53f..0000000 --- a/slide6.jor +++ /dev/null @@ -1,8 +0,0 @@ -header -s" First Steps" write -bullet -s" * Could I write a tile engine?" write pause -s" * Stretch goal: Could I make it scroll smoothly?" write pause -s" * And obviously I've got to draw stuff on top..." write pause -s" * Ooh, what about a stationary HUD?" write pause -3 0 demo diff --git a/slide7.jor b/slide7.jor deleted file mode 100755 index fc34a66..0000000 --- a/slide7.jor +++ /dev/null @@ -1,7 +0,0 @@ -BLUE bg! -header -s" Problems: One Month In" write -bullet -s" * Game logic was messy" write pause -s" * Debugging is hard!" write pause -s" * How to edit maps?" write diff --git a/slide8.jor b/slide8.jor deleted file mode 100755 index 942eeb4..0000000 --- a/slide8.jor +++ /dev/null @@ -1,20 +0,0 @@ -header -s" I know, I'll just..." write pause -s" WRITE MY OWN" write -s" SCRIPTING LANGUAGE" write pause -bullet -s" What could POSSIBLY go wrong??" write pause - -header -s" @SpindleyQ" write pause -bullet -s" ohhh noooo I am definitely going to" write -s" write a 16-bit x86 Forth as a scripting" write -s" language for my game, this is happeniiiiing" write pause - -header -s" @mogwai_poet" write pause -bullet -s" @SpindleyQ Have you used forth before?" write -s" It's like programming assembly" write -s" on a CPU designed by an alien." write diff --git a/slide9.jor b/slide9.jor deleted file mode 100755 index 1b0ebb1..0000000 --- a/slide9.jor +++ /dev/null @@ -1,8 +0,0 @@ -header -s" FORTH" write -bullet -s" * Invented by Chuck Moore around 1970" write pause -s" * Still used in embedded systems & firmware" write pause -s" * The tiniest possible useful language" write pause -s" * 'If you've seen one Forth, you've seen one forth'" write pause -s" * I called mine Jorth ( jean forth)" write diff --git a/slidenot.es b/slidenot.es deleted file mode 100755 index 50a292d..0000000 --- a/slidenot.es +++ /dev/null @@ -1,19 +0,0 @@ -: slideNotes - bullet - s" * The tiniest abstraction may be the most flexible" write - s" (if you're willing to trade off 'safety')" write - -* Forth is really, really good for one person who understands everything -* It is not necessarily great for complex problems - (Change the problem!) -* It is not necessarily great for co-operation - (write-only language) -* It's kind of an anti-social language - (not least because you want to talk about it at length once you learn it!) - -Challenges: -* I spent a couple of hours figuring out how to free up enough - memory in the data segment to hold my game engine, Jorth data, - graphics data, and the slide fonts, all at the same time -* Then I wrote some more slides and ran out of RAM to store all - the text, so I diff --git a/testbed.c b/testbed.c index ee32f03..cd0ade6 100755 --- a/testbed.c +++ b/testbed.c @@ -13,7 +13,6 @@ #include "jorth.h" #include "egamap.h" #include "adlib.h" -#include "slide.h" /*** T E X T ***/ char far *font = NULL; @@ -225,39 +224,6 @@ void f_cleanup() { f_execcp(f_atexit); } -void f_320x200() { - FILE *f; - TifImageMeta_t meta; - - setEGAMode(); - tile_init(); - - f = fopen("FOOTER2.TIF", "rb"); - meta = tifLoadMeta(f); - tifLoadEGA(f, meta, 0, 48, 336); - fclose(f); - - f = fopen("TILES.TIF", "rb"); - meta = tifLoadMeta(f); - tifLoadEGA(f, meta, OFF_TILES, NUM_TILES * 16, 16); - fclose(f); -} - -void f_loadportraits() { - FILE *f; - TifImageMeta_t meta; - - f = fopen("FOOTER.TIF", "rb"); - meta = tifLoadMeta(f); - tifLoadEGA(f, meta, 0, 48, 336); - fclose(f); - - f = fopen("PORTRAIT.TIF", "rb"); - meta = tifLoadMeta(f); - tifLoadEGA(f, meta, OFF_PORTRAITS, NUM_PORTRAITS * 32, 32); - fclose(f); - -} void game_f_init(char *exe) { f_init(exe); CDEF("seremit", f_seremit); @@ -280,10 +246,7 @@ void game_f_init(char *exe) { CDEF("mousepos", f_mousepos); CDEF("mousebuttons", f_mousebuttons); CDEF("unfuck", tile_init); - CDEF("320x200", f_320x200); - CDEF("loadportraits", f_loadportraits); - slide_init(); f_loadjor("gameboot.jor"); f_atexit = f_lookupcp("atexit");