6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 10, 2024 2:46 pm

All times are UTC




Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: Supermon64 sources
PostPosted: Sat Jan 21, 2017 10:56 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8479
Location: Midwestern USA
barrym95838 wrote:
I have a lot of respect for him...and his ability to survive giant deadly meteor impacts.

http://www.sciencemag.org/news/2016/03/ ... -dinosaurs

Mike B.

I saw it coming, dug a really big hole in the ground, climbed in, got one of the other dinosaurs to cover me with stuff and waited for the meteor to do its dirty work. :D It took some serious effort to get out of the hole after all the dust and debris had settled. :lol:

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Sat Jan 21, 2017 11:20 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8479
Location: Midwestern USA
jblang wrote:
Anyway, regardless of who came first it's clear they share a common heritage.

Part of it is the 6502 architecture constrains the number of ways in which an algorithm can be programmed. We're working with a paucity of registers and in the case of the 6502 or 65C02, a limit of eight bit chunks of data per operation. The predictable result is different programmers will tend to develop similar code for a given algorithm. The 65C816 reduces that tendency due to its 16 bit capabilities, as well as its more expansive instruction set and addressing modes. However, the paucity of registers is still there, so a tendency remains to use memory as ephemeral workspace, especially page zero memory.

Quote:
In general, it looks like the origins of many of the early 6502 monitors were pretty incestuous and nobody really bothered much with attribution.

That was not uncommon in those days before lawyers got their meathooks into everything related to software. It was all new and exciting technology, and no one was worried about copyrights, etc. The goal was to make the systems of the day work.

The first hint of trouble came when Bill Gates published a letter complaining about how Micro-Soft BASIC was being "stolen" by members of the ancient Homebrew Computer Club. It was partially nonsense, as the rights to BASIC belong to Dartmouth College, which is where the language was developed in 1964. Dartmouth never received any royalties from Gates and Allen, so it could be argued those two stole BASIC from Dartmouth. :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Last edited by BigDumbDinosaur on Sun Jan 22, 2017 4:35 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Sun Jan 22, 2017 7:26 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10976
Location: England
AIUI, it was very unclear as to whether software was even subject to copyright - was it a creative work? That's since been put into a legal framework. (The same is true of physical chip designs, aka layouts - in this case, a new category of copyright was created for the purpose, with a ten year span.)


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Sun Jan 22, 2017 4:42 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8479
Location: Midwestern USA
BigEd wrote:
AIUI, it was very unclear as to whether software was even subject to copyright - was it a creative work? That's since been put into a legal framework. (The same is true of physical chip designs, aka layouts - in this case, a new category of copyright was created for the purpose, with a ten year span.)

I just don't remember seeing any copyright notices in the code I worked with in the 1970s. Much of it couldn't be run outside of the specific system for which it was developed, which to stretch the imagination a bit, would have been a form of copy protection. Operating systems, of course, were 100 percent non-portable and given the high cost of the mainframes and minis of the day, "stealing" the OS wasn't going to happen. :D

It all changed with UNIX, especially after Thompson and Ritchie rewrote UNIX in C, reducing the non-portable code to only what was specific to the underlying hardware, i.e., the device drivers. At that point, the notion of an operating system being usable on disparate hardware came into being and around that time I suspect the (AT&T) lawyers got into the picture.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Mon Jan 23, 2017 4:44 am 
Offline

Joined: Wed Jan 18, 2017 2:12 pm
Posts: 35
I finally wrapped my mind around the code and tables that handle the addressing modes in the assembler. When I finally understood, it felt kind of like this:

Image

I've documented both the code and the layout of the tables and checked it into github.

Code here: https://github.com/jblang/supermon64/bl ... 4.asm#L621
Tables here: https://github.com/jblang/supermon64/bl ... .asm#L1417


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Wed Jan 25, 2017 1:12 am 
Offline

Joined: Wed Jan 18, 2017 2:12 pm
Posts: 35
Just finished documenting the last of the subroutines.

Edit: I started a new topic looking for suggestions on sources I should read next: viewtopic.php?f=2&t=4398


Last edited by jblang on Wed Jan 25, 2017 2:24 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Wed Jan 25, 2017 4:07 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
Jeff Tranter has a lightly-commented disassembly of Apple 1 Integer BASIC here:

https://github.com/jefftranter/6502/tre ... sm/a1basic

I think it would be really neat to see someone with your attention to thoroughness and detail give it the "full treatment", with more meaningful labels and comments. It is an important part of 6502 history, but was originally hand-assembled by Woz, so there isn't a truly "original" source in machine-readable form, at least as far as I know.

