Thriller · the program listingsThe title program

About the listingsTitle programCard programThe woodsThe graveyardThe mansionPictures, tunes and sounds

The front screen with its three little pictures, the moonwalker under them, the music that loops behind them, and the verses that climb the screen when a game ends. It also keeps the score, the lives and the high score between screens.

Never compiled. These listings were written as the design of the game, in Action!, within what a 48K Atari 800 of 1984 could do. They have not been through the Action! cartridge or run on an Atari. What plays on the game page is a line-for-line translation into JavaScript, made by hand, PROC for PROC. Expect small mistakes a compiler would have caught, and note the parts marked NOT WRITTEN: loading one program from another off the disk.

THRILLER.ACT · 1029 lines · the file itself

Its 25 PROCs and FUNCs, in the order they appear:

1; **************************************2; *        T H R I L L E R             *3; *       the title program            *4; **************************************5; Designed in 1984 by Dale Lutz, on a6; sheet of paper. Written in 2026 by7; Dale and Claude, in Action!, for a8; 48K Atari 800 and one joystick.9;10; The game is five programs on one11; disk: this one, the card program12; (THRILLERC.ACT) and the three13; screens (THRILLER1, 2 and 3.ACT).14; This one shows the front screen,15; with the three screens side by side16; as they were on the 1984 sketch.17; The joystick picks one, the button18; starts it. When a screen is won it19; comes back here, and this program20; runs the card program, which shows21; a card and runs the next one:22; 1, 2, 3, then 1 again, a night later23; and harder. Every third screen won24; earns a life. It keeps the score,25; the lives and the high score in a26; few bytes of page 6.27;28; NOT WRITTEN: Run(), which has to29; load the next program from the disk.30;31; In this listing {inv}...{/inv} marks32; text typed in inverse video.33;34; HOW THIS PROGRAM WORKS35; PROC Main looks at the shared bytes36; to see why it was run: for the first37; time, after a screen was won, or38; after a game ended. It shows the39; verses and the front screen as40; needed, sets the bytes for the next41; program and runs it.42; The front screen and the verses each43; have a display list of their own44; (the table that tells the Atari what45; kind of line to draw at each place46; down the screen), built at $640. The47; moving figures are players48; (sprites).49; There is no ordinary main loop. PROC50; Loop plays the digitized music, and51; sixty times a second it calls Tick52; (front screen) or Roll (verses) to53; do everything else.5455; TITLE has the characters (tset) and56; the three pictures (panels), SHAPES57; him and her (hero, girl), SHAPES158; the werewolf (wolf), LAUGH the laugh.59; L1POKEY, the front screen's music,60; has procedures in it, so it comes61; in after the declarations below.62INCLUDE "D:TITLE.ACT"63INCLUDE "D:SHAPES.ACT"64INCLUDE "D:SHAPES1.ACT"65INCLUDE "D:LAUGH.ACT"6667; DLIST: where our display list is68; built, in page 6. FUR, SKIN: the two69; colours player 1 takes (the wolf's70; fur, his skin). MAGIC: the mark that71; says the shared bytes have been set72; up.73DEFINE DLIST="$640",FUR="$18",74  SKIN="$28",MAGIC="$54"7576; the bytes the five programs share77; chain: 1 while a game is going on.78; wins: screens won this game. result:79; 1 the screen just run was won.80; score, hi, last: this game's score,81; the high score, and the last game's82; score.83BYTE chain=$6F0,wins=$6F1,lives=$6F2,84  result=$6F5,85  next=$6F6,   ; the screen to run86  magic=$6FB,  ; MAGIC once hi is set87  bonus=$6FC   ; a life has been earned88CARD score=$6F3,89  hi=$6F7,last=$6F99091; places in the Atari itself: the92; clock that ticks every TV frame, the93; attract-mode timer, the top of94; memory, the START, SELECT and OPTION95; keys, two volume registers, and the96; left-to-right positions of the four97; players and the four missiles98BYTE rtclok=20,atract=77,ramtop=106,99  consol=53279,100  audc1=$D201,audc2=$D203,101  hposp0=$D000,hposp1=$D001,102  hposp2=$D002,hposp3=$D003,103  hposm0=$D004,hposm1=$D005,104  hposm2=$D006,hposm3=$D007105; scrn, pmb, chb: the addresses of106; screen memory, player-missile memory107; and our character set (idle is not108; used). sel: the panel picked, 0 to109; 2. frm: counts frames. held: the110; stick has not been let go since it111; last stepped.112CARD scrn,pmb,chb,idle113BYTE sel,frm,held114; the moonwalker under the panels:115; where he is (the second interrupt116; reads it), which way he glides,117; and how long his spin has to run118BYTE mwx=$6E0,mwd,mwt119; where the figure in the panel is120; (the first interrupt reads it)121BYTE pnx=$6E1122; go: the button has been pressed.123; blip: how long the picking sound124; has left125; armed: the button and the keys126; have been let go since the screen127; came up. scene: 0 the front screen,128; 1 the verses. bnote: the pitch of129; the picking sound.130BYTE go,blip,armed,scene,bnote131; the verses: nl lines so far, row132; the line in the top slot, sub how133; far it has crept toward the next134; gf: counts the graveyard ghouls'135; steps136BYTE nl,row,sub,gf137; crawl: the verses, 40 bytes a line.138; The three ghouls in the graveyard:139; gcol the column each is in, gdir140; which way it is going, glo and ghi141; the two ends of its beat.142BYTE ARRAY crawl(2160),gcol(3),143  gdir(3),glo=[1 12 29],ghi=[7 16 36]144145; his eleven poses again, facing left146; (made by PROC Init)147BYTE ARRAY herol(858)148149; Two display list interrupts, one150; after the other down the screen.151; The first, on the line above the152; panels, makes playfield 0 green and153; playfield 2 brown for the pictures,154; and puts players 0 to 2 where the155; figure in the chosen panel is (pnx).156; The second, on the panels' last157; line, makes playfield 2 black again158; for the words underneath, and moves159; the same three players across to160; where the moonwalker is (mwx), with161; his skin colour in player 1. They162; are copied to $600 and $621.163;  PHA; LDA #$C6; STA WSYNC;164;  STA COLPF0; LDA #$24; STA COLPF2;165;  LDA pnx; STA HPOSP0; STA HPOSP1;166;  STA HPOSP2; LDA #$21; STA VDSLST;167;  PLA; RTI168;  PHA; LDA #0; STA WSYNC; STA COLPF2;169;  STA VDSLST; LDA mwx; STA HPOSP0;170;  STA HPOSP1; STA HPOSP2; LDA #$28;171;  STA COLPM1; PLA; RTI172; (VDSLST holds the address of the173; routine the next interrupt will run.174; Each of the two puts the other's low175; byte there, $21 or 0, so they take176; turns down the screen.)177BYTE ARRAY dlicode=[178  $48 $A9 $C6 $8D $0A $D4 $8D $16 $D0179  $A9 $24 $8D $18 $D0 $AD $E1 $06180  $8D $00 $D0 $8D $01 $D0 $8D $02 $D0181  $A9 $21 $8D $00 $02 $68 $40182  $48 $A9 $00 $8D $0A $D4 $8D $18 $D0183  $8D $00 $02 $AD $E0 $06 $8D $00 $D0184  $8D $01 $D0 $8D $02 $D0 $A9 $28185  $8D $13 $D0 $68 $40]186187; The front screen's music: the table188; l1pokey and the three procedures189; that play it (L1Start, L1Tick,190; L1Stop). See "the loop", below.191INCLUDE "D:L1POKEY.ACT"192193; wait for the next TV frame194PROC Frame()195  BYTE f196  f=rtclok197  DO UNTIL rtclok<>f OD198  atract=0 frm==+1199RETURN200201; a mirror image of n bytes of shapes202; (each byte is a row of eight dots,203; so its bits are put in the opposite204; order)205PROC Flip(BYTE POINTER src,dst CARD n)206  CARD i207  BYTE b,m,k208  FOR i=0 TO n-1 DO209    b=src(i) m=0210    FOR k=0 TO 7 DO211      m==LSH 1212      IF (b&1)=1 THEN m==+1 FI213      b==RSH 1214    OD215    dst(i)=m216  OD217RETURN218219; Done once. Take 4K at the top of220; memory for the players and our221; characters, copy the two interrupts222; to page 6, and make his left-facing223; shapes.224PROC Init()225  ; 16 pages down: players at pmb,226  ; characters 2K further up227  ramtop==-16228  Graphics(0)229  pmb=ramtop*256 chb=pmb+2048230  Zero(pmb,2048)231  ; the Atari's own letters (in ROM at232  ; 57344), then ours over them from233  ; character 65 on (520 = 65*8)234  MoveBlock(chb,57344,1024)235  MoveBlock(chb+520,tset,400)236  ; the two interrupt routines, 64237  ; bytes, to $600238  MoveBlock($600,dlicode,64)239  ; 858 bytes: eleven poses of 78240  Flip(hero,herol,858)241RETURN242243; Interrupts off, players and missiles244; off and moved off the screen. Used245; when a scene ends.246PROC PmOff()247  Poke(54286,64) Poke(53277,0)248  hposp0=0 hposp1=0 hposp2=0 hposp3=0249  hposm0=0 hposm1=0 hposm2=0 hposm3=0250RETURN251252; ---------- the front screen ----------253254; our own display list: the name in255; big letters, two lines of words,256; nine lines of pictures (ANTIC mode257; 4), eleven more lines of words258; Also turns the players on and sets259; the colours. The interrupts are260; turned on later, in PROC Front.261PROC Display()262  BYTE i263  Graphics(0)264  Poke(752,1) Poke(82,0)265  scrn=PeekC(88)266  ; three lots of 8 blank TV lines267  Poke(DLIST,$70) Poke(DLIST+1,$70)268  Poke(DLIST+2,$70)269  ; row 0 in mode 7 (big letters). $40270  ; means the address of the line's271  ; data follows: here, screen memory.272  Poke(DLIST+3,$47) PokeC(DLIST+4,scrn)273  ; rows 1 to 3 in mode 2 (ordinary274  ; text). $80 on row 3 calls the275  ; first interrupt, ready for the276  ; pictures.277  Poke(DLIST+6,$42)278  PokeC(DLIST+7,scrn+40)279  Poke(DLIST+9,2)280  Poke(DLIST+10,$82)281  ; rows 4 to 12, the pictures, in282  ; mode 4 (four-colour characters).283  ; The last calls the second284  ; interrupt.285  FOR i=11 TO 18 DO Poke(DLIST+i,4) OD286  Poke(DLIST+19,$84)287  ; rows 13 to 23 in mode 2288  FOR i=20 TO 30 DO Poke(DLIST+i,2) OD289  ; $41: wait for the next frame and290  ; start the list again. Then tell291  ; the Atari where the list is.292  Poke(DLIST+31,$41)293  PokeC(DLIST+32,DLIST)294  PokeC(560,DLIST)295  ; our character set (756). Players:296  ; where their memory is (54279),297  ; switch them on (53277), players in298  ; front and missiles as a fifth299  ; player (623), one-line players300  ; (559).301  Poke(756,chb RSH 8)302  Poke(54279,ramtop)303  Poke(53277,3)304  Poke(623,49)305  Poke(559,62)306  ; colours: 704-707 the players,307  ; 708-711 the playfield, 712 the308  ; background309  Poke(704,$34) Poke(705,SKIN)310  Poke(706,$02) Poke(707,$86)311  Poke(708,$36) Poke(709,$0C)312  Poke(710,0) Poke(711,$28)313  Poke(712,0)314RETURN315316; words under panel k, centred317; (Panel k starts at column 1+k*13 and318; is 12 wide. s(0) is the number of319; letters in s.)320PROC Centre(BYTE k,y BYTE ARRAY s)321  Position(1+k*13+((12-s(0)) RSH 1),y)322  Print(s)323RETURN324325; all the words on the front screen,326; with the two scores327PROC Words()328  Position(6,0) Print("THRILLER")329  Position(11,1)330  Print("NOW PLAY THE GAME!")331  Centre(0,13,"SAVE YOUR")332  Centre(0,14,"GIRL AS YOU")333  Centre(0,15,"ARE A")334  Centre(0,16,"WEREWOLF!")335  Centre(1,13,"PROTECT YOUR")336  Centre(1,14,"GIRLFRIEND")337  Centre(1,15,"FROM GRISLY")338  Centre(1,16,"GHOULS!")339  Centre(2,13,"FIND YOUR")340  Centre(2,14,"GIRL IN THE")341  Centre(2,15,"MANSION")342  Position(25,16)343  Print("BEFORE THEY DO!")344  ; lines 17 to 19 are his stage345  Position(2,20)346  Print("JOYSTICK: PICK A SCREEN  ")347  Print("BUTTON: PLAY")348  Position(5,21) Print("HIGH SCORE ")349  PrintC(hi)350  Position(25,21) Print("LAST ")351  PrintC(last)352  Position(9,22)353  Print("OPTION: A TALE IN VERSE")354  Position(9,23)355  Print("GET YOUR THRILL TODAY!")356RETURN357358; The three pictures. Each is 12359; characters wide and 9 high, 108360; bytes, and is copied a row at a time361; to rows 4 to 12 of the screen (40362; bytes to a row).363PROC Panels()364  BYTE k,y365  FOR k=0 TO 2 DO366    FOR y=0 TO 8 DO367      MoveBlock(scrn+(4+y)*40+1+k*13,368        panels+k*108+y*12,12)369    OD370  OD371RETURN372373; the chosen screen's name in inverse,374; and its frame in the bright colour375PROC Mark(BYTE k,on)376  BYTE x,y,c377  BYTE POINTER p378  ; p: the top left cell of panel k379  ; (161 = row 4, column 1)380  p=scrn+161+k*13381  ; its name on row 3. 49 is the digit382  ; 1; 128 more makes a character383  ; inverse.384  Position(3+k*13,3)385  IF on=1 THEN Print("SCREEN ")386  ELSE Print("SCREEN ") FI387  Put(49+k+on*128)388  ; the cells round the edge of the389  ; panel: 128 more gives the bright390  ; colour, 128 less the plain one391  FOR y=0 TO 8 DO392    FOR x=0 TO 11 DO393      IF y=0 OR y=8 OR x=0 OR x=11 THEN394        c=p(x)&127395        p(x)=c+on*128396      FI397    OD398    p==+40399  OD400RETURN401402; the chosen panel comes to life: the403; players are him (or the wolf) and her404PROC Live()405  BYTE POINTER s406  BYTE x,gx,x0,t407  ; x0: just inside the left edge of408  ; the chosen panel, in player409  ; coordinates. t counts 0 to 15, a410  ; step every four frames; x goes411  ; from 0 up to 7 and back.412  x0=56+sel*52 t=(frm RSH 2)&15413  IF t<8 THEN x=t ELSE x=15-t FI414  IF sel=0 THEN  ; the wolf runs after her415    Poke(705,FUR)416    s=wolf+((frm RSH 2)&1)*78417    x=x0+x gx=x0+26418  ELSEIF sel=1 THEN ; he dances419    Poke(705,SKIN)420    s=hero+156+((frm RSH 3)&1)*78421    x=x0+12 gx=x0+2422  ELSE           ; he searches, to and423    Poke(705,SKIN) ; fro; she is hidden424    x=x0+4+x*2 gx=0425    IF t<8 THEN426      s=hero+((frm RSH 3)&1)*78427    ELSE428      s=herol+((frm RSH 3)&1)*78429    FI430  FI431  ; His shape: 26 bytes each for432  ; players 0, 1 and 2 (their memory433  ; is at +1024, +1280 and +1536),434  ; starting 110 TV lines down. pnx435  ; tells the first interrupt where to436  ; put them across.437  MoveBlock(pmb+1024+110,s,26)438  MoveBlock(pmb+1280+110,s+26,26)439  MoveBlock(pmb+1536+110,s+52,26)440  pnx=x441  ; Her: two poses of 52 bytes, 26 for442  ; player 3 (+1792) and 26 for the443  ; missiles (+768). In the middle444  ; panel she stands still.445  s=girl+((frm RSH 2)&1)*52446  IF sel=1 THEN s=girl FI447  MoveBlock(pmb+1792+110,s,26)448  MoveBlock(pmb+768+110,s+26,26)449  ; position 0 is off the screen:450  ; hidden451  hposp3=gx452  IF gx=0 THEN453    hposm3=0 hposm2=0 hposm1=0 hposm0=0454  ELSE455    hposm3=gx hposm2=gx+2456    hposm1=gx+4 hposm0=gx+6457  FI458RETURN459460; While the front screen waits he461; moonwalks to and fro under the462; panels: facing one way and gliding463; the other, with a spin at each end.464PROC Moon()465  BYTE POINTER s466  ; mwt>0: he is spinning, one pose467  ; held for 24 frames468  IF mwt>0 THEN469    mwt==-1 s=hero+468470  ELSE471    ; gliding: four poses in turn,472    ; facing right (hero) while he473    ; goes left and left (herol) while474    ; he goes right. He moves every475    ; second frame, and turns at 60476    ; and at 188.477    IF mwd=0 THEN s=hero ELSE s=herol FI478    s==+546+((frm RSH 3)&3)*78479    IF (frm&1)=0 THEN480      IF mwd=0 THEN481        mwx==-1482        IF mwx<60 THEN mwd=1 mwt=24 FI483      ELSE484        mwx==+1485        IF mwx>188 THEN mwd=0 mwt=24 FI486      FI487    FI488  FI489  ; his shape goes 176 TV lines down;490  ; the second interrupt puts him at491  ; mwx492  MoveBlock(pmb+1024+176,s,26)493  MoveBlock(pmb+1280+176,s+26,26)494  MoveBlock(pmb+1536+176,s+52,26)495RETURN496497; ---------------- the loop ----------------498; The front screen plays L1POKEY.ACT:499; two bars of music on all four of500; POKEY's voices (bass, lead, and two501; for the drum), round and round for502; as long as it is up. The tune is a503; table of 243 rows, one for each504; sixtieth of a second, and each row505; is the eight bytes to put in the506; sound registers for that moment.507; PROC Loop (further down, which the508; verses share) waits for each new509; frame, has L1Tick() poke the next510; row, and then calls Tick() for the511; joystick and the moving figures.512; The music takes all four voices, so513; the note that sounds when you pick514; a screen borrows the fourth from515; the drum for a tenth of a second.516; L1Start() sets the sound clock to517; its slow rate (AUDCTL=1), which is518; why that note is poked straight in519; rather than made with Sound(), which520; would set the clock back.521522; The front screen's sixtieth of a523; second: move the figures, then read524; the joystick, the button and the525; keys.526PROC Tick()527  BYTE s528  ; Frame() has already counted this529  ; frame in frm530  Live() Moon()531  ; the name glows532  Poke(708,$32+((frm RSH 3)&3)*2)533  ; the picking sound stops when its534  ; time is up535  IF blip>0 THEN536    blip==-1537    ; while it lasts, the note takes538    ; voice 4 back from the drum that539    ; L1Tick() has just put there540    IF blip>0 THEN541      Poke(53766,bnote) Poke(53767,$A8)542    FI543  FI544  s=Stick(0)545  ; SELECT steps along, too546  IF consol=5 THEN s=7 FI547  ; held makes one push of the stick548  ; one step. 7 is right, 11 is left;549  ; the choice goes round from 2 to 0.550  IF s=15 THEN held=0551  ELSEIF held=0 THEN552    held=1553    IF s=7 OR s=11 THEN554      ; take the mark off the old555      ; panel, mark the new one, sound556      ; a note557      Mark(sel,0)558      IF s=7 THEN559        sel==+1560        IF sel=3 THEN sel=0 FI561      ELSEIF sel=0 THEN sel=2562      ELSE sel==-1 FI563      Mark(sel,1)564      ; 14, 12 or 9: about the notes565      ; C, D and G with the slow clock566      bnote=14-sel*2-(sel RSH 1)567      Poke(53766,bnote) Poke(53767,$A8)568      blip=6569    FI570  FI571  ; Nothing counts until the button572  ; and the keys have all been let go573  ; once (armed). Then the button or574  ; START sets go to 1, OPTION to 2.575  IF armed=0 THEN576    IF Strig(0)=1 AND consol=7 THEN577      armed=1 FI578  ELSEIF Strig(0)=0 OR consol=6 THEN579    go=1580  ELSEIF consol=3 THEN go=2 ; OPTION581  FI582RETURN583584; ---------------- the verses ----------------585; Shown when a game ends, and from the586; front screen with OPTION: verses of587; our own that climb the screen and588; shrink as they go, as if the page589; were leaning away.590; Each line of words is 40 bytes: ten591; blanks, twenty letters, ten blanks.592; The screen is eight slots, sixteen593; TV lines each, every one with its594; own address in the display list:595;  top 3   mode 2 (small letters, the596;          whole 40 bytes) and 8 blank597;  next 3  mode 6 (wide letters, the598;          middle 20) and 8 blank599;  last 2  mode 7 (wide and tall)600; A line of words steps up a slot at601; a time and so gets smaller. Between602; steps the whole stack creeps up a603; TV line at a time: three blank-line604; instructions above it shrink (18605; lines down to 3) and three under it606; grow by the same, so the graveyard607; at the bottom stays where it is.608; Under the verses: four lines of609; mode 4 with a fence, two stones and610; three ghouls shuffling; he611; moonwalks through them and she612; stands by. The front screen's two613; interrupts do the colours and put614; the players in place.615; NOT TRIED ON AN 800: if crawl()616; lies across a 4K line of memory,617; one line of words will show wrong.618619; three blank-line instructions that620; add up to t TV lines (3 to 18)621; (The instruction for n blank lines,622; 1 to 8, is (n-1)*16: LSH 4 does the623; multiplying.)624PROC Pad(CARD at BYTE t)625  BYTE a,b626  a=t/3 b=(t-a)/2627  Poke(at,(a-1) LSH 4)628  Poke(at+1,(b-1) LSH 4)629  Poke(at+2,(t-a-b-1) LSH 4)630RETURN631632; point the eight slots at their lines633; (by putting an address in each634; slot's instruction in the display635; list)636PROC Slots()637  BYTE j638  CARD p639  ; the three small slots show a whole640  ; 40 bytes each641  p=crawl+row*40642  FOR j=0 TO 2 DO643    PokeC(DLIST+6+j*4,p) p==+40644  OD645  ; the five wide ones show the middle646  ; 20: 10 bytes further in647  p==+10648  FOR j=0 TO 2 DO649    PokeC(DLIST+18+j*4,p) p==+40650  OD651  PokeC(DLIST+30,p)652  PokeC(DLIST+33,p+40)653RETURN654655; one more line of words, centred656; (into crawl, at line nl. Taking 32657; from a letter's code gives the658; number the screen uses for it.)659PROC Line(BYTE ARRAY s)660  BYTE i661  BYTE POINTER p662  p=crawl+nl*40+9+((20-s(0)) RSH 1)663  FOR i=1 TO s(0) DO664    p(i)=s(i)-32665  OD666  nl==+1667RETURN668669; a blank line between verses670PROC Gap()671  nl==+1672RETURN673674; the three ghouls: a step, and every675; second step a move along676PROC Shuffle()677  BYTE k,y,c678  CARD p679  ; every second step each ghoul goes680  ; one column along, and turns at the681  ; end of its beat682  gf==+1683  FOR k=0 TO 2 DO684    IF (gf&1)=0 THEN685      IF gdir(k)=0 THEN686        gcol(k)==+1687        IF gcol(k)=ghi(k) THEN688          gdir(k)=1 FI689      ELSE690        gcol(k)==-1691        IF gcol(k)=glo(k) THEN692          gdir(k)=0 FI693      FI694    FI695    ; its two poses are characters 89696    ; to 94 and 109 to 114, two wide697    ; and three high698    c=89699    IF (gf&1)=1 THEN c=109 FI700    ; rows 1 to 3 of the graveyard:701    ; wipe its beat, then draw it702    FOR y=0 TO 2 DO703      p=scrn+40+y*40704      Zero(p+glo(k),ghi(k)-glo(k)+2)705      Poke(p+gcol(k),c+y*2)706      Poke(p+gcol(k)+1,c+y*2+1)707    OD708  OD709RETURN710711; the verses' sixtieth of a second712PROC Roll()713  BYTE POINTER s714  ; Frame() has already counted this715  ; frame in frm716  ; he moonwalks; both interrupts put717  ; him at mwx718  Moon() pnx=mwx719  ; she changes pose every 16 frames720  s=girl+((frm RSH 4)&1)*52721  MoveBlock(pmb+1792+176,s,26)722  MoveBlock(pmb+768+176,s+26,26)723  ; the ghouls step every 32 frames724  IF (frm&31)=0 THEN Shuffle() FI725  ; Every second frame the stack726  ; creeps up one TV line. After 16 of727  ; those each line of words moves up728  ; a slot. When the last line has had729  ; its turn in the top slot, stop.730  IF (frm&1)=0 THEN731    sub==+1732    IF sub=16 THEN733      sub=0 row==+1734      IF row>=nl THEN go=1 RETURN FI735      Slots()736    FI737    ; the blank lines above shrink and738    ; those below grow739    Pad(DLIST+2,18-sub)740    Pad(DLIST+35,3+sub)741  FI742  ; once the button and the keys have743  ; been let go, either ends the744  ; verses745  IF armed=0 THEN746    IF Strig(0)=1 AND consol=7 THEN747      armed=1 FI748  ELSEIF Strig(0)=0 OR consol<>7 THEN749    go=1750  FI751RETURN752753; set the verses up. over=1: a game754; has just ended755PROC Verses(BYTE over)756  BYTE i757  ; a plain screen; clear the players758  ; and the verses759  Graphics(0)760  Poke(752,1) Poke(82,0)761  scrn=PeekC(88)762  Zero(pmb,2048)763  Zero(crawl,2160)764  ; the first eight lines stay blank,765  ; so the words come in at the bottom766  ; slot767  nl=8768  IF over=1 THEN Line("GAME OVER")769  ELSE Line("THRILLER") FI770  Gap()771  Line("THE MOON CLIMBS HIGH")772  Line("ABOVE THE TREES")773  Line("AND SOMETHING HOWLS")774  Line("UPON THE BREEZE")775  Gap()776  Line("THE GRAVEYARD GATE")777  Line("SWINGS OPEN WIDE")778  Line("THE GHOULS BELOW")779  Line("WON'T STAY INSIDE")780  Gap()781  Line("THEY SHUFFLE OUT")782  Line("ON CREAKING FEET")783  Line("THEY CANNOT HELP IT")784  Line("IT'S THE BEAT")785  Gap()786  Line("UP ON THE HILL")787  Line("A MANSION WAITS")788  Line("TWELVE ROOMS OF DARK")789  Line("BEHIND ITS GATES")790  Gap()791  Line("SHE CALLS FOR YOU")792  Line("THE LAMP BURNS LOW")793  Line("A CLOCK STRIKES ONE")794  Line("THE GHOULS ALL KNOW")795  Gap()796  Line("YOU RAN, YOU DANCED")797  Line("YOU FOUGHT ALL NIGHT")798  Line("BUT NO ONE LASTS")799  Line("TILL MORNING LIGHT")800  Gap()801  Line("SO REST A WHILE")802  Line("BENEATH THE STONE")803  Line("THEN TRY AGAIN")804  Line("YOU'RE NOT ALONE")805  Gap()806  Line("GET YOUR THRILL")807  Line("TODAY!")808  ; The display list. Two lots of 8809  ; blank lines, then (further down)810  ; the top pad at +2.811  row=0 sub=0812  Poke(DLIST,$70) Poke(DLIST+1,$70)813  ; three mode 2 slots from +5 and814  ; three mode 6 slots from +17. Each815  ; is an instruction with $40 (an816  ; address follows: Slots fills it817  ; in), two bytes of address, and 8818  ; blank lines.819  FOR i=0 TO 2 DO820    Poke(DLIST+5+i*4,$42)821    Poke(DLIST+8+i*4,$70)822    Poke(DLIST+17+i*4,$46)823    Poke(DLIST+20+i*4,$70)824  OD825  ; two mode 7 slots. $C7 is $47 with826  ; $80: the first interrupt, for the827  ; graveyard's colours.828  Poke(DLIST+29,$47) Poke(DLIST+32,$C7)829  ; the pads above and below the830  ; stack, and the slots' addresses831  Pad(DLIST+2,18) Pad(DLIST+35,3)832  Slots()833  ; four lines of mode 4 for the834  ; graveyard, which is the start of835  ; screen memory; the second836  ; interrupt on the last; then back837  ; to the top838  Poke(DLIST+38,$44)839  PokeC(DLIST+39,scrn)840  Poke(DLIST+41,4) Poke(DLIST+42,4)841  Poke(DLIST+43,$84)842  Poke(DLIST+44,$41)843  PokeC(DLIST+45,DLIST)844  ; the graveyard845  ; a fence along row 0, two stones846  ; two cells square on rows 2 and 3,847  ; and the ghouls848  FOR i=0 TO 39 DO Poke(scrn+i,88) OD849  Poke(scrn+89,80) Poke(scrn+90,81)850  Poke(scrn+129,82) Poke(scrn+130,83)851  Poke(scrn+106,80) Poke(scrn+107,81)852  Poke(scrn+146,82) Poke(scrn+147,83)853  FOR i=0 TO 2 DO854    gcol(i)=glo(i)+i gdir(i)=0855  OD856  gf=0 Shuffle()857  ; she stands at 130 across; he858  ; starts at the right859  hposp3=130 hposm3=130 hposm2=132860  hposm1=134 hposm0=136861  mwx=188 mwd=0 mwt=0 pnx=mwx862  ; use our list, our characters, the863  ; players and the colours, as PROC864  ; Display does865  PokeC(560,DLIST)866  Poke(756,chb RSH 8)867  Poke(54279,ramtop)868  Poke(53277,3)869  Poke(623,49)870  Poke(559,62)871  Poke(704,$34) Poke(705,SKIN)872  Poke(706,$02) Poke(707,$86)873  Poke(708,$1C) Poke(709,$0A)874  Poke(710,0) Poke(711,$28)875  Poke(712,0)876  ; wait for the next frame, then877  ; point the interrupt at $600 and878  ; switch it on879  armed=0 go=0 scene=1880  Frame()881  PokeC(512,$600) Poke(54286,192)882RETURN883884; play the music until go is set:885; each frame, the next row of the886; tune, then Tick() or Roll()887PROC Loop()888  L1Start()889  DO890    Frame()891    L1Tick()892    IF scene=0 THEN Tick()893    ELSE Roll() FI894  UNTIL go>0 OD895  L1Stop()896RETURN897898; the laugh, once, fading over its899; last quarter (as the screens play900; it when a life is lost): ft is the901; 16 levels at 1/8 to 8/8 of full902; strength, shrunk toward the middle903; level 8904PROC Laugh()905  CARD i,c,fs,st906  BYTE b,v,d,k,o907  BYTE ARRAY ft(128)908  FOR k=1 TO 8 DO909    FOR v=0 TO 15 DO910      IF v<8 THEN d=8-((8-v)*k+4)/8911      ELSE d=8+((v-8)*k+4)/8 FI912      ft((k-1)*16+v)=$10%d913    OD914  OD915  fs=LAUGHLEN/28916  o=112 c=fs-1 st=LAUGHLEN-fs*7917  FOR i=0 TO LAUGHLEN-1 DO918    b=laugh(i)919    v=ft(o+(b RSH 4)) audc1=v audc2=v920    FOR d=1 TO 9 DO OD921    v=ft(o+(b&15)) audc1=v audc2=v922    FOR d=1 TO 9 DO OD923    IF i>=st THEN924      c==+1925      IF c=fs THEN926        c=0927        IF o>0 THEN o==-16 FI928      FI929    FI930  OD931  audc1=0 audc2=0932RETURN933934; The verses, start to finish. If935; they run to the end (the last words936; have gone off the top) the laugh937; plays over the graveyard before the938; front screen comes back; the button939; skips both.940; (Called by Main with over=1 after a941; game, and with over=0 for OPTION.)942PROC Story(BYTE over)943  Verses(over)944  Loop()945  SndRst()946  IF row>=nl THEN Laugh() FI947  PmOff()948  Zero(pmb,2048)949RETURN950951; The front screen, start to finish.952; It comes back with go=1 (play: next953; is the screen picked) or go=2954; (OPTION: show the verses).955PROC Front()956  Display() Words() Panels()957  ; start with the next screen picked958  sel=next-1959  IF sel>2 THEN sel=0 FI960  Mark(0,0) Mark(1,0) Mark(2,0)961  Mark(sel,1)962  ; held=1: a stick already pushed963  ; does not count964  held=1 go=0 blip=0 armed=0 scene=0965  mwx=188 mwd=0 mwt=0966  ; wait for the next frame, then967  ; point the interrupt at $600 and968  ; switch it on969  Frame()970  PokeC(512,$600) Poke(54286,192)971  ; the music, until something is972  ; chosen973  Loop()974  next=sel+1975  SndRst() PmOff()976RETURN977978; NOT WRITTEN. Load the card program979; (D:THRILLC.OBJ) and jump to its980; start; it shows the card and loads981; the screen `next` names. Under DOS982; 2.0S that is a binary load through983; CIO.984PROC Run()985RETURN986987; Run at power-on, and again each time988; a screen ends. chain and result say989; which.990PROC Main()991  Init()992  ; the first run since power-on?993  IF magic<>MAGIC THEN994    magic=MAGIC hi=0 last=0995    chain=0 next=1996  FI997  bonus=0998  IF chain=1 AND result=1 THEN999    ; a screen was won: the next one1000    next==+11001    IF next=4 THEN next=1 FI1002    ; three in a row: a bonus life1003    IF wins MOD 3=0 AND lives<5 THEN1004      lives==+1 bonus=11005    FI1006  ELSE1007    IF chain=1 THEN ; a game just ended1008      ; keep the scores, show the1009      ; verses1010      last=score1011      IF score>hi THEN hi=score FI1012      Story(1)1013    FI1014    chain=01015    ; OPTION on the front screen shows1016    ; the verses, then it comes back1017    DO1018      Front()1019      IF go=1 THEN EXIT FI1020      Story(0)1021    OD1022    ; a new game1023    chain=1 wins=0 lives=3 score=01024  FI1025  ; run the card program (when Run is1026  ; written)1027  result=01028  Run()1029RETURN