EhBasic for the NES... Copyright status?

A forum for users of EhBASIC (Enhanced BASIC), a portable BASIC interpreter for 6502 microcomputers written by Lee Davison.
Post Reply
halkun
Posts: 45
Joined: 26 Nov 2012

EhBasic for the NES... Copyright status?

Post by halkun »

So I'm porting EhBasic to the NES and was contemplating getting a commercial license. Sadly, since Lee has died, I was wondering how would you handle the copyright status as this is now officially an orphaned work?

If anything here's at least a screenshot of progress...
Image

I still have to write handlers for Tab, LF, and CR... Oh and the input system too.

I was thinking of making a "Basic compiler" for the NES where you could program in EhBasic and then a NES ROM image is created with the Basic acting as a kernal and your program saved in ROM. (Leaving all 8k of ram for variables) There is a stipulation for commercial licensing for EhBasic, but well, it's difficult to ask now :/

Ideas?
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: EhBasic for the NES... Copyright status?

Post by drogon »

halkun wrote:
So I'm porting EhBasic to the NES and was contemplating getting a commercial license. Sadly, since Lee has died, I was wondering how would you handle the copyright status as this is now officially an orphaned work?

If anything here's at least a screenshot of progress...
Image

I still have to write handlers for Tab, LF, and CR... Oh and the input system too.

I was thinking of making a "Basic compiler" for the NES where you could program in EhBasic and then a NES ROM image is created with the Basic acting as a kernal and your program saved in ROM. (Leaving all 8k of ram for variables) There is a stipulation for commercial licensing for EhBasic, but well, it's difficult to ask now :/

Ideas?
If it were me, then I'd do the port, give it away for free with full sources, etc. then offer consultancy services, or sell games, utilities, etc. based on it.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Re: EhBasic for the NES... Copyright status?

Post by BitWise »

Why do you need a commercial license? What are you planning to charge for?

I think Lee was happy for people to use his code as long as it was given away freely and others didn't claim it to be their own work.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Re: EhBasic for the NES... Copyright status?

Post by Arlet »

Formally, copyright now belong to his heirs. Maybe they can be contacted.
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: EhBasic for the NES... Copyright status?

Post by drogon »

I really think anyone is on a sticky wicket here... If EhBASIC really is an enhanced version of MS Basic then the issue of copyright is probably moot as if MS get wind of it, then they might have something to say.

Someone - Lee's family, maybe would have to prove beyond doubt that it was an original work before I'd try to do anything commercial with it whatsoever and without full, annotated sources to go on, that's going to be somewhat challenging.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Re: EhBasic for the NES... Copyright status?

Post by BitWise »

drogon wrote:
I really think anyone is on a sticky wicket here... If EhBASIC really is an enhanced version of MS Basic then the issue of copyright is probably moot as if MS get wind of it, then they might have something to say.
I believe EhBasic was entirely Lee's own work.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: EhBasic for the NES... Copyright status?

Post by drogon »

BitWise wrote:
drogon wrote:
I really think anyone is on a sticky wicket here... If EhBASIC really is an enhanced version of MS Basic then the issue of copyright is probably moot as if MS get wind of it, then they might have something to say.
I believe EhBasic was entirely Lee's own work.
I asked something along these lines a while back - the replies I got more or less indicated that it might not be all his own work.

viewtopic.php?f=5&t=5389

And if it was all his own work, then why is all we have what is effectively a disassembly. Is there a properly annotated source file anywhere?

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: EhBasic for the NES... Copyright status?

Post by GARTHWILSON »

drogon wrote:
And if it was all his own work, then why is all we have what is effectively a disassembly. Is there a properly annotated source file anywhere?
It's available at https://github.com/jefftranter/6502/blo ... source.zip . It is heavily commented.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: EhBasic for the NES... Copyright status?

Post by BigEd »

It's a bit of a lesson for anyone choosing a non-standard license for their offerings - their choice may not have all the effects they intend.

As noted, only Lee's heirs can issue a commercial license.
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: EhBasic for the NES... Copyright status?

Post by drogon »

GARTHWILSON wrote:
drogon wrote:
And if it was all his own work, then why is all we have what is effectively a disassembly. Is there a properly annotated source file anywhere?
It's available at https://github.com/jefftranter/6502/blo ... source.zip . It is heavily commented.
It is a very well commented disassembly.

