News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Silly question

Started by FORTRANS, May 18, 2024, 04:44:42 AM

Previous topic - Next topic

FORTRANS

Hi Jochen,

   I was looking at a book by Creative Computing "More BASIC Computer
Games", David H. Ahl, 1979.  And was thinking of typing in some of
them for old times sake.  The BASIC used for these programs is the
Microsoft BASICA.  The version I have is from the MS_DOS 6.22
installation diskettes.  Now for a dumb question about MASMBASIC.
How compatible are these two BASICs?  Or, how easy would it be to use
MASMBASIC to run a BASICA program?  My most used computer here doesn't
run MASMBASIC or I would look at it here.

Notes:

   1. I can run BASICA, but this is to share with someone with Windows
10, which cannot run DOS programs natively.  And I don't know if I can
do a software installation on his system,

   2. I am, at best, a slow typist.  So if this happens at all, it will
probably be a limited excursion.  Mostly to reacquaint myself with using
BASIC.

   3. Along with #2, these games look a bit contrived.  So probably not
much of a loss if I give up early on in this enterprise.

   Alternate version of the question; what is the best free BASIC to
run BASICA programs in a Windows 10 console?

Regards,

Steve

jj2007

Hi Steve,

Can you post an example (not a Hello World, something bigger)?

MasmBasic is closer to GfaBasic, but it might not be difficult to write a translator. It seems BASICA is roughly the same as GW-BASIC, right?

FORTRANS

Quote from: jj2007 on May 18, 2024, 05:36:14 AMHi Steve,

Can you post an example (not a Hello World, something bigger)?

   Here is one of the games.  Typed in, partly debugged, and starts to
run.  It may have more errors though.  I also put in some INPUT statements
to avoid the scrolling from allowing one to read things.  Not yet worked
out for all text.

QuoteMasmBasic is closer to GfaBasic, but it might not be difficult to write a translator. It seems BASICA is roughly the same as GW-BASIC, right?

   If I remember, GW-BASIC was newer and could compile to an executable.
BASICA is only an interpreter.  They were compatible for all the programs
I tried at the time.  Equals long ago though.

Regards,

Steve

jj2007

Attached a translated file - a very early version, just to give you an idea... lots of manual fixes needed. I won't have much time to work on it.

Source and exe of the translator in the second attachment. Drag any *.bas file over the exe to translate it to MyTest.asm

daydreamer

I found a package which combine qbasic with dosbox,for old basic programs designed to run on slow few MHz CPU ,to keep speed down to make old games playable
Other way is like jochen pacman example ,put code in timer that updates each frame 1/60 ,otherwise running changing screen coordinates @3ghz makes game unplayable, because objects on screen seem to move at lightspeed
The big advantage is a very slow init data on original computer ,is made in milliseconds or less
My 16 bit dos coding started with emulate similar apple 2 vector graphics, few bits / vector
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

FORTRANS

Hi,

   Will look at the attachments.

   A fix to a technical error: The BASIC mentioned in the book is
"Microsoft BASIC".  BASICA was in the IBM PC as a ROM.  QBASIC was
the one supplied with MS-DOS.  All are similar.

Regards,

Steve N.

TimoVJL

May the source be with you

jj2007

Version 2 - throw some code at it (i.e. drag the *.bas over the exe) and let me know what you think. There is still lots of manual work to do, but it starts to look acceptable.

