// ๐Ÿงช Chip-8 fini Propagation Simple Test - Phase 10 Feature Verification // Simple CPU component for fini testing box SimpleCPU { init { memory_ref, graphics_ref, sound_ref } SimpleCPU() { me.memory_ref = null me.graphics_ref = null me.sound_ref = null print("๐Ÿ”ง SimpleCPU created") } // โญ Phase 10: fini propagation test fini() { print("๐Ÿ”„ CPU cleanup triggered - fini propagation starting") // Clean up dependent components in order if (me.memory_ref != null) { me.memory_ref.cleanup() print("๐Ÿ“ฆ Memory cleanup completed") } if (me.graphics_ref != null) { me.graphics_ref.cleanup() print("๐Ÿ–ผ๏ธ Graphics cleanup completed") } if (me.sound_ref != null) { me.sound_ref.cleanup() print("๐Ÿ”Š Sound cleanup completed") } print("โœ… CPU fini propagation complete") } link_components(memory, graphics, sound) { me.memory_ref = memory me.graphics_ref = graphics me.sound_ref = sound print("๐Ÿ”— Components linked to CPU") } } // Simple Memory component box SimpleMemory { init { data, alive } SimpleMemory() { me.data = new ArrayBox() me.alive = true me.data.push("memory_data_1") me.data.push("memory_data_2") print("๐Ÿ’พ SimpleMemory created with 2 data items") } read_data() { if (me.alive) { return me.data.get(0) } else { print("โš ๏ธ Memory component destroyed - access blocked") return null } } cleanup() { print("๐Ÿงน Memory cleanup: clearing data") me.data.clear() me.alive = false } } // Simple Graphics component box SimpleGraphics { init { pixels, alive } SimpleGraphics() { me.pixels = new ArrayBox() me.alive = true me.pixels.push(0) me.pixels.push(1) me.pixels.push(0) print("๐Ÿ–ผ๏ธ SimpleGraphics created with 3 pixels") } draw() { if (me.alive) { print("๐ŸŽจ Drawing graphics...") return true } else { print("โš ๏ธ Graphics component destroyed - draw blocked") return false } } cleanup() { print("๐Ÿงน Graphics cleanup: clearing display") me.pixels.clear() me.alive = false } } // Simple Sound component box SimpleSound { init { volume, alive } SimpleSound() { me.volume = 50 me.alive = true print("๐Ÿ”Š SimpleSound created with volume " + me.volume) } play() { if (me.alive) { print("๐Ÿ”” Playing sound at volume " + me.volume) return true } else { print("โš ๏ธ Sound component destroyed - playback blocked") return false } } cleanup() { print("๐Ÿงน Sound cleanup: stopping audio") me.volume = 0 me.alive = false } } static box Main { init { console } main() { me.console = new ConsoleBox() me.console.log("๐Ÿงช Phase 10: Chip-8 fini Propagation Test") // Create CPU and components local cpu = new SimpleCPU() local memory = new SimpleMemory() local graphics = new SimpleGraphics() local sound = new SimpleSound() // Link components for fini propagation cpu.link_components(memory, graphics, sound) // Test normal operation me.console.log("=== Normal Operation Test ===") local mem_data = memory.read_data() me.console.log("Memory data: " + mem_data) local gfx_result = graphics.draw() me.console.log("Graphics draw result: " + gfx_result) local sound_result = sound.play() me.console.log("Sound play result: " + sound_result) // Test fini propagation me.console.log("=== fini Propagation Test ===") cpu.fini() // Test operation after fini me.console.log("=== Post-fini Operation Test ===") local mem_data2 = memory.read_data() me.console.log("Memory data after fini: " + mem_data2) local gfx_result2 = graphics.draw() me.console.log("Graphics draw after fini: " + gfx_result2) local sound_result2 = sound.play() me.console.log("Sound play after fini: " + sound_result2) me.console.log("๐ŸŽ‰ Phase 10 fini propagation test complete!") return "fini propagation test finished" } }