Project Manhattan: Advanced MOS 6510 CPU/GPU Emulator with Extended Capabilities

CPU Mode
Assembly Mode
GPU Mode

CPU Mode Documentation

CPU Mode emulates high-level operations for scientific computing and game development.

Instruction Set (65c02 Equivalent):

  • LOAD [register] [value] - Load value into register
  • STORE [register] [address] - Store register value at address
  • ADD [dest] [src1] [src2] - Add src1 and src2, store in dest
  • SUB [dest] [src1] [src2] - Subtract src2 from src1, store in dest
  • MUL [dest] [src1] [src2] - Multiply src1 and src2, store in dest
  • DIV [dest] [src1] [src2] - Divide src1 by src2, store in dest
  • JUMP [address] - Jump to address
  • BRANCH [condition] [address] - Branch if condition is true
  • CALL [address] - Call subroutine
  • RETURN - Return from subroutine
  • NEW - Create new program
  • SAVE [filename] - Save current program
  • LOAD [filename] - Load program from file
  • LIST - List current program

Example: Fibonacci Sequence

NEW LOAD R0 0 ; First number LOAD R1 1 ; Second number LOAD R2 10 ; Counter LABEL LOOP ADD R3 R0 R1 ; Calculate next number STORE R3 1000 ; Store in memory LOAD R0 R1 ; Shift numbers LOAD R1 R3 SUB R2 R2 1 ; Decrement counter BRANCH NZ LOOP LIST SAVE fibonacci

Assembly Mode Documentation

Assembly Mode provides low-level access to the emulated 65c02 CPU with MS-DOS DEBUG.COM-like functionality.

65c02 Instruction Set:

  • LDA/LDX/LDY - Load Accumulator/X/Y
  • STA/STX/STY - Store Accumulator/X/Y
  • ADC/SBC - Add/Subtract with Carry
  • INC/DEC - Increment/Decrement
  • AND/ORA/EOR - Logical AND/OR/XOR
  • ASL/LSR/ROL/ROR - Shifts and Rotates
  • JMP - Jump
  • JSR - Jump to Subroutine
  • RTS - Return from Subroutine
  • BEQ/BNE/BCC/BCS/BPL/BMI - Conditional Branches

DEBUG.COM-like Commands:

  • A [address] - Assemble
  • D [range] - Dump memory
  • E [address] - Enter data
  • F [range] [value] - Fill memory
  • G [address] - Go (execute)
  • N [filename] - Name (for load/save)
  • L - Load file
  • W - Write file
  • Q - Quit
  • R - Display/modify registers
  • T [count] - Trace
  • U [range] - Unassemble

Example: Simple Loop

A 1000 LDA #00 STA 2000 LDX #0A LOOP: INC 2000 DEX BNE LOOP RTS U 1000 L20 G 1000 D 2000 L1

GPU Mode Documentation

GPU Mode provides access to advanced graphics operations with a 65c02-like instruction set for 3D rendering.

Instruction Set (65c02 GPU Equivalent):

  • CLEAR [r] [g] [b] - Clear screen to color
  • LDVERT [x] [y] [z] - Load vertex coordinates
  • STNORM [x] [y] [z] - Set normal vector
  • LDTEX [u] [v] - Load texture coordinates
  • DRAWTRI - Draw triangle using last 3 vertices
  • LDSHADER [type] [source] - Load and compile shader
  • BINGTEX [file] - Bind texture
  • SETTRANS [matrix] - Set transformation matrix
  • SETLIGHT [type] [params...] - Set up lighting
  • SETCAM [eye] [target] - Set camera position and target
  • RENDER - Render frame
  • NEW - Create new program
  • SAVE [filename] - Save current program
  • LOAD [filename] - Load program from file
  • LIST - List current program

Example: Rotating Cube

NEW CLEAR 0 0 0 SETCAM 0,0,5 0,0,0 LDSHADER VERTEX " attribute vec3 position; uniform mat4 mvp; void main() { gl_Position = mvp * vec4(position, 1.0); } " LDSHADER FRAGMENT " void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); } " LABEL LOOP SETTRANS ROTATE_Y TIME*0.001 LDVERT -1 -1 -1 LDVERT 1 -1 -1 LDVERT 1 1 -1 DRAWTRI LDVERT -1 -1 -1 LDVERT 1 1 -1 LDVERT -1 1 -1 DRAWTRI ; ... (repeat for other cube faces) RENDER JUMP LOOP LIST SAVE rotating_cube