Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:08 23 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : TRS80 emulation in GWBASIC

Author Message
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 947
Posted: 08:38am 20 May 2024
Copy link to clipboard 
Print this post

Hi folks,
I have found an interesting TRS80 emulator in GWBASIC:

http://cpmarchives.classiccmp.org/trs80/mirrors/www.vavasour.ca/jeff/mice.html

Annoyingly, I can't get it to work! Is it because of my ROMFILE? - unfortunately i don't know...  

I tried it with different ROM's under GWBASIC and QBASIC, which I had previously renamed to ROMIMAGE...  

It would be fantastic to get this emulator running on a PicoMite!

Frank
 
SimpleSafeName

Guru

Joined: 28/07/2019
Location: United States
Posts: 351
Posted: 09:45am 20 May 2024
Copy link to clipboard 
Print this post

Here's the line that opens the "ROMIMAGE." file in the GW source code:

180 OPEN "R", 1, "ROMIMAGE.", 128

Are you getting an error? What happens, or doesn't happen?

And I would try renaming "ROMIMAGE." to "ROMIMAGE.ROM" since I don't recall filenames ending in "." ever being used.

I tried it in QB64, but QB64 doesn't support "DEF FN".
 
SimpleSafeName

Guru

Joined: 28/07/2019
Location: United States
Posts: 351
Posted: 09:59am 20 May 2024
Copy link to clipboard 
Print this post

Okay, I see what's going on here. If ROMIMAGE. does not exist, GW-BASIC (or in my case, PC-BASIC) will create the file for you.

Look in your folder where you are running GW-BASIC, you will find a 0 byte file named "ROMIMAGE" (without the ".") in it.


In case you are interested, I found PC-BASIC tonight which:

"aims for bug-for-bug compatibility with Microsoft GW-BASIC"

Aim high as I always say... But it makes it so I don't have to run FreeDOS or some such nonsense just to then run GW-BASIC.
Edited 2024-05-20 20:05 by SimpleSafeName
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 947
Posted: 06:14pm 20 May 2024
Copy link to clipboard 
Print this post

Nothing happens at all - just a black screen that I can exit by pressing F1.

Yes, I have also noticed that the file ROMIMAGE is recreated if it does not exist.
I have renamed my ROM's to ROMIMAGE, but unfortunately it still didn't work.

I also tried PC-BASIC first, then GWBASIC in the DOSBOX - unfortunately no difference...

Frank
 
darthvader
Regular Member

Joined: 31/01/2020
Location: France
Posts: 87
Posted: 07:49pm 20 May 2024
Copy link to clipboard 
Print this post

  SimpleSafeName said  I tried it in QB64, but QB64 doesn't support "DEF FN".


replace it with :

function FNB(x)
fnb = ASC(MID$(RM$(INT(X / 128) MOD M), (X AND 127) + 1, 1))
end function

function FNW (X, Y)
FNW = CVI(CHR$(Y) + CHR$(X))
end function

Theory is when we know everything but nothing work ...
Practice is when everything work but no one know why ;)
 
SimpleSafeName

Guru

Joined: 28/07/2019
Location: United States
Posts: 351
Posted: 09:11pm 20 May 2024
Copy link to clipboard 
Print this post

I downloaded some TRS80 ROMs, created the "ROMIMAGE" file, and put PC-BASIC into C:\PC-BASIC along with the MICE files and got this:

Illegal function call in 2200 
Ok 

Which is this line:

2200 V2 = FNB(PT)

Looks like it's not intended to be used with the level1.rom.


Then I tried the level2.rom (these ROMs are from Slackware), which is a 12K file, and it loads and sits waiting for a key to be pressed on line 700. It most likely is coming from line 1040.

So... It's working?
 
SimpleSafeName

Guru

Joined: 28/07/2019
Location: United States
Posts: 351
Posted: 09:12pm 20 May 2024
Copy link to clipboard 
Print this post

  darthvader said  
  SimpleSafeName said  I tried it in QB64, but QB64 doesn't support "DEF FN".


replace it with :

function FNB(x)
fnb = ASC(MID$(RM$(INT(X / 128) MOD M), (X AND 127) + 1, 1))
end function

function FNW (X, Y)
FNW = CVI(CHR$(Y) + CHR$(X))
end function


Thanks!!
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1229
Posted: 05:27am 23 May 2024
Copy link to clipboard 
Print this post

I took a look at the listing, the main part of the program seems to be a BASIC-Z80 emulator (Volhout would surely get a pain in the neck with all the GOTO s ).
Even so, one can't simply translate the program into MMBASIC, too many GW-BASIC peculiarities are used for that.
But one can possibly use the way the program works as a blueprint.
So replace the whole ON GOTOs sequences with Select Case s etc.
Maybee I ll give it a try.
Cheers
Martin
'no comment
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5074
Posted: 07:36am 23 May 2024
Copy link to clipboard 
Print this post

  Martin H. said  Volhout would surely get a pain in the neck with all the GOTO s
Cheers
Martin


No, just laughing. I really love that many people have different use for a PicoMite. But a TRS80 emulator was not in my view. And doing it the hard way, by emulating a Z80 microprocessor in MMBasic. I estimate this aproach will be 100x slower than the TRS80.

Ok, it is a proof "It can be done". But it will not be usefull. On a CMM2 you may be able to run some text adventures, but you will need MMB4W or MMB4L on a serious PC to get to TRS80 speed (a 4MHz Z80).

And on the PC there will be better alternatives.

The RP2040 can sure do a TRS80, and will need to be slowed down, but in compiled C code, not in interpreted MMBasic.

So that is why I smile at the idea. It is a nice example of "It can be done, told you...!!", but is not in my interest (unless there is a military application...;))

Volhout
PicomiteVGA PETSCII ROBOTS
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 437
Posted: 03:21pm 23 May 2024
Copy link to clipboard 
Print this post

  Frank N. Furter said  Hi folks,
I have found an interesting TRS80 emulator in GWBASIC:

http://cpmarchives.classiccmp.org/trs80/mirrors/www.vavasour.ca/jeff/mice.html

Annoyingly, I can't get it to work! Is it because of my ROMFILE? - unfortunately i don't know...  

I tried it with different ROM's under GWBASIC and QBASIC, which I had previously renamed to ROMIMAGE...  

It would be fantastic to get this emulator running on a PicoMite!

Frank


I'm trying to port this to QB64.
After moving all the DEF FN statements to the bottom, deleting their line numbers and changing them into FUNCTION...END FUNCTION instead, I get a duplicate definition error between FNW() and FNW$(). Apparently, QB64 can't distinguish function names only varying by a string attribute.

Also, FNW$ isn't called anywhere in the program, as far as I can see. Am I missing something? If not, then I'll just eliminate the function definition for FNW$ and solve the duplicate problem.
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 947
Posted: 03:51pm 23 May 2024
Copy link to clipboard 
Print this post

Has anyone got the emulator running in GWBASIC, QBASIC or PC-BASIC? It should work there, which unfortunately it doesn't in my case...

Frank
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025