I've no doubt that Lee put a lot of work into this, dissembling, commenting and Enhancing, but I'm not convinced it was all his original work.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Re: EhBasic for the NES... Copyright status?

Post by BitWise »

drogon wrote:
GARTHWILSON wrote:
drogon wrote:
And if it was all his own work, then why is all we have what is effectively a disassembly. Is there a properly annotated source file anywhere?
It's available at https://github.com/jefftranter/6502/blo ... source.zip . It is heavily commented.
It is a very well commented disassembly.

I've no doubt that Lee put a lot of work into this, dissembling, commenting and Enhancing, but I'm not convinced it was all his original work.

-Gordon
I've downloaded the first release of the code from Lee's site via the Wayback machine

https://web.archive.org/web/20030118100 ... 2/ehbasic/

.. and compared bits of it with the Microsoft Basic source here

https://github.com/brajeshwar/Microsoft ... 02.MAC.txt

.. and there are a lot of similarities you wouldn't expect if the code was all Lee's own work.

The order of the tokens for example starts END, FOR, NEXT, DATA in both and the order for the functions starts SGN, INT, ABS, USR in both. This could explained if Lee was trying to have some degree of token code compatibility but his additions break this later in the table.

Some of the code looks very similar too. For example the code for inserting a line into a program looks like this in the Microsoft version:

Code: Select all

BLTU:	JSR	REASON		;ASCERTAIN THAT STRING SPACE WON'T
				;BE OVERRUN.
	STWD	STREND
BLTUC:	SEC			;PREPARE TO SUBTRACT.
	LDA	HIGHTR
	SBC	LOWTR		;COMPUTE NUMBER OF THINGS TO MOVE.
	STA	INDEX		;SAVE FOR LATER.
	TAY
	LDA	HIGHTR+1
	SBC	LOWTR+1
	TAX			;PUT IT IN A COUNTER REGISTER.
	INX			;SO THAT COUNTER ALGORITHM WORKS.
	TYA			;SEE IF LOW PART OF COUNT IS ZERO.
	BEQ	DECBLT		;YES, GO START MOVING BLOCKS.
	LDA	HIGHTR		;NO, MUST MODIFY BASE ADDR.
	SEC
	SBC	INDEX		;BORROW IS OFF SINCE [HIGHTR].GT.[LOWTR].
	STA	HIGHTR		;SAVE MODIFIED BASE ADDR.
	BCS	BLT1		;IF NO BORROW, GO SHOVE IT.
	DEC	HIGHTR+1	;BORROW IMPLIES SUB 1 FROM HIGH ORDER.
	SEC
BLT1:	LDA	HIGHDS		;MOD BASE OF DEST ADDR.
	SBC	INDEX
	STA	HIGHDS
	BCS	MOREN1		;NO BORROW.
	DEC	HIGHDS+1	;DECREMENT HIGH ORDER BYTE.
	BCC	MOREN1		;ALWAYS SKIP.
BLTLP:	LDADY	HIGHTR		;FETCH BYTE TO MOVE
	STADY	HIGHDS		;MOVE IT IN, MOVE IT OUT.
MOREN1: DEY
	BNE	BLTLP
	LDADY	HIGHTR		;MOVE LAST OF THE BLOCK.
	STADY	HIGHDS
DECBLT: DEC	HIGHTR+1
	DEC	HIGHDS+1	;START ON NEW BLOCKS.
	DEX
	BNE	MOREN1
	RTS			;RETURN TO CALLER.
And this is Lee's

Code: Select all

LAB_11CF
	JSR	LAB_121F		; check available memory, "Out of memory" error if no room
					; addr to check is in AY (low/high)
	STA	Earryl		; save new array mem end low byte
	STY	Earryh		; save new array mem end high byte

; open up space in memory
; move (Ostrtl)-(Obendl) to new block ending at (Nbendl)
; don't set array end

LAB_11D6
	SEC				; set carry for subtract
	LDA	Obendl		; get block end low byte
	SBC	Ostrtl		; subtract block start low byte
	TAY				; copy MOD(block length/$100) byte to Y
	LDA	Obendh		; get block end high byte
	SBC	Ostrth		; subtract block start high byte
	TAX				; copy block length high byte to X
	INX				; +1 to allow for count=0 exit
	TYA				; copy block length low byte to A
	BEQ	LAB_120A		; branch if length low byte=0

					; block is (X-1)*256+Y bytes, do the Y bytes first

	SEC				; set carry for add + 1, two's complement
	EOR	#$FF			; invert low byte for subtract
	ADC	Obendl		; add block end low byte

	STA	Obendl		; save corrected old block end low byte
	BCS	LAB_11F3		; branch if no underflow

	DEC	Obendh		; else decrement block end high byte
	SEC				; set carry for add + 1, two's complement
