# FISK.DMP Loading Analysis

## Summary

FISK.DMP.oct is a raw memory dump of the FISK adventure game. After extensive analysis, we've determined:

### File Format
- **95,616 words** of PDP-10 36-bit data (one word per line in octal)
- File is a **complete memory image starting at address 0**, not the WAITS .DMP format (which starts at 074)
- Contains split address space:
  - Low segment: addresses 0 to ~0o156673 (game data + code)
  - High segment: addresses 0o400000+ (additional data)

### Key Discoveries

1. **Format Mismatch**: The WAITS emulator's `load -d` command expects files starting at address 074, but FISK.DMP.oct starts at 0. This causes a 60-word address shift that misaligns the code.

2. **Game Structure**:
   - Job data area: addresses 0-0o200 (system pointers, HALT at 0o26)
   - Game data tables: addresses ~0o2000-0o155000 (vocabulary: TAKE, DROP, LOOK, NORTH, SOUTH, etc.)
   - Executable code: addresses ~0o155460-0o156674 (PUSHJ/POPJ subroutine structure)
   - High segment marker at address 0o135: value 0o156674

3. **Entry Point**: The code region starts around address 0o155460. This is where actual game logic resides.

4. **WAITS Dependency**: The game makes UUO (unimplemented user operation) calls that require WAITS to handle. It cannot run standalone without the OS.

## Files Created

| File | Description |
|------|-------------|
| `load_fisk.simh` | 58,567 SIMH deposit commands to load memory at correct addresses |
| `load_fisk_partial.simh` | 740 deposits for just header + code region (fast testing) |
| `fisk_memory.bin` | 764KB binary memory image (8 bytes per word) |
| `FISK.DMP` | Version with SAILDART header (loads at wrong offset) |

## Verified Working

The partial load script works correctly:
```
./pdp10-ka test_partial.ini
1:       466000304744
155460:  636162640000   ; TDZN instruction (code confirmed!)
155461:  304000000000
...
```

## Blocking Issues

1. **Full Load Performance**: The 58,000+ deposit commands take too long (~3+ minutes)
2. **WAITS Dependency**: FISK needs WAITS system calls to run (TTY I/O, etc.)
3. **No Disk Access**: FISK isn't on the 1974 WAITS disk images

## Recommended Next Steps

### Option A: Load via Script Optimization (Fastest to Test)
1. Use `load_fisk_partial.simh` for quick code region testing
2. For full load, run the deposit script overnight or optimize by:
   - Batching deposits
   - Creating a custom binary loader

### Option B: Inject into WAITS Disk Image (Most Authentic)
1. Use tools from `saildart/waits-disk-kits` to modify SYS000.ckd
2. Add FISK.DMP to the disk with proper WAITS filesystem format
3. Boot WAITS and run FISK from disk

### Option C: Create Minimal WAITS Environment
1. Build a minimal WAITS kernel that only handles:
   - TTY I/O (UUO 051)
   - Program termination
2. Load FISK into this environment
3. Requires understanding WAITS UUO dispatch

### Option D: Full Reverse Engineering
1. Continue analyzing the disassembly at `/mnt/c/repotemp/fdisk/fisk_disasm.txt`
2. Identify all WAITS UUO calls
3. Build a modern interpreter that emulates just those calls

## Technical Notes

### PDP-10 Instruction Format
- 36-bit words
- Opcode in bits 0-8, AC in 9-12, I in 13, X in 14-17, Y in 18-35
- FISK uses PUSHJ 17, and POPJ 17, (AC 17 as stack pointer)

### WAITS .DMP Format (for reference)
- Optional text header (SAILDART metadata)
- Octal words loaded starting at address 0o74
- Address 0o135 contains high segment marker
- When current address equals high marker, jump to 0o400000

### Game Vocabulary Found
TAKE, DROP, LOOK, NORTH, SOUTH, EAST, WEST, SCORE, YES, NO, LAMP, TOKEN, PUT, ROOMS, SQRT