Mike B.


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Wed Jan 25, 2017 8:19 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10976
Location: England
(It's a good idea to start a new topic when a thread reaches the point that the title doesn't really describe it any one.)


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Wed Jan 25, 2017 2:25 pm 
Offline

Joined: Wed Jan 18, 2017 2:12 pm
Posts: 35
OK, new topic created (see above).


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Fri Feb 03, 2017 4:27 am 
Offline

Joined: Wed Jan 18, 2017 2:12 pm
Posts: 35
I haven't started my next project yet, but I realized that I hadn't really finished with Supermon64. In addition to the monitor itself, it also has a relocatable code stub, for which the source was not included. I disassembled it from the original binary and added it to my github repo: https://github.com/jblang/supermon64/bl ... locate.asm

Quoting my comments from the code:

Quote:
; Jim Butterfield described the post-processing of Supermon 64 binaries
; in a posting to comp.sys.cbm on Dec 20, 2003:

; I should note that, since Supermon+64 is relocatable code, the source
; does not assemble into the final binary file. It may seem crude, but
; I follow this procedure: (1) The source is carefully structured so
; that there are no "dispersed addresses" such as might be created with
; something like LDA #>VECTOR .. LDY #<VECTOR - every relocatable
; address is two adjacent bytes; (2) I assemble the source TWICE, to
; two different page addresses; the only difference in the binaries will
; be the high-order bytes of the relocatable addresses; (3) a small
; post-processing program blends the two binaries into a relocatable
; package, adding a Basic driver to complete the bundle.

; Source: https://groups.google.com/forum/#!searc ... _UQlwVnPcJ

; This code was disassembled from the original Supermon+64 V1.2 binary.

; The relocation stub starts at the Start of Variables pointer (VARTAB) and
; works backwards through the Supermon64 machine code, copying it to the top
; of basic memory pointer (MEMSIZ), and decrementing the pointer as it goes.
; Relative addresses that need to be adjusted are marked with a $36 byte
; immediately following them. Since we're working backwards, the marker is
; encountered first, then the high byte, then the low byte of the address
; needing to be adjusted. The relative addresses are calculated such that
; adding the top of memory to them will yield the absolute address of the
; jump target in the relocated code.

; The next step will be to build a Python script that will take Supermon64
; binaries assembled to two different addresses and output relocatable code
; with the relative addresses and $36 address markers.


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Fri Feb 03, 2017 5:17 am 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
So, just to be clear.

The file was assembled twice, with 2 different origins.

Then, a process was applied to ferret out the differences between the files, thus identifying the addresses to patch.

Then that data was taken and rolled into a loader? And that was part of the final binary?


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Fri Feb 03, 2017 2:48 pm 
Offline

Joined: Wed Jan 18, 2017 2:12 pm
Posts: 35
I believe that's correct. NB, I haven't built a working binary using this technique yet.


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Sat Feb 04, 2017 2:33 am 
Offline

Joined: Wed Jan 18, 2017 2:12 pm
Posts: 35
I've added the python script to build the final relocatable binary: https://github.com/jblang/supermon64/bl ... r/build.py

I assembled relocate.asm to relocate.prg using 64tass. Then I assembled supermon64.asm to two different origins (I used $8000 and $C000). I provided these inputs to build.py and confirmed that the output is identical to the original supermon64.prg from Jim Butterfield.

Edit: also created a Makefile: https://github.com/jblang/supermon64/bl ... r/Makefile


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Sat Feb 04, 2017 3:32 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
Quote:
; ... (1) The source is carefully structured so
; that there are no "dispersed addresses" such as might be created with
; something like LDA #>VECTOR .. LDY #<VECTOR - every relocatable
; address is two adjacent bytes; ...

Could you briefly explain why "dispersed addresses" might be cause for concern? I could be misunderstanding something important, but at first glance it seems to me that the described technique would work just fine for these too, as long as the relocation is a multiple of 256.

Mike B.


Top
 Profile  
Reply with quote  
 Post subject: Re: Supermon64 sources
PostPosted: Sat Feb 04, 2017 4:28 am 
Offline

Joined: Wed Jan 18, 2017 2:12 pm
Posts: 35
The relocator code as it was originally written doesn't handle them. It expects the lower and upper bytes to be consecutive within the binary. If the code had something like LDA #>VECTOR .. LDY #<VECTOR, the bytes in the address would be separated from each other by the intervening opcode, and would not be properly adjusted by the relocator. I'm sure it's possible to write a relocator that would handle these, but I guess Jim was going for simplicity.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 41 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: