Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
698B

  1. ( Addressed devices.
  2. Abstractions to read and write to devices that allow addressed
  3. access. At all times, we have one active "fetch" device and
  4. one active "store" device, A@ and A!.
  5. Those words have the same signature as C@ and C!, and in fact,
  6. initially default to proxy of those words.
  7. )
  8. : ADEVMEM+ 0x55 RAM+ @ + ;
  9. : A@* 0 ADEVMEM+ ;
  10. : A!* 2 ADEVMEM+ ;
  11. : ADEV$
  12. H@ 0x55 RAM+ !
  13. 4 ALLOT
  14. ['] C@ A@* !
  15. ['] C! A!* !
  16. ;
  17. : A@ A@* @ EXECUTE ;
  18. : A! A!* @ EXECUTE ;
  19. ( Same as MOVE, but with A@ and A! )
  20. ( src dst u -- )
  21. : AMOVE
  22. ( u ) 0 DO
  23. SWAP DUP I + A@ ( dst src x )
  24. ROT SWAP OVER I + ( src dst x dst )
  25. A! ( src dst )
  26. LOOP
  27. 2DROP
  28. ;