Before (excerpt, first 40 lines of 225):
10 PRINT TAB(33); "WUMPUS"
20 PRINT TAB(13); "CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
22 PRINT
24 PRINT
26 PRINT
30 PRINT "INSTRUCTIONS (Y-N);"
40 INPUT I$
50 IF I$ = "N" THEN 60
55 GOSUB 1000
60 REM- SET UP CAVE (DODECAHEDRAL NODE LIST
70 DIM S(20, 3)
80 FOR J = 1 TO 20
90 FOR K = 1 TO 3
100 READ S(I, K)
110 NEXT K
120 NEXT J
130 DATA 2,5,8,1,3,10,2,4,12,3,5,14,1,4,6
140 DATA 5,7,15,6,8,17,1,7,9,8,10,18,2,9,11
150 DATA 10,12,19,3,11,13,12,14,20,4,13,15,6,14,16
160 DATA 15,17,20,7,16,8,9,17,19,11,18,20,13,16,19
170 DEF FNA (X) = INT(20 * RND(1)) + 1
180 DEF FNB (X) = INT(3 * RND(1)) + 1
190 DEF FNC (X) = INT(4 * RND(1)) + 1
200 REM- LOCATE L ARRAY ITEMS
210 REM- 1-YOU,2-WUMPUS,3&4-PITS,5&6-BATS
220 DIM L(6), M(6)
230 FOR J = 1 TO 6
240 L(J) = FNA(0)
260 M(J) = L(J)
270 NEXT J
280 REM- CHECK FOR CROSSOVERS (IE L(1)=L(2) ETC)
290 FOR J = 1 TO 6
300 FOR K = 1 TO J
310 IF J = K THEN 330
320 IF L(J) = L(K) THEN 240
330 NEXT K
340 NEXT J
350 REM- SET# ARROS
360 A = 5
370 REM- RUN THE GAME
375 PRINT "HUNT THE WUMPUS"
380 REM- HAZARD WARNINGS & LOCATIONS
390 GOSUB 2000

After:
  Print At(33) "WUMPUS"
  Print At(13) "CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
  Print
  Print
  Print
  Print "INSTRUCTIONS (Y-N);"
  Input I$
  .if#== I$ = "N" //jmp @60
  call @1000
@60:
  ;- SET UP CAVE (DODECAHEDRAL NODE LIST
  Dim S(20, 3) As DWORD
  For_ J = 1 TO 20
  For_ K = 1 TO 3
  Read S(I, K)
  Next K
  Next
  Data 2,5,8,1,3,10,2,4,12,3,5,14,1,4,6
  Data 5,7,15,6,8,17,1,7,9,8,10,18,2,9,11
  Data 10,12,19,3,11,13,12,14,20,4,13,15,6,14,16
  Data 15,17,20,7,16,8,9,17,19,11,18,20,13,16,19
  # FNA (X) = INT(20 * RND(1)) + 1
  # FNB (X) = INT(3 * RND(1)) + 1
  # FNC (X) = INT(4 * RND(1)) + 1
  ;- LOCATE L ARRAY ITEMS
  ;- 1-YOU,2-WUMPUS,3&4-PITS,5&6-BATS
  Dim L(6), M(6) As DWORD
@230:
  For_ J = 1 TO 6
@240:
  L(J) = FNA(0)
  M(J) = L(J)
  Next
  ;- CHECK For_ CROSSOVERS (IE L(1)=L(2) ETC)
  For_ J = 1 TO 6
  For_ K = 1 TO J
  .if#== J = K //jmp @330
  .if#== L(J) = L(K) //jmp @240
@330:
  Next K
  Next J
  ;- SET# ARROS
@360:
  A = 5
  ;- RUN //jmp GAME
  Print "HUNT THE WUMPUS"
  ;- HAZARD WARNINGS & LOCATIONS
@390:
@390:
  call @2000

jj2007


jj2007

#9
Version 4

I must say that the *.bas code is a really ugly example of spaghetti code - it hurts the eye. GfaBasic in the 1980ies was a thousand times better.

I would check what the code does and rewrite it from scratch.

FORTRANS

Hi Jochen,

Quote from: jj2007 on May 20, 2024, 08:18:43 AMI must say that the *.bas code is a really ugly example of spaghetti code - it hurts the eye.

   Well, that book has seventy to eighty odd more of the same ilk.
Not to mention using rather small text.  That hurts my eyes.

Cheers,

Steve

jj2007

Quote from: FORTRANS on May 20, 2024, 10:27:06 PMWell, that book has seventy to eighty odd more of the same ilk.

It was actually a short period before structured BASIC arrived, but long enough to destroy BASIC's reputation forever.

daydreamer

#12
I agree on annoying spaghetti code,gosub 2000 for example but compiled its might instead hidden on different call memory address 2000 instead
Small text has pre computer solution : reading glasses,but if you are lucky someone has scanned in all old computer magazines that had basic code as PDF
Edit
I don't know if archived compute magazine have any basic game of interest ?
Copy and paste code simpler than tedious type in basic code in editor ?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jack

#13
Quote from: FORTRANS on May 18, 2024, 04:44:42 AM....
  Alternate version of the question; what is the best free BASIC to
run BASICA programs in a Windows 10 console?

Regards,

Steve
PC Basic will probably work for most BasicA programs https://robhagemans.github.io/pcbasic/
btw, Capture2Text might help if the source code is a scanned image  https://capture2text.sourceforge.net/#download

daydreamer

I see random generated area in wumpus code!wish for find old basic or other language code that random generates whole world
Or for example random generates two different villages,with 2 different random seeds
32 bit code access to fill few GB with milky way galaxy ?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding