# bear2305/x86-chicken-invader architecture

> Architecture diagram of the GitHub repository bear2305/x86-chicken-invader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bear2305/x86-chicken-invader
- Repository: https://github.com/bear2305/x86-chicken-invader

## Overview

Chicken Invader is a bare-metal, 16-bit x86 space-shooter. The user boots the raw disk image; the BIOS loads the bootloader, which loads the game using LBA or CHS disk services and transfers control to it. During play, keyboard input moves the ship or fires, while timed game behavior drives the player’s projectiles and enemy formation and attacks; collisions can end the game. Rendering uses BIOS text output. The map follows README-documented behavior only; source excerpts were unavailable, so internal call wiring is intentionally limited.

Main entry points: [`spacegame.asm`](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm) (Game loop), [`bootloader.asm`](https://github.com/bear2305/x86-chicken-invader/blob/main/bootloader.asm) (Bootloader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot"]
  node_bootloader["Bootloader<br/>[bootloader.asm]"]
end

subgraph group_play["Gameplay"]
  node_game["Game runtime<br/>[spacegame.asm]"]
  node_loop["Game loop<br/>[spacegame.asm]"]
  node_timer["Busy-wait timer<br/>[spacegame.asm]"]
  node_ship["Ship movement<br/>[spacegame.asm]"]
  node_gameover["Game over<br/>[spacegame.asm]"]
  node_restart["System restart<br/>[spacegame.asm]"]
end

subgraph group_combat["Combat"]
  node_formation["Chicken formation<br/>[spacegame.asm]"]
  node_bullet["Player bullets<br/>[spacegame.asm]"]
  node_eggs["Chicken eggs<br/>[spacegame.asm]"]
  node_collision["Collision checks<br/>[spacegame.asm]"]
end

subgraph group_io["Input and display"]
  node_input["Keyboard input<br/>[spacegame.asm]"]
  node_render["Text rendering<br/>[spacegame.asm]"]
end

node_player(("Player"))
node_bios["BIOS services"]
node_disk[("Boot disk")]

node_bios -->|"loads at 0x7C00"| node_bootloader
node_bootloader -->|"requests disk read"| node_bios
node_disk -->|"supplies game sectors"| node_bootloader
node_bootloader -->|"loads and jumps"| node_game
node_game -->|"starts"| node_loop
node_player -->|"presses keys"| node_input
node_input -->|"reads via INT 16h"| node_bios
node_loop -->|"handles controls"| node_input
node_loop -->|"paces animation"| node_timer
node_loop -->|"updates position"| node_ship
node_loop -->|"updates enemies"| node_formation
node_loop -->|"updates projectiles"| node_bullet
node_loop -->|"updates attacks"| node_eggs
node_loop -->|"checks impacts"| node_collision
node_input -->|"moves ship"| node_ship
node_input -->|"fires"| node_bullet
node_formation -->|"drops eggs"| node_eggs
node_bullet -->|"checks hits"| node_collision
node_eggs -->|"checks hits"| node_collision
node_ship -->|"checks hitbox"| node_collision
node_collision -->|"triggers on hit"| node_gameover
node_input -->|"Delete key"| node_restart
node_loop -->|"draws game state"| node_render
node_render -->|"outputs via INT 10h"| node_bios

click node_bootloader "https://github.com/bear2305/x86-chicken-invader/blob/main/bootloader.asm"
click node_game "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_loop "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_timer "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_input "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_ship "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_formation "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_bullet "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_eggs "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_collision "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_render "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_gameover "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"
click node_restart "https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bootloader toneBlue
class node_game,node_loop,node_timer,node_ship,node_gameover,node_restart,node_disk toneAmber
class node_formation,node_bullet,node_eggs,node_collision toneMint
class node_input,node_render toneRose
class node_player,node_bios toneIndigo
```

## Components

### Boot

- [Bootloader](https://github.com/bear2305/x86-chicken-invader/blob/main/bootloader.asm): `bootloader.asm`

### Gameplay

- [Game runtime](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [Game loop](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [Busy-wait timer](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [Ship movement](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [Game over](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [System restart](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`

### Combat

- [Chicken formation](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [Player bullets](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [Chicken eggs](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [Collision checks](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`

### Input and display

- [Keyboard input](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`
- [Text rendering](https://github.com/bear2305/x86-chicken-invader/blob/main/spacegame.asm): `spacegame.asm`

### Other components

- **Player**
- **BIOS services**
- **Boot disk**

## Connections

- BIOS services → Bootloader: loads at 0x7C00
- Bootloader → BIOS services: requests disk read
- Boot disk → Bootloader: supplies game sectors
- Bootloader → Game runtime: loads and jumps
- Game runtime → Game loop: starts
- Player → Keyboard input: presses keys
- Keyboard input → BIOS services: reads via INT 16h
- Game loop → Keyboard input: handles controls
- Game loop → Busy-wait timer: paces animation
- Game loop → Ship movement: updates position
- Game loop → Chicken formation: updates enemies
- Game loop → Player bullets: updates projectiles
- Game loop → Chicken eggs: updates attacks
- Game loop → Collision checks: checks impacts
- Keyboard input → Ship movement: moves ship
- Keyboard input → Player bullets: fires
- Chicken formation → Chicken eggs: drops eggs
- Player bullets → Collision checks: checks hits
- Chicken eggs → Collision checks: checks hits
- Ship movement → Collision checks: checks hitbox
- Collision checks → Game over: triggers on hit
- Keyboard input → System restart: Delete key
- Game loop → Text rendering: draws game state
- Text rendering → BIOS services: outputs via INT 10h
