Compare commits

...

15 Commits

Author SHA1 Message Date
Chris Pressey
f6fb52e2cd The .BAS files in this repository are BASIC language programs. 2023-11-02 18:41:00 +00:00
Chris Pressey
c7b6ae01a9 Added tag rel_1_1_2014_0819 for changeset 84b098721847 2014-08-19 15:35:13 +01:00
catseye
344e4d9dec Conform to distribution organization guidelines. Update README.
--HG--
rename : befunge.dsk => disk/befunge.dsk
rename : apple-befunge-editor.bas => src/apple-befunge-editor.bas
2012-10-20 13:54:20 +01:00
catseye
c254b1934f Add section about the example programs. 2012-08-27 20:08:50 -05:00
catseye
d9f1cb189e Add license information. 2012-08-27 20:05:44 -05:00
Cat's Eye Technologies
b8ac58d07b Rename source file to better reflect what language it's in.
--HG--
rename : editor-apple befunge.txt => apple-befunge-editor.bas
2012-04-22 08:50:43 -05:00
catseye
ba4319011c Remove jump to empty REM line. Found with yucca! 2012-03-24 22:31:00 -05:00
Cat's Eye Technologies
681a730080 Added tag rel_1_1 for changeset 383f358b5bf2 2012-02-20 11:41:50 -06:00
catseye
9e4344169b Update contents of disk image. 2012-02-20 10:56:34 -06:00
Cat's Eye Technologies
17f30b83e9 Abandon APPLE BEFUNGE RUNNER. 2012-02-20 10:35:04 -06:00
Cat's Eye Technologies
b814c28d84 Tweak README. 2012-02-20 10:17:13 -06:00
Cat's Eye Technologies
d1f0d2165c Refactor docs. 2012-02-20 10:13:51 -06:00
catseye
38545b988f Refactor; PD; fix bug when pressing RETURN in last line. 2012-02-05 14:40:42 -06:00
Chris Pressey
4355c6e39b Truncate disk image so that it can be read by AppleWin. 2011-09-20 22:20:42 -05:00
catseye
b1ca0ba7a3 Added tag rel_1_0 for changeset 2fa493621877 2011-06-06 09:38:20 -05:00
9 changed files with 318 additions and 346 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.bas linguist-language=BASIC

View File

@ -1 +0,0 @@
0fd740c35d6cad47decbe9bab6b669d325fcefdc rel_1_0

50
LICENSE Normal file
View File