LAB_11F3
	TYA				; get MOD(block length/$100) byte
	EOR	#$FF			; invert low byte for subtract
	ADC	Nbendl		; add destination end low byte
	STA	Nbendl		; save modified new block end low byte
	BCS	LAB_1203		; branch if no underflow

	DEC	Nbendh		; else decrement block end high byte
	BCC	LAB_1203		; branch always

LAB_11FF
	LDA	(Obendl),Y		; get byte from source
	STA	(Nbendl),Y		; copy byte to destination
LAB_1203
	DEY				; decrement index
	BNE	LAB_11FF		; loop until Y=0

					; now do Y=0 indexed byte
	LDA	(Obendl),Y		; get byte from source
	STA	(Nbendl),Y		; save byte to destination
LAB_120A
	DEC	Obendh		; decrement source pointer high byte
	DEC	Nbendh		; decrement destination pointer high byte
	DEX				; decrement block count
	BNE	LAB_1203		; loop until count = $0

	RTS				;
Different labels but its basically the same.

It does appear that Lee disassembled Microsoft Basic and reused portions of it to build EhBasic.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: EhBasic for the NES... Copyright status?

Post by BigEd »

A consequence of this sort of derived work is that the copyright rests with two parties: Microsoft have copyright on their contributions, and Lee's estate has copyright on his. According to law, you'd need agreement from both parties before distributing or modifying the result.

(Of course, in practice, these days people ignore Microsoft's claims on their 8-bit Basics, and Microsoft ignore them too. By no means does this neglect change the status of the code or the claim.)
Klaus2m5
Posts: 442
Joined: 28 Jul 2012
Location: Wiesbaden, Germany

Re: EhBasic for the NES... Copyright status?

Post by Klaus2m5 »

The BASIC here seems to have the same problem. It comes with a 2-clause BSD license but is clearly derived from disassembled ROMs of various 6502 computers. It even assembles to exactly the same addresses for the individual machine's ROM.

If I were to produce a comercial product to include BASIC, I would start from scratch and would include the features of a modern BASIC: No line numbers but labels, structured programming (If-THEN-ELSE, loops, function/procedure calls with local variables) and the requirement to declare all varables in advance getting rid of the need to search in RAM for every reference to a variable and the dreadfull garbadge collection.
6502 sources on GitHub: https://github.com/Klaus2m5
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: EhBasic for the NES... Copyright status?

Post by drogon »

Klaus2m5 wrote:
If I were to produce a comercial product to include BASIC, I would start from scratch and would include the features of a modern BASIC: No line numbers but labels, structured programming (If-THEN-ELSE, loops, function/procedure calls with local variables) and the requirement to declare all varables in advance getting rid of the need to search in RAM for every reference to a variable and the dreadfull garbadge collection.
You've just described a compiled language ;-)

I did write a BASIC interpreter a few years ago, however I wrote it in C with not real thoughts on making it work on anything other than a 32-bit micro (running Linux, but that's not essential). It's almost as you describe above, however you don't need to pre-declare variables (but it is an error to read from an un-initialised scalar variable). It works almost as a one-pass compiler maintaining a separate symbol table for variables, although strings an arrays are dynamically allocated at run-time. The tokenised code is effectively interpreted in much the same way most tokenising BASICs work. It supports named & recursive procedures and local variables.

An example is here: https://unicorn.drogon.net/wumpus.rtb

I have been thinking of an 8 (or 16) bit re-write of it, but not sure I have the time or energy right now, although maybe this summer when I've cleared some other projects I have going. If I released it, it would be GPLv3 which I've used before. (although that's not stopped people stealing my code and passing it off as their own - if only I had the resources to pursue them, but such is life...)

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: EhBasic for the NES... Copyright status?

Post by BillO »

If you want to build a product using EhBASIC then do so. Just don't directly include the interpreter. You could provide a 'free' ROM pre-programmed with the code as a bonus for buying the product such that the end user must plug the free ROM in to use it. This would be allowed under Lee's license wording.

You could also do what Lee did and just modify the code and call it your own.
Bill
Post Reply