Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@arpruss
Created January 5, 2021 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arpruss/3047a35551b58b506c5f60e992b683a3 to your computer and use it in GitHub Desktop.
Save arpruss/3047a35551b58b506c5f60e992b683a3 to your computer and use it in GitHub Desktop.
TIA 0
TIY 0
zeroLoop:
AM
AIY 1
CIY F
JUMP zeroLoop
mainLoop:
TIA 1
TIY -1
DEM+
TIY -7 ; this will take a LONG time in the stock system
MA
CIA 1
JUMP mainLoop
AO
ENDS
END: JUMP END
; 100,000 iterations = 26 sec on fast mode; 1 sec in forkphorus; 0.1 sec in turbowarp
; 7 instructions in main loop
; fast mode: ~27,000 instructions / sec
; forkphorus fast: ~700,000 instructions / sec
; turbowarp fast: ~7,000,000 instructions / sec
; original ran at 400 kHz, 6 cycles per instruction, so at most 66,666 instructions / sec
; but the original ran a VM, so the trainer must have been an order of magnitude faster
; so, in fast mode on Scratch we get better performance than the original
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment