From 8b7018aab0d12af2532c9fc82a3e8dce7419221f Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Fri, 12 Dec 2014 22:30:58 -0800 Subject: [PATCH] Add ROGUE --- src/makefile | 7 +++- src/samplesrc/rogue.pla | 93 ++++++++++++++++++++++++++++++----------- src/vmsrc/cmd.pla | 1 + 3 files changed, 76 insertions(+), 25 deletions(-) diff --git a/src/makefile b/src/makefile index 81b01c3..643c1a9 100644 --- a/src/makefile +++ b/src/makefile @@ -9,6 +9,7 @@ ED = ED\#FF2000 SB = SB\#FF2000 ROD = ROD\#FE1000 SIEVE = SIEVE\#FE1000 +ROGUE = ROGUE\#FE1000 HELLO = HELLO\#FE1000 HGR1 = HGR1\#FE1000 HGR1TEST= HGR1TEST\#FE1000 @@ -34,7 +35,7 @@ TXTTYPE = .TXT #SYSTYPE = \#FF2000 #TXTTYPE = \#040000 -all: $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM03) $(CMD) $(PROFILE) $(ED) $(SB) $(ROD) $(SIEVE) $(HGR1) +all: $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM03) $(CMD) $(PROFILE) $(ED) $(SB) $(ROD) $(SIEVE) $(ROGUE) $(HGR1) clean: -rm *FE1000 *FF2000 $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM03) @@ -99,6 +100,10 @@ $(SIEVE): samplesrc/sieve.pla $(PLVM02) $(PLASM) ./$(PLASM) -AM < samplesrc/sieve.pla > samplesrc/sieve.a acme --setpc 4094 -o $(SIEVE) samplesrc/sieve.a +$(ROGUE): samplesrc/rogue.pla $(PLVM02) $(PLASM) + ./$(PLASM) -AM < samplesrc/rogue.pla > samplesrc/rogue.a + acme --setpc 4094 -o $(ROGUE) samplesrc/rogue.a + $(PROFILE): samplesrc/profile.pla $(PLVM02) $(PLASM) m4 -I inc < samplesrc/profile.pla | ./$(PLASM) -AM > samplesrc/profile.a acme --setpc 4094 -o $(PROFILE) samplesrc/profile.a diff --git a/src/samplesrc/rogue.pla b/src/samplesrc/rogue.pla index aafc5b0..f7f0986 100755 --- a/src/samplesrc/rogue.pla +++ b/src/samplesrc/rogue.pla @@ -1,3 +1,9 @@ +import STDLIB + predef syscall, call, memset, getc, putc, puts, putln + predef heapmark, heapallocallign, heapalloc, heaprelease, heapavail + byte MACHID +end + const FALSE = 0 const TRUE = not FALSE // @@ -79,7 +85,9 @@ byte = "#......##.......#.#......#....#" byte = "#.#.............#.#......#....#" byte = "#.###############.#......###..#" byte = "#.................#...........#" -byte = "######################################" +byte = "###############################" + +word vismap const xcentr = 20 const ycentr = 12 @@ -89,20 +97,31 @@ word = $400, $480, $500, $580, $600, $680, $700, $780 word = $428, $4A8, $528, $5A8, $628, $6A8, $728, $7A8 word = $450, $4D0, $550, $5D0, $650, $6D0, $750, $7D0 -word xdir = 0, 1, 1, 1, 0, -1, -1, -1 -word ydir = -1, -1, 0, 1, 1, 1, 0, -1 +word xdir = 0, 1, 1, 1, 0, -1, -1, -1 +word ydir = -1, -1, 0, 1, 1, 1, 0, -1 word xplayer = 5 word yplayer = 5 byte aplayer = 0 -byte lamp = 10 +byte lamp = 4 byte fov = 1 byte vplayer = '^', '\\', '>', '/', 'v', '\\', '<', '/' +def home + return call($FC58, 0, 0, 0, 0) +end +def gotoxy(x, y) + ^$24 = x + ^$20 + return call($FB5B, y + ^$22, 0, 0, 0) +end def drawmap(xorg, yorg, dir, light) byte[octpts] vispix byte o, l, tile, occlude - word ymap, xmap + word ymap, xmap, imap byte yscr, xscr + + // + // Clear screen + // home // // Draw background map @@ -113,7 +132,7 @@ def drawmap(xorg, yorg, dir, light) for xscr = 0 to 39 xmap = xscr - xcentr + xorg if xmap >= 0 and xmap < mapcols - 1 - screen.[yscr, xscr] = map[(ymap << 5) + xmap + 1] | $80 + screen.[yscr, xscr] = ^(vismap + (ymap << 5) + xmap + 1) | $80 fin next fin @@ -127,11 +146,14 @@ def drawmap(xorg, yorg, dir, light) is 0 for l = 1 to dbeam[light] if vispix[vbeam[l]] - tile = map[((yorg - ybeam[l]) << 5) + xorg + xbeam[l] + 1] + imap = ((yorg - ybeam[l]) << 5) + xorg + xbeam[l] + 1 + tile = map[imap] + ^(vismap + imap) = tile if tile <> '.' vispix[l] = FALSE else - if map[((yorg - ybeam[l]) << 5) + xorg + xbeam[l] + 2] == '#' + if map[imap + 1] == '#' + ^(vismap + imap + 1) = '#' screen.[ycentr - ybeam[l], xcentr + xbeam[l] + 1] = '#' fin fin @@ -144,11 +166,14 @@ def drawmap(xorg, yorg, dir, light) is 1 for l = 1 to dbeam[light] if vispix[vbeam[l]] - tile = map[((yorg - xbeam[l]) << 5) + xorg + ybeam[l] + 1] + imap = ((yorg - xbeam[l]) << 5) + xorg + ybeam[l] + 1 + tile = map[imap] + ^(vismap + imap) = tile if tile <> '.' vispix[l] = FALSE else - if map[((yorg - xbeam[l] - 1) << 5) + xorg + ybeam[l] + 1] == '#' + if map[imap - mapcols] == '#' + ^(vismap + imap - mapcols)='#' screen.[ycentr - xbeam[l] - 1, xcentr + ybeam[l]] = '#' fin fin @@ -161,12 +186,15 @@ def drawmap(xorg, yorg, dir, light) is 2 for l = 1 to dbeam[light] if vispix[vbeam[l]] - tile = map[((yorg + xbeam[l]) << 5) + xorg + ybeam[l] + 1] + imap = ((yorg + xbeam[l]) << 5) + xorg + ybeam[l] + 1 + tile = map[imap] + ^(vismap + imap) = tile if tile <> '.' vispix[l] = FALSE else - if map[((yorg - xbeam[l] + 1) << 5) + xorg + ybeam[l] + 1] == '#' - screen.[ycentr - xbeam[l] + 1, xcentr + ybeam[l]] = '#' + if map[imap + mapcols] == '#' + ^(vismap + imap + mapcols) = '#' + screen.[ycentr + xbeam[l] + 1, xcentr + ybeam[l]] = '#' fin fin screen.[ycentr + xbeam[l], xcentr + ybeam[l]] = tile @@ -178,11 +206,14 @@ def drawmap(xorg, yorg, dir, light) is 3 for l = 1 to dbeam[light] if vispix[vbeam[l]] - tile = map[((yorg + ybeam[l]) << 5) + xorg + xbeam[l] + 1] + imap = ((yorg + ybeam[l]) << 5) + xorg + xbeam[l] + 1 + tile = map[imap] + ^(vismap + imap) = tile if tile <> '.' vispix[l] = FALSE else - if map[((yorg + ybeam[l]) << 5) + xorg + xbeam[l] + 2] == '#' + if map[imap + 1] == '#' + ^(vismap + imap + 1) = '#' screen.[ycentr + ybeam[l], xcentr + xbeam[l] + 1] = '#' fin fin @@ -195,11 +226,14 @@ def drawmap(xorg, yorg, dir, light) is 4 for l = 1 to dbeam[light] if vispix[vbeam[l]] - tile = map[((yorg + ybeam[l]) << 5) + xorg - xbeam[l] + 1] + imap = ((yorg + ybeam[l]) << 5) + xorg - xbeam[l] + 1 + tile = map[imap] + ^(vismap + imap) = tile if tile <> '.' vispix[l] = FALSE else - if map[((yorg + ybeam[l]) << 5) + xorg - xbeam[l]] == '#' + if map[imap - 1] == '#' + ^(vismap + imap - 1) = '#' screen.[ycentr + ybeam[l], xcentr - xbeam[l] - 1] = '#' fin fin @@ -212,11 +246,14 @@ def drawmap(xorg, yorg, dir, light) is 5 for l = 1 to dbeam[light] if vispix[vbeam[l]] - tile = map[((yorg + xbeam[l]) << 5) + xorg - ybeam[l] + 1] + imap = ((yorg + xbeam[l]) << 5) + xorg - ybeam[l] + 1 + tile = map[imap] + ^(vismap + imap) = tile if tile <> '.' vispix[l] = FALSE else - if map[((yorg + xbeam[l] + 1) << 5) + xorg - ybeam[l] + 1] == '#' + if map[imap + mapcols] == '#' + ^(vismap + imap + mapcols) = '#' screen.[ycentr + xbeam[l] + 1, xcentr - ybeam[l]] = '#' fin fin @@ -229,11 +266,14 @@ def drawmap(xorg, yorg, dir, light) is 6 for l = 1 to dbeam[light] if vispix[vbeam[l]] - tile = map[((yorg - xbeam[l]) << 5) + xorg - ybeam[l] + 1] + imap = ((yorg - xbeam[l]) << 5) + xorg - ybeam[l] + 1 + tile = map[imap] + ^(vismap + imap) = tile if tile <> '.' vispix[l] = FALSE else - if map[((yorg - xbeam[l] - 1) << 5) + xorg - ybeam[l] + 1] == '#' + if map[imap - mapcols] == '#' + ^(vismap + imap - mapcols) = '#' screen.[ycentr - xbeam[l] - 1, xcentr - ybeam[l]] = '#' fin fin @@ -246,11 +286,14 @@ def drawmap(xorg, yorg, dir, light) is 7 for l = 1 to dbeam[light] if vispix[vbeam[l]] - tile = map[((yorg - ybeam[l]) << 5) + xorg - xbeam[l] + 1] + imap = ((yorg - ybeam[l]) << 5) + xorg - xbeam[l] + 1 + tile = map[imap] + ^(vismap + imap) = tile if tile <> '.' vispix[l] = FALSE else - if map[((yorg - ybeam[l]) << 5) + xorg - xbeam[l]] == '#' + if map[imap - 1] == '#' + ^(vismap + imap - 1) = '#' screen.[ycentr - ybeam[l], xcentr - xbeam[l] - 1] = '#' fin fin @@ -276,6 +319,8 @@ def moveplayer(dir) fin end +vismap = heapalloc(maprows * mapcols) +memset(vismap, maprows * mapcols, $2020) while TRUE drawmap(xplayer, yplayer, aplayer, lamp) when getc() @@ -297,7 +342,7 @@ while TRUE fin break is '+' - if lamp < 9 + if lamp < beamdepth - 1 lamp = lamp + 1 fin break diff --git a/src/vmsrc/cmd.pla b/src/vmsrc/cmd.pla index cd7b647..9e6909f 100644 --- a/src/vmsrc/cmd.pla +++ b/src/vmsrc/cmd.pla @@ -353,6 +353,7 @@ asm cin BIT LCRDEN+LCBNK2 DEX LDY #$00 + AND #$7F STA ESTKL,X STY ESTKH,X RTS