Saturday, April 12, 2025

MSX-2 SCREEN Concept

# MSX-2 SCREEN Concept

The **MSX-2 SCREEN concept** revolves around *multiple screen modes*, each tailored for different use cases like text, tile-based graphics, bitmapped images, and sprites. MSX-2 greatly expanded upon the original MSX video capabilities by leveraging the **Yamaha V9938** video display processor (VDP), allowing for higher resolution, more colors, and multiple VRAM pages.

---

## 🎨 Overview of SCREEN Modes in MSX-2

| Mode       | Type     | Resolution     | Colors           | Description                                  |
|------------|----------|----------------|------------------|----------------------------------------------|
| SCREEN 0   | Text     | 40×24 (text)    | 2 colors         | Default text screen (40 columns)             |
| SCREEN 1   | Text     | 32×24 (text)    | 15 colors (limited) | Colorful, 32-column text mode             |
| SCREEN 2   | Tile     | 256×192         | 16 (per 8×1 area) | Tile-based mode for games                    |
| SCREEN 4   | Tile     | 256×212         | 16 (fixed palette) | MSX2 version of SCREEN 2                     |
| SCREEN 5   | Bitmap   | 256×212         | 16 (from 512)     | Direct pixel graphics                         |
| SCREEN 6   | Bitmap   | 512×212         | 4 (from 512)      | High-res graphics mode                        |
| SCREEN 7   | Bitmap   | 512×212         | 16 (from 512)     | High-res, 16-color mode                       |
| SCREEN 8   | Bitmap   | 256×212         | 256 (fixed)       | 8-bit color mode (no sprite support)         |
| SCREEN 10  | YJK      | 256×212         | ~12,000 (YJK)     | Photo-realistic color encoding               |
| SCREEN 11  | YJK+PAL  | 256×212         | ~12,000 + 16      | YJK with palette override                    |
| SCREEN 12  | YJK      | 512×212         | ~12,000           | Hi-res YJK mode (MSX2+)                      |

---

## 📦 Concepts Behind the SCREEN System

### 1. Tile Modes vs Bitmap Modes
- **Tile-based (SCREEN 1–4):**
  - Use **character patterns** and **name tables**.
  - Efficient and fast—perfect for retro-style games.

- **Bitmap modes (SCREEN 5–8, 10–12):**
  - Allow **per-pixel** control.
  - Best for drawing, images, or artistic apps.

---

### 2. Color System
- MSX-1: fixed 16-color palette.
- MSX-2:
  - **512-color palette**
  - Custom palette via `COLOR=` or `VDP` register.
  - Bitmap screens can use these with up to 16 or 256 colors.
  - YJK modes allow 12,000+ virtual colors.

---

### 3. Pages
- Most modes support **multiple VRAM pages**.
- You can:
  - Draw on one page.
  - Show another page.
  - Swap for **smooth animation** (double-buffering).

---

### 4. Sprites
- Used in SCREEN 1–7.
- **32 hardware sprites**, up to 16 colors.
- Limit: **4 sprites per scanline**.

---

### 5. VRAM Layout
- Use `VPOKE`, `VPEEK`, and `COPY` to directly manage VRAM:
  - Tiles, bitmaps, sprite patterns, palettes, etc.

---

## 🧪 Example: Draw a Pixel in SCREEN 5

```basic
SCREEN 5
PSET (100, 100), 15  ' White pixel