Commodore Trivia

by Jim Brain (j.brain@ieee.org)

Introduction

As some may know, these questions are part of a contest held each month on the Internet, in which the winner receives a donated prize. I encourage those who can received the newest editions of trivia to enter the contest.

This article contains the questions and answers for trivia editions #29-32, with questions for edition #33.

If you wish, you can subscribe to the trivia mailing list and receive the newest editions of the trivia via Internet email. To add your name to the list, please mail a message:

To: brain@mail.msen.com 
Subject: MAILSERV 
Body: 
subscribe trivia Firstname Lastname 
help 
quit 

Trivia Questions and Answers

This edition should be sub-titled "Programmer's Trivia".

Q $1C0) What are the two configurations for the LORAM, HIRAM, GAME, and EXROM pins that will allow the use of a full 64kB of RAM in the C64?

A $1C0) There are actually 4 configurations, in two categories:

        LORAM   0   0   (X means either 1 or 0)
        HIRAM   0   0
        GAME    1   X
        EXROM   X   0

Q $1C1) What is the first thing that the C64 (and VIC) KERNAL does upon powerup?

A $1C1) The first thing each does is reset the stack pointer to $ff.

Q $1C2) What KERNAL routine is used to set a DOS channel to input?

A $1C2) CHKIN ($ffc6)

Q $1C3) What KERNAL routine is used to set a DOS channel to output?

A $1C3) CHKOUT ($ffc9)

Q $1C4) Before calling the routines in $1C2 and $1C3, what register must you load?

A $1C4) You must load .X with the logical file number.

Q $1C5) What 3 devices can the KERNAL NOT load from?

A $1C5) keyboard (0), RS-232 (2), or screen (3). The first and last are somewhat obvious, but allowing RS-232 loads would have made loading from a remote machine possible. Incidentally, you can't save to any of these devices, either.

Q $1C6) In the Commodore KERNAL, there are "high" and "low" level routines. To which class of routines does "SECOND" belong?

A $1C6) low. It is used to specify the secondary address, as the '7' in open 4,4,7.

Q $1C7) If a programmer calls the KERNAL routine "STOP" and the RUN/STOP key is NOT pressed, what is returned in the .A register?

A $1C7) .A will contain a byte representing the last row of the keyboard scan.

Q $1C8) The Commodore KERNAL routines are all accessed via a jump table. What routine is used to change the values in the KERNAL jump table?

A $1C8) The appropriately named VECTOR ($ff8d) call, which few programmers actually use.

Q $1C9) A call is made to a KERNAL routine, the call returns with the C bit set and the .A register holds $02. What error does this indicate?

A $1C9) "File already open"

Q $1CA) If a call to READST is made, and a $40 is returned in .A, what does this indicate?

A $1CA) End of File.

Q $1CB) What routine can be called to determine the physical format of the Commodore 64 screen in characters?

A $1CB) The also appropriately named SCREEN ($ffed) call.

Q $1CC) The Commodore 64 starts a non-destructive RAM test at what location?

A $1CC) $0300.

Q $1CD) Which way does the RAM test proceed: up or down?

A $1CD) Up.

Q $1CE) Which KERNAL routine is used ONLY in conjunction with a Commodore IEEE card?

A $1CE) SETTMO ($ffa2), which sets the IEEE bus card timeout flag. I infer that Commodore thought many people would use the IEEE interface. (Anyone know any more about this?)

Q $1CF) Many hybrid BASIC/ML programs use SYS to transfer control from BASIC to ML. However, a few use USR(X). When using the latter function, where does BASIC fetch the ML routine's starting address from?

A $1CF) 785 and 786, in classic LO:HI format.

        

The "BASIC" Trivia Set

Q $1D0) To load a program from the current location on a cassette tape, what two key combination must a user press on a VIC-20 or C64.

A $1D0) SHIFT and the RUN/STOP key. Note that the same key sequence loads a file from disk on the SX-64 or C128 in 128 mode.

