remove presentation as it no longer runs
This commit is contained in:
parent
69bab3aacd
commit
530d79c09b
BIN
footer2.tif
BIN
footer2.tif
Binary file not shown.
82
slide.c
82
slide.c
|
@ -1,82 +0,0 @@
|
|||
#include <graphics.h>
|
||||
#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);
|
||||
}
|
181
slide.jor
181
slide.jor
|
@ -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 <rot outtext moveto ;
|
||||
|
||||
: header :| 320 50 writeline |; ' write redefine
|
||||
wipe BLUE bg! 1 5 font 1 justify WHITE color! 320 10 moveto ;
|
||||
|
||||
: bullet :| 30 30 writeline |; ' write redefine
|
||||
3 3 font 0 justify LCYAN color! 30 y 30 + moveto ;
|
||||
|
||||
: goof :| 320 60 writeline |; ' write redefine
|
||||
wipe 4 7 font 1 justify CYAN color! 320 100 moveto ;
|
||||
|
||||
( S L I D E S )
|
||||
|
||||
' noop
|
||||
:noname 12 11 tile>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
|
|
@ -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
|
|
@ -1,4 +0,0 @@
|
|||
header 320 180 moveto
|
||||
s" Building Your Own Tools" write pause
|
||||
bullet
|
||||
s" Or, Be Moore Like Chuck" write
|
16
slide10.jor
16
slide10.jor
|
@ -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
|
10
slide11.jor
10
slide11.jor
|
@ -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
|
15
slide12.jor
15
slide12.jor
|
@ -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
|
||||
|
||||
|
|
@ -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
|
11
slide14.jor
11
slide14.jor
|
@ -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
|
14
slide15.jor
14
slide15.jor
|
@ -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
|
||||
|
||||
|
||||
|
|
@ -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
|
|
@ -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
|
16
slide18.jor
16
slide18.jor
|
@ -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
|
|
@ -1,4 +0,0 @@
|
|||
header
|
||||
s" I should shut up now" write pause
|
||||
goof CYAN bg! MAGENTA color!
|
||||
s" Questions?" write
|
|
@ -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
|
|
@ -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
|
30
slide4.jor
30
slide4.jor
|
@ -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
|
11
slide5.jor
11
slide5.jor
|
@ -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
|
|
@ -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
|
|
@ -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
|
20
slide8.jor
20
slide8.jor
|
@ -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
|
|
@ -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
|
19
slidenot.es
19
slidenot.es
|
@ -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
|
37
testbed.c
37
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");
|
||||
|
|
Loading…
Reference in a new issue