Mirror of CollapseOS
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

37 lignes
577B

  1. ; mmap
  2. ;
  3. ; Block device that maps to memory.
  4. ;
  5. ; *** DEFINES ***
  6. ; MMAP_START: Memory address where the mmap begins
  7. ; Returns absolute addr of memory pointer in HL.
  8. _mmapAddr:
  9. push de
  10. ld de, MMAP_START
  11. add hl, de
  12. jr nc, .end
  13. ; we have carry? out of bounds, set to maximum
  14. ld hl, 0xffff
  15. .end:
  16. pop de
  17. ret
  18. ; if out of bounds, will continually return the last char
  19. ; TODO: add bounds check and return Z accordingly.
  20. mmapGetC:
  21. push hl
  22. call _mmapAddr
  23. ld a, (hl)
  24. cp a ; ensure Z
  25. pop hl
  26. ret
  27. mmapPutC:
  28. push hl
  29. call _mmapAddr
  30. ld (hl), a
  31. cp a ; ensure Z
  32. pop hl
  33. ret