?login_element?

Subversion Repositories NedoOS

Rev

Rev 126 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.     DEVICE ZXSPECTRUMNEXT : SLOT 7 : LABELSLIST "incbin80k.lbl"
  2.     ; incbin80k.bin is from offset 2 letters 'a' to 't' with linux newlines (byte 10)
  3.     ; for each letter, there's 80 of them + newline, repeated 51 times
  4.     ; such one letter block = 51*81 = 4131 bytes (just over 4ki), there's 20 letters
  5.     ; = 82620 bytes (plus 2 bytes at beginning making it "binary" file for git)
  6.  
  7.     ; try short incbin (no paging) first into page 20
  8.     ORG 0xE000
  9.     MMU 7 n, 20
  10. short_start:
  11.     INCBIN "incbin80k/incbin80k.bin",2,81
  12. short_end:
  13.     ASSERT $$ == 20 && $ == 0xE000 + 81
  14.     ASSERT {0xE000} == "aa" && {0xE000+79} == "\na"
  15.  
  16.     ; try 3-page long incbin into pages 21, 22, 23
  17.     MMU 7 n, 21
  18.     ORG 0xE000
  19. p3_start:
  20.     INCBIN "incbin80k/incbin80k.bin",2,81*51*4      ; include four letters (16524 bytes)
  21. p3_end:
  22.     PAGE 21 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb"
  23.     PAGE 22 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb"
  24.     ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc"
  25.     ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd"
  26.     PAGE 23 : ASSERT {0xE000} == "dd" && {0xE000+81*204-0x4000-2} == "\nd"
  27.     ASSERT {0xE000+81*204-0x4000} == 0
  28.  
  29.     ; try error by including beyond device RAM range
  30.     MMU 7, 23       ; reset wrapping behaviour for slot 7, keep page 23
  31. err_start:
  32.     INCBIN "incbin80k/incbin80k.bin",2,81*51*2      ; include two letters (8+ki)
  33. err_end:
  34.  
  35.     ; try full length 80+ki binary include
  36.     MMU 7 n, 30     ; map pages 30, 31, 32, .., 40 (11 pages long)
  37.     ORG 0xE000
  38. long_start:
  39.     INCBIN "incbin80k/incbin80k.bin",2          ; include 20 letters from offset 2
  40. long_end:
  41.     PAGE 30 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb"
  42.     PAGE 31 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb"
  43.     ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc"
  44.     ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd"
  45.     PAGE 32 : ASSERT {0xE000} == "dd" && {0xE000+81*204-0x4000-2} == "\nd"
  46.     ASSERT {0xE000+81*204-0x4000} == "ee" && {0xE000+81*255-0x4000-2} == "\ne"
  47.     PAGE 37 : ASSERT {0xE000} == "nn" && {0xE000+81*51*14-0xE000-2} == "\nn"
  48.     ASSERT {0xE000+81*51*14-0xE000} == "oo" && {0xE000+81*51*15-0xE000-2} == "\no"
  49.     ASSERT {0xE000+81*51*15-0xE000} == "pp" && {0xFFFE} == "pp"
  50.     PAGE 38 : ASSERT {0xE000} == "pp" && {0xE000+81*51*16-0x10000-2} == "\np"
  51.     ASSERT {0xE000+81*51*16-0x10000} == "qq" && {0xE000+81*51*17-0x10000-2} == "\nq"
  52.     ASSERT {0xE000+81*51*17-0x10000} == "rr" && {0xFFFE} == "rr"
  53.     PAGE 40 : ASSERT {0xE000} == "tt" && {0xE000+81*51*20-0x14000-2} == "\nt"
  54.     ASSERT {0xE000+81*51*20-0x14000} == 0 && {0xFFFE} == 0
  55.  
  56.     ; incbin in no-device mode: includes whole file, addressing goes into 16+ bit realm
  57.     DEVICE NONE
  58.     ORG 0xE000
  59. nodevice_start:
  60.     INCBIN "incbin80k/incbin80k.bin",2          ; include 20 letters from offset 2
  61. nodevice_end:                                   ; emits warning about going over 0x10000
  62.  
  63.     ; switch back to ZX Next to produce labels list
  64.     ORG 0 : DEVICE ZXSPECTRUMNEXT   ; slot 7 is still in "wrap", but $ is beyond (error) => org 0 needed
  65.  
  66.     ; one more test of case when even wrapping MMU runs out of next pages
  67.     MMU 7 n, 222                    ; two pages left: 222, 223, try to include 3 pages
  68.     ORG 0xE000
  69. noram_start:                        ; emit error of running out of free memory pages
  70.     INCBIN "incbin80k/incbin80k.bin",2,81*51*4  ; include four letters (16524 bytes)
  71. noram_end:
  72.     PAGE 222 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb"
  73.     PAGE 223 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb"
  74.     ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc"
  75.     ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd"
  76.  
  77.     nop                             ; check error message wording in case of further write
  78.