Q $1D1) If I issue the BASIC statement OPEN "JIM,S,W", What type of file am I opening?

A $1D1) A sequential file.

Q $1D2) Is BASIC in the Commodore computer systems an "interpreted" or "compiled" language

A $1D2) Interpreted. When a program has been "Blitzed!", it is then compiled.

Q $1D3) What type of variable is A%?

A $1D3) An integer variable.

Q $1D4) If I issue the BASIC line PRINT:PRINT "A","B" what column does the "B" show up on when run on a C64?

A $1D4) Column 11, if we number columns from 1.

Q $1D5) What column does "B" show up on if I run the BASIC line in $1D4 on a VIC-20?

A $1D5) Column 12. Since the VIC has 22 columns, the natural column spacing was 11 positions, instead of 10 on 40 and 80 column CBMs.

Q $1D6) Alphebetically, what is the first BASIC 2.0 command to have a 3 letter abbreviation?

A $1D6) CLOSE.

Q $1D7) How many times does the statement FOR T=1TO0 execute?

A $1D7) Once. A BASIC for loop always executes at least once. This is different from languages like 'C', which would not execute the loop at all. Feature or bug, who knows...

Q $1D8) What base does the BASIC LOG command use for its logarithm function?

A $1D8) base e. (2.7....) (one of the entrants claims that "e" in the 64 isn't quite as accurate as we think. He was quoting 2.85....

Q $1D9) A = NOT B can be written as which expression:

        a) A = -B
        b) A = -(B+1)

A $1D9) b. NOT computes the twos-complement of the number, not the simple ones-complement negation. This feature simpleifies subtraction in a CPU, since subtractions can be performed as additions.

Q $1DA) What does INT(-15.43) return?

A $1DA) -16. INT returns the next LOWER integer.

Q $1DB) What does ASC$("JIM") return?

A $1DB) ASC$ returns an error. That's what I get for writing these late at night. What I meant was "ASC", returns the value of the first character of a string, in this case 'J'. Since I didn't specify if this was a uppercase 'j' or lowercase 'J' in graphics mode, the result could either be 74 or 202.

Q $1DC) What is the abbreviation for GET#?

A $1DC) Technically, there is none. However, on the C128 at least, GET# shares the same token as GET, so typing gE# will indeed work. This is different from PRINT and PRINT#, which have different tokens.

Q $1DD) What is the largest integer value that Commodore BASIC can handle?

A $1DD) Again, this was a little ambiguous. I was looking for the maximum value that an integer variable can hold, which is 32767, but line numbers (which are integers) can be up to 63999.

Q $1DE) What is the ONLY Commodore Editor key not affected by "quote mode"

A $1DE) The DEL key. I would have answered return, but the 64 PRG spells it out that only this key is unaffected.

Q $1DF) What is the range of RND?

A $1DF) 0.0 <= RND > 1.0, or [0,1). Both mean that the range is from 0 to 1, including 0, but not 1.0.

 

The "VIC Chip" Trivia Set

Q $1E0) We all know that VIC stands for Video Interface Chip. However, in what computer was a VIC chip first used?

A $1E0) The VIC-I was used in the VIC-20.

Q $1E1) What is the difference between the 6566 and 6567 VIC chips?

A $1E1) The 6566 has fully decoded address lines. The '67 has multiplexed address lines for connection to DRAM.

Q $1E2) On what computer would one find a VIC-II chip?

A $1E2) C64, C64C, 64SX.

Q $1E3) On what computer would one find a VIC-IIe chip?

A $1E3) C128, C128D

Q $1E4) On what computer would one find a VIC-III chip?

A $1E4) C65 (64DX)

Q $1E5) Versions of each VIC chip exist for each computer model/video standard combinations supported by Commodore. What model/video standard would the 6569 work with?

