?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. # file opened: mmu.asm
  2.   1   0000              ; DOCS design (happened here, while working on it):
  3.   2   0000              ;
  4.   3   0000              ;     MMU <first slot number> [<last slot number>|<single slot option>], <page number>
  5.   4   0000              ;
  6.   5   0000              ; Maps memory page(s) to slot(s), similar to SLOT + PAGE combination, but allows to set up
  7.   6   0000              ; whole range of consecutive slots (with consecutive memory pages). Or when only single
  8.   7   0000              ; slot is specified, extra option can be used to extend particular slot functionality.
  9.   8   0000              ; The slot behaviour will stay set in the current DEVICE until reset by another MMU
  10.   9   0000              ; specifying same slot (even as part of range, that will clear the option to "default").
  11.  10   0000              ;
  12.  11   0000              ; Single slot option (default state is: no error/warning and no wrap = nothing special):
  13.  12   0000              ;     e = error on writing beyond last byte of slot
  14.  13   0000              ;     w = warning on writing beyond last byte of slot
  15.  14   0000              ;     n = wrap address back to start of slot, map next page
  16.  15   0000              ;
  17.  16   0000
  18.  17   0000                  DEVICE NONE         ; set "none" explicitly, to avoid "global device" feature
  19. mmu.asm(18): warning: MMU is allowed only in real device emulation mode (See DEVICE)
  20.  18   0000                  MMU                 ;; warning about non-device mode
  21.  19   0000                  DEVICE ZXSPECTRUM128
  22.  20   0000
  23.  21   0000                  ;; error messages (parsing test)
  24. mmu.asm(22): error: [MMU] First slot number parsing failed: MMU !
  25.  22   0000                  MMU !
  26. mmu.asm(23): error: [MMU] Second slot number parsing failed: MMU 1
  27.  23   0000                  MMU 1
  28. mmu.asm(24): error: [MMU] Second slot number parsing failed: MMU 1 !
  29.  24   0000                  MMU 1 !
  30. mmu.asm(25): warning: [MMU] Unknown slot option (legal: e, w, n): x
  31. mmu.asm(25): error: [MMU] Comma and page number expected after slot info: MMU 1 x
  32.  25   0000                  MMU 1 x ; white space (or comma) after char to detect it as unknown option
  33. mmu.asm(26): warning: [MMU] Unknown slot option (legal: e, w, n): x,
  34. mmu.asm(26): error: [MMU] Page number parsing failed: MMU 1 x,
  35.  26   0000                  MMU 1 x,
  36. mmu.asm(27): error: [MMU] Comma and page number expected after slot info: MMU 1 1
  37.  27   0000                  MMU 1 1
  38. mmu.asm(28): error: [MMU] Page number parsing failed: MMU 0,
  39.  28   0000                  MMU 0,
  40. mmu.asm(29): error: [MMU] Page number parsing failed: MMU 0 1,
  41.  29   0000                  MMU 0 1,
  42. mmu.asm(30): error: [MMU] Page number parsing failed: MMU 0 e,
  43.  30   0000                  MMU 0 e,
  44. mmu.asm(31): error: [MMU] Page number parsing failed: MMU 0 e,!
  45.  31   0000                  MMU 0 e,!
  46.  32   0000
  47.  33   0000                  ;; correct syntax, invalid arguments
  48. mmu.asm(34): error: [MMU] Requested page(s) must be in range 0..7
  49.  34   0000                  MMU 0,8
  50. mmu.asm(35): error: [MMU] Slot number(s) must be in range 0..3 and form a range
  51.  35   0000                  MMU 4,0
  52. mmu.asm(36): error: [MMU] Slot number(s) must be in range 0..3 and form a range
  53.  36   0000                  MMU 3 4,0
  54. mmu.asm(37): error: [MMU] Requested page(s) must be in range 0..7
  55.  37   0000                  MMU 0 0,8
  56. mmu.asm(38): error: [MMU] Slot number(s) must be in range 0..3 and form a range
  57.  38   0000                  MMU 1 0,0
  58. mmu.asm(39): error: [MMU] Requested page(s) must be in range 0..7
  59.  39   0000                  MMU 0 2,6   ; map pages 6, 7, 8 -> 8 is wrong
  60.  40   0000
  61.  41   0000                  ;; test functionality
  62.  42   0000                  ; set init markers in pages 0, 5, 6 and 7
  63.  43   0000 37 37            DB  "77"
  64.  43   0002                ORG 0xC000
  65.  43   C000 30 30          DB "00"
  66.  43   C002                ORG 0xC000, 5
  67.  43   C000 35 35          DB "55"
  68.  43   C002                ORG 0xC000, 6
  69.  43   C000 36 36          DB "66"
  70.  44   C002                  PAGE 7
  71.  44   C002                ASSERT {0xC000} == "77"
  72.  44   C002                PAGE 6
  73.  44   C002                ASSERT {0xC000} == "66"
  74.  45   C002                  PAGE 5
  75.  45   C002                ASSERT {0xC000} == "55"
  76.  45   C002                PAGE 0
  77.  45   C002                ASSERT {0xC000} == "00"
  78.  46   C002
  79.  47   C002                  ; test simple page-in
  80.  48   C002                  MMU 0, 5
  81.  48   C002                ASSERT {0} == "55"
  82.  49   C002                  MMU 1 3, 5
  83.  49   C002                ASSERT {0x4000} == "55"
  84.  49   C002                ASSERT {0x8000} == "66"
  85.  49   C002                ASSERT {0xC000} == "77"
  86.  50   C002
  87.  51   C002                  ;; test slot options (these are confined to single slot only, not to range)
  88.  52   C002                  ; error option (guarding machine code write outside of current slot)
  89.  53   C002                  MMU 1 e, 5
  90.  53   C002                ASSERT {0x4000} == "55"
  91.  54   C002                  ORG 0x7FFF
  92. mmu.asm(54): error: Write outside of memory slot: 32768
  93.  54   7FFF 36 73          ld (hl),'s'   ; should be error, 2B opcode leaving slot memory
  94.  55   8001                  ASSERT {0x8000} == "6s"     ; but damage is done in the virtual memory, that's how it is
  95.  56   8001                  ; while escaping from slot through ORG should be legal
  96.  57   8001                  ORG 0x7FFF
  97.  57   7FFF 00             nop
  98.  57   8000                ORG 0x8000
  99.  57   8000 36 36          DB "66"
  100.  58   8002                  ; changing page within tainted slot will keep the guarding ON
  101.  59   8002                  SLOT 1
  102.  59   8002                PAGE 6
  103.  59   8002                ASSERT {0x4000} == "66"           ; map page 6 also into slot 1
  104.  60   8002                  ORG 0x7FFF
  105. mmu.asm(60): error: Write outside of memory slot: 32768
  106.  60   7FFF 36 73          ld (hl),'s'
  107.  60   8001                ASSERT {0x8000} == "6s" ; error + damage check
  108.  61   8001
  109.  62   8001                  ; verify clearing option by another MMU
  110.  63   8001                  MMU 1, 5
  111.  63   8001                ASSERT {0x4000} == "55"
  112.  64   8001                  ORG 0x7FFF
  113.  64   7FFF 36 36          ld (hl),'6'
  114.  64   8001                ASSERT {0x8000} == "66" ; no error
  115.  65   8001
  116.  66   8001                  ; warning option (guarding machine code write outside of current slot)
  117.  67   8001                  MMU 1 w, 5
  118.  67   8001                ASSERT {0x4000} == "55"
  119.  68   8001                  ORG 0x7FFF
  120. mmu.asm(68): warning: Write outside of memory slot
  121.  68   7FFF 36 73          ld (hl),'s'   ; should be warning, 2B opcode leaving slot memory
  122.  69   8001                  ASSERT {0x8000} == "6s"     ; but damage is done in the virtual memory, that's how it is
  123.  70   8001                  ; while escaping from slot through ORG should be legal
  124.  71   8001                  ORG 0x7FFF
  125.  71   7FFF 00             nop
  126.  71   8000                ORG 0x8000
  127.  71   8000 36 36          DB "66"
  128.  72   8002                  ; changing page within tainted slot will keep the guarding ON
  129.  73   8002                  SLOT 1
  130.  73   8002                PAGE 6
  131.  73   8002                ASSERT {0x4000} == "66"           ; map page 6 also into slot 1
  132.  74   8002                  ORG 0x7FFF
  133. mmu.asm(74): warning: Write outside of memory slot
  134.  74   7FFF 36 73          ld (hl),'s'
  135.  74   8001                ASSERT {0x8000} == "6s" ; warning + damage check
  136.  75   8001
  137.  76   8001                  ; verify clearing option by another MMU when the slot is part of range
  138.  77   8001                  MMU 0 2, 5
  139.  77   8001                ASSERT {0x4000} == "6s"
  140.  78   8001                  ORG 0x7FFF
  141.  78   7FFF 36 37          ld (hl),'7'
  142.  78   8001                ASSERT {0x8000} == "77" ; no warning
  143.  79   8001
  144.  80   8001                  ; next option making the memory wrap, automatically mapping in next page
  145.  81   8001                  MMU 1 n, 2
  146.  82   8001                  ORG 0x4000
  147.  82   4000 6E 6E 6E...    BLOCK 3*16384, 'n' ; fill pages 2, 3 and 4 with 'n'
  148.  83   4000                  ASSERT {0x4000} == "55" && {0x8000} == "77" ; page 5 is mapped in after that block
  149.  84   4000                  SLOT 1                      ; verify the block write
  150.  85   4000                  PAGE 2
  151.  85   4000                ASSERT {0x4000} == "nn"
  152.  86   4000                  PAGE 3
  153.  86   4000                ASSERT {0x4000} == "nn"
  154.  87   4000                  PAGE 4
  155.  87   4000                ASSERT {0x4000} == "nn"
  156.  88   4000
  157.  89   4000                  ; do the wrap-around test with instructions, watch labels land into different pages
  158.  90   4000                  MMU 1 n, 4
  159.  91   4000