diff --git a/res/Pitch Dark.interpp20180104.2mg b/Attic/Pitch Dark.interpp20180104.2mg similarity index 100% rename from res/Pitch Dark.interpp20180104.2mg rename to Attic/Pitch Dark.interpp20180104.2mg diff --git a/Makefile b/Makefile index 1a5edb8..66f1355 100644 --- a/Makefile +++ b/Makefile @@ -15,12 +15,14 @@ ACME=acme # https://sourceforge.net/projects/applecommander/ AC=bin/AppleCommander.jar -BUILDDISK=build/work.po +DISK=pitchdark.po +MASTERDISK=res/$(DISK) +BUILDDISK=build/$(DISK) asm: mkdir -p build cd src && $(ACME) pitchdark.a - cp res/work.po $(BUILDDISK) + cp $(MASTERDISK) $(BUILDDISK) java -jar $(AC) -p $(BUILDDISK) "PITCHDRK.SYSTEM" sys 0x2000 < "build/PITCHDRK.SYSTEM#FF2000" clean: diff --git a/bin/V2Make.scpt b/bin/V2Make.scpt index d7980a0..15afb35 100644 Binary files a/bin/V2Make.scpt and b/bin/V2Make.scpt differ diff --git a/notes/game-descriptions.txt b/notes/game-descriptions.txt index 811b33a..b38be3d 100644 --- a/notes/game-descriptions.txt +++ b/notes/game-descriptions.txt @@ -1,3 +1,4 @@ +[info] BALLYHOO @@ -5,7 +6,7 @@ Difficulty: ^^^&& - +[description] Spurred by your natural curiosity, you stick around after the show in the big top, hoping to catch an after-hours performance. Perhaps you'll get a peek at an impromptu clown act, or watch the late-night feedings of the @@ -27,8 +28,12 @@ would call you foolish. Every circus has its seedy underside. But few are as dangerous as this. +[versions] +R97.851218.Z3=r97 / 851218 + -- +[info] CUTTHROATS @@ -36,7 +41,7 @@ Every circus has its seedy underside. But few are as dangerous as this. Difficulty: ^^^&& - +[description] In Cutthroats, you are a skilled diver living on Hardscrabble Island, a small seaport past its prime. You will try to salvage a treasure from one of four shipwrecks; if you are successful, you will be fabulously and @@ -48,8 +53,12 @@ There is more than one shipwreck in Cutthroats, but in each story you will be trying to recover only one particular treasure. When you restart the story, you may find yourself diving for a different treasure. +[versions] +R23.840809=r23 / 840809 + -- +[info] DEADLINE @@ -57,7 +66,7 @@ story, you may find yourself diving for a different treasure. Difficulty: ^^^^^ - +[description] A wealthy industrialist, Mr. Marshall Robner, locked himself in the upstairs library of his New England colonial estate one night and committed suicide by taking a lethal overdose of anti-depressants. Or did he? @@ -76,8 +85,17 @@ this case, and the one you reach is determined by your actions and by the deductions you draw from the evidence you gather. But one ending fits the facts better than any other, and you will know it when you reach it. +[versions] +R27.831005.Z3=r27 / 831005 +R26.821108.Z3=r26 / 821108 +R22.820809.Z3=r22 / 820809 +R21.820512.Z3=r21 / 820512 +R19.820427.Z3=r19 / 820427 +R18.820311.Z3=r18 / 820311 + -- +[info] ENCHANTER @@ -85,12 +103,7 @@ facts better than any other, and you will know it when you reach it. Difficulty: ^^^&& - -Welcome to the World of the Enchanter saga - a world where magic is -commonplace, a world where guilds of professional magic-users spend their -lifetimes mastering the intricacies of thaumaturgy, a world where great -forces of evil must constantly be held at bay. - +[description] An Evil Warlock has subjugated the land to his power. All who have opposed him have failed. But many years ago, in another age, the great Elders of the Circle of Enchanters foresaw the possibility of these dreaded occurences. @@ -108,8 +121,16 @@ the basics of magic, and you will be greatly aided by the spells you know and the spells you will learn. But you must also rely on your powers of observation and quick wits. +[versions] +R29.860820.Z3=r29 / 860820 +R24.851118.Z3=r24 / 851118 +R16.831118.Z3=r16 / 831118 +R15.831107.Z3=r15 / 831107 +R10.830810.Z3=r10 / 830810 + -- +[info] HITCHHIKER'S GUIDE TO THE GALAXY @@ -117,7 +138,7 @@ observation and quick wits. Difficulty: ^^^&& - +[description] Don't Panic! In this story, you will be Arthur Dent, a rather ordinary earth creature who @@ -138,8 +159,15 @@ Familiarity with the story may make a few of the early puzzles easier, but if you rely too heavily on this previous knowledge you will certainly befuddle yourself. +[versions] +R59.851108.Z3=r59 / 851108 +R58.851002.Z3=r58 / 851002 +R56.841221.Z3=r56 / 841221 +R47.840914.Z3=r47 / 840914 + -- +[info] HOLLYWOOD HIJINX @@ -147,7 +175,7 @@ befuddle yourself. Difficulty: ^^^&& - +[description] As a child, you spent most of your summers with your Aunt Hildegard and Uncle Buddy. What memories! Uncle Buddy was a Hollywood big-shot, Aunt Hildegard his loving (and very rich!) wife. They had no children on their @@ -164,8 +192,13 @@ you inherit nothing. And so Hollywood Hijinx begins with you being dropped off in front of a dark house, not too far from Hollywood... +[versions] +R37.861215.Z3=r37 / 861215 +R235.861118.Z3=r235 / 861118 + -- +[info] INFIDEL @@ -173,7 +206,7 @@ house, not too far from Hollywood... Difficulty: ^^^^& - +[description] You like to think of yourself as a bold and adventurous soldier of fortune, daring to brave the perils of the Egyptian Desert in search of a great lost pyramid. In fact, you're a small-time explorer, and you've just been @@ -190,8 +223,12 @@ Still, you're driven onward against desperate odds. Undreamed-of riches and treasures beyond imagination await you. And your pride and dignity, your reputation and self-esteem, are at stake. For you are branded INFIDEL. +[versions] +R22.830916.Z3=r22 / 830916 + -- +[info] LEATHER GOODESSES OF PHOBOS @@ -199,7 +236,7 @@ reputation and self-esteem, are at stake. For you are branded INFIDEL. Difficulty: ^^^&& - +[description] 1936. In the United States, a new miracle fabric called nylon is becoming popular, the Great Plains continue to suffer from a severe drought that is turning the region into a Dust Bowl, Alf Landon is running for President, @@ -227,8 +264,13 @@ should you be able to catch your breath long enough to think about it, is to collect the materials you'll need to ultimately defeat the Leather Goddesses of Phobos and save humanity! Are you "up" for the job? +[versions] +R59.860730.Z3=r59 / 860730 +R50.860711.Z3=r50 / 860711 + -- +[info] THE LURKING HORROR @@ -236,7 +278,7 @@ of Phobos and save humanity! Are you "up" for the job? Difficulty: ^^^&& - +[description] In The Lurking Horror, you are a student at G.U.E. Tech. You have braved a snowstorm to get to the Computer Center and finish work on an assignment. But the snowstorm has turned into a raging blizzard, and has trapped you in @@ -251,8 +293,38 @@ calm corridors and study halls. Shapes emerge from dark corners. Eerie sounds draw closer. Slimy passageways lead to sights so horrifying that they will feed your nightmares for weeks. +[versions] +R221.870918.Z3=r221 / 870918 +R219.870912.Z3=r219 / 870912 +R203.870506.Z3=r203 / 870506 + -- +[info] + MINI-ZORK + + +1987 Fantasy + +Difficulty: ^^^&& + +[description] +This is a condensed version of Zork I, reduced to make it viable for the +cassette-based Commodore 64. The only Infocom story file ever to be intended +to run from cassette rather than disk, Mini-Zork has been compared to a +Reader's Digest edition of a classic. It is one of several remakings of Zork +from the final years of Infocom. + +In November 1990, a year after Infocom had effectively become defunct, Mini- +Zork was given away with the British Commodore magazine "Zzap! 64" no. 67, +which is now a collector's item. + +[versions] +R34.871124.Z3=r34 / 871124 + +-- + +[info] MOONMIST @@ -260,7 +332,7 @@ lead to sights so horrifying that they will feed your nightmares for weeks. Difficulty: ^^&&& - +[description] In Moonmist, you are a famous young American detective. An old friend, Tamara Lynd, has written you a letter, asking for your help. And so you have travelled to England to test your detective skills. @@ -271,13 +343,18 @@ valuable treasure. But Tamara is worried about a ghost that is tormenting her. What does the ghost want? Is it jealous of her? Does the ghost want the hidden treasure -for itself? Or is the ghost a fake -- just someone dressing up to frighten +for itself? Or is the ghost a fake -- just someone dressing up to frighten Tamara? If so, why? These mysteries and others are waiting to test your wits in Moonmist. +[versions] +R9.861022.Z3=r9 / 861022 +R4.860918.Z3=r4 / 860918 + -- +[info] PLANETFALL @@ -285,7 +362,7 @@ These mysteries and others are waiting to test your wits in Moonmist. Difficulty: ^^^&& - +[description] After the fall of the Second Galactic Union in 1716 GY, a ten-thousand-year dark age settled upon the galaxy. Interstellar travel was non-existent, and many star systems descended into a near-barbaric state, buring coal and gas @@ -313,8 +390,15 @@ Seventh Class. You superior officer, Ensign First Class Blather, has been making your life miserable. You're beginning to wonder if you're really cut out for the Stellar Patrol... +[versions] +R37.851003.Z3=r37 / 851003 +R29.840118.Z3=r29 / 840118 +R26.831014.Z3=r26 / 831014 +R20.830708.Z3=r20 / 830708 + -- +[info] PLUNDERED HEARTS @@ -322,7 +406,7 @@ out for the Stellar Patrol... Difficulty: ^^&&& - +[description] Plundered Hearts is set in the late 1600s, where you are living the gentle life of a beautiful young Englishwoman. You have received news that your dear father is ailing, and so you are travelling to the West Indies to care @@ -333,8 +417,12 @@ are carried off by the dashing pirate captain! But this does not dissuade you from your determination to find your father. Along the way, you shall encounter danger, adventure ... and more than a touch of romance. +[versions] +R26.870730.Z3=r26 / 870730 + -- +[info] SEASTALKER @@ -342,7 +430,7 @@ encounter danger, adventure ... and more than a touch of romance. Difficulty: ^&&&& - +[description] Welcome to the world of Infocom's junior interactive fiction, a world where: * you can become the hero or heroine in a story, @@ -358,8 +446,16 @@ dive deeply into the sea to capture plants and animals for you to study. But you will have to use it to save your undersea scientific station from a sea monster that is attacking it! +[versions] +R16B.850603.Z3=r16 / 850603 +R16A.850515.Z3=r16 / 850515 +R15B.840522.Z3=r15 / 840522 +R15A.840501.Z3=r15 / 840501 +R86.840320.Z3=r86 / 840320 + -- +[info] SORCERER @@ -367,12 +463,7 @@ monster that is attacking it! Difficulty: ^^^^& - -Welcome to the World of the Enchanter saga - a world where magic is -commonplace, a world where guilds of professional magic-users spend their -lifetimes mastering the intricacies of thaumaturgy, a world where great -forces of evil must constantly be held at bay. - +[description] In your late youth you left home to join the Guild of Enchanters. After years of schooling, you achieved the rank of Apprentice Enchanter. In fulfillment of an ancient prophecy, you were sent to find Krill, an evil @@ -397,8 +488,21 @@ darkness instead of the forces of light, who knows what would result? And now, unbeknownst to you, Belboz has vanished. +[versions] +R18.DEPROT.Z3=r18 / 860904 (deprotected) +R15.DEPROT.Z3=r15 / 851108 (deprotected) +R13.DEPROT.Z3=r13 / 851021 (deprotected) +R6.DEPROT.Z3=r6 / 840508 (deprotected) +R4.DEPROT.Z3=r4 / 840131 (deprotected) +R18.860904.Z3=r18 / 860904 +R15.851108.Z3=r15 / 851108 +R13.851021.Z3=r13 / 851021 +R6.840508.Z3=r6 / 840508 +R4.840131.Z3=r4 / 840131 + -- +[info] SPELLBREAKER @@ -406,11 +510,7 @@ And now, unbeknownst to you, Belboz has vanished. Difficulty: ^^^^^ - -Welcome to the World of the Enchanter saga - a world founded on magic, where -guilds of magicians have mastered the powers of sorcery; a world now -threatened with destruction. - +[description] You distinguished yourself among the young Enchanters by defeating the evil warlock Krill, whose attempt to subjugate the land was thwarted by your clerverness, as your inexperience allowed you to succeed where others might @@ -424,8 +524,15 @@ Spells fail to work or go strangely awry, the populace is confused and restive, and even the Enchanters Guild is baffled. And it is at this conclave that the final conflict between good and evil begins to unfold. +[versions] +R87.DEPROT.Z3=r87 / 860904 (deprotected) +R63.DEPROT.Z3=r63 / 850916 (deprotected) +R87.860904.Z3=r87 / 860904 +R63.850916.Z3=r63 / 850916 + -- +[info] STARCROSS @@ -433,7 +540,7 @@ conclave that the final conflict between good and evil begins to unfold. Difficulty: ^^^^^ - +[description] The year is 2186. Humanity has established colonies on the moon, Mars, and several of the larger asteroids. Earth's sky is dotted with space habitats, and the spaceways are always busy. As usual, there is urgent need for energy @@ -461,8 +568,13 @@ grapple with the long-sought black hole. Your quest hast taken an unexpected turn, for you are destined to rendezvous with a gargantuan alien space ship from the outer fringes of the galaxy. +[versions] +R17.821021.Z3=r17 / 821021 +R15.820901.Z3=r15 / 820901 + -- +[info] STATIONFALL @@ -470,7 +582,7 @@ from the outer fringes of the galaxy. Difficulty: ^^^^& - +[description] After the fall of the Second Galactic Union in 1716 GY, a ten-thousand-year dark age settled upon the galaxy. Interstellar travel was nonexistent, and many star systems descended into a near-barbaric state, buring coal and gas @@ -510,8 +622,13 @@ at today's "thrilling" assignment: scooting over to Space Station Gamma Delta Gamma 777-G 59/59 Sector Alpha-Mu-79 to pick up a supply of Request for Stellar Patrol Issue Regulation Black Form Binders Request Form Forms... +[versions] +R107.DEPROT.Z3=r107 / 870430 deprotected +R107.870430.Z3=r107 / 870430 + -- +[info] SUSPECT @@ -519,7 +636,7 @@ for Stellar Patrol Issue Regulation Black Form Binders Request Form Forms... Difficulty: ^^^^& - +[description] Halloween night. You are a guest at a very exclusive party: the annual Costume Ball at @@ -537,8 +654,12 @@ a few hours to escape the trap that's been laid for you. The murderer is in your midst, laughing behind your back. +[versions] +R14.841005.Z3=r14 / 841005 + -- +[info] SUSPENDED @@ -546,7 +667,7 @@ The murderer is in your midst, laughing behind your back. Difficulty: ^^^^^ - +[description] You are the Central Mentality on an advanced semi-automated planet. You were supposed to sleep -- in limited cryogenic suspension -- for the next 500 years, 20 miles beneath the surface of the planet, while the great Filtering @@ -563,8 +684,15 @@ offers you specific abilities. One offers you sight; a second, hearing; a third, access to information in the computer memory banks. Through the robots, you must save the planet from destruction. +[versions] +R8B.840521.Z3=r8 / 840521 +R8A.830521.Z3=r8 / 830521 +R7.830419.Z3=r7 / 830419 +R5.830222.Z3=r5 / 830222 + -- +[info] WISHBRINGER @@ -572,7 +700,7 @@ robots, you must save the planet from destruction. Difficulty: ^^&&& - +[description] In Wishbringer, you're a postal clerk in a small seaside village called Festeron. You deliver a strange envelope to a magic shop, and discover that an old woman's black cat has been kidnapped by "the Evil One." The old woman @@ -584,8 +712,13 @@ only in unusual places. Everyone seeks to possess a magic stone of dreams known as Wishbringer; but only you can find it and use its powers to make your town safe again. And you only have a few hours! +[versions] +R69.850920.Z3=r69 / 850920 +R68.850501.Z3=r68 / 850501 + -- +[info] THE WITNESS @@ -593,7 +726,7 @@ your town safe again. And you only have a few hours! Difficulty: ^^^&& - +[description] In The Witness, you are a police detective working near Los Angeles. The year is 1938, and on this stormy February night a wealthy but frightened man has asked your for protection. In spite of your best efforts, a death will @@ -619,8 +752,16 @@ actions and by the deductions you draw from the evidence you gather. But one ending fits the facts better than any, and you will know it when you reach it. +[versions] +R22.840924.Z3=r22 / 840924 +R21.831208.Z3=r21 / 831208 +R20.831119.Z3=r20 / 831119 +R18.830910.Z3=r18 / 830910 +R13.830524.Z3=r13 / 830524 + -- +[info] ZORK I: THE GREAT UNDERGROUND EMPIRE @@ -628,7 +769,7 @@ it. Difficulty: ^^^&& - +[description] Welcome to ZORK! You are about to experience a classic interactive fantasy, set in a magical universe. The ZORK trilogy takes place in the ruins of an ancient empire lying far underground. You, a dauntless treasure-hunter, are @@ -645,8 +786,20 @@ of light (for the caverns are dark) and weapons (for some of the inhabitants are unfriendly -- especially the thief, a skilled pickpocket and ruthless opponent). +[versions] +R88.840726.Z3=r88 / 840726 +R76.840509.Z3=r76 / 840509 +R75.830929.Z3=r75 / 830929 +R30.830330.Z3=r30 / 830330 +R28.821013.Z3=r28 / 821013 +R26.820803.Z3=r26 / 820803 +R25.820515.Z3=r25 / 820515 +R23.820428.Z3=r23 / 820428 +R20.000000.Z3=r20 / 000000 + -- +[info] ZORK II: THE WIZARD OF FROBOZZ @@ -654,14 +807,7 @@ ZORK II: THE WIZARD Difficulty: ^^^^& - -Welcome to ZORK! You are about to experience a classic interactive fantasy, -set in a magical universe. The ZORK trilogy takes place in the ruins of an -ancient empire lying far underground. You, a dauntless treasure-hunter, are -venturing into this dangerous land in search of wealth and adventure. -Because each part of the ZORK saga is a completely independent story, you -can explore them in any order. - +[description] In Zork II, you will explore a long hidden region of the Empire, a region dominated by the Wizard of Frobozz. The Wizard was once a respected Enchanter, but when his powers began to fade he was exiled by Lord Dimwit @@ -669,8 +815,19 @@ Flathead the Excessive. Now bordering on senility, the Wizard is still a force to be reckoned with. Your goal, as you venture into the Wizard's realm, is to avoid his capricious tricks and learn to control his magic. +[versions] +R48.840904.Z3=r48 / 840904 +R23.830411.Z3=r23 / 830411 +R22.830331.Z3=r22 / 830331 +R19.820721.Z3=r19 / 820721 +R18B.820517.Z3=r18 / 820517 +R18A.820512.Z3=r18 / 820512 +R17.820427.Z3=r17 / 820427 +R15.820308.Z3=r15 / 820308 + -- +[info] ZORK III: THE DUNGEON MASTER @@ -678,17 +835,18 @@ realm, is to avoid his capricious tricks and learn to control his magic. Difficulty: ^^^^& - -Welcome to ZORK! You are about to experience a classic interactive fantasy, -set in a magical universe. The ZORK trilogy takes place in the ruins of an -ancient empire lying far underground. You, a dauntless treasure-hunter, are -venturing into this dangerous land in search of wealth and adventure. -Because each part of the ZORK saga is a completely independent story, you -can explore them in any order. - +[description] As ZORK III begins, your greatest challenge beckons as you take the final step down into the very heart of the Great Underground Empire. Your character and courage will be tested as the enigmatic Dungeon Master confronts you with predicaments and perils. Your quest hinges upon discovering his secret purpose, even as he oversees your ultimate triumph - or destruction! + +[versions] +R17.840727.Z3=r17 / 840727 +R16.830410.Z3=r16 / 830410 +R15B.840518.Z3=r15 / 840518 +R15A.830331.Z3=r15 / 830331 +R12.821025.Z3=r12 / 821025 +R10.820818.Z3=r10 / 820818 diff --git a/notes/game-versions.txt b/notes/game-versions.txt index 19868de..352fdf7 100644 --- a/notes/game-versions.txt +++ b/notes/game-versions.txt @@ -120,5 +120,4 @@ Zork III 15/830331 - done (as "r15a") 15/840518 - done (as "r15b") 16/830410 - done - 15/840518 - done 17/840727 - done diff --git a/res/Pitch Dark.2mg b/res/Pitch Dark.2mg new file mode 100644 index 0000000..721d69c Binary files /dev/null and b/res/Pitch Dark.2mg differ diff --git a/res/info/zork.i.txt b/res/info/zork.i.txt deleted file mode 100644 index bbb3105..0000000 --- a/res/info/zork.i.txt +++ /dev/null @@ -1,35 +0,0 @@ -[info] - ZORK I: THE GREAT - UNDERGROUND EMPIRE - -1980 Fantasy - -Difficulty: ***.. - -[description] -Welcome to ZORK! You are about to experience a classic interactive fantasy, -set in a magical universe. The ZORK trilogy takes place in the ruins of an -ancient empire lying far underground. You, a dauntless treasure-hunter, are -venturing into this dangerous land in search of wealth and adventure. -Because each part of the ZORK saga is a completely independent story, you -can explore them in any order. However, since ZORK I is the least difficult, -it is usually the best place to begin. - -Many strange tales have been told of the fabulous treasures, exotic -creatures and diabolical puzzles in the Great Underground Empire. As an -aspiring adventurer you will undoubtedly want to locate the treasures and -deposit them in your trophy case. You'd better equip yourself with a source -of light (for the caverns are dark) and weapons (for some of the inhabitants -are unfriendly -- especially the thief, a skilled pickpocket and ruthless -opponent). - -[versions] -R88.840726.Z3=r88 / 840726 -R76.840509.Z3=r76 / 840509 -R75.830929.Z3=r75 / 830929 -R30.830330.Z3=r30 / 830330 -R28.821013.Z3=r28 / 821013 -R26.820803.Z3=r26 / 820803 -R25.820515.Z3=r25 / 820515 -R23.820428.Z3=r23 / 820428 -R20.000000.Z3=r20 / 000000 diff --git a/res/work.po b/res/pitchdark.po similarity index 91% rename from res/work.po rename to res/pitchdark.po index 4131b1c..3090697 100644 Binary files a/res/work.po and b/res/pitchdark.po differ diff --git a/src/action.a b/src/action.a new file mode 100644 index 0000000..135b6c2 --- /dev/null +++ b/src/action.a @@ -0,0 +1,87 @@ +;license:MIT +;(c) 2018 by 4am +; +; User interface - click/activation callbacks +; +; Public functions +; - HandleKey +; +; (all callbacks are defined in view configuration blocks in paint.a +; and triggered through UI actions or called from HandleKey) +; + +!zone { +.keys + !byte $D0,ID_PLAY ; P + !byte $F0,ID_PLAY ; p + !byte $C3,ID_CLUES ; C + !byte $E3,ID_CLUES ; c + !byte $C2,ID_BOXART ; B + !byte $E2,ID_BOXART ; b + !byte $CF,ID_OPTIONS ; O + !byte $EF,ID_OPTIONS ; o + !byte $D6,ID_PREVIOUS ; V + !byte $F6,ID_PREVIOUS ; v + !byte $CE,ID_NEXT ; N + !byte $EE,ID_NEXT ; n +.endkeys + +;------------------------------------------------------------------------------ +; HandleKey +; handle keypress to activate various UI elements +; +; in: A contains key pressed +; out: C set if program should quit +; C clear otherwise (no other indication of whether the specific key +; was handled or not) +; all registers and other flags clobbered +;------------------------------------------------------------------------------ +HandleKey + cmp #$9B + bne + + sec + rts ++ ldx #$16 +- cmp .keys,x + beq + + dex + dex + bpl - + clc + rts ++ lda .keys+1,x + ldx #WGSelectView + jsr WeeGUI + ldx #WGViewFocus + jsr WeeGUI + ldx #WGViewFocusAction + jsr WeeGUI + ldx #WGViewUnfocus + jsr WeeGUI + clc + rts + +callback_previous + lda gCurrentGame + dec + bpl + + lda #kNumberOfGames-1 ++ sta gCurrentGame + bra .loadNewGameInfoAndRepaint +callback_next + lda gCurrentGame + inc + cmp #kNumberOfGames + bcc + + lda #0 ++ sta gCurrentGame +.loadNewGameInfoAndRepaint + jsr LoadGameInfo + jmp RepaintSomeViews + +callback_play +callback_clues +callback_boxart +callback_options + rts +} diff --git a/src/config.a b/src/config.a index e56c566..3c9f8b9 100644 --- a/src/config.a +++ b/src/config.a @@ -1,10 +1,25 @@ -kNumberOfGames = 25 +;license:MIT +;(c) 2018 by 4am +; +; Game descriptions and configuration +; +; Public functions +; - LoadGameInfo +; +; Public variables +; - gCurrentGame +; gCurrentGame !byte $FD ; set at runtime + +!zone { + +; application-specific constants and strings +kNumberOfGames = 25 kGameDirectory ; length-prefixed pathname of where game subdirectories are stored - !byte 2 - !raw "Z/" + !byte 14 + !raw "/PITCH.DARK/Z/" ; TODO use relative path ('Z/') for final release kInfoFilename ; length-prefixed partial pathname of game info file, starting with '/' because reasons !byte 5 !raw "/INFO" @@ -113,29 +128,60 @@ subdirectories ; length of this array must = kNumberOfGame !byte 8 !raw "ZORK.III" -!zone { +.BEGIN_PARSER_DATA +bInSectionName + !byte 0 +bFoundCR + !byte 0 +iSection + !byte 0 +iSectionsFound + !byte 0 + +; array of pointers to start of each section (order must match code) +sectionPointers +addrInfo + !word 0 +addrDescription + !word 0 +addrVersions + !word 0 +.END_PARSER_DATA + +;------------------------------------------------------------------------------ +; LoadGameInfo +; load file with information about the current game +; +; in: gCurrentGame between 0 and (kNumberOfGames-1) +; out: if success, C clear and addrInfo, addrDescription, addrVersions +; populated with pointers to parsed data +; if error, C set +; all other registers and flags clobbered +;------------------------------------------------------------------------------ LoadGameInfo stz .path lda #kGameDirectory - jsr addToPath + jsr .addToPath lda gCurrentGame asl tax lda subdirectories,x ldy subdirectories+1,x - jsr addToPath + jsr .addToPath lda #kInfoFilename - jsr addToPath + jsr .addToPath jsr LoadFile !word .path !word $0800 !word $1400 !word $1C00 + bcc .parseGameInfo + rts -; initialize all parser data +.parseGameInfo ldx #9 ; .END_PARSER_DATA-.BEGIN_PARSER_DATA-1 - stz .BEGIN_PARSER_DATA,x dex @@ -245,31 +291,12 @@ parseloop rts + sec rts -.BEGIN_PARSER_DATA -bInSectionName - !byte 0 -bFoundCR - !byte 0 -iSection - !byte 0 -iSectionsFound - !byte 0 -sectionPointers ; array of pointers to start of each section (order matches constants used by parser) -addrInfo - !word 0 -addrDescription - !word 0 -addrVersions - !word 0 -.END_PARSER_DATA - -addToPath +.addToPath sta $00 sty $01 ldx .path ; current pathname length - ldy #$00 - lda ($00),y ; length of this segment + lda ($00) ; length of this segment inc sta .a+1 ldy #$01 diff --git a/src/paint.a b/src/paint.a new file mode 100644 index 0000000..ab9439a --- /dev/null +++ b/src/paint.a @@ -0,0 +1,317 @@ +;license:MIT +;(c) 2018 by 4am +; +; User interface - views and paint routines +; +; Public functions +; - CreateViews +; - PaintAllViews +; - RepaintSomeViews +; + +; ROM routines +INVERSE = $FE80 +NORMAL = $FE84 +MAGICRTS = $FF58 ; used to set overflow bit + +; View IDs (application-specific, acceptable range 0..15, no duplicates) +ID_TITLE = 0 +ID_PLAY = 1 +ID_CLUES = 2 +ID_BOXART = 3 +ID_OPTIONS = 4 +ID_INFO = 12 +ID_DESCRIPTION = 13 +ID_PREVIOUS = 14 +ID_NEXT = 15 + +!zone { + +;------------------------------------------------------------------------------ +; CreateViews +; call WeeGUI to create all application views +; +; in: WeeGUI loaded and initialized +; out: all registers clobbered +; all flags clobbered +;------------------------------------------------------------------------------ +CreateViews + ldx #WGCreateView ; create title bar on top line + lda #<.viewTitle + sta PARAM0 + lda #>.viewTitle + sta PARAM1 + jsr WeeGUI + ldx #WGViewSetAction + lda #<.paintTitleView + sta PARAM0 + lda #>.paintTitleView + sta PARAM1 + jsr WeeGUI + + jsr .createButton ; create various buttons + !word .viewPrevious + jsr .createButton + !word .viewNext + jsr .createButton + !word .viewPlay + jsr .createButton + !word .viewClues + jsr .createButton + !word .viewBoxArt + jsr .createButton + !word .viewOptions + + ldx #WGCreateView ; create borderless frame for game title and info + lda #<.viewInfo + sta PARAM0 + lda #>.viewInfo + sta PARAM1 + jsr WeeGUI + ldx #WGViewSetAction + lda #<.paintInfoView + sta PARAM0 + lda #>.paintInfoView + sta PARAM1 + jsr WeeGUI + + ldx #WGCreateView ; create scrollable frame for game description text + lda #<.viewDescription + sta PARAM0 + lda #>.viewDescription + sta PARAM1 + jsr WeeGUI + ldx #WGViewSetAction + lda #<.paintDescriptionView + sta PARAM0 + lda #>.paintDescriptionView + sta PARAM1 + jmp WeeGUI + +;------------------------------------------------------------------------------ +; PaintAllViews +; call WeeGUI to paint all UI elements +; +; in: WeeGUI loaded and initialized +; CreateViews has been called +; out: all registers clobbered +; all flags clobbered +;------------------------------------------------------------------------------ +PaintAllViews + ldx #WGViewPaintAll ; repaint all views that can be painted automatically + jsr WeeGUI + jsr .paintTitleView + jsr .paintInfoView + jmp .paintDescriptionView + +;------------------------------------------------------------------------------ +; RepaintSomeViews +; call WeeGUI to repaint UI elements after changing the current game +; +; in: WeeGUI loaded and initialized +; CreateViews has been called +; gCurrentGame has new game index +; LoadGameInfo has been called to load new game description text +; out: all registers clobbered +; all flags clobbered +;------------------------------------------------------------------------------ +RepaintSomeViews + jsr .paintInfoView + jmp .paintDescriptionView + +;------------------------------------------------------------------------------ + +.paintTitleView + ldx #WGSelectView + lda #0 + jsr WeeGUI + jsr INVERSE + ldx #WGPrint + lda #<.stringTitle + sta PARAM0 + lda #>.stringTitle + sta PARAM1 + jsr WeeGUI + jsr NORMAL + rts + +.paintInfoView + ldx #WGSelectView + lda #12 + jsr WeeGUI + ldx #WGEraseViewContents + jsr WeeGUI + lda addrInfo + ldy addrInfo+1 + ldx #0 + bra .multiPrint + +.paintDescriptionView + ldx #WGSelectView + lda #13 + jsr WeeGUI + ldx #WGEraseViewContents + jsr WeeGUI + lda addrDescription + ldy addrDescription+1 + ldx #1 +; note: execution falls through here + +.multiPrint + sta $00 + sty $01 + stx .htab+1 + stx .vtab+1 +.printLoop + ldx #WGSetCursor +.htab lda #$FD ; set at runtime + sta PARAM0 +.vtab lda #$FD ; set at runtime + sta PARAM1 + jsr WeeGUI + ldx #WGPrint + lda $00 + sta PARAM0 + lda $01 + sta PARAM1 + bit MAGICRTS ; set overflow bit + jsr WeeGUI + bit #%00000000 +- lda ($00) + bne + + bit MAGICRTS ++ inc $00 + bne + + inc $01 ++ bvc - + inc .vtab+1 + lda .vtab+1 + cmp #$06 + bne .printLoop + rts + +.createButton + pla + sta $00 + pla + sta $01 + tax + lda #$02 + clc + adc $00 + bcc + + inx ++ phx + pha + ldy #$01 + lda ($00),y + sta PARAM0 + iny + lda ($00),y + sta PARAM1 + ldx #WGCreateButton + jsr WeeGUI + ldx #WGViewSetRawTitle + lda #RAW + sta PARAM0 + jmp WeeGUI + +.viewTitle + !byte ID_TITLE ; view ID + !byte 0 ; style + !byte 0 ; left + !byte 0 ; top + !byte 80 ; visible width + !byte 1 ; visible height + !byte 80 ; width + !byte 1 ; height +.stringTitle + !raw "Pitch Dark ",0 + +.viewPrevious + !byte ID_PREVIOUS ; view ID + !byte 1 ; left + !byte 2 ; top + !byte 12 ; width + !word callback_previous ; callback + !word .stringPrevious ; caption +.stringPrevious + !text "< Pre" + !byte $76 ; 'v' inverse + !text "ious",0 + +.viewNext + !byte ID_NEXT ; view ID + !byte 65 ; left + !byte 2 ; top + !byte 13 ; width + !word callback_next ; callback + !word .stringNext ; caption +.stringNext + !byte $0E ; 'N' inverse + !text "ext game >",0 + +.viewPlay + !byte ID_PLAY ; view ID + !byte 34 ; left + !byte 10 ; top + !byte 13 ; width + !word callback_play ; callback + !word .stringPlay ; caption +.stringPlay + !byte $10 ; 'P' inverse + !text "lay game",0 + +.viewClues + !byte ID_CLUES ; view ID + !byte 66 ; left + !byte 7 ; top + !byte 11 ; width + !word callback_clues ; callback + !word .stringClues ; caption +.stringClues + !byte $03 ; 'C' inverse + !text "lues",0 + +.viewBoxArt + !byte ID_BOXART ; view ID + !byte 66 ; left + !byte 9 ; top + !byte 11 ; width + !word callback_boxart ; callback + !word .stringBoxArt ; caption +.stringBoxArt + !byte $02 ; 'B' inverse + !text "ox art",0 + +.viewOptions + !byte ID_OPTIONS ; view ID + !byte 66 ; left + !byte 11 ; top + !byte 11 ; width + !word callback_options ; callback + !word .stringOptions ; caption +.stringOptions + !byte $0F ; 'O' inverse + !text "ptions",0 + +.viewInfo + !byte ID_INFO ; view ID + !byte 0 ; style + !byte 30 ; left + !byte 2 ; top + !byte 20 ; visible width + !byte 7 ; visible height + !byte 20 ; width + !byte 7 ; height + +.viewDescription + !byte ID_DESCRIPTION ; view ID + !byte 2 ; style + !byte 1 ; left + !byte 15 ; top + !byte 77 ; visible width + !byte 8 ; visible height + !byte 77 ; width + !byte 17 ; height +} diff --git a/src/pitchdark.a b/src/pitchdark.a index 1fad7a5..ab54bc6 100644 --- a/src/pitchdark.a +++ b/src/pitchdark.a @@ -6,21 +6,24 @@ !to "../build/PITCHDRK.SYSTEM#FF2000",plain *=$2000 -; ROM routines -INVERSE = $FE80 -NORMAL = $FE84 -MAGICRTS = $FF58 - ; application constants RAW = 1 - jmp Init +!zone { + jmp .start !source "WeeGUI_MLI.s" + +.weeguiFilename + !byte 6 + !raw "WEEGUI" + !source "prodos.a" !source "config.a" + !source "action.a" + !source "paint.a" -Init +.start lda MACHID and #$30 cmp #$30 ; 128K? @@ -29,278 +32,38 @@ Init + bit $c010 jsr LoadFile ; load WEEGUI binary at $4000 - !word weeguifilename + !word .weeguiFilename !word $4000 !word $2000 !word $1C00 jsr $4000 ; initialize WeeGUI - lda #22 + lda #22 ; TODO load this from a prefs file instead sta gCurrentGame - jsr LoadGameInfo + jsr LoadGameInfo ; load and parse game description text + + jsr CreateViews ; create all WeeGUI views (UI elements) + + ldx #WGClearScreen ; clear screen + jsr WeeGUI + jsr PaintAllViews ; draw all UI elements ldx #WGEnableMouse ; enable mouse support jsr WeeGUI - ldx #WGClearScreen ; clear screen - jsr WeeGUI - - ldx #WGCreateView ; create title bar on top line - lda #view_title - sta PARAM1 - jsr WeeGUI - jsr INVERSE - ldx #WGPrint - lda #string_title - sta PARAM1 - jsr WeeGUI - jsr NORMAL - - jsr _create_button ; create buttons - !word view_previous - jsr _create_button - !word view_next - jsr _create_button - !word view_play - jsr _create_button - !word view_clues - jsr _create_button - !word view_boxart - jsr _create_button - !word view_options - - ldx #WGCreateView ; create borderless frame for game title and info - lda #view_info - sta PARAM1 - jsr WeeGUI - - ldx #WGCreateView ; create scrollable frame for game description text - lda #view_description - sta PARAM1 - jsr WeeGUI - ldx #WGViewSetAction - lda #PaintDescription - sta PARAM1 - jsr WeeGUI - ldx #WGPaintView - jsr WeeGUI - - jsr PaintInfo - jsr PaintDescription - -runloop +.runLoop ldx #WGPendingViewAction jsr WeeGUI lda $c000 - bpl runloop + bpl .runLoop bit $c010 + jsr HandleKey + bcc .runLoop ldx #WGDisableMouse ; disable mouse support before quitting jsr WeeGUI ldx #WGExit ; clean up WeeGUI jsr WeeGUI jmp QuitToProDOS ; quit via ProDOS MLI - -callback_previous -callback_next -callback_play -callback_clues -callback_boxart -callback_options - rts - -_create_button - pla - sta $00 - pla - sta $01 - tax - lda #$02 - clc - adc $00 - bcc + - inx -+ phx - pha - ldy #$01 - lda ($00),y - sta PARAM0 - iny - lda ($00),y - sta PARAM1 - ldx #WGCreateButton - jsr WeeGUI - ldx #WGViewSetRawTitle - lda #RAW - sta PARAM0 - jsr WeeGUI - ldx #WGPaintView - jmp WeeGUI - -PaintInfo - ldx #WGSelectView - lda #12 - jsr WeeGUI - ldx #WGEraseViewContents - jsr WeeGUI - lda addrInfo - ldy addrInfo+1 - ldx #0 - bra MultiPrint - -PaintDescription - ldx #WGSelectView - lda #13 - jsr WeeGUI - ldx #WGEraseViewContents - jsr WeeGUI - lda addrDescription - ldy addrDescription+1 - ldx #1 - -MultiPrint - sta $00 - sty $01 - stx .htab+1 - stx .vtab+1 -printloop - ldx #WGSetCursor -.htab lda #$FD ; set at runtime - sta PARAM0 -.vtab lda #$FD ; set at runtime - sta PARAM1 - jsr WeeGUI - ldx #WGPrint - lda $00 - sta PARAM0 - lda $01 - sta PARAM1 - bit MAGICRTS ; set overflow bit - jsr WeeGUI - bit #%00000000 -- lda ($00) - bne + - bit MAGICRTS -+ inc $00 - bne + - inc $01 -+ bvc - - inc .vtab+1 - lda .vtab+1 - cmp #$06 - bne printloop - rts - -weeguifilename - !byte 6 - !raw "WEEGUI" - -view_title - !byte 0 ; view ID - !byte 0 ; style - !byte 0 ; left - !byte 0 ; top - !byte 80 ; visible width - !byte 1 ; visible height - !byte 80 ; width - !byte 1 ; height -string_title - !raw "Pitch Dark ",0 - -view_previous - !byte 14 ; view ID - !byte 1 ; left - !byte 2 ; top - !byte 12 ; width - !word callback_previous ; callback - !word string_previous ; caption -string_previous - !text "< Pre" - !byte $76 ; 'v' inverse - !text "ious",0 - -view_next - !byte 15 ; view ID - !byte 65 ; left - !byte 2 ; top - !byte 13 ; width - !word callback_next ; callback - !word string_next ; caption -string_next - !byte $0E ; 'N' inverse - !text "ext game >",0 - -view_play - !byte 1 ; view ID - !byte 34 ; left - !byte 10 ; top - !byte 13 ; width - !word callback_play ; callback - !word string_play ; caption -string_play - !byte $10 ; 'P' inverse - !text "lay game",0 - -view_clues - !byte 2 ; view ID - !byte 66 ; left - !byte 7 ; top - !byte 11 ; width - !word callback_clues ; callback - !word string_clues ; caption -string_clues - !byte $03 ; 'C' inverse - !text "lues",0 - -view_boxart - !byte 3 ; view ID - !byte 66 ; left - !byte 9 ; top - !byte 11 ; width - !word callback_boxart ; callback - !word string_boxart ; caption -string_boxart - !byte $02 ; 'B' inverse - !text "ox art",0 - -view_options - !byte 4 ; view ID - !byte 66 ; left - !byte 11 ; top - !byte 11 ; width - !word callback_options ; callback - !word string_options ; caption -string_options - !byte $0F ; 'O' inverse - !text "ptions",0 - -view_info - !byte 12 ; view ID - !byte 0 ; style - !byte 30 ; left - !byte 2 ; top - !byte 20 ; visible width - !byte 7 ; visible height - !byte 20 ; width - !byte 7 ; height - -view_description - !byte 13 ; view ID - !byte 2 ; style - !byte 1 ; left - !byte 15 ; top - !byte 77 ; visible width - !byte 8 ; visible height - !byte 77 ; width - !byte 17 ; height +} diff --git a/src/prodos.a b/src/prodos.a index b206393..03471b5 100644 --- a/src/prodos.a +++ b/src/prodos.a @@ -1,9 +1,12 @@ -; ProDOS functions +;license:MIT +;(c) 2017-8 by 4am ; -; Primary: -; LoadFile -; SaveFile -; QuitToProDOS +; ProDOS and file routines +; +; Public functions +; - LoadFile +; - SaveFile +; - QuitToProDOS ; ; MLI command codes