Transitioning programs to use ROM 920373
The MEGA65’s ROM 920373 provides an exciting new 80x50 text mode. In order to implement it though, the position of colour RAM had to be moved:
Colour RAM | Old | New |
---|---|---|
Location: | $0001F800 | $0FF80800 |
ROM versions: | ROM 920372 and earlier | ROM 920373 and beyond |
Â
Here's some examples of how I transitioned across to the new rom:
Github diff: https://github.com/MEGA65/mega65-release-prep/commit/95a974f560b9a9cbd9be61fdfa715b1a9e01b799
The
border.s
file is an example of transitioning for assemblyThe
gen.py
file is an example of transitioning in BASIC
Â
Safe BASIC access to screen+colour memory (T@& and C@&)
As an alternative to directly peek’ing and poke’ing hardcoded addresses for screen memory and colour memory in your BASIC programs, a safer alternative is to use the T@& and C@& arrays.
Â
Writing examples:
T@&(5,0) = 1
(place the letter 'A' at column 5, row 0)C@&(5,0) = 2
(set the color to red for character at column 5, row 0)
Â
Reading examples:
PRINT T@&(0,0)
(print the screen-code value of the character at column 0, row 0)PRINT C@&(0,0)
(print the colour-value of the character at column 0, row 0)
Â
Obtaining base address of screen and colour memory:
10 TR=WPEEK($D060) + WPEEK($D062) *65536 : REM SCREEN MEMORY BASE
20 CR=$FF80000 + WPEEK($D064) : REM COLOUR MEMORY BASE
Â
Bit Shifter’s example
How to PEEK or POKE screen text RAM and attribute (colour) RAM.
This example program shows, how the base address of text and attribute can be obtained to be used in PEEK and POKE.
This method works on old and new ROMs regardless of the current setting of colour RAM base address.
The first lines show the access with the special arrays T@& and C@&, that avoid the usage of PEEK and POKE.
Â