Commodore Trivia
Home  Weblog  Research Kitchen  Contact 
All You Ever Wanted To Know About Commodore Main Menu
Home > Trivia #12A

Resources
C64 Chronology
  A comprehensive chronology of the Commodore 64
Zzap! 64
  Fan site for the classic C64 mag
Lemon 64
  Awesome 64 games site
CCS64
  A C64 on your desktop
RKO C64 Remixes
  Amazing site of C64 SID remixes
   

Who wrote this stuff?
This trivia was originally written by Jim Brain as part of the now long defunct C= Hacking Magazine, but happily Jim has kindly agreed to let me reproduce it in HTML-ized format for retro computing fans everywhere.

If you are interested in seeing the Commodore Trivia digests in their original form, take a look at this website.

For those who are interested, these pages were generated from the original text files using Perl and Velocity (and a nice template originally found here)

 
TRIVIA 12A

$0B0)
	What will happen if you type ?""+-0 into the CBM BASIC interpreter
        on the PET series, the 64 series, or the 128 series?

	The BASIC interpreter has a bug in it that shows up while interpreting
        the above statement.  The interpreter leaves two bytes on the CPU
        stack prior to returning from a subroutines call.  At least on the
        C64, the two bytes are both zeros.  Since subroutines put the return
        address on the stack, the return retrieves the two bytes left on the
        stack and attempts to se that as the return address.  So, depending on
        what code it executes after the return, it can do a number of things.
       
        Most of the time after the bug occurs, the interpreter limps along
        for a while until it hits a BRK instruction, $00.  Then, that 
        instruction causes the system to execute an interrupt.  On the C64,
        the system vectors through $316-$317 (BRK vector) and does a warm
        start.  On the C128 and PETs with Monitors, the system dumps into the
        internal machine language monitor.  If the machine under use did not
        do something with the BRK vector, the machine will hang. 
        
        Now, note that the above is not the only result.  Since the 
        interpreter is executing code from the wrong location, any result
        from no effect to hung machine is possible.
        
        Note that this is NOT normal behavior.  The system should report an
        error while interpreting the above statement.

Top
$0B1)
	In the first CBM 64 units, what color was the screen color RAM
        changed to when you cleared the screen?

	The screen color RAM was changed to value 1 when the screen was
        cleared.  Thus, when a byte was poked into screen RAM, the resulting
        character was white on the screen.  The white contrasted nicely
        with the normal blue background.

Top
$0B2)
	Why was it changed in later versions of the 64?

	Commodore found that this practice sometimes caused "light flashes"
        during screen scrolls.  I was going to leave this for another time,
        but ... The change was to make the color RAM equal to background
        color register #0.  Well, this got rid of the "light flashes", but
        then poking values to screen RAM  caused invisible characters, since
        the foreground color of the character was the same as the background
        color of the screen. 
        
        Well, this broke a number of older programs that did not
        properly initialize the color RAM. Also, Commodore fixed the problem
        with the VIC-II that had caused these "light flashes" So, Commodore
        changed the KERNAL a third time.  Since the above change caused
        invisible characters, Commodore made a third revision that changed
        the color RAM to the value in location 646 (the current cursor
        foreground color).
        

Top
$0B3)
	What is "special" about the text that displays the "illegal quantity 
        error" in CBM BASIC?

	The text is actually "?ILLEGAL QUANTITY  ERROR".  Notice the two
        spaces between "QUANTITY" and "ERROR".  John West supplies the
        expanantion:
        
        "The vector at $0300 points to a routine at $A43A, which is the
        general error message printing routine.  Load .X with the number of
        the error, and it prints it.  it looks up the address of the error
        text from a table, then prints the text, which does not have any
        trailing spaces.  It then prints '  ERROR', with *2* spaces.  It
        does this for all errors."         
        
        Historically, this effect is caused by the VIC-20, which only had 22
        columns.  When the VIC-20 BASIC was being ported from the PET BASIC
        code, someone noticed that the some of the error strings would
        span two VIC-20 lines.  So, the BASIC error messages were changed
        a little, so that they all printed neatly on two lines:  The PET
        error string:
           ?ILLEGAL QUANTITY ERROR (one space) became:
           ?ILLEGAL QUANTITY
            ERROR                  (carriage return plus one space).
        When the C64 BASIC was being ported from the VIC-20, the carriage
        return was replaced with a space character. 
        
        I admit this caught me by surprise.  I have used Commodore computers
        for years, and never noticed that "?SYNTAX  ERROR" had 2 spaces in it.

Top
$0B4)
	On what Commodore machine was the operating system OS/9 available?

	Since OS/9 was a real-time operating system for the 6809
        microprocessor, it was available on only one Commodore machine, which
        had two different names:  The Commodore SuperPET.  The machine was
        sold as the "MMF (Micro MainFrame) 9000 in Germany, and its model
        number was SP9000.

