cpu-vm1

Guides writing and reviewing KR580VM1 assembly for the z88dk Z80 toolchain.

1.1k|206|Updated Mar 16, 2016
One-click install
npx skills add https://github.com/z88dk/z88dk --skill cpu-vm1-z88dk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpu-vm1
Source: https://github.com/z88dk/z88dk/tree/main/.agents/skills/cpu-vm1
Command: npx skills add https://github.com/z88dk/z88dk --skill cpu-vm1-z88dk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing correct assembly for the Soviet KR580VM1 CPU is error-prone because it reuses 8085 undocumented opcode slots for different instructions, adds RS/MB prefixes and dual 64K data banks, and has a dangerous pop af bank-switch trap. This Skill encodes the exact ISA, flag semantics, errata, and z88dk coding rules so generated or reviewed vm1 code is correct. ## Core Features & Use Cases - Complete ISA reference: Zilog mnemonics, opcodes, timings, prefix behavior (RS $38, MB/CS $28), and the ten extra instructions (DSUB, LHLX, SHLX, DCMP, ANX/ORX/XRX, JOF, SMF0/SMF1) with errata resolved against the local documentation. - Trap avoidance rules: Hard rules on pop af bank swaps, OF vs 8085 K flag differences, DSUB/DCMP not setting OF, and why 8085 sequences like ld de,sp+* must never be emitted. - z88dk integration guidance: Classic library paths (libsrc/l/sccz80/7-vm1/), build flags (-mvm1, +test -clib=vm1, --math-mbf32/--math32), ticks emulation (-mvm1), and assembler test fixtures as the last-resort source of truth. - Use Case: When implementing a 16-bit compare helper in libsrc/l/sccz80/7-vm1/, use cp hl,de (DCMP D) in one byte instead of the 8085 two-instruction sequence, while avoiding jp of since DCMP does not set the overflow flag. ## Quick Start Ask the assistant to write or review a KR580VM1 assembly routine for z88dk, for example a 16-bit subtract helper using the vm1 clib conventions.

Frequently Asked Questions about cpu-vm1

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write KR580VM1 assembly for z88dk?

Write Zilog mnemonics and assemble with -mvm1, targeting the vm1 clib via zcc +test -clib=vm1 or +z80 -clib=vm1. Prefer the VM1 extras like cp hl,de, sub hl,de, ld hl,(de), and ld (de),hl over byte-wise 8080 sequences.

What is the difference between KR580VM1 and Intel 8085 instructions?

Only DSUB B, SHLX, and LHLX share encodings; the other undocumented 8085 slots mean different operations on the VM1. For example $28 and $38 are MB/CS and RS prefixes, not LDSI/LDHI, and $FD is jp of rather than jp k.

Why is pop af dangerous on the KR580VM1?

pop af loads the MF flag from bit 3 of the flags byte, which selects the data RAM bank for all subsequent accesses. Popping any word that is not a previously pushed PSW can silently swap banks, so only matched push af/pop af pairs are safe.

Does z88dk support floating point math on the KR580VM1?

Yes, the default is --math-mbf32 linking mbf32_vm1.lib, and --math32 links math32_vm1.lib. There is no math16 vm1 product because those 8085 cores use ld de,sp+* and rl de, which are prefixes on this CPU.

Can I use jr or exx instructions in KR580VM1 code?

jr is allowed in normal z80asm mode and is synthesized as a 3-byte jp, but strict mode rejects it. exx does not exist; use the RS prefix with the hl' second pointer pair instead.