Re: User Port and AutoRun Addresses

From: Nate Dannenberg (
Date: 2001-02-02 07:04:53

Answering these as they apply to the C128 (and in most places, the C64):

> What address is the userport at and the DDR for it?

$DD02 is the DDR, and $DD03 is "Port B" (the main port).  $DD00/1 are the
corresponding addresses for the few bits of Port A that are available at
the User Port.

> What is the pinout of the userport regarding datalines only, is it
> C64/V20 compatible?

Regarding only the data lines.. 

   Top:  1, 12: Ground
         2: +5v
         3: Reset
         4-7: not important
         8: /PC
         9: /ATN (/PA3)
        10-11: not important

Bottom:  A, N: Ground
         B: /Flag2
         C-L: PB0 - PB7 (resp.)
         M: PA2

> Where is the input buffer (loc512 on the C64/Vic20)?

$0200 is the 512-byte input buffer, $0354 is the 10-byte keyboard buffer, 

> Where to I load in order to initiate a vector based autorun function
> (ie I normally use the CHROUT vector/tape buffer on a C64)?

I don't quite follow.  Multi-load routines work the same way in a C128 as
they do in other machines - fill the screen with commands, fill the
keyboard buffer with $0D, and exit to BASIC, or just execute a LOAD
command within the program, with the proper lines at the start of the
program to handle BASIC's wraparound to the start when the LOAD is done.

> Where are BASIC start /end text pointers?

Start of Text: $2D
Start of Variables: $2F
Start of Arrays: $31
End of Arrays (+1): $33
Start of Strings: $35
End of Strings: $39

All variables, arrays, dynamic strings, etc are stored in Bank 1 and
follow a similar format to that used in the C64 (strings are different, so
I understand)

> What is some simple code to bank I/O in and out of processor space?

  Bits 7, 6: Ram Bank select (only 00/01 work on stock machines)
       5, 4: RAM/ROM Select for $C000-$FFFF range:
             00: Kernal
             01: Internal Function ROM [1]
             10: External Function ROM
             11: RAM
       3, 2: RAM/ROM Select for $8000-$BFFF
             00: BASIC (High half)
             01: Internal Function ROM [1]
             10: External Function ROM
             11: RAM
          1: RAM/ROM Select for $4000-$9FFF (0=BASIC Low half, 1=RAM)
          0: I/O Select for $D000-$DFFF (0=I/O Devices, 1=See bits 5, 4)

So to reveal all the RAM in Bank 0, just set this register to $3F.  To get
at all the RAM in Bank 0, but with I/O devices, set it to $3E.  Stock
configuration would be to set this to $00.
 ___________________________________  _____  _____
|                                   _///@@@|      |
|              /'//ZZ@@|____  |
|                                 |'''/    |'/@7  |
| |`'|     `~~'   |
|                                 | `|     .--.   |
| C64/C128 - What's *YOUR* hobby? |  `\____|___\  |
|                                  \_      |      |
|___________________________________ \_____| _____|

This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail

Archive generated by hypermail 2.1.1.