A $1E5) C64 type machine using the PAL-B standard. Note that there are also PAL-N and PAL-M standards, which required different VIC-II models.

Q $1E6) How much memory could be directly addressed by a VIC-II chip?

A $1E6) 16 kilobytes.

Q $1E7) How many control registers does the VIC-I contain?

A $1E7) 16 control registers.

Q $1E8) How many control registers does the VIC-II contain?

A $1E8) 47 control registers.

Q $1E9) The VIC-II series introduced Movable Object Blocks to the Commodore programmer. By what common name are MOBs known?

A $1E9) "sprites"

Q $1EA) What are the dimensions of a MOB?

A $1EA) 24 dots wide by 21 tall.

Q $1EB) What difference between the VIC-I and VIC-II causes VIC-II equipped systems to potentially operate slightly slower than VIC-I equipped systems, all other items held constant?

A $1EB) Even with all of the fancy features of the VIC-II (like sprites) turned off, the VIC-II doesn't have quite enough time to do all of its work, which includes refreshing the DRAM ICs in addition to the work of drawing the screen and reading the Paddle inputs. So, every 8th rasterline, the VIC has to "steal cycles" from the CPU to fetch character data from RAM. Since this time is not available to the CPU to execute programs, a simple program written on each machine will execute faster on the VIC because its CPU doesn't have to fight the video IC for cycles.

Q $1EC) In addition to supporting graphical output to an external display, what other vitally important function do the VIC chips (starting with the VIC-II) perform?

A $1EC) They refresh the Dynamic RAM of the computer periodically. If the DRAM is not refreshed, it would lose its contents.

Q $1ED) Many people know that the VIC-II can deliver up to 320x200 resolution without much trouble. What is the maximum resolution of the VIC-III chip?

A $1ED) According to the specifications, it is supposed to handle 1280H by 400V interlaced and non-interlaced.

Q $1EE) Between the development of the VIC-II and the VIC-IIe, there was a related, though not very similar video IC developed for CBM machines. Name its TLA (three letter acronym).

A $1EE) TED (Text Editting Device). It was developed for the 264 series (Plus/4, C16).

Q $1EF) How many pins does a VIC-II chip contain?

A $1EF) Every VIC-II has 40 pins.

The "BASIC Tokens" Trivia Set

The following questions refer to the way Commodore "crunched" BASIC programs by substituting one or more bytes called "tokens" for BASIC keywords in a BASIC program. The resulting code was smaller, since multiple character keywords were internally replaced with smaller length tokens.

(All the answers were taken from _Commodore Magazine_, April 1987, pp 82-85.)

Q $1F0) Commodore BASIC tokens start at what number?

A $1F0) $80, or 128.

Q $1F1) BASIC 2.0 defines tokens without gaps up to $ca. What keyword is represented by $cb?

A $1F1) GO.

Q $1F2) Why is the token for PI strange?

A $1F2) It is token $ff, or 255.

Q $1F3) All versions of Commodore BASIC contain at least a subset of tokens. At what number does this subset end?

A $1F3) $ca.

Q $1F4) BASIC 4.0 defines tokens beyond $cb. What is the last token included in BASIC 4.0?

A $1F4) $da.

Q $1F5) There was a BASIC 4.0+ included in the B series. It extends the BASIC with some new commands not in 4.0. What token range are these new commands at?

A $1F5) $db-$e8.

Q $1F6) When a user plugs a Super Expander into a Commodore 64, he or she gains access to 25 new BASIC commands. The tokens for these commands are defined differently from the previous tokens. What is the difference?

A $1F6) They are two byte tokens of the form: $fe XX, where XX ranges from $80 to $9e.

Q $1F7) When the Plus/4 and C-16 was developed, new commands were added to BASIC. In addition, many commands from BASIC 4.0 were also included. Unfortunately, the tokens for BASIC 4.0 commands included in these new machines differed from those in the older BASIC 4.0. If a user lists a program written in BASIC 4.0 on a Plus/4, what will the BASIC 4.0 CONCAT command show up as?

