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 · 1027 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  atract=0 frm==+1529  Live() Moon()530  ; the name glows531  Poke(708,$32+((frm RSH 3)&3)*2)532  ; the picking sound stops when its533  ; time is up534  IF blip>0 THEN535    blip==-1536    ; while it lasts, the note takes537    ; voice 4 back from the drum that538    ; L1Tick() has just put there539    IF blip>0 THEN540      Poke(53766,bnote) Poke(53767,$A8)541    FI542  FI543  s=Stick(0)544  ; SELECT steps along, too545  IF consol=5 THEN s=7 FI546  ; held makes one push of the stick547  ; one step. 7 is right, 11 is left;548  ; the choice goes round from 2 to 0.549  IF s=15 THEN held=0550  ELSEIF held=0 THEN551    held=1552    IF s=7 OR s=11 THEN553      ; take the mark off the old554      ; panel, mark the new one, sound555      ; a note556      Mark(sel,0)557      IF s=7 THEN558        sel==+1559        IF sel=3 THEN sel=0 FI560      ELSEIF sel=0 THEN sel=2561      ELSE sel==-1 FI562      Mark(sel,1)563      ; 14, 12 or 9: about the notes564      ; C, D and G with the slow clock565      bnote=14-sel*2-(sel RSH 1)566      Poke(53766,bnote) Poke(53767,$A8)567      blip=6568    FI569  FI570  ; Nothing counts until the button571  ; and the keys have all been let go572  ; once (armed). Then the button or573  ; START sets go to 1, OPTION to 2.574  IF armed=0 THEN575    IF Strig(0)=1 AND consol=7 THEN576      armed=1 FI577  ELSEIF Strig(0)=0 OR consol=6 THEN578    go=1579  ELSEIF consol=3 THEN go=2 ; OPTION580  FI581RETURN582583; ---------------- the verses ----------------584; Shown when a game ends, and from the585; front screen with OPTION: verses of586; our own that climb the screen and587; shrink as they go, as if the page588; were leaning away.589; Each line of words is 40 bytes: ten590; blanks, twenty letters, ten blanks.591; The screen is eight slots, sixteen592; TV lines each, every one with its593; own address in the display list:594;  top 3   mode 2 (small letters, the595;          whole 40 bytes) and 8 blank596;  next 3  mode 6 (wide letters, the597;          middle 20) and 8 blank598;  last 2  mode 7 (wide and tall)599; A line of words steps up a slot at600; a time and so gets smaller. Between601; steps the whole stack creeps up a602; TV line at a time: three blank-line603; instructions above it shrink (18604; lines down to 3) and three under it605; grow by the same, so the graveyard606; at the bottom stays where it is.607; Under the verses: four lines of608; mode 4 with a fence, two stones and609; three ghouls shuffling; he610; moonwalks through them and she611; stands by. The front screen's two612; interrupts do the colours and put613; the players in place.614; NOT TRIED ON AN 800: if crawl()615; lies across a 4K line of memory,616; one line of words will show wrong.617618; three blank-line instructions that619; add up to t TV lines (3 to 18)620; (The instruction for n blank lines,621; 1 to 8, is (n-1)*16: LSH 4 does the622; multiplying.)623PROC Pad(CARD at BYTE t)624  BYTE a,b625  a=t/3 b=(t-a)/2626  Poke(at,(a-1) LSH 4)627  Poke(at+1,(b-1) LSH 4)628  Poke(at+2,(t-a-b-1) LSH 4)629RETURN630631; point the eight slots at their lines632; (by putting an address in each633; slot's instruction in the display634; list)635PROC Slots()636  BYTE j637  CARD p638  ; the three small slots show a whole639  ; 40 bytes each640  p=crawl+row*40641  FOR j=0 TO 2 DO642    PokeC(DLIST+6+j*4,p) p==+40643  OD644  ; the five wide ones show the middle645  ; 20: 10 bytes further in646  p==+10647  FOR j=0 TO 2 DO648    PokeC(DLIST+18+j*4,p) p==+40649  OD650  PokeC(DLIST+30,p)651  PokeC(DLIST+33,p+40)652RETURN653654; one more line of words, centred655; (into crawl, at line nl. Taking 32656; from a letter's code gives the657; number the screen uses for it.)658PROC Line(BYTE ARRAY s)659  BYTE i660  BYTE POINTER p661  p=crawl+nl*40+9+((20-s(0)) RSH 1)662  FOR i=1 TO s(0) DO663    p(i)=s(i)-32664  OD665  nl==+1666RETURN667668; a blank line between verses669PROC Gap()670  nl==+1671RETURN672673; the three ghouls: a step, and every674; second step a move along675PROC Shuffle()676  BYTE k,y,c677  CARD p678  ; every second step each ghoul goes679  ; one column along, and turns at the680  ; end of its beat681  gf==+1682  FOR k=0 TO 2 DO683    IF (gf&1)=0 THEN684      IF gdir(k)=0 THEN685        gcol(k)==+1686        IF gcol(k)=ghi(k) THEN687          gdir(k)=1 FI688      ELSE689        gcol(k)==-1690        IF gcol(k)=glo(k) THEN691          gdir(k)=0 FI692      FI693    FI694    ; its two poses are characters 89695    ; to 94 and 109 to 114, two wide696    ; and three high697    c=89698    IF (gf&1)=1 THEN c=109 FI699    ; rows 1 to 3 of the graveyard:700    ; wipe its beat, then draw it701    FOR y=0 TO 2 DO702      p=scrn+40+y*40703      Zero(p+glo(k),ghi(k)-glo(k)+2)704      Poke(p+gcol(k),c+y*2)705      Poke(p+gcol(k)+1,c+y*2+1)706    OD707  OD708RETURN709710; the verses' sixtieth of a second711PROC Roll()712  BYTE POINTER s713  atract=0 frm==+1714  ; he moonwalks; both interrupts put715  ; him at mwx716  Moon() pnx=mwx717  ; she changes pose every 16 frames718  s=girl+((frm RSH 4)&1)*52719  MoveBlock(pmb+1792+176,s,26)720  MoveBlock(pmb+768+176,s+26,26)721  ; the ghouls step every 32 frames722  IF (frm&31)=0 THEN Shuffle() FI723  ; Every second frame the stack724  ; creeps up one TV line. After 16 of725  ; those each line of words moves up726  ; a slot. When the last line has had727  ; its turn in the top slot, stop.728  IF (frm&1)=0 THEN729    sub==+1730    IF sub=16 THEN731      sub=0 row==+1732      IF row>=nl THEN go=1 RETURN FI733      Slots()734    FI735    ; the blank lines above shrink and736    ; those below grow737    Pad(DLIST+2,18-sub)738    Pad(DLIST+35,3+sub)739  FI740  ; once the button and the keys have741  ; been let go, either ends the742  ; verses743  IF armed=0 THEN744    IF Strig(0)=1 AND consol=7 THEN745      armed=1 FI746  ELSEIF Strig(0)=0 OR consol<>7 THEN747    go=1748  FI749RETURN750751; set the verses up. over=1: a game752; has just ended753PROC Verses(BYTE over)754  BYTE i755  ; a plain screen; clear the players756  ; and the verses757  Graphics(0)758  Poke(752,1) Poke(82,0)759  scrn=PeekC(88)760  Zero(pmb,2048)761  Zero(crawl,2160)762  ; the first eight lines stay blank,763  ; so the words come in at the bottom764  ; slot765  nl=8766  IF over=1 THEN Line("GAME OVER")767  ELSE Line("THRILLER") FI768  Gap()769  Line("THE MOON CLIMBS HIGH")770  Line("ABOVE THE TREES")771  Line("AND SOMETHING HOWLS")772  Line("UPON THE BREEZE")773  Gap()774  Line("THE GRAVEYARD GATE")775  Line("SWINGS OPEN WIDE")776  Line("THE GHOULS BELOW")777  Line("WON'T STAY INSIDE")778  Gap()779  Line("THEY SHUFFLE OUT")780  Line("ON CREAKING FEET")781  Line("THEY CANNOT HELP IT")782  Line("IT'S THE BEAT")783  Gap()784  Line("UP ON THE HILL")785  Line("A MANSION WAITS")786  Line("TWELVE ROOMS OF DARK")787  Line("BEHIND ITS GATES")788  Gap()789  Line("SHE CALLS FOR YOU")790  Line("THE LAMP BURNS LOW")791  Line("A CLOCK STRIKES ONE")792  Line("THE GHOULS ALL KNOW")793  Gap()794  Line("YOU RAN, YOU DANCED")795  Line("YOU FOUGHT ALL NIGHT")796  Line("BUT NO ONE LASTS")797  Line("TILL MORNING LIGHT")798  Gap()799  Line("SO REST A WHILE")800  Line("BENEATH THE STONE")801  Line("THEN TRY AGAIN")802  Line("YOU'RE NOT ALONE")803  Gap()804  Line("GET YOUR THRILL")805  Line("TODAY!")806  ; The display list. Two lots of 8807  ; blank lines, then (further down)808  ; the top pad at +2.809  row=0 sub=0810  Poke(DLIST,$70) Poke(DLIST+1,$70)811  ; three mode 2 slots from +5 and812  ; three mode 6 slots from +17. Each813  ; is an instruction with $40 (an814  ; address follows: Slots fills it815  ; in), two bytes of address, and 8816  ; blank lines.817  FOR i=0 TO 2 DO818    Poke(DLIST+5+i*4,$42)819    Poke(DLIST+8+i*4,$70)820    Poke(DLIST+17+i*4,$46)821    Poke(DLIST+20+i*4,$70)822  OD823  ; two mode 7 slots. $C7 is $47 with824  ; $80: the first interrupt, for the825  ; graveyard's colours.826  Poke(DLIST+29,$47) Poke(DLIST+32,$C7)827  ; the pads above and below the828  ; stack, and the slots' addresses829  Pad(DLIST+2,18) Pad(DLIST+35,3)830  Slots()831  ; four lines of mode 4 for the832  ; graveyard, which is the start of833  ; screen memory; the second834  ; interrupt on the last; then back835  ; to the top836  Poke(DLIST+38,$44)837  PokeC(DLIST+39,scrn)838  Poke(DLIST+41,4) Poke(DLIST+42,4)839  Poke(DLIST+43,$84)840  Poke(DLIST+44,$41)841  PokeC(DLIST+45,DLIST)842  ; the graveyard843  ; a fence along row 0, two stones844  ; two cells square on rows 2 and 3,845  ; and the ghouls846  FOR i=0 TO 39 DO Poke(scrn+i,88) OD847  Poke(scrn+89,80) Poke(scrn+90,81)848  Poke(scrn+129,82) Poke(scrn+130,83)849  Poke(scrn+106,80) Poke(scrn+107,81)850  Poke(scrn+146,82) Poke(scrn+147,83)851  FOR i=0 TO 2 DO852    gcol(i)=glo(i)+i gdir(i)=0853  OD854  gf=0 Shuffle()855  ; she stands at 130 across; he856  ; starts at the right857  hposp3=130 hposm3=130 hposm2=132858  hposm1=134 hposm0=136859  mwx=188 mwd=0 mwt=0 pnx=mwx860  ; use our list, our characters, the861  ; players and the colours, as PROC862  ; Display does863  PokeC(560,DLIST)864  Poke(756,chb RSH 8)865  Poke(54279,ramtop)866  Poke(53277,3)867  Poke(623,49)868  Poke(559,62)869  Poke(704,$34) Poke(705,SKIN)870  Poke(706,$02) Poke(707,$86)871  Poke(708,$1C) Poke(709,$0A)872  Poke(710,0) Poke(711,$28)873  Poke(712,0)874  ; wait for the next frame, then875  ; point the interrupt at $600 and876  ; switch it on877  armed=0 go=0 scene=1878  Frame()879  PokeC(512,$600) Poke(54286,192)880RETURN881882; play the music until go is set:883; each frame, the next row of the884; tune, then Tick() or Roll()885PROC Loop()886  L1Start()887  DO888    Frame()889    L1Tick()890    IF scene=0 THEN Tick()891    ELSE Roll() FI892  UNTIL go>0 OD893  L1Stop()894RETURN895896; the laugh, once, fading over its897; last quarter (as the screens play898; it when a life is lost): ft is the899; 16 levels at 1/8 to 8/8 of full900; strength, shrunk toward the middle901; level 8902PROC Laugh()903  CARD i,c,fs,st904  BYTE b,v,d,k,o905  BYTE ARRAY ft(128)906  FOR k=1 TO 8 DO907    FOR v=0 TO 15 DO908      IF v<8 THEN d=8-((8-v)*k+4)/8909      ELSE d=8+((v-8)*k+4)/8 FI910      ft((k-1)*16+v)=$10%d911    OD912  OD913  fs=LAUGHLEN/28914  o=112 c=fs-1 st=LAUGHLEN-fs*7915  FOR i=0 TO LAUGHLEN-1 DO916    b=laugh(i)917    v=ft(o+(b RSH 4)) audc1=v audc2=v918    FOR d=1 TO 9 DO OD919    v=ft(o+(b&15)) audc1=v audc2=v920    FOR d=1 TO 9 DO OD921    IF i>=st THEN922      c==+1923      IF c=fs THEN924        c=0925        IF o>0 THEN o==-16 FI926      FI927    FI928  OD929  audc1=0 audc2=0930RETURN931932; The verses, start to finish. If933; they run to the end (the last words934; have gone off the top) the laugh935; plays over the graveyard before the936; front screen comes back; the button937; skips both.938; (Called by Main with over=1 after a939; game, and with over=0 for OPTION.)940PROC Story(BYTE over)941  Verses(over)942  Loop()943  SndRst()944  IF row>=nl THEN Laugh() FI945  PmOff()946  Zero(pmb,2048)947RETURN948949; The front screen, start to finish.950; It comes back with go=1 (play: next951; is the screen picked) or go=2952; (OPTION: show the verses).953PROC Front()954  Display() Words() Panels()955  ; start with the next screen picked956  sel=next-1957  IF sel>2 THEN sel=0 FI958  Mark(0,0) Mark(1,0) Mark(2,0)959  Mark(sel,1)960  ; held=1: a stick already pushed961  ; does not count962  held=1 go=0 blip=0 armed=0 scene=0963  mwx=188 mwd=0 mwt=0964  ; wait for the next frame, then965  ; point the interrupt at $600 and966  ; switch it on967  Frame()968  PokeC(512,$600) Poke(54286,192)969  ; the music, until something is970  ; chosen971  Loop()972  next=sel+1973  SndRst() PmOff()974RETURN975976; NOT WRITTEN. Load the card program977; (D:THRILLC.OBJ) and jump to its978; start; it shows the card and loads979; the screen `next` names. Under DOS980; 2.0S that is a binary load through981; CIO.982PROC Run()983RETURN984985; Run at power-on, and again each time986; a screen ends. chain and result say987; which.988PROC Main()989  Init()990  ; the first run since power-on?991  IF magic<>MAGIC THEN992    magic=MAGIC hi=0 last=0993    chain=0 next=1994  FI995  bonus=0996  IF chain=1 AND result=1 THEN997    ; a screen was won: the next one998    next==+1999    IF next=4 THEN next=1 FI1000    ; three in a row: a bonus life1001    IF wins MOD 3=0 AND lives<5 THEN1002      lives==+1 bonus=11003    FI1004  ELSE1005    IF chain=1 THEN ; a game just ended1006      ; keep the scores, show the1007      ; verses1008      last=score1009      IF score>hi THEN hi=score FI1010      Story(1)1011    FI1012    chain=01013    ; OPTION on the front screen shows1014    ; the verses, then it comes back1015    DO1016      Front()1017      IF go=1 THEN EXIT FI1018      Story(0)1019    OD1020    ; a new game1021    chain=1 wins=0 lives=3 score=01022  FI1023  ; run the card program (when Run is1024  ; written)1025  result=01026  Run()1027RETURN