Purpose: Define I/O memory page
Call address: $FFF3 (hex) 65523 (decimal)
Communication registers:X, Y
Preparatory routines: None
Stack requirements: 2
Registers affected: X, Y
Description: This routine sets the X and Y registers to the address of the memory section where the memory mapped 110 devices are located. This address can then be used with an offset to access the memory mapped I/O devices in the Commodore 64. The offset is the number of locations from the beginning of the page on which the I/O register you want is located. The X register contains the low order address byte, while the Y register contains the high order address byte.
This routine exists to provide compatibility between the Commodore 64, VIC-20, and future models of the Commodore 64. If the J/0 locations for a machine language program are set by a call to this routine, they should still remain compatible with future versions of the Commodore 64, the KERNAL and BASIC.
How to Use:
;SET THE DATA DIRECTION REGISTER OF THE USER PORT TO 0 (INPUT) JSR IOBASE STX POINT ;SET BASE REGISTERS STY POINT+1 LDY #2 LDA #0 ;OFFSET FOR DDR OF THE USER PORT STA (POINT),Y ;SET DDR TO 0