A $1F7) CONCAT is $cc in BASIC 4.0, and is RGR in BASIC 3.5.

Q $1F8) What is the last token used in the Plus/4 line?

A $1F8) $fd.

Q $1F9) If you list a program written on the Plus/4 with the keyword SCALE on a BASIC 4.0/4.0+ machine, what happens?

A $1F9) SCALE on BASIC 3.5 is token $e9, which is not in the BASIC 4.0(+) list. The PET will crash. Interstingly, tokens above $e9 do not crash the PET.

Q $1FA) When the C128 was released, it shared many tokens with the Plus/4. However, at $ce, the 128 differs from the Plus/4. The Plus/4 token $ce corresponds to RLUM, but the C128 uses the token another way. What is peculiar about the C128 usage?

A $1FA) The C128 uses $ce as a prefix byte for a range of two-byte tokens that range from $02 to $0a.

Q $1FB) The C128 shares many keywords with the Super Expander cartridge for the C64. As with the Plus/4, though, keywords don't map to the same token. To what token does the C128 keyword SPRITE (token: $fe $07) correspond to on the Super Expander equipped 64?

A $1FB) $fe $93.

Q $1FC) What keyword was not included in BASIC v1, but was included in BASIC v2?

A $1FC) GO, token $cb.

Q $1FD) The C128 defines all the tokens from $fe $02 to $fe $26, with the exception of two tokens. Name one of them.

A $1FD) $fe $20 and $fe $22.

Q $1FE) The Plus/4 line had the ability to add keywords dynamically when running cartridges. At what point in the token list do these "added" keywords show up in the Plus/4 line?

A $1FE) They use $fe as a prefix byte for two-byte tokens.

Q $1FF) If a programmer want to write a single program to run on a B128, a plus/4, and a C128, what version of BASIC is the lowest common denominator?

A $1FF) Unfortunately, BASIC 2.0 is it.

 

The C128 Set:

Q $200) How many general purpose central processing units does a C128 contain?

Q $201) The Commodore 128 contains a MMU IC. What does MMU stand for?

Q $202) What Commodore produced cartridge is specifically mentioned in the 128 PRG as being incompatible with the 128?

Q $203) The C128 introduces the concepts of "banks" How many such banks are recognized by the C128 BASIC?

Q $204) What version is the BASIC included in the C128 in native mode?

Q $205) Can any of the BASIC graphics commands be used on the 80 column screen?

Q $206) How many high-level graphics commands are available on the C128 in C128 mode?

Q $207) In C128 mode, at what location does screen memory start?

Q $208) The 80 column IC in the 128 can display how many full character sets of 256 characters each at one time?

Q $209) Many have scorned the C128's 80 column video IC. What about this IC makes it so hard to use?

Q $20A) What number is the 80 column IC referenced by?

Q $20B) What machine language addressing modes cannot be used with the 80 column chip?

Q $20C) The C128 contains keyboard keys not present on the C64. What IC is used to read these keys? (besides the CIA, as on the 64)

Q $20D) Following the introduction of the C128, a new version of was developed. Name it.

Q $20E) Many people refer to C128s as 16k or 64k units. To what does this refer?

Q $20F) According to the C128 literature, the C128 can be expanded to use how much memory?

C= Hacking Home | Issue 14 Contents


Copyright © 1992 - 1997 Commodore Hacking

Commodore, CBM, its respective computer system names, and the CBM logo are either registered trademarks or trademarks of ESCOM GmbH or VISCorp in the United States and/or other countries. Neither ESCOM nor VISCorp endorse or are affiliated with Commodore Hacking.

Commodore Hacking is published by:

Brain Innovations, Inc.
10710 Bruhn Avenue
Bennington, NE 68007

Last Updated: 1997-03-31 by Jim Brain