@ -0,0 +1,50 @@
The software comprising Apple Befunge proper is in the public domain, as
described in the following Unlicense:
-----------------------------------------------------------------------------
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
-----------------------------------------------------------------------------
The disk image included in the distribution contains boot code which is
part of the ESDOS ][ disk format. This is most likely copyrighted material
and therefore NOT in the public domain. However, it is difficult to imagine
that its authors object to this code being redistributed for non-commercial
purposes, especially given its function. ESDOS ][-formatted disk images
have been available for download on the Internet for years now with, it would
seem, no controversy at all. (But don't go reverse-engineering it or trying
to sell it, as that's likely not what its authors had in mind.)
-----------------------------------------------------------------------------
The contributed Befunge-93 example sources included on the disk image
are copyrighted works made by their respective authors. They are not
open-source or in the public domain, but their contributors' willingness to
allow them to be included in this distribution implies that they are all
freely redistributable unmodified for non-commercial purposes. If you wish
to base your next best-selling novel on one of them, you should seek out and
contact its author for permission first.

96
README.markdown Normal file
View File

@ -0,0 +1,96 @@
Apple Befunge
=============
_Version 1.1, February 2012, Chris Pressey, Cat's Eye Technologies_
Apple Befunge is a "retrolanguage" for the Apple ][+. Being written
in Applesoft BASIC, it should also work on an Apple //e or similar
model of 8-bit Apple computer (or, of course, an emulator thereof.)
It is based largely on [Befunge-93](https://catseye.tc/node/Befunge-93.html),
with some Befunge-98-isms, and some instructions and behaviour peculiar to
the Apple 8-bit architecture.
Differences from Befunge-93
---------------------------
The Apple ][+ has no lowercase characters. In Apple Befunge, `G`, `P`
and `V` do what `g`, `p`, and `v` do in Befunge-93.
The Apple ][+ has no `` ` `` (backtick) symbol. Instead, the `'`
(apostrophe) symbol is used (it's undefined in Befunge-93.)
The Apple ][+ has no `~` (tilde) symbol. Instead, the `=` (equals sign)
symbol is used (it's undefined in Befunge-93.)
The Apple ][+ has no `|` (vertical bar) symbol. Instead, the letter `I`
is used (it's undefined in Befunge-93.)
The Apple ][+'s screen is only 40x24, not 80x25, and until a scrolling
version of the Apple Befunge debugger is made, program size is limited to
the screen size.
Enhancements
------------
Letters `A` through `F` represent values 10 through 15, respectively.
The `;` (semicolon) symbol begins and ends "ignoremode".
If the _x_ argument to `G` is negative, the result is `PEEK(`_y_`)`.
If the _x_ argument to `P` is negative, the result is `POKE `_y_`, `_d_.
The `]` instruction pops an argument _a_ off the stack; the result is
`CALL `_a_.
These three instructions allow a direct interface to the architecture of the
8-bit Apple system on which Apple Befunge is running.
Implementations
---------------
The distribution contains an Apple disk image, formatted with _ESDOS ][_,
in the `disk` subdirectory. It contains:
* a full visual debugger/editor for Apple Befunge called
`APPLE BEFUNGE EDITOR`; and
* a handful of Befunge programs which have been converted to Apple Befunge
format.
The distribution also contains the source code, in ASCII text, for
`APPLE BEFUNGE EDITOR`, in the `src` subdirectory. It is intended to be
copied-and-pasted into an Apple ][+ emulator. This process, and the
program itself, have been tested on a recent version of
[AppleWin](http://applewin.berlios.de/). (And for this reason, and because
I have not yet found a decent Apple ][+ emulator for non-Windows systems,
the source code file has CRLF line terminators. This is intentional.)
In version 1.0 of the distribution there was also a program called
`APPLE BEFUNGE RUNNER`; its source code was intended to be pasted into
the emulator after that of `APPLE BEFUNGE EDITOR`, acting as a sort of
"diff", adding and deleting lines. This proved to be a nuisance for
maintaining `APPLE BEFUNGE EDITOR`. And I think `APPLE BEFUNGE EDITOR`
alone sort of gets the point across. So in version 1.1, `APPLE BEFUNGE
RUNNER` was abandoned.
License
-------
The source code for `APPLE BEFUNGE EDITOR` is hereby placed, by me, the
author, in the public domain.
Known Bugs and Shortcomings
---------------------------
The coordinate (39,23) can only contain blank space; I have not yet put
in code to draw instructions in that part of the screen, without scrolling
it. Apparently, I once knew how to do this, but I never bothered; I no
longer know how, but I could probably look it up.
Subtle bug in either `%` (modulo) or `'` (greater than) or `hex.bf` --
not entirely sure which.
A good reorganization of `APPLE BEFUNGE EDITOR`'s source is in order. The
push and pop subroutines should probably be as near the beginning of the
program as possible. More constant values should be held in variables, as
well.

View File

@ -1,106 +0,0 @@
<html>
<center><h1>Apple Befunge</h1>
<p> <a href="http://www.catseye.mb.ca/vintage/apple/befunge.html">Go&nbsp;to&nbsp;the&nbsp;Apple&nbsp;Befunge&nbsp;Web&nbsp;Site</a>
| <a href="http://www.catseye.mb.ca/vintage/apple/apple-befunge-dsk-1.zip">Download&nbsp;the&nbsp;Apple&nbsp;Befunge&nbsp;Disk&nbsp;Image&nbsp;1.0</a>
| <a href="http://geta.life.uiuc.edu/~badger/apple2.html">Obtain&nbsp;an&nbsp;Apple&nbsp;][+&nbsp;Emulator</a>
| <a href="http://www.catseye.mb.ca/esoteric/befunge/src/">Go&nbsp;Insane</a>
</center>
<hr>
<p>Apple Befunge is a retrolanguage for the Apple ][+
based mainly on <a href="http://www.catseye.mb.ca/esoteric/befunge/">Befunge-93</a>.
<h3>Differences</h3>
<p>The Apple ][+ has no lowercase characters. In Apple
Befunge, G, P and V do what g, p, and v do in Befunge-93.
<p>The Apple ][+ has no ` (backtick) symbol. Instead the
' (apostrophe) symbol is used (it's undefined in Befunge-93.)
<p>The Apple ][+ has no ~ (tilde) symbol. Instead the
= (equals sign) symbol is used (it's undefined in Befunge-93.)
<p>The Apple ][+ has no | (vertical bar) symbol. Instead the
letter I is used (it's undefined in Befunge-93.)
<p>The Apple ][+'s screen is only 40x24, not 80x25, and until
a scrolling version of the Apple Befunge debugger is made,
screen size limits program size.
<h3>Improvements</h3>
<p>Letters A through F represent values 10 through 15 respectively.
<p>The ; (semicolon) symbol begins and ends "ignoremode".
<p>If the <i>x</i> argument to G is negative, the result is PEEK(<i>y</i>).
If the <i>x</i> argument to P is negative, the result is POKE <i>y</i>, <i>d</i>.
The ] instruction pops an argument <i>a</i> off the stack; the result is CALL <i>a</i>.
These three instructions allow a direct interface to the rest of
the Apple ][+ system.
<h3>Implementations</h3>
<p>On the ESDOS-][-formatted
<a href="http://www.catseye.mb.ca/vintage/apple/apple-befunge-dsk-1.zip">Apple&nbsp;Befunge&nbsp;Disk&nbsp;Image&nbsp;1.0</a>
there is:
<ul>
<li> a full visual debugger/editor for Apple Befunge
called APPLE BEFUNGE EDITOR
<li> a less obtrustive but unfinished interpreter called APPLE BEFUNGE RUNNER
<li> and a handful
of Befunge programs which have been converted to Apple Befunge format.
</ul>
<p>Also in the ZIP archive which contains the disk image, are the source
codes (ASCII text) for APPLE BEFUNGE EDITOR and the 'diffs' for APPLE BEFUNGE RUNNER,
along with a copy of this HTML page.
<h3>Licsensing</h3>
<p>All Apple Befunge material is freely redistributable. If you
make a derivative work based on Apple Befunge or any of its tools,
all I ask is that you contact me so that we can link web pages
(or I can host your stuff on my site if you don't have a web page.)
<h3>Known Bugs</h3>
<p>In APPLE BEFUNGE EDITOR:
<p>The coordinate (39,23) can only contain blank space (not yet put
in code to draw instructions in that part of the screen, without
scrolling it. I know how to do it, I just haven't bothered.)
<p>Subtle bug in either % (modulo) or ' (greater than) or
<tt>hex.bf</tt> - not entirely sure which.
<h3>To Do List</h3>
<p>Finish the APPLE BEFUNGE RUNNER program
to execute an Apple Befunge program
non-visually, with more normal I/O for .,=&.
It needs to ask the user for a filename when run
(no command-line arguments in ESDOS ][.)
<p>A good reorganization of APPLE BEFUNGE EDITOR is in order. The push and pop subroutines
should probably be as near the beginning of the program as possible. Should hold more
constant values in variables. All the editor-dependent stuff should be in the same place
so it can be wiped out more easily by APPLE BEFUNGE RUNNER.
<p>Put a great many more example Apple Befunge programs on the disk image.
<p>Write an APPLE BEFUNGE TO APPLESOFT COMPILER. Will probably need
a deeper understanding of the tokenizing mechanism and the filesystem
to accomplish this, since I'll need to write type "A" files.
<p><hr>
<p><i>Last Updated Jul 3 &copy;2000 <a href="http://www.catseye.mb.ca/">Cat's Eye Technologies</a>.</i>
</html>

Binary file not shown.

View File

@ -1,41 +0,0 @@
<html><head>
<title>Cat's Eye Technologies' Apple ][+ Retrodevelopment Lunacy Server</title>
</head>
<body bgcolor=#000000 text=#ffffff link=#00dd00 vlink=#008800 alink=#00ff00>
<center>
<img src="/img/3qtrsize.gif">
<br><font size=-3><i>Disclaimer: this page does not actually exist. You are currently hallucinating.</i></font>
<table><tr><td bgcolor=#ffffff><font color=#000000 size=+4><tt><b><blink>&nbsp;APPLE&nbsp;][+&nbsp;</blink></b></tt></font></td></tr></table>
<font size=+2>Retrodevelopment Lunacy Server</font></center>
<p>Cat's Eye Technologies encourages the engineering of <b>new</b>
and <b>innovative</b> software for the Apple ][+ computing platform
as an act of <i>retrodevelopment</i>.
<p>This page was established to provide, free to all websurfers,
our contribution to this cheerful insanity.
<p>Among our efforts include thus far so far we have (<i>sic</i>):
<ul>
<li><a href="befunge.html">Apple Befunge</a>
<p>A version of the Befunge language for the Apple ][+,
based mainly on Befunge-93. Disk version 1.0 plus
source (Applesoft BASIC in text file.)
</ul>
<hr>
<p>&nbsp;
<p>&nbsp;
<center><table cellpadding=20 border=2><tr><td><pre>
] RUN
?BULLSH*T ERROR IN 20
] LIST 20
20 2 + 2 = 5</pre></td></tr></table>
<p>&nbsp;
<p>&nbsp;
<hr><i>Last Updated Jul 3 &copy;2000 <a href="http://www.catseye.mb.ca/">Cat's Eye Technologies</a>.</i></center>
</body>
</html>

View File

@ -1,77 +0,0 @@
REM THIS SOURCE SHOULD FOLLOW UPLOAD OF 'APPLE BEFUNGE EDITOR'
REM AS IT USES IT AS THE BASIS FOR 'APPLE BEFUNGE RUNNER'
REM PROGRAMMING IN APPLESOFT IS MORE INTERESTING LIKE THIS :-)
1 REM APPLE BEFUNGE RUNNER V1.0
2 REM ----- ------- ------ ----
99 REM HOME
190 RM%=1:REM GOTO 710:REM EDIT
210 REM VTAB Y%+1:HTAB X%+1
310 RETURN: REM J%=0: REM ???DELETE 300-399
710 RETURN: REM GOSUB 8010:REM DISPLAY PAGE: REM ???DELETE 700-899
1500 REM & INPUT INTEGER:REM ???DELETE 1500-1599
1510 REM
1520 REM
1530 INPUT "";WT$:D%=VAL(WT$):GOSUB 500:RETURN
1535 REM
1537 REM
1538 REM
1540 REM
1550 REM
1590 RETURN
1800 REM , OUTPUT CHARACTER:REM ???DELETE 1800-1899
1810 GOSUB 600
1820 IF D%<>10 THEN GOTO 1880
1825 PRINT:RETURN
1830 REM
1840 REM
1850 REM
1858 REM
1860 RETURN
1880 PRINT CHR$(D%);:RETURN
1882 REM
1890 RETURN
2000 REM . OUTPUT INTEGER:REM ???DELETE 2000-2099
2010 GOSUB 600
2020 PRINT STR$(D%);" ";:RETURN
2030 REM
2090 RETURN
2600 REM ~ INPUT CHARACTER
2601 REM USES = ON APPLE ][+
2610 GET WT$:D%=ASC(WT$):GOSUB 500:RETURN
2615 REM
2620 REM
2626 REM
2628 REM
2630 REM
2640 REM
2690 RETURN
2900 REM @ END PROGRAM
2910 END:REM
2920 REM
2930 REM
2935 REM
2940 REM
2990 REM
3700 REM P PUT INTO SPACE
3710 GOSUB 600
3715 E%=D%
3720 GOSUB 600
3725 F%=D%
3730 GOSUB 600
3732 IF F%<0 THEN POKE E%,D%:GOTO 3790
3740 PG%(F%,E%)=D%
3742 RETURN:REM HTAB F%+1:VTAB E%+1:INVERSE:PRINT CHR$(D%);:NORMAL
3790 RETURN
REM DELETE 6000-7129

View File

@ -1,40 +1,40 @@
NEW
1 REM APPLE BEFUNGE EDITOR V1.0
2 REM ----- ------- ------ ----
REM APPLE BEFUNGE EDITOR V1.1
REM ----- ------- ------ ----
6 REM BEFUNGE-93-ESQUE INTERPRETER
7 REM WRITTEN IN APPLESOFT BASIC!
8 REM (C)2000 CAT'S EYE TECHNOLOGIES
9 REM FREELY REDISTRIBUTABLE
REM BEFUNGE-93-ESQUE INTERPRETER
REM WRITTEN IN APPLESOFT BASIC!
11 REM V1.0 JUL 3 2000 CHRIS PRESSEY
REM V1.0 JUN 2000 CHRIS PRESSEY
REM V1.1 FEB 2012 CHRIS PRESSEY
99 HOME
REM THIS WORK IS HEREBY ENTERED INTO
REM THE PUBLIC DOMAIN
100 REM INITIALISE
REM THIS LISTING IS INTENDED TO BE
REM PASTED INTO YOUR EMULATOR. SO,
REM TO SAVE SPACE AND TIME, THESE
REM 'REM'S EXIST ONLY IN THIS FILE,
REM AND ARE NOT SAVED IN PROGRAM
110 DIM PG%(79,24)
120 DIM ST%(256)
130 X%=0:Y%=0:DX%=1:DY%=0:QM%=0:IM%=0:RM%=0
140 I%=0:J%=0:IR%=0:SP%=0:D%=0:E%=0:F%=0
142 OS$="":D$=CHR$(4)
REM IT IS RECOMMENDED TO RUN YOUR
REM EMULATOR AT FULL SPEED, OR THE
REM INTERPRETER WILL BE SOMEWHAT,
REM SHALL WE SAY, POKEY
150 GOSUB 7140:REM NEW PLAYFIELD
100 GOSUB 8000: GOTO 720
190 GOTO 710:REM EDIT
REM RUN-PROGRAM LOOP
200 REM RUN-PROGRAM LOOP
210 VTAB Y%+1:HTAB X%+1
200 VTAB Y%+1:HTAB X%+1
220 IR%=PG%(X%,Y%)
225 IF QM%=1 THEN GOSUB 910:GOTO 240
230 IF IM%=0 OR IR%=59 THEN GOSUB 400:REM EXECUTE
235 IF RM%=0 THEN GOTO 720:REM END
240 GOSUB 250:REM MOVE THREAD
245 GOTO 210
230 IF IM%=0 OR IR%=59 THEN GOSUB 400
235 IF RM%=0 THEN 720
240 GOSUB 250: GOTO 200
249 REM ADVANCE THREAD
REM ADVANCE IP
250 X%=X%+DX%:Y%=Y%+DY%
260 IF X%>39 THEN X%=X%-40
@ -43,9 +43,9 @@ NEW
275 IF Y%<0 THEN Y%=Y%+24
280 RETURN
300 REM DISPLAY PAGE
REM DISPLAY PAGE
310 J%=0
300 J%=0
320 VTAB J%+1: HTAB 1
330 I%=0
340 IF I%=39 AND J%=23 GOTO 360
@ -54,9 +54,9 @@ NEW
370 J%=J%+1:IF J%<24 THEN GOTO 320
390 RETURN
400 REM EXECUTE IR%
REM EXECUTE IR%
410 IF IR%<33 THEN RETURN
400 IF IR%<33 THEN RETURN
412 IF IR%=86 THEN GOTO 3410:REM V
413 IF IR%=73 THEN GOTO 3010:REM I
414 IF IR%=71 THEN GOTO 3610:REM G
@ -69,21 +69,20 @@ NEW
450 ON IR%-32 GOTO 1010,1110,1210,1310,1410,1510,3510
460 RETURN
500 REM PUSH D% ONTO STACK
REM PUSH D% ONTO STACK
510 ST%(SP%)=D%:SP%=SP%+1
590 RETURN
500 ST%(SP%)=D%:SP%=SP%+1:RETURN
600 REM POP D% FROM STACK
REM POP D% FROM STACK
610 IF SP%=0 THEN GOTO 650
600 IF SP%=0 THEN GOTO 650
620 SP%=SP%-1:D%=ST%(SP%)
630 RETURN
650 D%=0
690 RETURN
700 REM EDIT-PROGRAM LOOP
710 GOSUB 8010:REM DISPLAY PAGE
REM EDIT-PROGRAM LOOP
720 VTAB Y%+1:HTAB X%+1
722 IR%=PG%(X%,Y%)
730 GET A$:A%=ASC(A$)
@ -95,74 +94,89 @@ NEW
738 IF A%=12 THEN DX%=1:DY%=0:X%=0:Y%=0:GOTO 720
740 IF A%=7 THEN RM%=1:GOTO 200
741 IF A%=9 THEN GOSUB 810
742 IF A%=96 THEN A%=39:REM BACKTICK TO APOSTROPHE
744 IF A%=126 THEN A%=61:REM TILDE TO EQUALS SIGN
746 IF A%=124 THEN A%=73:REM VERTICAL BAR TO LETTER I
REM BACKTICK BECOMES APOSTROPHE
REM TILDE BECOMES EQUALS SIGN
REM VERTICAL BAR BECOMES LETTER I
742 IF A%=96 THEN A%=39
744 IF A%=126 THEN A%=61
746 IF A%=124 THEN A%=73
750 IF A%=20 THEN GOSUB 7110:GOTO 720
752 IF A%=18 THEN GOSUB 300:GOTO 720
760 IF A%=11 THEN DX%= 0:DY%=-1:GOSUB 250
765 IF A%=8 THEN DX%=-1:DY%= 0:GOSUB 250
770 IF A%=21 THEN DX%= 1:DY%= 0:GOSUB 250
775 IF A%=10 THEN DX%= 0:DY%= 1:GOSUB 250
777 IF A%=13 THEN DX%= 1:DY%= 0:X%=0:Y%=Y%+1:GOTO 720
785 IF A%=27 THEN HOME:END:GOSUB 300:GOTO 720:REM SHELL TO BASIC
777 IF A%=13 THEN DX%= 0:DY%= 1:X%=0:GOSUB 250:DX%=1:DY%=0:GOTO 720
REM SHELL TO BASIC
785 IF A%=27 THEN HOME:END:GOSUB 300:GOTO 720
786 IF X%=39 AND Y%=23 THEN GOSUB 250:GOTO 720
787 IF A%>127 THEN A%=A%-128:GOTO 787
788 IF A%>95 THEN A%=A%-32:GOTO 788
790 IF A%>31 THEN PG%(X%,Y%)=A%:PRINT CHR$(A%);:GOSUB 250
795 GOTO 720
800 REM HELP
REM HELP
810 VTAB 5:INVERSE
813 HTAB 5:PRINT " CTRL+I - SHOW THIS HELP "
812 HTAB 5:PRINT " CTRL+I - SHOW THIS HELP "
814 HTAB 5:PRINT "------------------------------"
815 HTAB 5:PRINT " ARROW KEYS - MOVE CURSOR/PC "
816 HTAB 5:PRINT " CTRL+L - HOME CURSOR "
817 HTAB 5:PRINT " CTRL+N - NEW:CLEAR PROG "
818 HTAB 5:PRINT " CTRL+O - OPEN:LOAD PROG "
819 HTAB 5:PRINT " CTRL+W - WRITE:SAVE PRG "
820 HTAB 5:PRINT " CTRL+G - GO:RUN PROGRAM "
821 HTAB 5:PRINT " CTRL+T - SINGLE STEP PC "
822 HTAB 5:PRINT " CTRL+E - EXAMINE STACK "
823 HTAB 5:PRINT " CTRL+R - REDRAW SCREEN "
824 HTAB 5:PRINT " CTRL+A - SHOW ABOUT BOX "
825 HTAB 5:PRINT " CTRL+C - STOP PROG RUN "
826 HTAB 5:PRINT " ESC (,CONT) - SHELL TO BASIC "
830 HTAB 5:PRINT "------------------------------"
840 HTAB 5:PRINT " PRESS ANY KEY TO RESUME EDIT "
816 HTAB 5:PRINT " ARROW KEYS - MOVE CURSOR/IP "
818 HTAB 5:PRINT " (CTRL+J = DOWN, CTRL+K = UP) "
820 HTAB 5:PRINT " CTRL+L - HOME CURSOR "
822 HTAB 5:PRINT " CTRL+N - NEW:CLEAR PROG "
824 HTAB 5:PRINT " CTRL+O - OPEN:LOAD PROG "
826 HTAB 5:PRINT " CTRL+W - WRITE:SAVE PRG "
828 HTAB 5:PRINT " CTRL+G - GO:RUN PROGRAM "
830 HTAB 5:PRINT " CTRL+T - SINGLE STEP IP "
832 HTAB 5:PRINT " CTRL+E - EXAMINE STACK "
834 HTAB 5:PRINT " CTRL+R - REDRAW SCREEN "
836 HTAB 5:PRINT " CTRL+A - SHOW ABOUT BOX "
838 HTAB 5:PRINT " CTRL+C - STOP PROG RUN "
840 HTAB 5:PRINT " ESC (,CONT) - SHELL TO BASIC "
842 HTAB 5:PRINT "------------------------------"
844 HTAB 5:PRINT " PRESS ANY KEY TO RESUME EDIT "
880 NORMAL
890 GET WT$:GOSUB 300
895 RETURN
900 REM QUOTEMODE
REM QUOTEMODE
910 IF IR%=34 THEN QM%=0:GOTO 990
920 D%=IR%
930 GOSUB 500
990 RETURN
1000 REM ! BOOLEAN NOT
REM ! BOOLEAN NOT
1010 GOSUB 600
1020 IF D%=0 THEN D%=1:GOTO 1040
1030 D%=0
1040 GOSUB 500
1090 RETURN
1100 REM " TOGGLE QUOTEMODE
1110 IF QM%=0 THEN QM%=1:GOTO 1180
REM " TOGGLE QUOTEMODE
1110 IF QM%=0 THEN QM%=1:GOTO 1190
1120 QM%=0
1180 REM
1190 RETURN
1200 REM # TRAMPOLINE
REM # TRAMPOLINE
1210 X%=X%+DX%
1220 Y%=Y%+DY%
1290 RETURN
1300 REM $ POP
REM $ POP
1310 GOSUB 600
1390 RETURN
1400 REM % MODULO (SLOW!)
REM % MODULO (SLOW!)
1410 GOSUB 600
1420 E%=D%
1430 GOSUB 600
@ -170,18 +184,20 @@ NEW
1450 GOSUB 500
1490 RETURN
1500 REM & INPUT INTEGER
REM & INPUT INTEGER
1510 HTAB 1:VTAB 23
1520 INVERSE:PRINT OS$;:NORMAL
1530 INPUT "";WT$
1535 D%=VAL(WT$)
1537 IF WT$=CHR$(3) THEN RM%=0
1538 J%=22:GOSUB 320:REM TRICKY BASTARD!
1538 J%=22:GOSUB 320
1540 GOSUB 500
1550 OS$=""
1590 RETURN
1600 REM * MULTIPLY INTEGERS
REM * MULTIPLY INTEGERS
1610 GOSUB 600
1620 E%=D%
1630 GOSUB 600
@ -189,7 +205,8 @@ NEW
1650 GOSUB 500
1690 RETURN
1700 REM + ADD INTEGERS
REM + ADD INTEGERS
1710 GOSUB 600
1720 E%=D%
1730 GOSUB 600
@ -197,20 +214,22 @@ NEW
1750 GOSUB 500
1790 RETURN
1800 REM , OUTPUT CHARACTER
REM , OUTPUT CHARACTER
1810 GOSUB 600
1820 IF D%<>10 THEN GOTO 1880
1825 HTAB 1:VTAB 24
1830 INVERSE:PRINT OS$;" (EOL)";:NORMAL
1840 GET WT$:IF WT$=CHR$(3) THEN RM%=0
1850 OS$=""
1858 J%=23:GOSUB 320:REM TRICKY BASTARD!
1858 J%=23:GOSUB 320
1860 RETURN
1880 OS$=OS$+CHR$(D%)
1882 IF LEN(OS$)>30 THEN GOTO 1825
1890 RETURN
1900 REM - SUBTRACT INTEGERS
REM - SUBTRACT INTEGERS
1910 GOSUB 600
1920 E%=D%
1930 GOSUB 600
@ -218,13 +237,15 @@ NEW
1950 GOSUB 500
1990 RETURN
2000 REM . OUTPUT INTEGER
REM . OUTPUT INTEGER
2010 GOSUB 600
2020 OS$=OS$+STR$(D%)+" "
2030 IF LEN(OS$)>30 THEN GOTO 1825:REM WAAHH!
2030 IF LEN(OS$)>30 THEN GOTO 1825
2090 RETURN
2100 REM / DIVIDE INTEGERS
REM / DIVIDE INTEGERS
2110 GOSUB 600
2120 E%=D%
2130 GOSUB 600
@ -237,31 +258,37 @@ NEW
2185 GOSUB 500
2190 RETURN
2200 REM 0-9 PUSH DIGIT
REM 0-9 PUSH DIGIT
2210 D%=IR%-48
2220 GOSUB 500
2240 RETURN
2250 REM A-F PUSH HEX DIGIT
REM A-F PUSH HEX DIGIT
2260 D%=IR%-55
2270 GOSUB 500
2290 RETURN
2300 REM COLON DUP VALUE
REM COLON DUP VALUE
2310 GOSUB 600:GOSUB 500:GOSUB 500
2390 RETURN
2400 REM ; IGNORE MODE
REM ; IGNORE MODE
2410 IF IM%=0 THEN IM%=1:GOTO 2490
2420 IM%=0
2490 RETURN
2500 REM < LEFT
REM < LEFT
2510 DX%=-1:DY%=0
2590 RETURN
2600 REM ~ INPUT CHARACTER
2601 REM USES = ON APPLE ][+
REM ~ INPUT CHARACTER
REM USES = ON APPLE ][+
2610 HTAB 1:VTAB 24
2615 INVERSE:PRINT OS$;:NORMAL
2620 GET WT$
@ -271,11 +298,13 @@ NEW
2640 GOSUB 500
2690 RETURN
2700 REM > RIGHT
REM > RIGHT
2710 DX%=1:DY%=0
2790 RETURN
2800 REM ? RANDOM
REM ? RANDOM
2810 QD%=RND(1)*4+1
2815 ON QD% GOTO 2820,2830,2840,2850
2820 DX%= 1:DY%= 0:RETURN
@ -284,7 +313,8 @@ NEW
2850 DX%= 0:DY%=-1:RETURN
2890 RETURN
2900 REM @ END PROGRAM
REM @ END PROGRAM
2910 HTAB 1:VTAB 24
2920 INVERSE:PRINT OS$;" (END)";:NORMAL
2930 GET WT$
@ -292,36 +322,42 @@ NEW
2940 RM%=0:OS$=""
2990 RETURN
3000 REM | UP-DOWN DECISION
3001 REM USES I ON APPLE ][+
REM | UP-DOWN DECISION
REM USES I ON APPLE ][+
3010 GOSUB 600
3015 DX%=0
3020 IF D%<>0 THEN DY%=-1:GOTO 3090
3030 DY%=1
3090 RETURN
3100 REM ] CALL MACHINE LANGUAGE
REM ] CALL MACHINE LANGUAGE
3110 GOSUB 600
3111 CALL D%
3190 RETURN
3200 REM ^ UP
REM ^ UP
3210 DX%=0:DY%=-1
3290 RETURN
3300 REM _ LEFT-RIGHT DECISION
REM _ LEFT-RIGHT DECISION
3310 GOSUB 600
3315 DY%=0
3320 IF D%<>0 THEN DX%=-1:GOTO 3390
3330 DX%=1
3390 RETURN
3400 REM V DOWN
REM V DOWN
3410 DX%=0:DY%=1
3490 RETURN
3500 REM ` GREATER THAN
3501 REM USES ' ON APPLE ][+
REM ` GREATER THAN
REM USES ' ON APPLE ][+
3510 GOSUB 600
3515 E%=D%
3520 GOSUB 600
@ -330,7 +366,8 @@ NEW
3530 GOSUB 500
3590 RETURN
3600 REM G GET FROM SPACE
REM G GET FROM SPACE
3610 GOSUB 600
3615 E%=D%
3620 GOSUB 600
@ -339,7 +376,8 @@ NEW
3640 GOSUB 500
3690 RETURN
3700 REM P PUT INTO SPACE
REM P PUT INTO SPACE
3710 GOSUB 600
3715 E%=D%
3720 GOSUB 600
@ -350,7 +388,8 @@ NEW
3742 HTAB F%+1:VTAB E%+1:INVERSE:PRINT CHR$(D%);:NORMAL
3790 RETURN
3600 REM \ SWAP
REM \ SWAP
3610 GOSUB 600
3620 E%=D%
3630 GOSUB 600
@ -358,8 +397,10 @@ NEW
3650 D%=F%:GOSUB 500
3690 RETURN
REM ---------------------------------
REM LOAD PROGRAM
6000 REM LOAD PROGRAM
6010 HTAB 1:VTAB 23:INPUT "FILENAME: ";F$
6012 GOSUB 7140
6015 I=0:J=0
@ -368,8 +409,6 @@ NEW
6032 A$="": CALL 64879
6034 FOR K=512 TO 611: IF PEEK(K)<>141 THEN A$=A$+CHR$(PEEK(K)-128): NEXT
6040 REM INPUT A$
6042 IF LEFT$(A$,14)="END OF PROGRAM" THEN GOTO 6060
6045 FOR I=0 TO LEN(A$)-1:PG%(I,J)=ASC(MID$(A$,I+1,1)):NEXT
6050 J=J+1:GOTO 6032
@ -377,12 +416,12 @@ NEW
6080 GOSUB 300
6090 RETURN
6200 REM SAVE PROGRAM
REM SAVE PROGRAM
6210 HTAB 1:VTAB 23:INPUT "FILENAME: ";F$
6215 I=0
6220 PRINT D$;"OPEN";F$
6230 PRINT D$;"WRITE";F$
6240 REM TODO: OUTPUT PG IN LOOP
6242 FOR J=0 TO 24
6244 FOR I=0 TO 39:PRINT CHR$(PG%(I,J));:NEXT
6246 PRINT: NEXT
@ -391,7 +430,8 @@ NEW
6280 GOSUB 300
6290 RETURN
7000 REM EXAMINE STACK
REM EXAMINE STACK
7010 HTAB 1:VTAB 20:QQ$=""
7012 D%=0
7014 IF D%=SP% GOTO 7020
@ -399,16 +439,18 @@ NEW
7018 D%=D%+1:GOTO 7014
7020 INVERSE:PRINT QQ$;:NORMAL
7030 GET WT$
7035 J%=19:GOSUB 320:REM TRICKY BASTARD!
7035 J%=19:GOSUB 320
7090 RETURN
7100 REM SINGLE STEP
REM SINGLE STEP
7110 IF QM%=1 THEN GOSUB 910:GOTO 7114
7112 IF IM%=0 OR IR%=59 THEN GOSUB 400:REM EXECUTE
7112 IF IM%=0 OR IR%=59 THEN GOSUB 400
7114 GOSUB 250
7116 RETURN
7130 REM NEW PLAYFIELD
REM NEW PLAYFIELD
7140 J%=0
7150 I%=0
7160 PG%(I%,J%)=32
@ -416,21 +458,29 @@ NEW
7180 J%=J%+1:IF J%<24 THEN GOTO 7150
7190 RETURN
8000 REM ABOUT
8010 VTAB 7
8013 HTAB 4:PRINT " ______________________________"
8015 HTAB 4:PRINT "/ \"
8016 HTAB 4:PRINT "\ APPLE BEFUNGE V1.0 /"
8018 HTAB 4:PRINT "/ ------------------ \"
8020 HTAB 4:PRINT "\(C)2000 CAT'S EYE TECHNOLOGIES/"
8022 HTAB 4:PRINT "/ HTTP://WWW.CATSEYE.MB.CA/ \"
8023 HTAB 4:PRINT "\ FREELY REDISTRIBUTABLE /"
8024 HTAB 4:PRINT "/ BASED ON BEFUNGE-93 & -96+ \"
8026 HTAB 4:PRINT "\ PRESS CTRL+I FOR HELP INFO /"
8028 HTAB 4:PRINT "/ LONG LIVE RETROCOMPUTING :-) \"
8030 HTAB 4:PRINT "\______________________________/"
8040 HTAB 4:PRINT " PRESS RETURN KEY TO CONTINUE ";
8090 GET WT$:GOSUB 300
8095 RETURN
REM INITIALIZE AND SHOW ABOUT BOX
8000 DIM PG%(79,24)
8010 DIM ST%(256)
8020 X%=0:Y%=0:DX%=1:DY%=0:QM%=0:IM%=0:RM%=0
8030 I%=0:J%=0:IR%=0:SP%=0:D%=0:E%=0:F%=0
8040 OS$="":D$=CHR$(4)
8050 HOME:VTAB 7
8053 HTAB 4:PRINT " ______________________________"
8055 HTAB 4:PRINT "/ \"
8056 HTAB 4:PRINT "\ APPLE BEFUNGE V1.1 /"
8058 HTAB 4:PRINT "/ ------------------ \"
8060 HTAB 4:PRINT "\ BY CAT'S EYE TECHNOLOGIES /"
8062 HTAB 4:PRINT "/ HTTP://WWW.CATSEYE.TC/ \"
8063 HTAB 4:PRINT "\ PUBLIC DOMAIN, FEB 2012 /"
8064 HTAB 4:PRINT "/ BASED ON BEFUNGE-93 & -96+ \"
8066 HTAB 4:PRINT "\ PRESS CTRL+I FOR HELP INFO /"
8068 HTAB 4:PRINT "/ LONG LIVE RETROCOMPUTING :-) \"
8070 HTAB 4:PRINT "\______________________________/"
8080 HTAB 4:PRINT " INITIALIZING, PLEASE WAIT... ";
8090 GOSUB 7140
8100 VTAB 18:HTAB 4:PRINT " PRESS RETURN KEY TO CONTINUE ";
8110 GET WT$:GOSUB 300
8120 RETURN
RUN