Top
$0B5)
	Which Commodore machine(s) does not have a user port?

	There were a number of answers to this question, and there may be
        more:
        
        The Commodore C16.  Commodore decided to cut out telecommunications,
        and thus designed the user port out of the computer, as the modem is
        the only use Commodore ever made of the user port.  This also
        includes the C116, a version of the C16 with a chicklet keyboard.
            
        The Commodore Ultimax/MAX machine.  This was the ill-fated game
        console produced in the early 80s.  It was basically a stripped down
        Commodore 64.
        
        The 64 GS (Game System).  This machine was another flop produced
        in the late 80s.  
        

Top
$0B6)
	How many pins are there in a Commodore Serial Connector?

	6.

Top
$0B7)
	There are 13 addressing modes available on the 6502. Name them.

	No# Name                 Description
        --- ------------         -----------
        01) accumulator          asl a
        02) immediate            lda #$00
        03) zero page            lda $00
        04) zero page,X          lda $00,X
        05) zero page,Y          lda $00,Y
        06) absolute             lda $1000
        07) absolute,X           lda $1000,X
        08) absolute,Y           lda $1000,Y
        09) implied              clc
        10) relative             bne
        11) (indirect,X)         lda ($00,X)
        12) (indirect),Y         lda ($00),Y
        13) (absolute indirect)  jmp ($1000)
   

Top
$0B8)
	If you were to put one large sequential file onto an 8050 disk drive,
        how big could that file be?

	According to the 8050 User Manual, a sequential file could be
        521208 bytes in size.

Top
$0B9)
	How many characters can be present in a standard Commodore DOS
        filename?

	16 characters.

Top
$0BA)
	How many pins does a 6502 IC have on it?

	40 pins.

Top
$0BB)
	How many pins does the standard IEEE-488 connector have on it?

	24 pins.  

Top
$0BC)
	On the IEEE-488 bus, what does the acronym for pin 7, NRFD, stand for?

	Not Ready For Data.

Top
$0BD)
	On the NMOS 6502, what is the ML opcode for SED, and what does this
        opcode do?

	$f8, SEt Decimal mode.  Sets the D flag in the status flags byte.
        Although used rarely, this opcode switches on Binary Coded Decimal
        mode.  In BCD mode, the byte $10 is treated as 10, not 16.  The add
        and subtract instructions are the only legal ones affected by this
        mode, although some undocumented/illegal opcodes are also affected.                          
        For example, in this mode, adding the byte $15 (21) to the byte $25
        (37) yields $40 (64) not $3a (58).  emember that, in this mode,
        $40 = 40, not 64.
                                        

Top
$0BE)
	Assuming a PET computer and a non-PET computer have access to a 
        common disk drive or tape drive, there are three ways to load a PET 
        BASIC program on the non PET CBM computer. Name them.

	Most differing series of Commodore computers had different places
        for the start of BASIC programs.  For instance, on the C64, $0801
        (2049) is the start of BASIC memory, but most PET computers start
        BASIC memory at $0401 (1025).  This wouldn't matter, except that
        BASIC programs are stored on tape and disk with the start address,
        and the line links in a BASIC program have absolute addresses in them.
        To fix these problems, the Commodore VIC-20 and newer computers came
        out with a "relocatable load".  So, here are the three choices:
        						 
        1)  Save the program on the PET like so: save "name",X (X is device).
            Then, you could load the program into the non-PET machine
            by using a relocatable load: load "name",X.  This would load the
            program in at start of BASIC memory and refigure the line links.  
                   
        2)  Redefine start of BASIC memory on non-PET machine.  A couple
            of pokes to relevant BASIC pointers, and the start of BASIC
            was moved. Then, load the program non-relocatable.
        
        3)  After saving the PET program, alter the first two bytes of the
            file to correspond to the start of BASIC for the non-PET
            machine.
        
        Now, from the above discussion, it looks like option 1 is the 
        simplest route.  Well, it would be, exept for one small detail:
        Earlier PET computers saved the BASIC program from $0400, not
        $0401 as is expected.  The effect:  loading relocatable on a non-PET
        would have a zero byte as the first byte of the program.  The quick
        fix:  change BASIC pointer to itself-1, load PET program, reset
        BASIC pointer.  Commodore didn't make it easy!
        
            

Top
$0BF)
	Only two of the ways detailed in $0BE works the other way around.
        Which two?
	      

	Since the earlier PET computers did not have a "relocatable load",
        the only way to load a program from, say, a C64 into an 2001 was to
        use option #2 above and move the start of BASIC memory to 
        $0801 (2049) or alter the program a la solution #3 to 2049.
             	    


Jim Brain
j.brain@ieee.org
10710 Bruhn Avenue
Bennington, NE  68007
(402) 431-7754


Top


This site 2005 The Research Kitchen and Jim Brain.
Page generated: Sat Oct 14 14:06:37 BST 2006