                             ;
                             ; +-------------------------------------------------------------------------+
                             ; ¦                                                                         ¦
                             ; ¦                             B R E C F 6 4 4                             ¦
                             ; ¦                                                                         ¦
                             ; +--------------------------------------------------------------------wiRe-+
                             ;
                             ; ---------------------------------------------------------------------------
                             ; filename    : brecf644.bin
                             ; format      : binary file
                             ; baseaddress :     h
                             ; range       :     h - 4000h
                             ; length      : 4000h
                             ; processor   : z80 []
                             ; assembler   : Zilog Macro Assembler
                             ; ---------------------------------------------------------------------------
                             ;

                                             include "ports.inc"
                                             include "system.inc"

                                             ; segment type: pure code
                                             segment ROM


0000                         ; ---------------------------------------------------------------------------
0000                         ; ||| entry point (0000h..0003h) ||||||||||||||||||||||||||||||||||||||||||||
0000                         ; ---------------------------------------------------------------------------
0000 C3 00 02                ENTRY:          jp      main
0003 00                                      nop


0004                         ; ---------------------------------------------------------------------------
0004                         ; ||| file header (0004h..007Fh) ||||||||||||||||||||||||||||||||||||||||||||
0004                         ; ---------------------------------------------------------------------------
0004 42                      HEADER:         db      "BRECF644"
000C 30                                      db      30h, 30h, 20h, 04h, 11h, 04h
0012                                         org     0080h


0080                         ; ---------------------------------------------------------------------------
0080                         ; ||| stack (0080h..01FFh) ||||||||||||||||||||||||||||||||||||||||||||||||||
0080                         ; ---------------------------------------------------------------------------
0080                         byte_80:        db  0  ; flags for each detected nand device
0081                         byte_81:        db  0  ; get only written to
0082                         byte_82:        db  0
0083                         byte_83:        db  0
0084                                         db  0,0,0,0
0088                         nand_tbl:       db  6*2 dup(0)   ; 6 possible nand devices, 2 bytes for each

0094                                         define  STACK_SIZE 0180h - 14h
0094 00                      STACK:          db      STACK_SIZE dup(0)




0200                         ; ---------------------------------------------------------------------------
0200                         ; ||| main ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
0200                         ; ---------------------------------------------------------------------------
0200                         main:
0200 31 00 02                                ld      sp, STACK + STACK_SIZE   ;setup stack

0203 DB DF                                   in      a, (POWER_CONTROL_REG)   ;select 200kHz DCOP CLK (75%)
0205 F6 01                                   or      1
0207 D3 DF                                   out     (POWER_CONTROL_REG), a

0209 CD 21 27                                call    sub_2721
020C CD 16 02                                call    sub_216

020F 31 00 04                                ld      sp, 400h                 ;setup larger stack
0212 C3 00 06                                jp      sub_600
0212                         ; ---------------------------------------------------------------------------




0216
0216                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0216
0216
0216                         sub_216:                                ; CODE XREF: sub_2721-2515p
0216 C5                                      push    bc
0217 D5                                      push    de
0218 DD E5                                   push    ix
021A DD 21 00 00                             ld      ix, 0
021E DD 39                                   add     ix, sp
0220 D5                                      push    de
0221 1E 00                                   ld      e, 0
0223 CD D7 03                                call    sub_3D7
0226 D1                                      pop     de
0227 CD 3A 02                                call    sub_23A
022A 4F                                      ld      c, a
022B 06 00                                   ld      b, 0
022D 59                                      ld      e, c
022E 50                                      ld      d, b
022F CD D6 03                                call    nullsub_1
0232 79                                      ld      a, c
0233 DD F9                                   ld      sp, ix
0235 DD E1                                   pop     ix
0237 D1                                      pop     de
0238 C1                                      pop     bc
0239 C9                                      ret
0239                         ; End of function sub_216
0239
023A
023A                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
023A
023A
023A                         sub_23A:                                ; CODE XREF: sub_216+11p
023A C5                                      push    bc
023B D5                                      push    de
023C DD E5                                   push    ix
023E DD 21 00 00                             ld      ix, 0
0242 DD 39                                   add     ix, sp
0244 F5                                      push    af
0245 01 00 00                                ld      bc, 0
0248 21 00 02                                ld      hl, 200h
024B 22 7D 03                                ld      (word_37D), hl
024E ED 43 7F 03                             ld      (word_37F), bc
0252 21 85 03                                ld      hl, 385h
0255 22 82 03                                ld      (word_382), hl
0258 3E 08                                   ld      a, 8
025A 32 84 03                                ld      (byte_384), a
025D
025D                         loc_25D:                                ; CODE XREF: sub_23A+136j
025D 01 20 00                                ld      bc, 20h ; ' '
0260 11 7D 03                                ld      de, 37Dh
0263 CD 25 3F                                call    sub_3F25
0266 B7                                      or      a
0267 CA 73 03                                jp      z, loc_373
026A 3A 85 03                                ld      a, (byte_385)
026D B7                                      or      a
026E CA 73 03                                jp      z, loc_373
0271 3A 85 03                                ld      a, (byte_385)
0274 FE 53                                   cp      'S'
0276 C2 64 03                                jp      nz, loc_364
0279 3A 86 03                                ld      a, (byte_386)
027C FE 59                                   cp      'Y'
027E C2 64 03                                jp      nz, loc_364
0281 3A 87 03                                ld      a, (byte_387)
0284 FE 53                                   cp      'S'
0286 C2 64 03                                jp      nz, loc_364
0289 3A 88 03                                ld      a, (byte_388)
028C FE 43                                   cp      'C'
028E C2 64 03                                jp      nz, loc_364
0291 3A 89 03                                ld      a, (byte_389)
0294 FE 46                                   cp      'F'
0296 C2 64 03                                jp      nz, loc_364
0299 3A 8A 03                                ld      a, (byte_38A)
029C FE 47                                   cp      'G'
029E C2 64 03                                jp      nz, loc_364
02A1 3A 8B 03                                ld      a, (byte_38B)
02A4 FE 20                                   cp      ' '
02A6 C2 64 03                                jp      nz, loc_364
02A9 3A 8C 03                                ld      a, (byte_38C)
02AC FE 20                                   cp      ' '
02AE C2 64 03                                jp      nz, loc_364
02B1 3A 8D 03                                ld      a, (byte_38D)
02B4 FE 53                                   cp      'S'
02B6 C2 64 03                                jp      nz, loc_364
02B9 3A 8E 03                                ld      a, (byte_38E)
02BC FE 59                                   cp      'Y'
02BE C2 64 03                                jp      nz, loc_364
02C1 3A 8F 03                                ld      a, (byte_38F)
02C4 FE 53                                   cp      'S'
02C6 C2 64 03                                jp      nz, loc_364
02C9 21 95 03                                ld      hl, 395h
02CC 5E                                      ld      e, (hl)
02CD 23                                      inc     hl
02CE 56                                      ld      d, (hl)
02CF 23                                      inc     hl
02D0 4E                                      ld      c, (hl)
02D1 23                                      inc     hl
02D2 46                                      ld      b, (hl)
02D3 EB                                      ex      de, hl
02D4 3E 09                                   ld      a, 9
02D6 CD A5 03                                call    sub_3A5
02D9 22 7D 03                                ld      (word_37D), hl
02DC ED 43 7F 03                             ld      (word_37F), bc
02E0 21 00 06                                ld      hl, 600h
02E3 22 82 03                                ld      (word_382), hl
02E6 3E 08                                   ld      a, 8
02E8 32 84 03                                ld      (byte_384), a
02EB AF                                      xor     a
02EC DD 77 FE                                ld      (ix+0FEh), a
02EF DD 77 FF                                ld      (ix+0FFh), a
02F2
02F2                         loc_2F2:                                ; CODE XREF: sub_23A+EFj
02F2                                                                 ; sub_23A+F4j
02F2 01 16 80                                ld      bc, 8016h
02F5 DD 6E FE                                ld      l, (ix+0FEh)
02F8 DD 66 FF                                ld      h, (ix+0FFh)
02FB 3E 80                                   ld      a, 80h ; 'Ç'
02FD AC                                      xor     h
02FE 67                                      ld      h, a
02FF ED 42                                   sbc     hl, bc
0301 30 2D                                   jr      nc, loc_330
0303 01 00 02                                ld      bc, 200h
0306 11 7D 03                                ld      de, 37Dh
0309 CD 25 3F                                call    sub_3F25
030C B7                                      or      a
030D 20 03                                   jr      nz, loc_312
030F AF                                      xor     a
0310 18 62                                   jr      loc_374
0312                         ; ---------------------------------------------------------------------------
0312
0312                         loc_312:                                ; CODE XREF: sub_23A+D3j
0312 21 82 03                                ld      hl, 382h
0315 3E 02                                   ld      a, 2
0317 23                                      inc     hl
0318 86                                      add     a, (hl)
0319 77                                      ld      (hl), a
031A 21 7D 03                                ld      hl, 37Dh
031D 01 00 00                                ld      bc, 0
0320 11 00 02                                ld      de, 200h
0323 CD BD 03                                call    sub_3BD
0326 DD 34 FE                                inc     (ix+0FEh)
0329 20 C7                                   jr      nz, loc_2F2
032B DD 34 FF                                inc     (ix+0FFh)
032E 18 C2                                   jr      loc_2F2
0330                         ; ---------------------------------------------------------------------------
0330
0330                         loc_330:                                ; CODE XREF: sub_23A+C7j
0330 01 00 01                                ld      bc, 100h
0333 11 7D 03                                ld      de, 37Dh
0336 CD 25 3F                                call    sub_3F25
0339 B7                                      or      a
033A 20 03                                   jr      nz, loc_33F
033C AF                                      xor     a
033D 18 35                                   jr      loc_374
033F                         ; ---------------------------------------------------------------------------
033F
033F                         loc_33F:                                ; CODE XREF: sub_23A+100j
033F 21 7D 03                                ld      hl, 37Dh
0342 01 00 00                                ld      bc, 0
0345 11 00 0B                                ld      de, 0B00h
0348 CD BD 03                                call    sub_3BD
034B 21 00 00                                ld      hl, 0
034E 22 82 03                                ld      (word_382), hl
0351 01 80 00                                ld      bc, 80h
0354 11 7D 03                                ld      de, 37Dh
0357 CD 25 3F                                call    sub_3F25
035A B7                                      or      a
035B 20 03                                   jr      nz, loc_360
035D AF                                      xor     a
035E 18 14                                   jr      loc_374
0360                         ; ---------------------------------------------------------------------------
0360
0360                         loc_360:                                ; CODE XREF: sub_23A+121j
0360 3E 01                                   ld      a, 1
0362 18 10                                   jr      loc_374
0364                         ; ---------------------------------------------------------------------------
0364
0364                         loc_364:                                ; CODE XREF: sub_23A+3Cj
0364                                                                 ; sub_23A+44j ...
0364 21 7D 03                                ld      hl, 37Dh
0367 01 00 00                                ld      bc, 0
036A 11 20 00                                ld      de, 20h ; ' '
036D CD BD 03                                call    sub_3BD
0370 C3 5D 02                                jp      loc_25D
0373                         ; ---------------------------------------------------------------------------
0373
0373                         loc_373:                                ; CODE XREF: sub_23A+2Dj
0373                                                                 ; sub_23A+34j
0373 AF                                      xor     a
0374
0374                         loc_374:                                ; CODE XREF: sub_23A+D6j
0374                                                                 ; sub_23A+103j ...
0374 DD F9                                   ld      sp, ix
0376 DD E1                                   pop     ix
0378 D1                                      pop     de
0379 C1                                      pop     bc
037A C9                                      ret
037A                         ; End of function sub_23A



037A
037A                         ; ---------------------------------------------------------------------------
037B 00                                      db    0,0

037D 76 76                   word_37D:       dw ?
037F 76 76                   word_37F:       dw ?
0381 76                                      db ?
0382 76 76                   word_382:       dw ?
0384 76                      byte_384:       db ?
0385 76                      byte_385:       db ?
0386 76                      byte_386:       db ?
0387 76                      byte_387:       db ?
0388 76                      byte_388:       db ?
0389 76                      byte_389:       db ?
038A 76                      byte_38A:       db ?
038B 76                      byte_38B:       db ?
038C 76                      byte_38C:       db ?
038D 76                      byte_38D:       db ?
038E 76                      byte_38E:       db ?
038F 76                      byte_38F:       db ?
0390 76                                      db  21 dup(?)



03A5                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
03A5
03A5
03A5                         sub_3A5:                                ; CODE XREF: sub_23A+9Cp
03A5 B7                                      or      a
03A6
03A6                         loc_3A6:                                ; CODE XREF: sub_3A5+Dj
03A6 C8                                      ret     z
03A7 FE 08                                   cp      8
03A9 38 09                                   jr      c, loc_3B4
03AB 41                                      ld      b, c
03AC 4C                                      ld      c, h
03AD 65                                      ld      h, l
03AE 2E 00                                   ld      l, 0
03B0 D6 08                                   sub     8
03B2 18 F2                                   jr      loc_3A6
03B4                         ; ---------------------------------------------------------------------------
03B4
03B4                         loc_3B4:                                ; CODE XREF: sub_3A5+4j
03B4                                                                 ; sub_3A5+15j
03B4 29                                      add     hl, hl
03B5 CB 11                                   rl      c
03B7 CB 10                                   rl      b
03B9 3D                                      dec     a
03BA 20 F8                                   jr      nz, loc_3B4
03BC C9                                      ret
03BC                         ; End of function sub_3A5
03BC
03BD
03BD                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
03BD
03BD
03BD                         sub_3BD:                                ; CODE XREF: sub_23A+E9p
03BD                                                                 ; sub_23A+10Ep ...
03BD F5                                      push    af
03BE 7E                                      ld      a, (hl)
03BF 83                                      add     a, e
03C0 77                                      ld      (hl), a
03C1 5F                                      ld      e, a
03C2 23                                      inc     hl
03C3 7E                                      ld      a, (hl)
03C4 8A                                      adc     a, d
03C5 77                                      ld      (hl), a
03C6 57                                      ld      d, a
03C7 23                                      inc     hl
03C8 7E                                      ld      a, (hl)
03C9 89                                      adc     a, c
03CA 77                                      ld      (hl), a
03CB 4F                                      ld      c, a
03CC 23                                      inc     hl
03CD 7E                                      ld      a, (hl)
03CE 88                                      adc     a, b
03CF 77                                      ld      (hl), a
03D0 47                                      ld      b, a
03D1 2B                                      dec     hl
03D2 2B                                      dec     hl
03D3 2B                                      dec     hl
03D4 F1                                      pop     af
03D5 C9                                      ret
03D5                         ; End of function sub_3BD
03D5
03D6                         nullsub_1:      ret
03D7
03D7                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
03D7
03D7
03D7                         sub_3D7:                                ; CODE XREF: sub_216+Dp
03D7 06 01                                   ld      b, 1
03D9 CD 2A 3F                                call    nand_init
03DC 21 FA 07                                ld      hl, 7FAh
03DF 22 80 3A                                ld      (word_3A80), hl
03E2 21 07 00                                ld      hl, 7
03E5 22 82 3A                                ld      (word_3A82), hl
03E8 2E 00                                   ld      l, 0
03EA 22 84 3A                                ld      (word_3A84), hl
03ED 26 01                                   ld      h, 1
03EF 22 86 3A                                ld      (word_3A86), hl
03F2 21 80 3A                                ld      hl, 3A80h
03F5 CD D0 3E                                call    sub_3ED0
03F8 AF                                      xor     a
03F9 06 06                                   ld      b, 6
03FB
03FB                         loc_3FB:                                ; CODE XREF: sub_3D7+27j
03FB 29                                      add     hl, hl
03FC CE 00                                   adc     a, 0
03FE 10 FB                                   djnz    loc_3FB
0400 11 20 00                                ld      de, 20h ; ' '
0403 19                                      add     hl, de
0404 22 8A 3A                                ld      (word_3A8A), hl
0407 32 8C 3A                                ld      (byte_3A8C), a
040A CD 4E 3F                                call    nand_deinit
040D 3E 01                                   ld      a, 1
040F C9                                      ret
040F                         ; End of function sub_3D7
040F
040F                         ; ---------------------------------------------------------------------------




0410 76                                      org 0600h
0600
0600                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0600
0600
0600                         sub_600:                                ; CODE XREF: sub_2721-250Fj
0600                                                                 ; sub_2721+1Ap
0600 00                                      nop
0601 06 00                                   ld      b, 0
0603 CD BA 29                                call    sub_29BA
0606
0606                         loc_606:                                ; CODE XREF: sub_600+58j
0606                                                                 ; sub_600+6Aj
0606 11 00 00                                ld      de, 0
0609 CD AB 06                                call    sub_6AB
060C A7                                      and     a
060D 20 33                                   jr      nz, loc_642
060F 2A ED 1A                                ld      hl, (word_1AED)
0612 22 F1 1A                                ld      (word_1AF1), hl
0615 2A EF 1A                                ld      hl, (word_1AEF)
0618 22 F3 1A                                ld      (word_1AF3), hl
061B 11 00 18                                ld      de, 1800h
061E CD AB 06                                call    sub_6AB
0621 A7                                      and     a
0622 20 37                                   jr      nz, loc_65B
0624 2A F1 1A                                ld      hl, (word_1AF1)
0627 ED 5B ED 1A                             ld      de, (word_1AED)
062B AF                                      xor     a
062C ED 52                                   sbc     hl, de
062E 7D                                      ld      a, l
062F B4                                      or      h
0630 20 29                                   jr      nz, loc_65B
0632 2A F3 1A                                ld      hl, (word_1AF3)
0635 ED 5B EF 1A                             ld      de, (word_1AEF)
0639 AF                                      xor     a
063A ED 52                                   sbc     hl, de
063C 7D                                      ld      a, l
063D B4                                      or      h
063E 20 1B                                   jr      nz, loc_65B
0640 18 2B                                   jr      loc_66D
0642                         ; ---------------------------------------------------------------------------
0642
0642                         loc_642:                                ; CODE XREF: sub_600+Dj
0642 11 00 18                                ld      de, 1800h
0645 CD AB 06                                call    sub_6AB
0648 A7                                      and     a
0649 C2 6D 06                                jp      nz, loc_66D
064C 21 00 18                                ld      hl, 1800h
064F 11 00 00                                ld      de, 0
0652 01 00 18                                ld      bc, 1800h
0655 CD AF 08                                call    sub_8AF
0658 C3 06 06                                jp      loc_606
065B                         ; ---------------------------------------------------------------------------
065B
065B                         loc_65B:                                ; CODE XREF: sub_600+22j
065B                                                                 ; sub_600+30j ...
065B CD 73 06                                call    sub_673
065E 21 00 00                                ld      hl, 0
0661 11 00 18                                ld      de, 1800h
0664 01 00 18                                ld      bc, 1800h
0667 CD AF 08                                call    sub_8AF
066A C3 06 06                                jp      loc_606
066D                         ; ---------------------------------------------------------------------------
066D
066D                         loc_66D:                                ; CODE XREF: sub_600+40j
066D                                                                 ; sub_600+49j
066D F5                                      push    af
066E CD 1F 29                                call    sub_291F
0671 F1                                      pop     af
0672 C9                                      ret
0672                         ; End of function sub_600
0672
0673
0673                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0673
0673
0673                         sub_673:                                ; CODE XREF: sub_600:loc_65Bp
0673 3E FF                                   ld      a, 0FFh
0675 06 00                                   ld      b, 0
0677 21 F5 1A                                ld      hl, 1AF5h
067A
067A                         loc_67A:                                ; CODE XREF: sub_673+Bj
067A 77                                      ld      (hl), a
067B 23                                      inc     hl
067C 77                                      ld      (hl), a
067D 23                                      inc     hl
067E 10 FA                                   djnz    loc_67A
0680 21 00 30                                ld      hl, 3000h
0683 22 F9 1E                                ld      (word_1EF9), hl
0686 21 00 00                                ld      hl, 0
0689 22 FB 1E                                ld      (word_1EFB), hl
068C 21 F5 1A                                ld      hl, 1AF5h
068F 22 FE 1E                                ld      (word_1EFE), hl
0692 3E 08                                   ld      a, 8
0694 32 00 1F                                ld      (byte_1F00), a
0697 06 80                                   ld      b, 80h ; 'Ç'
0699
0699                         loc_699:                                ; CODE XREF: sub_673+35j
0699 C5                                      push    bc
069A 11 F9 1E                                ld      de, 1EF9h
069D CD 6C 2B                                call    sub_2B6C
06A0 2A F9 1E                                ld      hl, (word_1EF9)
06A3 23                                      inc     hl
06A4 22 F9 1E                                ld      (word_1EF9), hl
06A7 C1                                      pop     bc
06A8 10 EF                                   djnz    loc_699
06AA C9                                      ret
06AA                         ; End of function sub_673
06AA
06AB
06AB                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
06AB
06AB
06AB                         sub_6AB:                                ; CODE XREF: sub_600+9p
06AB                                                                 ; sub_600+1Ep ...
06AB ED 53 EB 1A                             ld      (word_1AEB), de
06AF 21 00 00                                ld      hl, 0
06B2 22 01 1F                                ld      (word_1F01), hl
06B5 22 03 1F                                ld      (word_1F03), hl
06B8 21 F5 1C                                ld      hl, 1CF5h
06BB 22 06 1F                                ld      (word_1F06), hl
06BE 3E 08                                   ld      a, 8
06C0 32 08 1F                                ld      (byte_1F08), a
06C3 11 01 1F                                ld      de, 1F01h
06C6 CD F5 2A                                call    sub_2AF5
06C9 2A F9 1C                                ld      hl, (word_1CF9)
06CC 22 ED 1A                                ld      (word_1AED), hl
06CF 2A FB 1C                                ld      hl, (word_1CFB)
06D2 22 EF 1A                                ld      (word_1AEF), hl
06D5 3A F5 1C                                ld      a, (byte_1CF5)
06D8 FE 55                                   cp      55h                            ; compare header of firmware image (fwi)
06DA C2 EF 07                                jp      nz, loc_7EF
06DD 3A F6 1C                                ld      a, (byte_1CF6)
06E0 FE AA                                   cp      0AAh                           ;...
06E2 C2 EF 07                                jp      nz, loc_7EF
06E5 3A F7 1C                                ld      a, (byte_1CF7)
06E8 FE F0                                   cp      0F0h                           ;...
06EA C2 EF 07                                jp      nz, loc_7EF
06ED 3A F8 1C                                ld      a, (byte_1CF8)
06F0 FE 0F                                   cp      0Fh                            ;...
06F2 C2 EF 07                                jp      nz, loc_7EF

06F5 DD 21 F5 1C                             ld      ix, 1CF5h                      ;found correct fwi header!
06F9 21 00 00                                ld      hl, 0
06FC 3E FF                                   ld      a, 0FFh
06FE
06FE                         loc_6FE:                                ; CODE XREF: sub_6AB+5Fj
06FE DD 5E 00                                ld      e, (ix+0)
0701 DD 23                                   inc     ix
0703 DD 56 00                                ld      d, (ix+0)
0706 DD 23                                   inc     ix
0708 19                                      add     hl, de
0709 3D                                      dec     a
070A 20 F2                                   jr      nz, loc_6FE
070C DD 5E 00                                ld      e, (ix+0)
070F DD 56 01                                ld      d, (ix+1)
0712 AF                                      xor     a
0713 ED 52                                   sbc     hl, de
0715 7D                                      ld      a, l
0716 B4                                      or      h
0717 C2 EF 07                                jp      nz, loc_7EF
071A 2A 05 1D                                ld      hl, (word_1D05)
071D 22 F5 1E                                ld      (word_1EF5), hl
0720 2A 07 1D                                ld      hl, (word_1D07)
0723 22 F7 1E                                ld      (word_1EF7), hl
0726 21 00 00                                ld      hl, 0
0729 22 E3 1A                                ld      (word_1AE3), hl
072C 22 E5 1A                                ld      (word_1AE5), hl
072F 22 E7 1A                                ld      (word_1AE7), hl
0732 22 E9 1A                                ld      (word_1AE9), hl
0735 2A EB 1A                                ld      hl, (word_1AEB)
0738 22 01 1F                                ld      (word_1F01), hl
073B 06 0F                                   ld      b, 0Fh
073D
073D                         loc_73D:                                ; CODE XREF: sub_6AB+CEj
073D C5                                      push    bc
073E 2A 01 1F                                ld      hl, (word_1F01)
0741 23                                      inc     hl
0742 22 01 1F                                ld      (word_1F01), hl
0745 21 F5 1C                                ld      hl, 1CF5h
0748 22 06 1F                                ld      (word_1F06), hl
074B 11 01 1F                                ld      de, 1F01h
074E CD F5 2A                                call    sub_2AF5
0751 21 F5 1C                                ld      hl, 1CF5h
0754 06 80                                   ld      b, 80h ; 'Ç'
0756
0756                         loc_756:                                ; CODE XREF: sub_6AB+CBj
0756 3A E3 1A                                ld      a, (word_1AE3)
0759 86                                      add     a, (hl)
075A 23                                      inc     hl
075B 32 E3 1A                                ld      (word_1AE3), a
075E 3A E4 1A                                ld      a, (word_1AE3+1)
0761 8E                                      adc     a, (hl)
0762 23                                      inc     hl
0763 32 E4 1A                                ld      (word_1AE3+1), a
0766 3A E5 1A                                ld      a, (word_1AE5)
0769 8E                                      adc     a, (hl)
076A 23                                      inc     hl
076B 32 E5 1A                                ld      (word_1AE5), a
076E 3A E6 1A                                ld      a, (word_1AE5+1)
0771 8E                                      adc     a, (hl)
0772 23                                      inc     hl
0773 32 E6 1A                                ld      (word_1AE5+1), a
0776 10 DE                                   djnz    loc_756
0778 C1                                      pop     bc
0779 10 C2                                   djnz    loc_73D
077B 2A F5 1E                                ld      hl, (word_1EF5)
077E ED 5B E3 1A                             ld      de, (word_1AE3)
0782 AF                                      xor     a
0783 ED 52                                   sbc     hl, de
0785 C2 EF 07                                jp      nz, loc_7EF
0788 2A F7 1E                                ld      hl, (word_1EF7)
078B ED 5B E5 1A                             ld      de, (word_1AE5)
078F AF                                      xor     a
0790 ED 52                                   sbc     hl, de
0792 20 5B                                   jr      nz, loc_7EF
0794 22 E7 1A                                ld      (word_1AE7), hl
0797 22 E9 1A                                ld      (word_1AE9), hl
079A 2A EB 1A                                ld      hl, (word_1AEB)
079D 22 01 1F                                ld      (word_1F01), hl
07A0
07A0                         loc_7A0:                                ; CODE XREF: sub_6AB+13Bj
07A0 2A 01 1F                                ld      hl, (word_1F01)
07A3 23                                      inc     hl
07A4 22 01 1F                                ld      (word_1F01), hl
07A7 21 F5 1C                                ld      hl, 1CF5h
07AA 22 06 1F                                ld      (word_1F06), hl
07AD 11 01 1F                                ld      de, 1F01h
07B0 CD F5 2A                                call    sub_2AF5
07B3 06 10                                   ld      b, 10h
07B5 21 F5 1C                                ld      hl, 1CF5h
07B8
07B8                         loc_7B8:                                ; CODE XREF: sub_6AB+139j
07B8 C5                                      push    bc
07B9 11 C3 1A                                ld      de, 1AC3h
07BC 01 20 00                                ld      bc, 20h ; ' '
07BF ED B0                                   ldir
07C1 3A C3 1A                                ld      a, (byte_1AC3)
07C4 A7                                      and     a
07C5 CA ED 07                                jp      z, loc_7ED
07C8 E5                                      push    hl
07C9 2A D3 1A                                ld      hl, (word_1AD3)
07CC ED 5B EB 1A                             ld      de, (word_1AEB)
07D0 AF                                      xor     a
07D1 ED 5A                                   adc     hl, de
07D3 22 D3 1A                                ld      (word_1AD3), hl
07D6 E1                                      pop     hl
07D7 DB 4E                                   in      a, (WATCHDOG_REG)
07D9 F6 08                                   or      8
07DB D3 4E                                   out     (WATCHDOG_REG), a
07DD CD F2 07                                call    sub_7F2
07E0 A7                                      and     a
07E1 20 06                                   jr      nz, loc_7E9
07E3 C1                                      pop     bc
07E4 10 D2                                   djnz    loc_7B8
07E6 C3 A0 07                                jp      loc_7A0
07E9                         ; ---------------------------------------------------------------------------
07E9
07E9                         loc_7E9:                                ; CODE XREF: sub_6AB+136j
07E9 3E 01                                   ld      a, 1
07EB C1                                      pop     bc
07EC C9                                      ret
07ED                         ; ---------------------------------------------------------------------------
07ED
07ED                         loc_7ED:                                ; CODE XREF: sub_6AB+11Aj
07ED C1                                      pop     bc
07EE C9                                      ret
07EF                         ; ---------------------------------------------------------------------------
07EF
07EF                         loc_7EF:                                ; CODE XREF: sub_6AB+2Fj
07EF                                                                 ; sub_6AB+37j ...
07EF 3E 01                                   ld      a, 1
07F1 C9                                      ret
07F1                         ; End of function sub_6AB
07F1
07F2
07F2                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
07F2
07F2
07F2                         sub_7F2:                                ; CODE XREF: sub_6AB+132p
07F2 C5                                      push    bc
07F3 D5                                      push    de
07F4 E5                                      push    hl
07F5 DD E5                                   push    ix
07F7 21 00 00                                ld      hl, 0
07FA 22 E7 1A                                ld      (word_1AE7), hl
07FD 22 E9 1A                                ld      (word_1AE9), hl
0800 2A D3 1A                                ld      hl, (word_1AD3)
0803 22 F9 1E                                ld      (word_1EF9), hl
0806 2A D5 1A                                ld      hl, (word_1AD5)
0809 22 FB 1E                                ld      (word_1EFB), hl
080C 21 F5 1A                                ld      hl, 1AF5h
080F 22 FE 1E                                ld      (word_1EFE), hl
0812 3E 08                                   ld      a, 8
0814 32 00 1F                                ld      (byte_1F00), a
0817 ED 4B D8 1A                             ld      bc, (word_1AD8)
081B
081B                         loc_81B:                                ; CODE XREF: sub_7F2+42j
081B C5                                      push    bc
081C 11 F9 1E                                ld      de, 1EF9h
081F CD F5 2A                                call    sub_2AF5
0822 2A F9 1E                                ld      hl, (word_1EF9)
0825 23                                      inc     hl
0826 22 F9 1E                                ld      (word_1EF9), hl
0829 21 F5 1A                                ld      hl, 1AF5h
082C CD 56 08                                call    sub_856
082F C1                                      pop     bc
0830 0B                                      dec     bc
0831 0B                                      dec     bc
0832 78                                      ld      a, b
0833 B1                                      or      c
0834 20 E5                                   jr      nz, loc_81B
0836 2A DF 1A                                ld      hl, (word_1ADF)
0839 ED 5B E7 1A                             ld      de, (word_1AE7)
083D AF                                      xor     a
083E ED 52                                   sbc     hl, de
0840 20 0C                                   jr      nz, loc_84E
0842 2A E1 1A                                ld      hl, (word_1AE1)
0845 ED 5B E9 1A                             ld      de, (word_1AE9)
0849 AF                                      xor     a
084A ED 52                                   sbc     hl, de
084C 28 02                                   jr      z, loc_850
084E
084E                         loc_84E:                                ; CODE XREF: sub_7F2+4Ej
084E 3E 01                                   ld      a, 1
0850
0850                         loc_850:                                ; CODE XREF: sub_7F2+5Aj
0850 DD E1                                   pop     ix
0852 E1                                      pop     hl
0853 D1                                      pop     de
0854 C1                                      pop     bc
0855 C9                                      ret
0855                         ; End of function sub_7F2
0855
0856
0856                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0856
0856
0856                         sub_856:                                ; CODE XREF: sub_7F2+3Ap
0856 C5                                      push    bc
0857 D5                                      push    de
0858 E5                                      push    hl
0859 FD E5                                   push    iy
085B FD 2A E7 1A                             ld      iy, (word_1AE7)
085F ED 5B E9 1A                             ld      de, (word_1AE9)
0863 06 20                                   ld      b, 20h ; ' '
0865
0865                         loc_865:                                ; CODE XREF: sub_856+49j
0865 C5                                      push    bc
0866 4E                                      ld      c, (hl)
0867 23                                      inc     hl
0868 46                                      ld      b, (hl)
0869 23                                      inc     hl
086A FD 09                                   add     iy, bc
086C 4E                                      ld      c, (hl)
086D 23                                      inc     hl
086E 46                                      ld      b, (hl)
086F 23                                      inc     hl
0870 EB                                      ex      de, hl
0871 ED 4A                                   adc     hl, bc
0873 EB                                      ex      de, hl
0874 4E                                      ld      c, (hl)
0875 23                                      inc     hl
0876 46                                      ld      b, (hl)
0877 23                                      inc     hl
0878 FD 09                                   add     iy, bc
087A 4E                                      ld      c, (hl)
087B 23                                      inc     hl
087C 46                                      ld      b, (hl)
087D 23                                      inc     hl
087E EB                                      ex      de, hl
087F ED 4A                                   adc     hl, bc
0881 EB                                      ex      de, hl
0882 4E                                      ld      c, (hl)
0883 23                                      inc     hl
0884 46                                      ld      b, (hl)
0885 23                                      inc     hl
0886 FD 09                                   add     iy, bc
0888 4E                                      ld      c, (hl)
0889 23                                      inc     hl
088A 46                                      ld      b, (hl)
088B 23                                      inc     hl
088C EB                                      ex      de, hl
088D ED 4A                                   adc     hl, bc
088F EB                                      ex      de, hl
0890 4E                                      ld      c, (hl)
0891 23                                      inc     hl
0892 46                                      ld      b, (hl)
0893 23                                      inc     hl
0894 FD 09                                   add     iy, bc
0896 4E                                      ld      c, (hl)
0897 23                                      inc     hl
0898 46                                      ld      b, (hl)
0899 23                                      inc     hl
089A EB                                      ex      de, hl
089B ED 4A                                   adc     hl, bc
089D EB                                      ex      de, hl
089E C1                                      pop     bc
089F 10 C4                                   djnz    loc_865
08A1 FD 22 E7 1A                             ld      (word_1AE7), iy
08A5 ED 53 E9 1A                             ld      (word_1AE9), de
08A9 FD E1                                   pop     iy
08AB E1                                      pop     hl
08AC D1                                      pop     de
08AD C1                                      pop     bc
08AE C9                                      ret
08AE                         ; End of function sub_856
08AE
08AF
08AF                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
08AF
08AF
08AF                         sub_8AF:                                ; CODE XREF: sub_600+55p
08AF                                                                 ; sub_600+67p
08AF DB 4E                                   in      a, (WATCHDOG_REG)
08B1 F6 08                                   or      8
08B3 D3 4E                                   out     (WATCHDOG_REG), a
08B5 DB 50                                   in      a, (50h)
08B7 CB 77                                   bit     6, a
08B9 20 06                                   jr      nz, loc_8C1
08BB DB D0                                   in      a, (0D0h)
08BD FE 03                                   cp      3
08BF 38 39                                   jr      c, loc_8FA
08C1
08C1                         loc_8C1:                                ; CODE XREF: sub_8AF+Aj
08C1 22 0F 23                                ld      (word_230F), hl
08C4 ED 53 17 23                             ld      (word_2317), de
08C8 ED 43 0D 23                             ld      (word_230D), bc
08CC
08CC                         loc_8CC:                                ; CODE XREF: sub_8AF+49j
08CC DB 4E                                   in      a, (WATCHDOG_REG)
08CE F6 08                                   or      8
08D0 D3 4E                                   out     (WATCHDOG_REG), a
08D2 11 0F 23                                ld      de, 230Fh
08D5 CD F5 2A                                call    sub_2AF5
08D8 2A 0F 23                                ld      hl, (word_230F)
08DB 23                                      inc     hl
08DC 22 0F 23                                ld      (word_230F), hl
08DF 11 17 23                                ld      de, 2317h
08E2 CD 6C 2B                                call    sub_2B6C
08E5 2A 17 23                                ld      hl, (word_2317)
08E8 23                                      inc     hl
08E9 22 17 23                                ld      (word_2317), hl
08EC A7                                      and     a
08ED 20 0D                                   jr      nz, loc_8FC
08EF 2A 0D 23                                ld      hl, (word_230D)
08F2 2B                                      dec     hl
08F3 22 0D 23                                ld      (word_230D), hl
08F6 7D                                      ld      a, l
08F7 B4                                      or      h
08F8 20 D2                                   jr      nz, loc_8CC
08FA
08FA                         loc_8FA:                                ; CODE XREF: sub_8AF+10j
08FA AF                                      xor     a
08FB C9                                      ret
08FC                         ; ---------------------------------------------------------------------------
08FC
08FC                         loc_8FC:                                ; CODE XREF: sub_8AF+3Ej
08FC 3E 01                                   ld      a, 1
08FE C9                                      ret
08FE                         ; End of function sub_8AF


08FF                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
08FF                         sub_8FF         PROC
08FF C5                                      push    bc
0900 D5                                      push    de
0901 E5                                      push    hl
0902 DD E5                                   push    ix
0904 06 01                                   ld      b, 1
0906 CD 2A 3F                                call    nand_init
0909 0E 08                                   ld      c, 8
090B
090B                         loc_90B:        ld      b, 4
090D
090D                         loc_90D:        push    bc
090E 21 1F 23                                ld      hl, 231Fh
0911 CD 0F 3B                                call    sub_3B0F       ; do dma transfer flash (0) to IPM low (0)
0914 21 20 23                                ld      hl, 2320h
0917 34                                      inc     (hl)
0918 34                                      inc     (hl)
0919 21 25 23                                ld      hl, 2325h
091C 34                                      inc     (hl)
091D 34                                      inc     (hl)
091E C1                                      pop     bc
091F 10 EC                                   djnz    loc_90D
0921 AF                                      xor     a
0922 21 1F 23                                ld      hl, 231Fh
0925 77                                      ld      (hl), a
0926 23                                      inc     hl
0927 77                                      ld      (hl), a
0928 23                                      inc     hl
0929 34                                      inc     (hl)
092A 0D                                      dec     c
092B 20 DE                                   jr      nz, loc_90B
092D CD 4E 3F                                call    nand_deinit
0930 DD E1                                   pop     ix
0932 E1                                      pop     hl
0933 D1                                      pop     de
0934 C1                                      pop     bc
0935 C9                                      ret
0935                         sub_8FF         ENDP



0936                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0936
0936
0936                         sub_936:                                ; CODE XREF: sub_B7E+39p
0936                                                                 ; sub_BC2+B2p ...
0936 C5                                      push    bc
0937 D5                                      push    de
0938 E5                                      push    hl
0939 DD E5                                   push    ix
093B 06 01                                   ld      b, 1
093D CD 2A 3F                                call    nand_init
0940 0E 08                                   ld      c, 8
0942
0942                         loc_942:                                ; CODE XREF: sub_936+2Cj
0942 06 04                                   ld      b, 4
0944
0944                         loc_944:                                ; CODE XREF: sub_936+20j
0944 C5                                      push    bc
0945 21 1F 23                                ld      hl, 231Fh
0948 CD 1B 26                                call    sub_261B
094B 21 20 23                                ld      hl, 2320h
094E 34                                      inc     (hl)
094F 34                                      inc     (hl)
0950 21 25 23                                ld      hl, 2325h
0953 34                                      inc     (hl)
0954 34                                      inc     (hl)
0955 C1                                      pop     bc
0956 10 EC                                   djnz    loc_944
0958 AF                                      xor     a
0959 21 1F 23                                ld      hl, 231Fh
095C 77                                      ld      (hl), a
095D 23                                      inc     hl
095E 77                                      ld      (hl), a
095F 23                                      inc     hl
0960 34                                      inc     (hl)
0961 0D                                      dec     c
0962 20 DE                                   jr      nz, loc_942
0964 CD 4E 3F                                call    nand_deinit
0967 DD E1                                   pop     ix
0969 E1                                      pop     hl
096A D1                                      pop     de
096B C1                                      pop     bc
096C C9                                      ret
096C                         ; End of function sub_936
096C
096D
096D                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
096D
096D
096D                         sub_96D:                                ; CODE XREF: sub_2721+Ep
096D DB 05                                   in      a, (MROM_PAGE_REG)
096F F5                                      push    af
0970 06 01                                   ld      b, 1
0972 CD 2A 3F                                call    nand_init
0975 21 F8 07                                ld      hl, 7F8h
0978 22 1F 23                                ld      (word_231F), hl
097B 21 07 00                                ld      hl, 7
097E 22 21 23                                ld      (word_2321), hl
0981 2E 00                                   ld      l, 0
0983 22 23 23                                ld      (word_2323), hl
0986 21 1F 23                                ld      hl, 231Fh
0989 CD D0 3E                                call    sub_3ED0
098C CD 4E 3F                                call    nand_deinit
098F E5                                      push    hl
0990 06 01                                   ld      b, 1
0992 CD 55 24                                call    nand_detect_id
0995 C1                                      pop     bc
0996 FE 02                                   cp      2
0998 C2 B4 09                                jp      nz, loc_9B4
099B 24                                      inc     h
099C 2E 00                                   ld      l, 0
099E EB                                      ex      de, hl
099F 41                                      ld      b, c
09A0 0E 01                                   ld      c, 1
09A2 CD DC 0C                                call    sub_CDC
09A5 3E 05                                   ld      a, 5
09A7 CD B9 09                                call    sub_9B9
09AA 3E 04                                   ld      a, 4
09AC CD B9 09                                call    sub_9B9
09AF 3E 02                                   ld      a, 2
09B1 CD B9 09                                call    sub_9B9
09B4
09B4                         loc_9B4:                                ; CODE XREF: sub_96D+2Bj
09B4 F1                                      pop     af
09B5 D3 05                                   out     (MROM_PAGE_REG), a
09B7 AF                                      xor     a
09B8 C9                                      ret
09B8                         ; End of function sub_96D
09B8
09B9
09B9                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
09B9
09B9
09B9                         sub_9B9:                                ; CODE XREF: sub_96D+3Ap
09B9                                                                 ; sub_96D+3Fp ...
09B9 32 31 23                                ld      (byte_2331), a
09BC 47                                      ld      b, a
09BD CD 55 24                                call    nand_detect_id
09C0 FE 02                                   cp      2
09C2 C2 B0 0A                                jp      nz, locret_AB0
09C5 24                                      inc     h
09C6 2E 00                                   ld      l, 0
09C8 22 2F 23                                ld      (word_232F), hl
09CB 3A 31 23                                ld      a, (byte_2331)
09CE 47                                      ld      b, a
09CF CD 2A 3F                                call    nand_init
09D2 21 00 00                                ld      hl, 0
09D5 22 27 23                                ld      (word_2327), hl
09D8 22 29 23                                ld      (word_2329), hl
09DB 22 2B 23                                ld      (word_232B), hl
09DE 22 2D 23                                ld      (word_232D), hl
09E1 06 20                                   ld      b, 20h ; ' '
09E3
09E3                         loc_9E3:                                ; CODE XREF: sub_9B9+46j
09E3 C5                                      push    bc
09E4 21 27 23                                ld      hl, 2327h
09E7 CD 0F 3B                                call    sub_3B0F
09EA 21 28 23                                ld      hl, 2328h
09ED 34                                      inc     (hl)
09EE 34                                      inc     (hl)
09EF 7E                                      ld      a, (hl)
09F0 FE 08                                   cp      8
09F2 20 05                                   jr      nz, loc_9F9
09F4 3E 00                                   ld      a, 0
09F6 77                                      ld      (hl), a
09F7 23                                      inc     hl
09F8 34                                      inc     (hl)
09F9
09F9                         loc_9F9:                                ; CODE XREF: sub_9B9+39j
09F9 21 2D 23                                ld      hl, 232Dh
09FC 34                                      inc     (hl)
09FD 34                                      inc     (hl)
09FE C1                                      pop     bc
09FF 10 E2                                   djnz    loc_9E3
0A01 CD 4E 3F                                call    nand_deinit
0A04 3E F0                                   ld      a, 0F0h
0A06 D3 05                                   out     (MROM_PAGE_REG), a
0A08 AF                                      xor     a
0A09 2A FC 7F                                ld      hl, (7FFCh)
0A0C 01 55 AA                                ld      bc, 0AA55h
0A0F ED 42                                   sbc     hl, bc
0A11 20 30                                   jr      nz, loc_A43
0A13 21 00 00                                ld      hl, 0
0A16 01 FE 7F                                ld      bc, 7FFEh
0A19
0A19                         loc_A19:                                ; CODE XREF: sub_9B9+69j
0A19                                                                 ; sub_9B9+6Ej
0A19 0B                                      dec     bc
0A1A 0A                                      ld      a, (bc)
0A1B 57                                      ld      d, a
0A1C 0B                                      dec     bc
0A1D 0A                                      ld      a, (bc)
0A1E 5F                                      ld      e, a
0A1F 19                                      add     hl, de
0A20 79                                      ld      a, c
0A21 A7                                      and     a
0A22 20 F5                                   jr      nz, loc_A19
0A24 78                                      ld      a, b
0A25 FE 40                                   cp      40h ; '@'
0A27 20 F0                                   jr      nz, loc_A19
0A29 ED 5B FE 7F                             ld      de, (7FFEh)
0A2D AF                                      xor     a
0A2E ED 52                                   sbc     hl, de
0A30 20 11                                   jr      nz, loc_A43
0A32 3A F8 7F                                ld      a, (7FF8h)
0A35 47                                      ld      b, a
0A36 3A 31 23                                ld      a, (byte_2331)
0A39 4F                                      ld      c, a
0A3A ED 5B 2F 23                             ld      de, (word_232F)
0A3E CD DC 0C                                call    sub_CDC
0A41 18 6D                                   jr      locret_AB0
0A43                         ; ---------------------------------------------------------------------------
0A43
0A43                         loc_A43:                                ; CODE XREF: sub_9B9+58j
0A43                                                                 ; sub_9B9+77j
0A43 3A 31 23                                ld      a, (byte_2331)
0A46 4F                                      ld      c, a
0A47 ED 5B 2F 23                             ld      de, (word_232F)
0A4B CD C0 15                                call    sub_15C0
0A4E EB                                      ex      de, hl
0A4F AF                                      xor     a
0A50 21 00 40                                ld      hl, 4000h
0A53
0A53                         loc_A53:                                ; CODE XREF: sub_9B9+A0j
0A53 AF                                      xor     a
0A54 77                                      ld      (hl), a
0A55 23                                      inc     hl
0A56 7C                                      ld      a, h
0A57 FE 80                                   cp      80h ; 'Ç'
0A59 20 F8                                   jr      nz, loc_A53
0A5B ED 53 F8 7F                             ld      (7FF8h), de
0A5F ED 53 FA 7F                             ld      (7FFAh), de
0A63 21 55 AA                                ld      hl, 0AA55h
0A66 22 FC 7F                                ld      (7FFCh), hl
0A69 19                                      add     hl, de
0A6A 19                                      add     hl, de
0A6B 22 FE 7F                                ld      (7FFEh), hl
0A6E 3A 31 23                                ld      a, (byte_2331)
0A71 47                                      ld      b, a
0A72 CD 2A 3F                                call    nand_init
0A75 21 00 00                                ld      hl, 0
0A78 22 27 23                                ld      (word_2327), hl
0A7B 22 29 23                                ld      (word_2329), hl
0A7E 22 2B 23                                ld      (word_232B), hl
0A81 22 2D 23                                ld      (word_232D), hl
0A84 21 29 23                                ld      hl, 2329h
0A87 CD 63 25                                call    sub_2563
0A8A 06 20                                   ld      b, 20h ; ' '
0A8C
0A8C                         loc_A8C:                                ; CODE XREF: sub_9B9+EFj
0A8C C5                                      push    bc
0A8D 21 27 23                                ld      hl, 2327h
0A90 CD 1B 26                                call    sub_261B
0A93 21 28 23                                ld      hl, 2328h
0A96 34                                      inc     (hl)
0A97 34                                      inc     (hl)
0A98 7E                                      ld      a, (hl)
0A99 FE 08                                   cp      8
0A9B 20 05                                   jr      nz, loc_AA2
0A9D 3E 00                                   ld      a, 0
0A9F 77                                      ld      (hl), a
0AA0 23                                      inc     hl
0AA1 34                                      inc     (hl)
0AA2
0AA2                         loc_AA2:                                ; CODE XREF: sub_9B9+E2j
0AA2 21 2D 23                                ld      hl, 232Dh
0AA5 34                                      inc     (hl)
0AA6 34                                      inc     (hl)
0AA7 C1                                      pop     bc
0AA8 10 E2                                   djnz    loc_A8C
0AAA CD 4E 3F                                call    nand_deinit
0AAD C3 B9 09                                jp      sub_9B9
0AB0                         ; ---------------------------------------------------------------------------
0AB0
0AB0                         locret_AB0:                             ; CODE XREF: sub_9B9+9j
0AB0                                                                 ; sub_9B9+88j
0AB0 C9                                      ret
0AB0                         ; End of function sub_9B9



0AB1                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0AB1                         sub_AB1         PROC
0AB1 E5                                      push    hl
0AB2
0AB2                         loc_AB2:        ld      hl, 0
0AB5 CD 1E 0B                                call    sub_B1E              ; sub_B1E(0) - check for firmware
0AB8 A7                                      and     a
0AB9 20 21                                   jr      nz, loc_ADC          ; firmware not found (nonzero)? -> branch

0ABB DB 05                                   in      a, (MROM_PAGE_REG)   ; read value 3FFAh from IPM(low) into hl
0ABD F5                                      push    af
0ABE 3E F0                                   ld      a, 0F0h
0AC0 D3 05                                   out     (MROM_PAGE_REG), a
0AC2 2A FA 7F                                ld      hl, (7FFAh)
0AC5 F1                                      pop     af
0AC6 D3 05                                   out     (MROM_PAGE_REG), a

0AC8 29                                      add     hl, hl               ; hl <<= 6
0AC9 29                                      add     hl, hl
0ACA 29                                      add     hl, hl
0ACB 29                                      add     hl, hl
0ACC 29                                      add     hl, hl
0ACD 29                                      add     hl, hl
0ACE 22 32 23                                ld      (word_2332), hl      ; store hl
0AD1 CD 1E 0B                                call    sub_B1E
0AD4 A7                                      and     a
0AD5 28 2E                                   jr      z, loc_B05           ; returned zero value? -> branch

0AD7 CD C2 0B                                call    sub_BC2
0ADA 18 D6                                   jr      loc_AB2
0ADC                         ; ---------------------------------------------------------------------------
0ADC                         loc_ADC:        ld      hl, 40h
0ADF 22 32 23                                ld      (word_2332), hl
0AE2 CD 1E 0B                                call    sub_B1E              ; sub_B1E(40h) - check for firmware
0AE5 A7                                      and     a
0AE6 28 18                                   jr      z, loc_B00

0AE8 21 80 00                                ld      hl, 80h
0AEB 22 32 23                                ld      (word_2332), hl
0AEE CD 1E 0B                                call    sub_B1E             ; sub_B1E(80h) - check for firmware
0AF1 A7                                      and     a
0AF2 28 0C                                   jr      z, loc_B00

0AF4 21 C0 00                                ld      hl, 0C0h
0AF7 22 32 23                                ld      (word_2332), hl
0AFA CD 1E 0B                                call    sub_B1E            ; sub_B1E(0C0h) - check for firmware
0AFD A7                                      and     a
0AFE 20 05                                   jr      nz, loc_B05        ; -> nothing found
0B00
0B00                         loc_B00:        call    sub_B7E
0B03 18 AD                                   jr      loc_AB2
0B05                         ; ---------------------------------------------------------------------------
0B050B05                         loc_B05:    push    af                   ; copy 32 bytes from byte_2334 to 0000h @IPM(low)
0B06 DB 05                                   in      a, (MROM_PAGE_REG)
0B08 F5                                      push    af
0B09 3E F0                                   ld      a, 0F0h
0B0B D3 05                                   out     (MROM_PAGE_REG), a
0B0D 21 00 40                                ld      hl, INT_MEMORY_ADDR
0B10 11 34 23                                ld      de, byte_2334
0B13 01 20 00                                ld      bc, 32
0B16 ED B0                                   ldir
0B18 F1                                      pop     af
0B19 D3 05                                   out     (MROM_PAGE_REG), a
0B1B F1                                      pop     af

0B1C E1                                      pop     hl
0B1D C9                                      ret
0B1D                         sub_AB1         ENDP




0B1E                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0B1E                         ; in: hl = ?
                             ; out: a = 0 or 1
0B1E                         sub_B1E         PROC
0B1E                                         push    hl
0B1F 22 21 23                                ld      (word_2321), hl
0B22 21 00 00                                ld      hl, 0
0B25 22 1F 23                                ld      (word_231F), hl
0B28 22 23 23                                ld      (word_2323), hl
0B2B 22 25 23                                ld      (word_2325), hl
0B2E CD 33 0B                                call    sub_B33
0B31 E1                                      pop     hl
0B32 C9                                      ret
0B32                         sub_B1E         ENDP


0B33                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
                             ; out: a = 0 or 1
0B33                         sub_B33         PROC
0B33 C5                                      push    bc
0B34 D5                                      push    de
0B35 E5                                      push    hl
0B36 DD E5                                   push    ix
0B38 FD E5                                   push    iy
0B3A CD FF 08                                call    sub_8FF                ; do a lot of dma transfers from flash to IPM-low
0B3D DB 05                                   in      a, (MROM_PAGE_REG)
0B3F F5                                      push    af
0B40 3E F0                                   ld      a, 0F0h
0B42 D3 05                                   out     (MROM_PAGE_REG), a
0B44 2A FC 7F                                ld      hl, (INT_MEMORY_ADDR + 3FFCh)
0B47 11 AA 55                                ld      de, 55AAh              ; check for our firmware id
0B4A AF                                      xor     a
0B4B ED 52                                   sbc     hl, de
0B4D 7D                                      ld      a, l
0B4E B4                                      or      h
0B4F C2 71 0B                                jp      nz, loc_B71            ; not our firmware id?
0B52 21 00 00                                ld      hl, 0
0B55 01 FE 7F                                ld      bc, INT_MEMORY_ADDR + 3FFEh
0B58
0B58                         loc_B58:        dec     bc
0B59 0A                                      ld      a, (bc)
0B5A 57                                      ld      d, a
0B5B 0B                                      dec     bc
0B5C 0A                                      ld      a, (bc)
0B5D 5F                                      ld      e, a
0B5E 19                                      add     hl, de
0B5F 79                                      ld      a, c
0B60 A7                                      and     a
0B61 20 F5                                   jr      nz, loc_B58
0B63 78                                      ld      a, b
0B64 FE 40                                   cp      40h
0B66 20 F0                                   jr      nz, loc_B58
0B68 ED 5B FE 7F                             ld      de, (INT_MEMORY_ADDR + 3FFEh)
0B6C AF                                      xor     a
0B6D ED 52                                   sbc     hl, de
0B6F 7D                                      ld      a, l
0B70 B4                                      or      h
0B71
0B71                         loc_B71:        ld      b, a
0B72 F1                                      pop     af
0B73 D3 05                                   out     (MROM_PAGE_REG), a
0B75 78                                      ld      a, b
0B76 FD E1                                   pop     iy
0B78 DD E1                                   pop     ix
0B7A E1                                      pop     hl
0B7B D1                                      pop     de
0B7C C1                                      pop     bc
0B7D C9                                      ret
0B7D                         sub_B33         ENDP




0B7E                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0B7E                         sub_B7E:                                ; CODE XREF: sub_AB1:loc_B00p
0B7E C5                                      push    bc
0B7F D5                                      push    de
0B80 E5                                      push    hl
0B81 DD E5                                   push    ix
0B83 FD E5                                   push    iy
0B85 21 00 00                                ld      hl, 0
0B88 22 1F 23                                ld      (word_231F), hl
0B8B 22 23 23                                ld      (word_2323), hl
0B8E 22 25 23                                ld      (word_2325), hl
0B91 2A 32 23                                ld      hl, (word_2332)
0B94 22 21 23                                ld      (word_2321), hl
0B97 CD FF 08                                call    sub_8FF
0B9A 06 01                                   ld      b, 1
0B9C CD 2A 3F                                call    nand_init
0B9F 21 00 00                                ld      hl, 0
0BA2 22 1F 23                                ld      (word_231F), hl
0BA5 22 21 23                                ld      (word_2321), hl
0BA8 22 23 23                                ld      (word_2323), hl
0BAB 22 25 23                                ld      (word_2325), hl
0BAE 21 21 23                                ld      hl, 2321h
0BB1 CD 63 25                                call    sub_2563
0BB4 CD 4E 3F                                call    nand_deinit
0BB7 CD 36 09                                call    sub_936
0BBA FD E1                                   pop     iy
0BBC DD E1                                   pop     ix
0BBE E1                                      pop     hl
0BBF D1                                      pop     de
0BC0 C1                                      pop     bc
0BC1 C9                                      ret
0BC1                         ; End of function sub_B7E
0BC1
0BC2
0BC2                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0BC2
0BC2
0BC2                         sub_BC2:                                ; CODE XREF: sub_AB1+26p
0BC2 C5                                      push    bc
0BC3 D5                                      push    de
0BC4 E5                                      push    hl
0BC5 DD E5                                   push    ix
0BC7 FD E5                                   push    iy
0BC9 21 00 00                                ld      hl, 0
0BCC 22 1F 23                                ld      (word_231F), hl
0BCF 22 23 23                                ld      (word_2323), hl
0BD2 22 25 23                                ld      (word_2325), hl
0BD5 2A 32 23                                ld      hl, (word_2332)
0BD8 11 20 00                                ld      de, 20h ; ' '
0BDB AF                                      xor     a
0BDC ED 5A                                   adc     hl, de
0BDE 22 21 23                                ld      (word_2321), hl
0BE1 3E 00                                   ld      a, 0
0BE3 32 26 23                                ld      (word_2325+1), a
0BE6 CD FF 08                                call    sub_8FF
0BE9 21 00 00                                ld      hl, 0
0BEC 22 1F 23                                ld      (word_231F), hl
0BEF 22 23 23                                ld      (word_2323), hl
0BF2 22 25 23                                ld      (word_2325), hl
0BF5 3E 01                                   ld      a, 1
0BF7 32 26 23                                ld      (word_2325+1), a
0BFA CD FF 08                                call    sub_8FF
0BFD 21 00 00                                ld      hl, 0
0C00 22 1F 23                                ld      (word_231F), hl
0C03 22 23 23                                ld      (word_2323), hl
0C06 22 25 23                                ld      (word_2325), hl
0C09 3E 02                                   ld      a, 2
0C0B 32 26 23                                ld      (word_2325+1), a
0C0E CD FF 08                                call    sub_8FF
0C11 21 00 00                                ld      hl, 0
0C14 22 1F 23                                ld      (word_231F), hl
0C17 22 23 23                                ld      (word_2323), hl
0C1A 22 25 23                                ld      (word_2325), hl
0C1D 3E 04                                   ld      a, 4
0C1F 32 26 23                                ld      (word_2325+1), a
0C22 CD FF 08                                call    sub_8FF
0C25 06 01                                   ld      b, 1
0C27 CD 2A 3F                                call    nand_init
0C2A 21 00 00                                ld      hl, 0
0C2D 22 1F 23                                ld      (word_231F), hl
0C30 22 23 23                                ld      (word_2323), hl
0C33 22 25 23                                ld      (word_2325), hl
0C36 2A 32 23                                ld      hl, (word_2332)
0C39 22 21 23                                ld      (word_2321), hl
0C3C 21 21 23                                ld      hl, 2321h
0C3F CD 63 25                                call    sub_2563
0C42 21 00 08                                ld      hl, 800h
0C45 22 1F 23                                ld      (word_231F), hl
0C48 21 1F 23                                ld      hl, 231Fh
0C4B 11 55 AA                                ld      de, 0AA55h
0C4E 01 FE FF                                ld      bc, 0FFFEh
0C51 CD BC 26                                call    sub_26BC
0C54 CD 4E 3F                                call    nand_deinit
0C57 21 00 00                                ld      hl, 0
0C5A 22 1F 23                                ld      (word_231F), hl
0C5D 22 23 23                                ld      (word_2323), hl
0C60 22 25 23                                ld      (word_2325), hl
0C63 2A 32 23                                ld      hl, (word_2332)
0C66 11 20 00                                ld      de, 20h ; ' '
0C69 AF                                      xor     a
0C6A ED 5A                                   adc     hl, de
0C6C 22 21 23                                ld      (word_2321), hl
0C6F 3E 00                                   ld      a, 0
0C71 32 26 23                                ld      (word_2325+1), a
0C74 CD 36 09                                call    sub_936
0C77 21 00 00                                ld      hl, 0
0C7A 22 1F 23                                ld      (word_231F), hl
0C7D 22 23 23                                ld      (word_2323), hl
0C80 22 25 23                                ld      (word_2325), hl
0C83 3E 01                                   ld      a, 1
0C85 32 26 23                                ld      (word_2325+1), a
0C88 CD 36 09                                call    sub_936
0C8B 21 00 00                                ld      hl, 0
0C8E 22 1F 23                                ld      (word_231F), hl
0C91 22 23 23                                ld      (word_2323), hl
0C94 22 25 23                                ld      (word_2325), hl
0C97 3E 02                                   ld      a, 2
0C99 32 26 23                                ld      (word_2325+1), a
0C9C CD 36 09                                call    sub_936
0C9F 21 00 00                                ld      hl, 0
0CA2 22 1F 23                                ld      (word_231F), hl
0CA5 3E 04                                   ld      a, 4
0CA7 32 26 23                                ld      (word_2325+1), a
0CAA CD 36 09                                call    sub_936
0CAD 21 00 00                                ld      hl, 0
0CB0 22 1F 23                                ld      (word_231F), hl
0CB3 22 21 23                                ld      (word_2321), hl
0CB6 22 23 23                                ld      (word_2323), hl
0CB9 22 25 23                                ld      (word_2325), hl
0CBC CD FF 08                                call    sub_8FF
0CBF 21 00 00                                ld      hl, 0
0CC2 22 1F 23                                ld      (word_231F), hl
0CC5 22 23 23                                ld      (word_2323), hl
0CC8 22 25 23                                ld      (word_2325), hl
0CCB 2A 32 23                                ld      hl, (word_2332)
0CCE 22 21 23                                ld      (word_2321), hl
0CD1 CD 36 09                                call    sub_936
0CD4 FD E1                                   pop     iy
0CD6 DD E1                                   pop     ix
0CD8 E1                                      pop     hl
0CD9 D1                                      pop     de
0CDA C1                                      pop     bc
0CDB C9                                      ret
0CDB                         ; End of function sub_BC2
0CDB
0CDC
0CDC                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0CDC
0CDC
0CDC                         sub_CDC:                                ; CODE XREF: sub_96D+35p
0CDC                                                                 ; sub_9B9+85p
0CDC C5                                      push    bc
0CDD D5                                      push    de
0CDE E5                                      push    hl
0CDF AF                                      xor     a
0CE0 32 70 23                                ld      (byte_2370), a
0CE3 32 72 23                                ld      (byte_2372), a
0CE6 DB 05                                   in      a, (MROM_PAGE_REG)
0CE8 32 90 23                                ld      (byte_2390), a
0CEB 79                                      ld      a, c
0CEC 32 74 23                                ld      (byte_2374), a
0CEF ED 53 77 23                             ld      (word_2377), de
0CF3 78                                      ld      a, b
0CF4 32 76 23                                ld      (byte_2376), a
0CF7 3A 74 23                                ld      a, (byte_2374)
0CFA 47                                      ld      b, a
0CFB CD 2A 3F                                call    nand_init
0CFE CD A0 3F                                call    nand_read_status
0D01 32 71 23                                ld      (byte_2371), a
0D04 A7                                      and     a
0D05 20 1F                                   jr      nz, loc_D26
0D07 CD 47 14                                call    sub_1447
0D0A CD EF 14                                call    sub_14EF
0D0D 3A 73 23                                ld      a, (byte_2373)
0D10 FE 00                                   cp      0
0D12 CC 37 0D                                call    z, sub_D37
0D15 3A 70 23                                ld      a, (byte_2370)
0D18 A7                                      and     a
0D19 20 0B                                   jr      nz, loc_D26
0D1B 3A 73 23                                ld      a, (byte_2373)
0D1E FE 01                                   cp      1
0D20 CC 02 0F                                call    z, sub_F02
0D23 3A 70 23                                ld      a, (byte_2370)
0D26
0D26                         loc_D26:                                ; CODE XREF: sub_CDC+29j
0D26                                                                 ; sub_CDC+3Dj
0D26 F5                                      push    af
0D27 CD D0 3F                                call    sub_3FD0
0D2A CD 4E 3F                                call    nand_deinit
0D2D 3A 90 23                                ld      a, (byte_2390)
0D30 D3 05                                   out     (MROM_PAGE_REG), a
0D32 F1                                      pop     af
0D33 E1                                      pop     hl
0D34 D1                                      pop     de
0D35 C1                                      pop     bc
0D36 C9                                      ret
0D36                         ; End of function sub_CDC
0D36
0D37
0D37                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0D37
0D37
0D37                         sub_D37:                                ; CODE XREF: sub_CDC+36p
0D37 CD 44 0D                                call    sub_D44
0D3A 3A 70 23                                ld      a, (byte_2370)
0D3D A7                                      and     a
0D3E 20 03                                   jr      nz, locret_D43
0D40 CD BF 0D                                call    sub_DBF
0D43
0D43                         locret_D43:                             ; CODE XREF: sub_D37+7j
0D43 C9                                      ret
0D43                         ; End of function sub_D37
0D43
0D44
0D44                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0D44
0D44
0D44                         sub_D44:                                ; CODE XREF: sub_D37p
0D44 C5                                      push    bc
0D45 D5                                      push    de
0D46 E5                                      push    hl
0D47 DB 05                                   in      a, (MROM_PAGE_REG)
0D49 32 6F 23                                ld      (byte_236F), a
0D4C 3E C1                                   ld      a, 0C1h                ;
0D4E D3 05                                   out     (MROM_PAGE_REG), a
0D50 21 FB 43                                ld      hl, 43FBh
0D53 22 7D 23                                ld      (word_237D), hl
0D56
0D56                         loc_D56:                                ; CODE XREF: sub_D44+34j
0D56                                                                 ; sub_D44:loc_DAFj
0D56 DB 4E                                   in      a, (WATCHDOG_REG)
0D58 F6 08                                   or      8
0D5A D3 4E                                   out     (WATCHDOG_REG), a
0D5C 2A 7D 23                                ld      hl, (word_237D)
0D5F 56                                      ld      d, (hl)
0D60 2B                                      dec     hl
0D61 5E                                      ld      e, (hl)
0D62 2B                                      dec     hl
0D63 22 7D 23                                ld      (word_237D), hl
0D66 ED 53 86 23                             ld      (word_2386), de
0D6A AF                                      xor     a
0D6B 01 00 40                                ld      bc, 4000h
0D6E ED 42                                   sbc     hl, bc
0D70 38 3F                                   jr      c, loc_DB1
0D72 AF                                      xor     a
0D73 21 FF FF                                ld      hl, 0FFFFh
0D76 ED 52                                   sbc     hl, de
0D78 28 DC                                   jr      z, loc_D56
0D7A 2E 00                                   ld      l, 0
0D7C 06 06                                   ld      b, 6
0D7E AF                                      xor     a
0D7F
0D7F                         loc_D7F:                                ; CODE XREF: sub_D44+41j
0D7F CB 23                                   sla     e
0D81 CB 12                                   rl      d
0D83 CB 15                                   rl      l
0D85 10 F8                                   djnz    loc_D7F
0D87 DD 21 54 23                             ld      ix, 2354h
0D8B DD 36 00 00                             ld      (ix+0), 0
0D8F DD 36 01 08                             ld      (ix+1), 8
0D93 DD 73 02                                ld      (ix+2), e
0D96 DD 72 03                                ld      (ix+3), d
0D99 DD 75 04                                ld      (ix+4), l
0D9C 21 54 23                                ld      hl, 2354h
0D9F CD E0 26                                call    sub_26E0
0DA2 AF                                      xor     a
0DA3 01 FF AF                                ld      bc, 0AFFFh
0DA6 ED 42                                   sbc     hl, bc
0DA8 28 05                                   jr      z, loc_DAF
0DAA 3E 02                                   ld      a, 2
0DAC CD B4 13                                call    sub_13B4
0DAF
0DAF                         loc_DAF:                                ; CODE XREF: sub_D44+64j
0DAF 18 A5                                   jr      loc_D56
0DB1                         ; ---------------------------------------------------------------------------
0DB1
0DB1                         loc_DB1:                                ; CODE XREF: sub_D44+2Cj
0DB1 3A 70 23                                ld      a, (byte_2370)
0DB4 F5                                      push    af
0DB5 3A 6F 23                                ld      a, (byte_236F)
0DB8 D3 05                                   out     (MROM_PAGE_REG), a
0DBA F1                                      pop     af
0DBB E1                                      pop     hl
0DBC D1                                      pop     de
0DBD C1                                      pop     bc
0DBE C9                                      ret
0DBE                         ; End of function sub_D44
0DBE
0DBF
0DBF                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0DBF
0DBF
0DBF                         sub_DBF:                                ; CODE XREF: sub_D37+9p
0DBF C5                                      push    bc
0DC0 D5                                      push    de
0DC1 E5                                      push    hl
0DC2 21 00 00                                ld      hl, 0
0DC5 22 84 23                                ld      (word_2384), hl
0DC8 DB 05                                   in      a, (MROM_PAGE_REG)
0DCA 32 6F 23                                ld      (byte_236F), a
0DCD 3E C0                                   ld      a, 0C0h
0DCF D3 05                                   out     (MROM_PAGE_REG), a
0DD1
0DD1                         loc_DD1:                                ; CODE XREF: sub_DBF+135j
0DD1 DB 4E                                   in      a, (WATCHDOG_REG)
0DD3 F6 08                                   or      8
0DD5 D3 4E                                   out     (WATCHDOG_REG), a
0DD7 2A 84 23                                ld      hl, (word_2384)
0DDA CB 25                                   sla     l
0DDC CB 14                                   rl      h
0DDE AF                                      xor     a
0DDF 01 00 40                                ld      bc, 4000h
0DE2 09                                      add     hl, bc
0DE3 5E                                      ld      e, (hl)
0DE4 23                                      inc     hl
0DE5 56                                      ld      d, (hl)
0DE6 23                                      inc     hl
0DE7 ED 53 86 23                             ld      (word_2386), de
0DEB AF                                      xor     a
0DEC 21 FF FF                                ld      hl, 0FFFFh
0DEF ED 52                                   sbc     hl, de
0DF1 CA F7 0E                                jp      z, loc_EF7
0DF4 2E 00                                   ld      l, 0
0DF6 06 06                                   ld      b, 6
0DF8 AF                                      xor     a
0DF9
0DF9                         loc_DF9:                                ; CODE XREF: sub_DBF+40j
0DF9 CB 23                                   sla     e
0DFB CB 12                                   rl      d
0DFD CB 15                                   rl      l
0DFF 10 F8                                   djnz    loc_DF9
0E01 DD 21 54 23                             ld      ix, 2354h
0E05 DD 36 00 00                             ld      (ix+0), 0
0E09 DD 36 01 08                             ld      (ix+1), 8
0E0D DD 73 02                                ld      (ix+2), e
0E10 DD 72 03                                ld      (ix+3), d
0E13 DD 75 04                                ld      (ix+4), l
0E16 21 54 23                                ld      hl, 2354h
0E19 CD F6 26                                call    sub_26F6
0E1C 01 FF AA                                ld      bc, 0AAFFh
0E1F AF                                      xor     a
0E20 ED 42                                   sbc     hl, bc
0E22 C2 34 0E                                jp      nz, loc_E34
0E25 AF                                      xor     a
0E26 62                                      ld      h, d
0E27 6B                                      ld      l, e
0E28 ED 4B 84 23                             ld      bc, (word_2384)
0E2C ED 42                                   sbc     hl, bc
0E2E C2 34 0E                                jp      nz, loc_E34
0E31 C3 ED 0E                                jp      loc_EED
0E34                         ; ---------------------------------------------------------------------------
0E34
0E34                         loc_E34:                                ; CODE XREF: sub_DBF+63j
0E34                                                                 ; sub_DBF+6Fj
0E34 ED 5B 86 23                             ld      de, (word_2386)
0E38 2E 00                                   ld      l, 0
0E3A 06 06                                   ld      b, 6
0E3C AF                                      xor     a
0E3D
0E3D                         loc_E3D:                                ; CODE XREF: sub_DBF+84j
0E3D CB 23                                   sla     e
0E3F CB 12                                   rl      d
0E41 CB 15                                   rl      l
0E43 10 F8                                   djnz    loc_E3D
0E45 DD 21 54 23                             ld      ix, 2354h
0E49 DD 36 00 00                             ld      (ix+0), 0
0E4D DD 36 01 00                             ld      (ix+1), 0
0E51 DD 73 02                                ld      (ix+2), e
0E54 DD 72 03                                ld      (ix+3), d
0E57 DD 75 04                                ld      (ix+4), l
0E5A DD 21 FB 43                             ld      ix, 43FBh
0E5E 3E C1                                   ld      a, 0C1h ; '-'
0E60 D3 05                                   out     (MROM_PAGE_REG), a
0E62 DD 56 00                                ld      d, (ix+0)
0E65 DD 2B                                   dec     ix
0E67 DD 5E 00                                ld      e, (ix+0)
0E6A DD 2B                                   dec     ix
0E6C 3E C0                                   ld      a, 0C0h ; '+'
0E6E D3 05                                   out     (MROM_PAGE_REG), a
0E70 2E 00                                   ld      l, 0
0E72 06 06                                   ld      b, 6
0E74 AF                                      xor     a
0E75
0E75                         loc_E75:                                ; CODE XREF: sub_DBF+BCj
0E75 CB 23                                   sla     e
0E77 CB 12                                   rl      d
0E79 CB 15                                   rl      l
0E7B 10 F8                                   djnz    loc_E75
0E7D DD 21 54 23                             ld      ix, 2354h
0E81 DD 36 05 00                             ld      (ix+5), 0
0E85 DD 36 06 00                             ld      (ix+6), 0
0E89 DD 73 07                                ld      (ix+7), e
0E8C DD 72 08                                ld      (ix+8), d
0E8F DD 75 09                                ld      (ix+9), l
0E92 21 5B 23                                ld      hl, 235Bh
0E95 CD 63 25                                call    sub_2563
0E98 32 70 23                                ld      (byte_2370), a
0E9B A7                                      and     a
0E9C 20 59                                   jr      nz, loc_EF7
0E9E 21 54 23                                ld      hl, 2354h
0EA1 11 59 23                                ld      de, 2359h
0EA4 CD 7A 14                                call    sub_147A
0EA7 21 56 23                                ld      hl, 2356h
0EAA CD 63 25                                call    sub_2563
0EAD 21 59 23                                ld      hl, 2359h
0EB0 11 54 23                                ld      de, 2354h
0EB3 CD 7A 14                                call    sub_147A
0EB6 DD 21 54 23                             ld      ix, 2354h
0EBA DD 36 00 00                             ld      (ix+0), 0
0EBE DD 36 01 08                             ld      (ix+1), 8
0EC2 21 54 23                                ld      hl, 2354h
0EC5 11 FF AA                                ld      de, 0AAFFh
0EC8 ED 4B 84 23                             ld      bc, (word_2384)
0ECC CD BC 26                                call    sub_26BC
0ECF 21 5B 23                                ld      hl, 235Bh
0ED2 CD 63 25                                call    sub_2563
0ED5 DD 21 59 23                             ld      ix, 2359h
0ED9 DD 36 00 00                             ld      (ix+0), 0
0EDD DD 36 01 08                             ld      (ix+1), 8
0EE1 21 59 23                                ld      hl, 2359h
0EE4 11 FF AF                                ld      de, 0AFFFh
0EE7 01 FF FF                                ld      bc, 0FFFFh
0EEA CD BC 26                                call    sub_26BC
0EED
0EED                         loc_EED:                                ; CODE XREF: sub_DBF+72j
0EED 2A 84 23                                ld      hl, (word_2384)
0EF0 23                                      inc     hl
0EF1 22 84 23                                ld      (word_2384), hl
0EF4 C3 D1 0D                                jp      loc_DD1
0EF7                         ; ---------------------------------------------------------------------------
0EF7
0EF7                         loc_EF7:                                ; CODE XREF: sub_DBF+32j
0EF7                                                                 ; sub_DBF+DDj
0EF7 F5                                      push    af
0EF8 3A 6F 23                                ld      a, (byte_236F)
0EFB D3 05                                   out     (MROM_PAGE_REG), a
0EFD F1                                      pop     af
0EFE E1                                      pop     hl
0EFF D1                                      pop     de
0F00 C1                                      pop     bc
0F01 C9                                      ret
0F01                         ; End of function sub_DBF
0F01
0F02
0F02                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0F02
0F02
0F02                         sub_F02:                                ; CODE XREF: sub_CDC+44p
0F02 C5                                      push    bc
0F03 D5                                      push    de
0F04 E5                                      push    hl
0F05 DD E5                                   push    ix
0F07 CD 47 14                                call    sub_1447
0F0A 11 04 00                                ld      de, 4
0F0D ED 53 86 23                             ld      (word_2386), de
0F11 11 F3 43                                ld      de, 43F3h
0F14 ED 53 88 23                             ld      (word_2388), de
0F18
0F18                         loc_F18:                                ; CODE XREF: sub_F02+D0j
0F18 DB 4E                                   in      a, (WATCHDOG_REG)
0F1A F6 08                                   or      8
0F1C D3 4E                                   out     (WATCHDOG_REG), a
0F1E ED 5B 86 23                             ld      de, (word_2386)
0F22 2E 00                                   ld      l, 0
0F24 06 06                                   ld      b, 6
0F26 AF                                      xor     a
0F27
0F27                         loc_F27:                                ; CODE XREF: sub_F02+2Bj
0F27 CB 23                                   sla     e
0F29 CB 12                                   rl      d
0F2B CB 15                                   rl      l
0F2D 10 F8                                   djnz    loc_F27
0F2F DB 05                                   in      a, (MROM_PAGE_REG)
0F31 32 6F 23                                ld      (byte_236F), a
0F34 DD 21 54 23                             ld      ix, 2354h
0F38 DD 36 00 00                             ld      (ix+0), 0
0F3C DD 36 01 08                             ld      (ix+1), 8
0F40 DD 73 02                                ld      (ix+2), e
0F43 DD 72 03                                ld      (ix+3), d
0F46 DD 75 04                                ld      (ix+4), l
0F49 21 54 23                                ld      hl, 2354h
0F4C CD F6 26                                call    sub_26F6
0F4F AF                                      xor     a
0F50 01 FE FF                                ld      bc, 0FFFEh
0F53 ED 42                                   sbc     hl, bc
0F55 CA C3 0F                                jp      z, loc_FC3
0F58 09                                      add     hl, bc
0F59 AF                                      xor     a
0F5A 01 FF AA                                ld      bc, 0AAFFh
0F5D ED 42                                   sbc     hl, bc
0F5F CA 76 0F                                jp      z, loc_F76
0F62 09                                      add     hl, bc
0F63 AF                                      xor     a
0F64 01 FF AF                                ld      bc, 0AFFFh
0F67 ED 42                                   sbc     hl, bc
0F69 C2 B7 0F                                jp      nz, loc_FB7
0F6C 21 FF FF                                ld      hl, 0FFFFh
0F6F 42                                      ld      b, d
0F70 4B                                      ld      c, e
0F71 AF                                      xor     a
0F72 ED 42                                   sbc     hl, bc
0F74 28 2D                                   jr      z, loc_FA3
0F76
0F76                         loc_F76:                                ; CODE XREF: sub_F02+5Dj
0F76 42                                      ld      b, d
0F77 4B                                      ld      c, e
0F78 3E C0                                   ld      a, 0C0h ; '+'
0F7A D3 05                                   out     (MROM_PAGE_REG), a
0F7C CB 21                                   sla     c
0F7E CB 10                                   rl      b
0F80 AF                                      xor     a
0F81 21 00 40                                ld      hl, 4000h
0F84 09                                      add     hl, bc
0F85 ED 4B 86 23                             ld      bc, (word_2386)
0F89 E5                                      push    hl
0F8A DD E1                                   pop     ix
0F8C AF                                      xor     a
0F8D DD 6E 00                                ld      l, (ix+0)
0F90 DD 66 01                                ld      h, (ix+1)
0F93 11 FF FF                                ld      de, 0FFFFh
0F96 ED 52                                   sbc     hl, de
0F98 DD E5                                   push    ix
0F9A E1                                      pop     hl
0F9B 20 1A                                   jr      nz, loc_FB7
0F9D 71                                      ld      (hl), c
0F9E 23                                      inc     hl
0F9F 70                                      ld      (hl), b
0FA0 23                                      inc     hl
0FA1 18 20                                   jr      loc_FC3
0FA3                         ; ---------------------------------------------------------------------------
0FA3
0FA3                         loc_FA3:                                ; CODE XREF: sub_F02+72j
0FA3                                                                 ; sub_F02+BFj
0FA3 ED 4B 86 23                             ld      bc, (word_2386)
0FA7 3E C1                                   ld      a, 0C1h ; '-'
0FA9 D3 05                                   out     (MROM_PAGE_REG), a
0FAB 2A 88 23                                ld      hl, (word_2388)
0FAE 70                                      ld      (hl), b
0FAF 2B                                      dec     hl
0FB0 71                                      ld      (hl), c
0FB1 2B                                      dec     hl
0FB2 22 88 23                                ld      (word_2388), hl
0FB5 18 0C                                   jr      loc_FC3
0FB7                         ; ---------------------------------------------------------------------------
0FB7
0FB7                         loc_FB7:                                ; CODE XREF: sub_F02+67j
0FB7                                                                 ; sub_F02+99j
0FB7 3E 02                                   ld      a, 2
0FB9 CD B4 13                                call    sub_13B4
0FBC 3A 72 23                                ld      a, (byte_2372)
0FBF FE FF                                   cp      0FFh
0FC1 28 E0                                   jr      z, loc_FA3
0FC3
0FC3                         loc_FC3:                                ; CODE XREF: sub_F02+53j
0FC3                                                                 ; sub_F02+9Fj ...
0FC3 ED 5B 86 23                             ld      de, (word_2386)
0FC7 13                                      inc     de
0FC8 ED 53 86 23                             ld      (word_2386), de
0FCC AF                                      xor     a
0FCD 2A 77 23                                ld      hl, (word_2377)
0FD0 ED 52                                   sbc     hl, de
0FD2 C2 18 0F                                jp      nz, loc_F18
0FD5 3A 6F 23                                ld      a, (byte_236F)
0FD8 D3 05                                   out     (MROM_PAGE_REG), a
0FDA DD 21 81 23                             ld      ix, 2381h
0FDE DD 7E 00                                ld      a, (ix+0)
0FE1 E6 C0                                   and     0C0h ; '+'
0FE3 5F                                      ld      e, a
0FE4 DD 56 01                                ld      d, (ix+1)
0FE7 DD 6E 02                                ld      l, (ix+2)
0FEA DD 21 54 23                             ld      ix, 2354h
0FEE DD 73 00                                ld      (ix+0), e
0FF1 DD 72 01                                ld      (ix+1), d
0FF4 DD 75 02                                ld      (ix+2), l
0FF7 21 54 23                                ld      hl, 2354h
0FFA CD 63 25                                call    sub_2563
0FFD CD 00 11                                call    sub_1100
1000 CD 0F 10                                call    sub_100F
1003 CD 92 12                                call    sub_1292
1006 CD 21 13                                call    sub_1321
1009 DD E1                                   pop     ix
100B E1                                      pop     hl
100C D1                                      pop     de
100D C1                                      pop     bc
100E C9                                      ret
100E                         ; End of function sub_F02
100E
100F
100F                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
100F
100F
100F                         sub_100F:                               ; CODE XREF: sub_F02+FEp
100F C5                                      push    bc
1010 D5                                      push    de
1011 E5                                      push    hl
1012 DD E5                                   push    ix
1014 FD E5                                   push    iy
1016 DB 05                                   in      a, (MROM_PAGE_REG)
1018 32 6F 23                                ld      (byte_236F), a
101B ED 5B 77 23                             ld      de, (word_2377)
101F 7A                                      ld      a, d
1020 FE 02                                   cp      2
1022 28 0C                                   jr      z, loc_1030
1024 FE 04                                   cp      4
1026 28 0D                                   jr      z, loc_1035
1028 FE 08                                   cp      8
102A 28 0E                                   jr      z, loc_103A
102C FE 10                                   cp      10h
102E 28 0F                                   jr      z, loc_103F
1030
1030                         loc_1030:                               ; CODE XREF: sub_100F+13j
1030 11 F8 01                                ld      de, 1F8h
1033 18 0D                                   jr      loc_1042
1035                         ; ---------------------------------------------------------------------------
1035
1035                         loc_1035:                               ; CODE XREF: sub_100F+17j
1035 11 F0 03                                ld      de, 3F0h
1038 18 08                                   jr      loc_1042
103A                         ; ---------------------------------------------------------------------------
103A
103A                         loc_103A:                               ; CODE XREF: sub_100F+1Bj
103A 11 E0 07                                ld      de, 7E0h
103D 18 03                                   jr      loc_1042
103F                         ; ---------------------------------------------------------------------------
103F
103F                         loc_103F:                               ; CODE XREF: sub_100F+1Fj
103F 11 C0 0F                                ld      de, 0FC0h
1042
1042                         loc_1042:                               ; CODE XREF: sub_100F+24j
1042                                                                 ; sub_100F+29j ...
1042 ED 53 8C 23                             ld      (word_238C), de
1046 11 00 00                                ld      de, 0
1049 ED 53 84 23                             ld      (word_2384), de
104D
104D                         loc_104D:                               ; CODE XREF: sub_100F+C2j
104D 3E C0                                   ld      a, 0C0h ; '+'
104F D3 05                                   out     (MROM_PAGE_REG), a
1051 FD 21 F2 43                             ld      iy, 43F2h
1055 2A 84 23                                ld      hl, (word_2384)
1058 CB 25                                   sla     l
105A CB 14                                   rl      h
105C AF                                      xor     a
105D 01 00 40                                ld      bc, 4000h
1060 09                                      add     hl, bc
1061 E5                                      push    hl
1062 DD E1                                   pop     ix
1064 5E                                      ld      e, (hl)
1065 23                                      inc     hl
1066 56                                      ld      d, (hl)
1067 2A 77 23                                ld      hl, (word_2377)
106A 2B                                      dec     hl
106B AF                                      xor     a
106C ED 52                                   sbc     hl, de
106E 30 53                                   jr      nc, loc_10C3
1070 3E C1                                   ld      a, 0C1h ; '-'
1072 D3 05                                   out     (MROM_PAGE_REG), a
1074
1074                         loc_1074:                               ; CODE XREF: sub_100F+97j
1074 FD 5E 00                                ld      e, (iy+0)
1077 FD 56 01                                ld      d, (iy+1)
107A 4A                                      ld      c, d
107B FD 2B                                   dec     iy
107D FD 2B                                   dec     iy
107F C5                                      push    bc
1080 2A 84 23                                ld      hl, (word_2384)
1083 ED 4B 8C 23                             ld      bc, (word_238C)
1087 CB 38                                   srl     b
1089 CB 19                                   rr      c
108B AF                                      xor     a
108C ED 42                                   sbc     hl, bc
108E 3A 85 23                                ld      a, (word_2384+1)
1091 38 07                                   jr      c, loc_109A
1093 3A 85 23                                ld      a, (word_2384+1)
1096 B8                                      cp      b
1097 20 01                                   jr      nz, loc_109A
1099 3C                                      inc     a
109A
109A                         loc_109A:                               ; CODE XREF: sub_100F+82j
109A                                                                 ; sub_100F+88j
109A C1                                      pop     bc
109B 2A 7A 23                                ld      hl, (word_237A)
109E
109E                         loc_109E:                               ; CODE XREF: sub_100F+94j
109E CB 39                                   srl     c
10A0 CB 3F                                   srl     a
10A2 2D                                      dec     l
10A3 20 F9                                   jr      nz, loc_109E
10A5 B9                                      cp      c
10A6 20 CC                                   jr      nz, loc_1074
10A8 3E FF                                   ld      a, 0FFh
10AA FD 77 02                                ld      (iy+2), a
10AD FD 77 03                                ld      (iy+3), a
10B0 3E C0                                   ld      a, 0C0h ; '+'
10B2 D3 05                                   out     (MROM_PAGE_REG), a
10B4 DD 73 00                                ld      (ix+0), e
10B7 DD 72 01                                ld      (ix+1), d
10BA 3E 01                                   ld      a, 1
10BC ED 53 86 23                             ld      (word_2386), de
10C0 CD B4 13                                call    sub_13B4
10C3
10C3                         loc_10C3:                               ; CODE XREF: sub_100F+5Fj
10C3 2A 84 23                                ld      hl, (word_2384)
10C6 23                                      inc     hl
10C7 22 84 23                                ld      (word_2384), hl
10CA ED 5B 8C 23                             ld      de, (word_238C)
10CE AF                                      xor     a
10CF ED 52                                   sbc     hl, de
10D1 C2 4D 10                                jp      nz, loc_104D
10D4 3E C1                                   ld      a, 0C1h ; '-'
10D6 D3 05                                   out     (MROM_PAGE_REG), a
10D8 3E 55                                   ld      a, 55h ; 'U'
10DA 32 FC 43                                ld      (43FCh), a
10DD 3E AA                                   ld      a, 0AAh ; '¬'
10DF 32 FD 43                                ld      (43FDh), a
10E2 CD 77 15                                call    sub_1577
10E5 3E C1                                   ld      a, 0C1h ; '-'
10E7 D3 05                                   out     (MROM_PAGE_REG), a
10E9 DD 21 FE 43                             ld      ix, 43FEh
10ED DD 73 00                                ld      (ix+0), e
10F0 DD 72 01                                ld      (ix+1), d
10F3 3A 6F 23                                ld      a, (byte_236F)
10F6 D3 05                                   out     (MROM_PAGE_REG), a
10F8 FD E1                                   pop     iy
10FA DD E1                                   pop     ix
10FC E1                                      pop     hl
10FD D1                                      pop     de
10FE C1                                      pop     bc
10FF C9                                      ret
10FF                         ; End of function sub_100F
10FF
1100
1100                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1100
1100
1100                         sub_1100:                               ; CODE XREF: sub_F02+FBp
1100 C5                                      push    bc
1101 D5                                      push    de
1102 E5                                      push    hl
1103 DD E5                                   push    ix
1105 ED 5B 77 23                             ld      de, (word_2377)
1109 CB 3A                                   srl     d
110B CB 1B                                   rr      e
110D AF                                      xor     a
110E
110E                         loc_110E:                               ; CODE XREF: sub_1100+11j
110E 3C                                      inc     a
110F CB 3A                                   srl     d
1111 20 FB                                   jr      nz, loc_110E
1113 3D                                      dec     a
1114 FE 01                                   cp      1
1116 20 02                                   jr      nz, loc_111A
1118 3E 02                                   ld      a, 2
111A
111A                         loc_111A:                               ; CODE XREF: sub_1100+16j
111A 32 7A 23                                ld      (word_237A), a
111D DB 05                                   in      a, (MROM_PAGE_REG)
111F 32 6F 23                                ld      (byte_236F), a
1122 3E C1                                   ld      a, 0C1h ; '-'
1124 D3 05                                   out     (MROM_PAGE_REG), a
1126 AF                                      xor     a
1127 FD 21 FA 43                             ld      iy, 43FAh
112B 06 04                                   ld      b, 4
112D
112D                         loc_112D:                               ; CODE XREF: sub_1100+63j
112D DD 21 F2 43                             ld      ix, 43F2h
1131
1131                         loc_1131:                               ; CODE XREF: sub_1100+4Ej
1131 DD 5E 00                                ld      e, (ix+0)
1134 DD 56 01                                ld      d, (ix+1)
1137 DD 4E 01                                ld      c, (ix+1)
113A DD 2B                                   dec     ix
113C DD 2B                                   dec     ix
113E DD E5                                   push    ix
1140 E1                                      pop     hl
1141 CB 74                                   bit     6, h
1143 28 20                                   jr      z, loc_1165
1145 2A 7A 23                                ld      hl, (word_237A)
1148
1148                         loc_1148:                               ; CODE XREF: sub_1100+4Bj
1148 CB 39                                   srl     c
114A 2D                                      dec     l
114B 20 FB                                   jr      nz, loc_1148
114D B9                                      cp      c
114E 20 E1                                   jr      nz, loc_1131
1150 3C                                      inc     a
1151 DD 36 02 FF                             ld      (ix+2), 0FFh
1155 DD 36 03 FF                             ld      (ix+3), 0FFh
1159 FD 72 01                                ld      (iy+1), d
115C FD 73 00                                ld      (iy+0), e
115F FD 2B                                   dec     iy
1161 FD 2B                                   dec     iy
1163 10 C8                                   djnz    loc_112D
1165
1165                         loc_1165:                               ; CODE XREF: sub_1100+43j
1165 3A 6F 23                                ld      a, (byte_236F)
1168 D3 05                                   out     (MROM_PAGE_REG), a
116A DD E1                                   pop     ix
116C E1                                      pop     hl
116D D1                                      pop     de
116E C1                                      pop     bc
116F C9                                      ret
116F                         ; End of function sub_1100
116F
1170
1170                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1170
1170
1170                         sub_1170:                               ; CODE XREF: sub_14EF+28p
1170 C5                                      push    bc
1171 D5                                      push    de
1172 E5                                      push    hl
1173 DD E5                                   push    ix
1175 DD 21 81 23                             ld      ix, 2381h
1179 DD 5E 00                                ld      e, (ix+0)
117C 7B                                      ld      a, e
117D C6 1F                                   add     a, 1Fh
117F 5F                                      ld      e, a
1180 DD 56 01                                ld      d, (ix+1)
1183 DD 6E 02                                ld      l, (ix+2)
1186 01 00 04                                ld      bc, 400h
1189 ED 43 7B 23                             ld      (word_237A+1), bc
118D 21 00 00                                ld      hl, 0
1190 22 7D 23                                ld      (word_237D), hl
1193 3E 02                                   ld      a, 2
1195 32 80 23                                ld      (byte_2380), a
1198
1198                         loc_1198:                               ; CODE XREF: sub_1170+82j
1198                                                                 ; sub_1170+8Bj
1198 DB 4E                                   in      a, (WATCHDOG_REG)
119A F6 08                                   or      8
119C D3 4E                                   out     (WATCHDOG_REG), a
119E DD 21 54 23                             ld      ix, 2354h
11A2 ED 4B 7B 23                             ld      bc, (word_237A+1)
11A6 DD 71 00                                ld      (ix+0), c
11A9 DD 70 01                                ld      (ix+1), b
11AC DD 73 02                                ld      (ix+2), e
11AF DD 72 03                                ld      (ix+3), d
11B2 DD 75 04                                ld      (ix+4), l
11B5 D5                                      push    de
11B6 E5                                      push    hl
11B7 ED 4B 7D 23                             ld      bc, (word_237D)
11BB DD 71 05                                ld      (ix+5), c
11BE DD 70 06                                ld      (ix+6), b
11C1 DD 36 07 01                             ld      (ix+7), 1
11C5 21 54 23                                ld      hl, 2354h
11C8 06 00                                   ld      b, 0
11CA CD 0F 3B                                call    sub_3B0F
11CD E1                                      pop     hl
11CE D1                                      pop     de
11CF 3A 80 23                                ld      a, (byte_2380)
11D2 3D                                      dec     a
11D3 32 80 23                                ld      (byte_2380), a
11D6 A7                                      and     a
11D7 28 24                                   jr      z, loc_11FD
11D9 E5                                      push    hl
11DA 2A 7D 23                                ld      hl, (word_237D)
11DD 01 00 02                                ld      bc, 200h
11E0 09                                      add     hl, bc
11E1 22 7D 23                                ld      (word_237D), hl
11E4 E1                                      pop     hl
11E5 ED 4B 7B 23                             ld      bc, (word_237A+1)
11E9 04                                      inc     b
11EA 04                                      inc     b
11EB ED 43 7B 23                             ld      (word_237A+1), bc
11EF 78                                      ld      a, b
11F0 FE 08                                   cp      8
11F2 20 A4                                   jr      nz, loc_1198
11F4 06 00                                   ld      b, 0
11F6 ED 43 7B 23                             ld      (word_237A+1), bc
11FA 1C                                      inc     e
11FB 18 9B                                   jr      loc_1198
11FD                         ; ---------------------------------------------------------------------------
11FD
11FD                         loc_11FD:                               ; CODE XREF: sub_1170+67j
11FD DD E1                                   pop     ix
11FF E1                                      pop     hl
1200 D1                                      pop     de
1201 C1                                      pop     bc
1202 C9                                      ret
1202                         ; End of function sub_1170
1202
1203
1203                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1203
1203
1203                         sub_1203:                               ; CODE XREF: sub_14EF+2Bp
1203 C5                                      push    bc
1204 D5                                      push    de
1205 E5                                      push    hl
1206 DD E5                                   push    ix
1208 DD 21 81 23                             ld      ix, 2381h
120C DD 5E 00                                ld      e, (ix+0)
120F DD 56 01                                ld      d, (ix+1)
1212 DD 6E 02                                ld      l, (ix+2)
1215 01 00 00                                ld      bc, 0
1218 ED 43 7B 23                             ld      (word_237A+1), bc
121C 21 00 00                                ld      hl, 0
121F 22 7D 23                                ld      (word_237D), hl
1222 3E 20                                   ld      a, 20h ; ' '
1224 32 80 23                                ld      (byte_2380), a
1227
1227                         loc_1227:                               ; CODE XREF: sub_1203+7Ej
1227                                                                 ; sub_1203+87j
1227 DB 4E                                   in      a, (WATCHDOG_REG)
1229 F6 08                                   or      8
122B D3 4E                                   out     (WATCHDOG_REG), a
122D DD 21 54 23                             ld      ix, 2354h
1231 ED 4B 7B 23                             ld      bc, (word_237A+1)
1235 DD 71 00                                ld      (ix+0), c
1238 DD 70 01                                ld      (ix+1), b
123B DD 73 02                                ld      (ix+2), e
123E DD 72 03                                ld      (ix+3), d
1241 DD 75 04                                ld      (ix+4), l
1244 D5                                      push    de
1245 E5                                      push    hl
1246 ED 4B 7D 23                             ld      bc, (word_237D)
124A DD 71 05                                ld      (ix+5), c
124D DD 70 06                                ld      (ix+6), b
1250 DD 36 07 00                             ld      (ix+7), 0
1254 21 54 23                                ld      hl, 2354h
1257 06 00                                   ld      b, 0
1259 CD 0F 3B                                call    sub_3B0F
125C E1                                      pop     hl
125D D1                                      pop     de
125E 3A 80 23                                ld      a, (byte_2380)
1261 3D                                      dec     a
1262 32 80 23                                ld      (byte_2380), a
1265 A7                                      and     a
1266 28 24                                   jr      z, loc_128C
1268 E5                                      push    hl
1269 2A 7D 23                                ld      hl, (word_237D)
126C 01 00 02                                ld      bc, 200h
126F 09                                      add     hl, bc
1270 22 7D 23                                ld      (word_237D), hl
1273 E1                                      pop     hl
1274 ED 4B 7B 23                             ld      bc, (word_237A+1)
1278 04                                      inc     b
1279 04                                      inc     b
127A ED 43 7B 23                             ld      (word_237A+1), bc
127E 78                                      ld      a, b
127F FE 08                                   cp      8
1281 20 A4                                   jr      nz, loc_1227
1283 06 00                                   ld      b, 0
1285 ED 43 7B 23                             ld      (word_237A+1), bc
1289 1C                                      inc     e
128A 18 9B                                   jr      loc_1227
128C                         ; ---------------------------------------------------------------------------
128C
128C                         loc_128C:                               ; CODE XREF: sub_1203+63j
128C DD E1                                   pop     ix
128E E1                                      pop     hl
128F D1                                      pop     de
1290 C1                                      pop     bc
1291 C9                                      ret
1291                         ; End of function sub_1203
1291
1292
1292                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1292
1292
1292                         sub_1292:                               ; CODE XREF: sub_F02+101p
1292 C5                                      push    bc
1293 D5                                      push    de
1294 E5                                      push    hl
1295 DD E5                                   push    ix
1297 DD 21 81 23                             ld      ix, 2381h
129B DD 5E 00                                ld      e, (ix+0)
129E DD 56 01                                ld      d, (ix+1)
12A1 DD 6E 02                                ld      l, (ix+2)
12A4 01 00 00                                ld      bc, 0
12A7 ED 43 7B 23                             ld      (word_237A+1), bc
12AB 21 00 00                                ld      hl, 0
12AE 22 7D 23                                ld      (word_237D), hl
12B1 3E 20                                   ld      a, 20h ; ' '
12B3 32 7F 23                                ld      (byte_237F), a
12B6
12B6                         loc_12B6:                               ; CODE XREF: sub_1292+7Ej
12B6                                                                 ; sub_1292+87j
12B6 DB 4E                                   in      a, (WATCHDOG_REG)
12B8 F6 08                                   or      8
12BA D3 4E                                   out     (WATCHDOG_REG), a
12BC DD 21 54 23                             ld      ix, 2354h
12C0 ED 4B 7B 23                             ld      bc, (word_237A+1)
12C4 DD 71 00                                ld      (ix+0), c
12C7 DD 70 01                                ld      (ix+1), b
12CA DD 73 02                                ld      (ix+2), e
12CD DD 72 03                                ld      (ix+3), d
12D0 DD 75 04                                ld      (ix+4), l
12D3 D5                                      push    de
12D4 E5                                      push    hl
12D5 ED 4B 7D 23                             ld      bc, (word_237D)
12D9 DD 71 05                                ld      (ix+5), c
12DC DD 70 06                                ld      (ix+6), b
12DF DD 36 07 00                             ld      (ix+7), 0
12E3 21 54 23                                ld      hl, 2354h
12E6 06 00                                   ld      b, 0
12E8 CD 1B 26                                call    sub_261B
12EB E1                                      pop     hl
12EC D1                                      pop     de
12ED 3A 7F 23                                ld      a, (byte_237F)
12F0 3D                                      dec     a
12F1 32 7F 23                                ld      (byte_237F), a
12F4 A7                                      and     a
12F5 28 24                                   jr      z, loc_131B
12F7 E5                                      push    hl
12F8 2A 7D 23                                ld      hl, (word_237D)
12FB 01 00 02                                ld      bc, 200h
12FE 09                                      add     hl, bc
12FF 22 7D 23                                ld      (word_237D), hl
1302 E1                                      pop     hl
1303 ED 4B 7B 23                             ld      bc, (word_237A+1)
1307 04                                      inc     b
1308 04                                      inc     b
1309 ED 43 7B 23                             ld      (word_237A+1), bc
130D 78                                      ld      a, b
130E FE 08                                   cp      8
1310 20 A4                                   jr      nz, loc_12B6
1312 06 00                                   ld      b, 0
1314 ED 43 7B 23                             ld      (word_237A+1), bc
1318 1C                                      inc     e
1319 18 9B                                   jr      loc_12B6
131B                         ; ---------------------------------------------------------------------------
131B
131B                         loc_131B:                               ; CODE XREF: sub_1292+63j
131B DD E1                                   pop     ix
131D E1                                      pop     hl
131E D1                                      pop     de
131F C1                                      pop     bc
1320 C9                                      ret
1320                         ; End of function sub_1292
1320
1321
1321                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1321
1321
1321                         sub_1321:                               ; CODE XREF: sub_F02+104p
1321 C5                                      push    bc
1322 D5                                      push    de
1323 E5                                      push    hl
1324 DD E5                                   push    ix
1326 DD 21 81 23                             ld      ix, 2381h
132A DD 5E 00                                ld      e, (ix+0)
132D 7B                                      ld      a, e
132E C6 1F                                   add     a, 1Fh
1330 5F                                      ld      e, a
1331 DD 56 01                                ld      d, (ix+1)
1334 DD 6E 02                                ld      l, (ix+2)
1337 01 00 04                                ld      bc, 400h
133A ED 43 7B 23                             ld      (word_237A+1), bc
133E 21 00 00                                ld      hl, 0
1341 22 7D 23                                ld      (word_237D), hl
1344 3E 02                                   ld      a, 2
1346 32 7F 23                                ld      (byte_237F), a
1349
1349                         loc_1349:                               ; CODE XREF: sub_1321+82j
1349                                                                 ; sub_1321+8Bj
1349 DB 4E                                   in      a, (WATCHDOG_REG)
134B F6 08                                   or      8
134D D3 4E                                   out     (WATCHDOG_REG), a
134F DD 21 54 23                             ld      ix, 2354h
1353 ED 4B 7B 23                             ld      bc, (word_237A+1)
1357 DD 71 00                                ld      (ix+0), c
135A DD 70 01                                ld      (ix+1), b
135D DD 73 02                                ld      (ix+2), e
1360 DD 72 03                                ld      (ix+3), d
1363 DD 75 04                                ld      (ix+4), l
1366 D5                                      push    de
1367 E5                                      push    hl
1368 ED 4B 7D 23                             ld      bc, (word_237D)
136C DD 71 05                                ld      (ix+5), c
136F DD 70 06                                ld      (ix+6), b
1372 DD 36 07 01                             ld      (ix+7), 1
1376 21 54 23                                ld      hl, 2354h
1379 06 00                                   ld      b, 0
137B CD 1B 26                                call    sub_261B
137E E1                                      pop     hl
137F D1                                      pop     de
1380 3A 7F 23                                ld      a, (byte_237F)
1383 3D                                      dec     a
1384 32 7F 23                                ld      (byte_237F), a
1387 A7                                      and     a
1388 28 24                                   jr      z, loc_13AE
138A E5                                      push    hl
138B 2A 7D 23                                ld      hl, (word_237D)
138E 01 00 02                                ld      bc, 200h
1391 09                                      add     hl, bc
1392 22 7D 23                                ld      (word_237D), hl
1395 E1                                      pop     hl
1396 ED 4B 7B 23                             ld      bc, (word_237A+1)
139A 04                                      inc     b
139B 04                                      inc     b
139C ED 43 7B 23                             ld      (word_237A+1), bc
13A0 78                                      ld      a, b
13A1 FE 08                                   cp      8
13A3 20 A4                                   jr      nz, loc_1349
13A5 06 00                                   ld      b, 0
13A7 ED 43 7B 23                             ld      (word_237A+1), bc
13AB 1C                                      inc     e
13AC 18 9B                                   jr      loc_1349
13AE                         ; ---------------------------------------------------------------------------
13AE
13AE                         loc_13AE:                               ; CODE XREF: sub_1321+67j
13AE DD E1                                   pop     ix
13B0 E1                                      pop     hl
13B1 D1                                      pop     de
13B2 C1                                      pop     bc
13B3 C9                                      ret
13B3                         ; End of function sub_1321
13B3
13B4
13B4                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
13B4
13B4
13B4                         sub_13B4:                               ; CODE XREF: sub_D44+68p
13B4                                                                 ; sub_F02+B7p ...
13B4 C5                                      push    bc
13B5 D5                                      push    de
13B6 E5                                      push    hl
13B7 DD E5                                   push    ix
13B9 32 75 23                                ld      (byte_2375), a
13BC ED 5B 86 23                             ld      de, (word_2386)
13C0 2E 00                                   ld      l, 0
13C2 06 06                                   ld      b, 6
13C4 AF                                      xor     a
13C5
13C5                         loc_13C5:                               ; CODE XREF: sub_13B4+17j
13C5 CB 23                                   sla     e
13C7 CB 12                                   rl      d
13C9 CB 15                                   rl      l
13CB 10 F8                                   djnz    loc_13C5
13CD 06 00                                   ld      b, 0
13CF DD 21 54 23                             ld      ix, 2354h
13D3 DD 73 00                                ld      (ix+0), e
13D6 DD 72 01                                ld      (ix+1), d
13D9 DD 75 02                                ld      (ix+2), l
13DC D5                                      push    de
13DD E5                                      push    hl
13DE 21 54 23                                ld      hl, 2354h
13E1 CD 63 25                                call    sub_2563
13E4 E1                                      pop     hl
13E5 D1                                      pop     de
13E6 DD 21 54 23                             ld      ix, 2354h
13EA DD 36 00 00                             ld      (ix+0), 0
13EE DD 36 01 08                             ld      (ix+1), 8
13F2 DD 73 02                                ld      (ix+2), e
13F5 DD 72 03                                ld      (ix+3), d
13F8 DD 75 04                                ld      (ix+4), l
13FB 32 71 23                                ld      (byte_2371), a
13FE A7                                      and     a
13FF 20 2B                                   jr      nz, loc_142C
1401 3E FF                                   ld      a, 0FFh
1403 32 72 23                                ld      (byte_2372), a
1406 3A 75 23                                ld      a, (byte_2375)
1409 FE 00                                   cp      0
140B CA 24 14                                jp      z, loc_1424
140E FE 01                                   cp      1
1410 CA 1B 14                                jp      z, loc_141B
1413 11 FF AF                                ld      de, 0AFFFh
1416 01 FF FF                                ld      bc, 0FFFFh
1419 18 1C                                   jr      loc_1437
141B                         ; ---------------------------------------------------------------------------
141B
141B                         loc_141B:                               ; CODE XREF: sub_13B4+5Cj
141B 11 FF AA                                ld      de, 0AAFFh
141E ED 4B 84 23                             ld      bc, (word_2384)
1422 18 13                                   jr      loc_1437
1424                         ; ---------------------------------------------------------------------------
1424
1424                         loc_1424:                               ; CODE XREF: sub_13B4+57j
1424 11 FF 80                                ld      de, 80FFh
1427 01 00 00                                ld      bc, 0
142A 18 0B                                   jr      loc_1437
142C                         ; ---------------------------------------------------------------------------
142C
142C                         loc_142C:                               ; CODE XREF: sub_13B4+4Bj
142C 3E FE                                   ld      a, 0FEh ; '¦'
142E 32 72 23                                ld      (byte_2372), a
1431 11 FE FF                                ld      de, 0FFFEh
1434 01 FF FF                                ld      bc, 0FFFFh
1437
1437                         loc_1437:                               ; CODE XREF: sub_13B4+65j
1437                                                                 ; sub_13B4+6Ej ...
1437 21 54 23                                ld      hl, 2354h
143A CD BC 26                                call    sub_26BC
143D 3E 37                                   ld      a, 37h
143F D3 2A                                   out     (SNAN_CMD_REG), a
1441 DD E1                                   pop     ix
1443 E1                                      pop     hl
1444 D1                                      pop     de
1445 C1                                      pop     bc
1446 C9                                      ret
1446                         ; End of function sub_13B4
1446
1447
1447                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1447
1447
1447                         sub_1447:                               ; CODE XREF: sub_CDC+2Bp
1447                                                                 ; sub_F02+5p
1447 C5                                      push    bc
1448 E5                                      push    hl
1449 DB 05                                   in      a, (MROM_PAGE_REG)
144B 32 6F 23                                ld      (byte_236F), a
144E 3E C0                                   ld      a, 0C0h ; '+'
1450 D3 05                                   out     (MROM_PAGE_REG), a
1452 21 00 40                                ld      hl, 4000h
1455 01 00 40                                ld      bc, 4000h
1458
1458                         loc_1458:                               ; CODE XREF: sub_1447+17j
1458 36 FF                                   ld      (hl), 0FFh
145A 23                                      inc     hl
145B 0B                                      dec     bc
145C 78                                      ld      a, b
145D B1                                      or      c
145E 20 F8                                   jr      nz, loc_1458
1460 3E C1                                   ld      a, 0C1h ; '-'
1462 D3 05                                   out     (MROM_PAGE_REG), a
1464 21 00 40                                ld      hl, 4000h
1467 01 00 04                                ld      bc, 400h
146A
146A                         loc_146A:                               ; CODE XREF: sub_1447+29j
146A 36 FF                                   ld      (hl), 0FFh
146C 23                                      inc     hl
146D 0B                                      dec     bc
146E 78                                      ld      a, b
146F B1                                      or      c
1470 20 F8                                   jr      nz, loc_146A
1472 3A 6F 23                                ld      a, (byte_236F)
1475 D3 05                                   out     (MROM_PAGE_REG), a
1477 E1                                      pop     hl
1478 C1                                      pop     bc
1479 C9                                      ret
1479                         ; End of function sub_1447
1479
147A
147A                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
147A
147A
147A                         sub_147A:                               ; CODE XREF: sub_DBF+E5p
147A                                                                 ; sub_DBF+F4p
147A C5                                      push    bc
147B D5                                      push    de
147C E5                                      push    hl
147D DD E5                                   push    ix
147F D5                                      push    de
1480 11 5F 23                                ld      de, 235Fh
1483 01 05 00                                ld      bc, 5
1486 ED B0                                   ldir
1488 DD 21 64 23                             ld      ix, 2364h
148C DD 36 00 00                             ld      (ix+0), 0
1490 DD 36 01 44                             ld      (ix+1), 44h ; 'D'
1494 DD 36 02 01                             ld      (ix+2), 1
1498 E1                                      pop     hl
1499 11 67 23                                ld      de, 2367h
149C 01 05 00                                ld      bc, 5
149F ED B0                                   ldir
14A1 DD 21 6C 23                             ld      ix, 236Ch
14A5 DD 36 00 00                             ld      (ix+0), 0
14A9 DD 36 01 44                             ld      (ix+1), 44h ; 'D'
14AD DD 36 02 01                             ld      (ix+2), 1
14B1 01 00 01                                ld      bc, 100h
14B4
14B4                         loc_14B4:                               ; CODE XREF: sub_147A+5Ej
14B4                                                                 ; sub_147A+6Dj
14B4 C5                                      push    bc
14B5 21 5F 23                                ld      hl, 235Fh
14B8 CD 0F 3B                                call    sub_3B0F
14BB 21 67 23                                ld      hl, 2367h
14BE CD 1B 26                                call    sub_261B
14C1 C1                                      pop     bc
14C2 0B                                      dec     bc
14C3 78                                      ld      a, b
14C4 B1                                      or      c
14C5 28 22                                   jr      z, loc_14E9
14C7 DD 21 5F 23                             ld      ix, 235Fh
14CB DD 7E 01                                ld      a, (ix+1)
14CE 3C                                      inc     a
14CF 3C                                      inc     a
14D0 DD 77 01                                ld      (ix+1), a
14D3 DD 77 09                                ld      (ix+9), a
14D6 FE 08                                   cp      8
14D8 20 DA                                   jr      nz, loc_14B4
14DA AF                                      xor     a
14DB DD 77 01                                ld      (ix+1), a
14DE DD 77 09                                ld      (ix+9), a
14E1 DD 34 02                                inc     (ix+2)
14E4 DD 34 0A                                inc     (ix+0Ah)
14E7 18 CB                                   jr      loc_14B4
14E9                         ; ---------------------------------------------------------------------------
14E9
14E9                         loc_14E9:                               ; CODE XREF: sub_147A+4Bj
14E9 DD E1                                   pop     ix
14EB E1                                      pop     hl
14EC D1                                      pop     de
14ED C1                                      pop     bc
14EE C9                                      ret
14EE                         ; End of function sub_147A
14EE
14EF
14EF                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
14EF
14EF
14EF                         sub_14EF:                               ; CODE XREF: sub_CDC+2Ep
14EF DB 05                                   in      a, (MROM_PAGE_REG)
14F1 32 6F 23                                ld      (byte_236F), a
14F4 3A 76 23                                ld      a, (byte_2376)
14F7 5F                                      ld      e, a
14F8 2E 00                                   ld      l, 0
14FA 16 00                                   ld      d, 0
14FC 06 06                                   ld      b, 6
14FE AF                                      xor     a
14FF
14FF                         loc_14FF:                               ; CODE XREF: sub_14EF+16j
14FF CB 23                                   sla     e
1501 CB 12                                   rl      d
1503 CB 15                                   rl      l
1505 10 F8                                   djnz    loc_14FF
1507 DD 21 81 23                             ld      ix, 2381h
150B 7B                                      ld      a, e
150C C6 20                                   add     a, 20h ; ' '
150E DD 77 00                                ld      (ix+0), a
1511 DD 72 01                                ld      (ix+1), d
1514 DD 75 02                                ld      (ix+2), l
1517 CD 70 11                                call    sub_1170
151A CD 03 12                                call    sub_1203
151D 3E C1                                   ld      a, 0C1h ; '-'
151F D3 05                                   out     (MROM_PAGE_REG), a
1521 3A FC 43                                ld      a, (43FCh)
1524 FE 55                                   cp      55h ; 'U'
1526 20 44                                   jr      nz, loc_156C
1528 3A FD 43                                ld      a, (43FDh)
152B FE AA                                   cp      0AAh ; '¬'
152D 20 3D                                   jr      nz, loc_156C
152F 3E C0                                   ld      a, 0C0h ; '+'
1531 D3 05                                   out     (MROM_PAGE_REG), a
1533 2A 77 23                                ld      hl, (word_2377)
1536 5C                                      ld      e, h
1537 55                                      ld      d, l
1538 CB 03                                   rlc     e
153A CB 03                                   rlc     e
153C ED 52                                   sbc     hl, de
153E 44                                      ld      b, h
153F 4D                                      ld      c, l
1540 DD 21 00 40                             ld      ix, 4000h
1544
1544                         loc_1544:                               ; CODE XREF: sub_14EF+72j
1544 AF                                      xor     a
1545 DD 5E 00                                ld      e, (ix+0)
1548 DD 56 01                                ld      d, (ix+1)
154B 2A 77 23                                ld      hl, (word_2377)
154E ED 52                                   sbc     hl, de
1550 38 1A                                   jr      c, loc_156C
1552 AF                                      xor     a
1553 21 03 00                                ld      hl, 3
1556 ED 52                                   sbc     hl, de
1558 30 12                                   jr      nc, loc_156C
155A DD 23                                   inc     ix
155C DD 23                                   inc     ix
155E 0B                                      dec     bc
155F 78                                      ld      a, b
1560 B1                                      or      c
1561 20 E1                                   jr      nz, loc_1544
1563 CD 77 15                                call    sub_1577
1566 AF                                      xor     a
1567 ED 52                                   sbc     hl, de
1569 CA 6E 15                                jp      z, loc_156E
156C
156C                         loc_156C:                               ; CODE XREF: sub_14EF+37j
156C                                                                 ; sub_14EF+3Ej ...
156C 3E 01                                   ld      a, 1
156E
156E                         loc_156E:                               ; CODE XREF: sub_14EF+7Aj
156E 32 73 23                                ld      (byte_2373), a
1571 3A 6F 23                                ld      a, (byte_236F)
1574 D3 05                                   out     (MROM_PAGE_REG), a
1576 C9                                      ret
1576                         ; End of function sub_14EF
1576
1577
1577                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1577
1577
1577                         sub_1577:                               ; CODE XREF: sub_100F+D3p
1577                                                                 ; sub_14EF+74p
1577 DB 05                                   in      a, (MROM_PAGE_REG)
1579 32 6F 23                                ld      (byte_236F), a
157C 3E C0                                   ld      a, 0C0h ; '+'
157E D3 05                                   out     (MROM_PAGE_REG), a
1580 21 00 00                                ld      hl, 0
1583 01 00 7E                                ld      bc, 7E00h
1586
1586                         loc_1586:                               ; CODE XREF: sub_1577+18j
1586                                                                 ; sub_1577+1Dj
1586 0B                                      dec     bc
1587 0A                                      ld      a, (bc)
1588 57                                      ld      d, a
1589 0B                                      dec     bc
158A 0A                                      ld      a, (bc)
158B 5F                                      ld      e, a
158C 19                                      add     hl, de
158D 79                                      ld      a, c
158E A7                                      and     a
158F 20 F5                                   jr      nz, loc_1586
1591 78                                      ld      a, b
1592 FE 40                                   cp      40h ; '@'
1594 20 F0                                   jr      nz, loc_1586
1596 3E C1                                   ld      a, 0C1h ; '-'
1598 D3 05                                   out     (MROM_PAGE_REG), a
159A 01 FE 43                                ld      bc, 43FEh
159D
159D                         loc_159D:                               ; CODE XREF: sub_1577+2Fj
159D                                                                 ; sub_1577+34j
159D 0B                                      dec     bc
159E 0A                                      ld      a, (bc)
159F 57                                      ld      d, a
15A0 0B                                      dec     bc
15A1 0A                                      ld      a, (bc)
15A2 5F                                      ld      e, a
15A3 19                                      add     hl, de
15A4 79                                      ld      a, c
15A5 A7                                      and     a
15A6 20 F5                                   jr      nz, loc_159D
15A8 78                                      ld      a, b
15A9 FE 42                                   cp      42h ; 'B'
15AB 20 F0                                   jr      nz, loc_159D
15AD DD 21 FF 43                             ld      ix, 43FFh
15B1 DD 56 00                                ld      d, (ix+0)
15B4 DD 2B                                   dec     ix
15B6 DD 5E 00                                ld      e, (ix+0)
15B9 EB                                      ex      de, hl
15BA 3A 6F 23                                ld      a, (byte_236F)
15BD D3 05                                   out     (MROM_PAGE_REG), a
15BF C9                                      ret
15BF                         ; End of function sub_1577
15BF
15C0
15C0                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
15C0
15C0
15C0                         sub_15C0:                               ; CODE XREF: sub_9B9+92p
15C0 C5                                      push    bc
15C1 D5                                      push    de
15C2 E5                                      push    hl
15C3 DD E5                                   push    ix
15C5 AF                                      xor     a
15C6 32 B2 23                                ld      (byte_23B2), a
15C9 79                                      ld      a, c
15CA 32 9F 23                                ld      (byte_239F), a
15CD 21 00 00                                ld      hl, 0
15D0 22 A2 23                                ld      (word_23A2), hl
15D3 ED 53 A4 23                             ld      (word_23A4), de
15D7 AF                                      xor     a
15D8 06 07                                   ld      b, 7
15DA
15DA                         loc_15DA:                               ; CODE XREF: sub_15C0+1Ej
15DA CB 3A                                   srl     d
15DC CB 1B                                   rr      e
15DE 10 FA                                   djnz    loc_15DA
15E0 2A A4 23                                ld      hl, (word_23A4)
15E3 CB 3C                                   srl     h
15E5 CB 1D                                   rr      l
15E7 AF                                      xor     a
15E8 ED 52                                   sbc     hl, de
15EA 22 BF 23                                ld      (word_23BF), hl
15ED 3A 9F 23                                ld      a, (byte_239F)
15F0 47                                      ld      b, a
15F1 CD 2A 3F                                call    nand_init
15F4 CD A0 3F                                call    nand_read_status
15F7 32 B2 23                                ld      (byte_23B2), a
15FA A7                                      and     a
15FB 20 0D                                   jr      nz, loc_160A
15FD CD 18 16                                call    sub_1618
1600 3A B2 23                                ld      a, (byte_23B2)
1603 A7                                      and     a
1604 20 04                                   jr      nz, loc_160A
1606 CD 76 16                                call    sub_1676
1609 AF                                      xor     a
160A
160A                         loc_160A:                               ; CODE XREF: sub_15C0+3Bj
160A                                                                 ; sub_15C0+44j
160A 47                                      ld      b, a
160B CD 4E 3F                                call    nand_deinit
160E 78                                      ld      a, b
160F DD E1                                   pop     ix
1611 E1                                      pop     hl
1612 2A A8 23                                ld      hl, (word_23A8)
1615 D1                                      pop     de
1616 C1                                      pop     bc
1617 C9                                      ret
1617                         ; End of function sub_15C0
1617
1618
1618                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1618
1618
1618                         sub_1618:                               ; CODE XREF: sub_15C0+3Dp
1618 C5                                      push    bc
1619 D5                                      push    de
161A E5                                      push    hl
161B DD E5                                   push    ix
161D 11 01 00                                ld      de, 1
1620 ED 53 A6 23                             ld      (word_23A6), de
1624 DD 21 A8 23                             ld      ix, 23A8h
1628 06 01                                   ld      b, 1
162A
162A                         loc_162A:                               ; CODE XREF: sub_1618+35j
162A AF                                      xor     a
162B CD 28 17                                call    sub_1728
162E 3A B3 23                                ld      a, (byte_23B3)
1631 FE FF                                   cp      0FFh
1633 C2 44 16                                jp      nz, loc_1644
1636 2A A6 23                                ld      hl, (word_23A6)
1639 DD 75 00                                ld      (ix+0), l
163C DD 74 01                                ld      (ix+1), h
163F DD 23                                   inc     ix
1641 DD 23                                   inc     ix
1643 05                                      dec     b
1644
1644                         loc_1644:                               ; CODE XREF: sub_1618+1Bj
1644 2A A6 23                                ld      hl, (word_23A6)
1647 23                                      inc     hl
1648 22 A6 23                                ld      (word_23A6), hl
164B 78                                      ld      a, b
164C A7                                      and     a
164D 20 DB                                   jr      nz, loc_162A
164F ED 5B A8 23                             ld      de, (word_23A8)
1653 2E 00                                   ld      l, 0
1655 06 06                                   ld      b, 6
1657 AF                                      xor     a
1658
1658                         loc_1658:                               ; CODE XREF: sub_1618+46j
1658 CB 23                                   sla     e
165A CB 12                                   rl      d
165C CB 15                                   rl      l
165E 10 F8                                   djnz    loc_1658
1660 DD 21 B7 23                             ld      ix, addr_23B7
1664 7B                                      ld      a, e
1665 C6 20                                   add     a, 20h ; ' '
1667 DD 77 00                                ld      (ix+0), a
166A DD 72 01                                ld      (ix+1), d
166D DD 75 02                                ld      (ix+2), l
1670 DD E1                                   pop     ix
1672 E1                                      pop     hl
1673 D1                                      pop     de
1674 C1                                      pop     bc
1675 C9                                      ret
1675                         ; End of function sub_1618
1675
1676
1676                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1676
1676
1676                         sub_1676:                               ; CODE XREF: sub_15C0+46p
1676 C5                                      push    bc
1677 D5                                      push    de
1678 E5                                      push    hl
1679 DD E5                                   push    ix
167B CD 24 19                                call    sub_1924
167E CD 70 18                                call    sub_1870
1681 11 FB 43                                ld      de, 43FBh
1684 ED 53 AE 23                             ld      (word_23AE), de
1688 01 00 00                                ld      bc, 0
168B ED 43 A2 23                             ld      (word_23A2), bc
168F ED 4B BF 23                             ld      bc, (word_23BF)
1693 ED 43 C6 23                             ld      (word_23C6), bc
1697 01 04 00                                ld      bc, 4
169A ED 43 A6 23                             ld      (word_23A6), bc
169E 3E 04                                   ld      a, 4
16A0 87                                      add     a, a
16A1 4F                                      ld      c, a
16A2 06 00                                   ld      b, 0
16A4 2A AE 23                                ld      hl, (word_23AE)
16A7 ED 42                                   sbc     hl, bc
16A9 22 B0 23                                ld      (word_23B0), hl
16AC
16AC                         loc_16AC:                               ; CODE XREF: sub_1676+A0j
16AC DB 4E                                   in      a, (WATCHDOG_REG)
16AE F6 08                                   or      8
16B0 D3 4E                                   out     (WATCHDOG_REG), a
16B2 AF                                      xor     a
16B3 32 B3 23                                ld      (byte_23B3), a
16B6 ED 5B C6 23                             ld      de, (word_23C6)
16BA 7A                                      ld      a, d
16BB B3                                      or      e
16BC 28 04                                   jr      z, loc_16C2
16BE 3E 01                                   ld      a, 1
16C0 18 02                                   jr      loc_16C4
16C2                         ; ---------------------------------------------------------------------------
16C2
16C2                         loc_16C2:                               ; CODE XREF: sub_1676+46j
16C2 3E 02                                   ld      a, 2
16C4
16C4                         loc_16C4:                               ; CODE XREF: sub_1676+4Aj
16C4 CD 28 17                                call    sub_1728
16C7 3A B3 23                                ld      a, (byte_23B3)
16CA FE FF                                   cp      0FFh
16CC C2 DF 16                                jp      nz, loc_16DF
16CF 3A C9 23                                ld      a, (byte_23C9)
16D2 FE 01                                   cp      1
16D4 CC 3B 18                                call    z, sub_183B
16D7 3A C9 23                                ld      a, (byte_23C9)
16DA FE 02                                   cp      2
16DC CC BC 17                                call    z, sub_17BC
16DF
16DF                         loc_16DF:                               ; CODE XREF: sub_1676+56j
16DF 3A C9 23                                ld      a, (byte_23C9)
16E2 FE 02                                   cp      2
16E4 20 21                                   jr      nz, loc_1707
16E6 ED 4B A6 23                             ld      bc, (word_23A6)
16EA 79                                      ld      a, c
16EB FE FF                                   cp      0FFh
16ED 20 18                                   jr      nz, loc_1707
16EF ED 4B BF 23                             ld      bc, (word_23BF)
16F3 ED 43 C6 23                             ld      (word_23C6), bc
16F7 21 00 04                                ld      hl, 400h
16FA ED 5B A4 23                             ld      de, (word_23A4)
16FE AF                                      xor     a
16FF ED 52                                   sbc     hl, de
1701 30 04                                   jr      nc, loc_1707
1703 AF                                      xor     a
1704 32 C8 23                                ld      (byte_23C8), a
1707
1707                         loc_1707:                               ; CODE XREF: sub_1676+6Ej
1707                                                                 ; sub_1676+77j ...
1707 ED 4B A6 23                             ld      bc, (word_23A6)
170B 03                                      inc     bc
170C ED 43 A6 23                             ld      (word_23A6), bc
1710 2A A4 23                                ld      hl, (word_23A4)
1713 AF                                      xor     a
1714 ED 42                                   sbc     hl, bc
1716 C2 AC 16                                jp      nz, loc_16AC
1719 CD F5 17                                call    sub_17F5
171C CD AD 19                                call    sub_19AD
171F CD 36 1A                                call    sub_1A36
1722 DD E1                                   pop     ix
1724 E1                                      pop     hl
1725 D1                                      pop     de
1726 C1                                      pop     bc
1727 C9                                      ret
1727                         ; End of function sub_1676
1727
1728
1728                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1728
1728
1728                         sub_1728:                               ; CODE XREF: sub_1618+13p
1728                                                                 ; sub_1676:loc_16C4p
1728 C5                                      push    bc
1729 D5                                      push    de
172A E5                                      push    hl
172B DD E5                                   push    ix
172D 32 C9 23                                ld      (byte_23C9), a
1730 ED 5B A6 23                             ld      de, (word_23A6)
1734 2E 00                                   ld      l, 0
1736 06 06                                   ld      b, 6
1738 AF                                      xor     a
1739
1739                         loc_1739:                               ; CODE XREF: sub_1728+17j
1739 CB 23                                   sla     e
173B CB 12                                   rl      d
173D CB 15                                   rl      l
173F 10 F8                                   djnz    loc_1739
1741 06 00                                   ld      b, 0
1743 DD 21 96 23                             ld      ix, addr_2396
1747 DD 73 00                                ld      (ix+0), e
174A DD 72 01                                ld      (ix+1), d
174D DD 75 02                                ld      (ix+2), l
1750 D5                                      push    de
1751 E5                                      push    hl
1752 21 96 23                                ld      hl, addr_2396
1755 CD 63 25                                call    sub_2563
1758 E1                                      pop     hl
1759 D1                                      pop     de
175A DD 21 96 23                             ld      ix, addr_2396
175E DD 36 00 00                             ld      (ix+0), 0
1762 DD 36 01 08                             ld      (ix+1), 8
1766 DD 73 02                                ld      (ix+2), e
1769 DD 72 03                                ld      (ix+3), d
176C DD 75 04                                ld      (ix+4), l
176F 32 B2 23                                ld      (byte_23B2), a
1772 A7                                      and     a
1773 C2 A1 17                                jp      nz, loc_17A1
1776 3E FF                                   ld      a, 0FFh
1778 32 B3 23                                ld      (byte_23B3), a
177B 3A C9 23                                ld      a, (byte_23C9)
177E FE 00                                   cp      0
1780 CA 99 17                                jp      z, loc_1799
1783 FE 01                                   cp      1
1785 CA 90 17                                jp      z, loc_1790
1788 11 FF AF                                ld      de, 0AFFFh
178B 01 FF FF                                ld      bc, 0FFFFh
178E 18 1C                                   jr      loc_17AC
1790                         ; ---------------------------------------------------------------------------
1790
1790                         loc_1790:                               ; CODE XREF: sub_1728+5Dj
1790 11 FF AA                                ld      de, 0AAFFh
1793 ED 4B A2 23                             ld      bc, (word_23A2)
1797 18 13                                   jr      loc_17AC
1799                         ; ---------------------------------------------------------------------------
1799
1799                         loc_1799:                               ; CODE XREF: sub_1728+58j
1799 11 FF 80                                ld      de, 80FFh
179C 01 00 00                                ld      bc, 0
179F 18 0B                                   jr      loc_17AC
17A1                         ; ---------------------------------------------------------------------------
17A1
17A1                         loc_17A1:                               ; CODE XREF: sub_1728+4Bj
17A1 3E FE                                   ld      a, 0FEh ; '¦'
17A3 32 B3 23                                ld      (byte_23B3), a
17A6 11 FE FF                                ld      de, 0FFFEh
17A9 01 FF FF                                ld      bc, 0FFFFh
17AC
17AC                         loc_17AC:                               ; CODE XREF: sub_1728+66j
17AC                                                                 ; sub_1728+6Fj ...
17AC 21 96 23                                ld      hl, addr_2396
17AF CD BC 26                                call    sub_26BC
17B2 3E 37                                   ld      a, 37h ; '7'
17B4 D3 2A                                   out     (SNAN_CMD_REG), a
17B6 DD E1                                   pop     ix
17B8 E1                                      pop     hl
17B9 D1                                      pop     de
17BA C1                                      pop     bc
17BB C9                                      ret
17BB                         ; End of function sub_1728
17BB
17BC
17BC                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
17BC
17BC
17BC                         sub_17BC:                               ; CODE XREF: sub_1676+66p
17BC DB 05                                   in      a, (MROM_PAGE_REG)
17BE 32 9E 23                                ld      (byte_239E), a
17C1 3E F5                                   ld      a, 0F5h ; ')'
17C3 D3 05                                   out     (MROM_PAGE_REG), a
17C5 3A C8 23                                ld      a, (byte_23C8)
17C8 A7                                      and     a
17C9 C2 E1 17                                jp      nz, loc_17E1
17CC 3E FF                                   ld      a, 0FFh
17CE 32 C8 23                                ld      (byte_23C8), a
17D1 ED 4B A6 23                             ld      bc, (word_23A6)
17D5 2A AE 23                                ld      hl, (word_23AE)
17D8 70                                      ld      (hl), b
17D9 2B                                      dec     hl
17DA 71                                      ld      (hl), c
17DB 2B                                      dec     hl
17DC 22 AE 23                                ld      (word_23AE), hl
17DF 18 0E                                   jr      loc_17EF
17E1                         ; ---------------------------------------------------------------------------
17E1
17E1                         loc_17E1:                               ; CODE XREF: sub_17BC+Dj
17E1 ED 4B A6 23                             ld      bc, (word_23A6)
17E5 2A B0 23                                ld      hl, (word_23B0)
17E8 70                                      ld      (hl), b
17E9 2B                                      dec     hl
17EA 71                                      ld      (hl), c
17EB 2B                                      dec     hl
17EC 22 B0 23                                ld      (word_23B0), hl
17EF
17EF                         loc_17EF:                               ; CODE XREF: sub_17BC+23j
17EF 3A 9E 23                                ld      a, (byte_239E)
17F2 D3 05                                   out     (MROM_PAGE_REG), a
17F4 C9                                      ret
17F4                         ; End of function sub_17BC
17F4
17F5
17F5                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
17F5
17F5
17F5                         sub_17F5:                               ; CODE XREF: sub_1676+A3p
17F5 DB 05                                   in      a, (MROM_PAGE_REG)
17F7 32 9E 23                                ld      (byte_239E), a
17FA 3E F4                                   ld      a, 0F4h ; '('
17FC D3 05                                   out     (MROM_PAGE_REG), a
17FE 21 00 00                                ld      hl, 0
1801 01 00 7E                                ld      bc, 7E00h
1804
1804                         loc_1804:                               ; CODE XREF: sub_17F5+18j
1804                                                                 ; sub_17F5+1Dj
1804 0B                                      dec     bc
1805 0A                                      ld      a, (bc)
1806 57                                      ld      d, a
1807 0B                                      dec     bc
1808 0A                                      ld      a, (bc)
1809 5F                                      ld      e, a
180A 19                                      add     hl, de
180B 79                                      ld      a, c
180C A7                                      and     a
180D 20 F5                                   jr      nz, loc_1804
180F 78                                      ld      a, b
1810 FE 40                                   cp      40h ; '@'
1812 20 F0                                   jr      nz, loc_1804
1814 3E F5                                   ld      a, 0F5h ; ')'
1816 D3 05                                   out     (MROM_PAGE_REG), a
1818 01 55 AA                                ld      bc, 0AA55h
181B ED 43 FC 43                             ld      (43FCh), bc
181F 01 FE 43                                ld      bc, 43FEh
1822
1822                         loc_1822:                               ; CODE XREF: sub_17F5+36j
1822                                                                 ; sub_17F5+3Bj
1822 0B                                      dec     bc
1823 0A                                      ld      a, (bc)
1824 57                                      ld      d, a
1825 0B                                      dec     bc
1826 0A                                      ld      a, (bc)
1827 5F                                      ld      e, a
1828 19                                      add     hl, de
1829 79                                      ld      a, c
182A A7                                      and     a
182B 20 F5                                   jr      nz, loc_1822
182D 78                                      ld      a, b
182E FE 42                                   cp      42h ; 'B'
1830 20 F0                                   jr      nz, loc_1822
1832 22 FE 43                                ld      (43FEh), hl
1835 3A 9E 23                                ld      a, (byte_239E)
1838 D3 05                                   out     (MROM_PAGE_REG), a
183A C9                                      ret
183A                         ; End of function sub_17F5
183A
183B
183B                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
183B
183B
183B                         sub_183B:                               ; CODE XREF: sub_1676+5Ep
183B DB 05                                   in      a, (MROM_PAGE_REG)
183D 32 9E 23                                ld      (byte_239E), a
1840 3E F4                                   ld      a, 0F4h ; '('
1842 D3 05                                   out     (MROM_PAGE_REG), a
1844 2A A2 23                                ld      hl, (word_23A2)
1847 CB 25                                   sla     l
1849 CB 14                                   rl      h
184B AF                                      xor     a
184C 01 00 40                                ld      bc, 4000h
184F 09                                      add     hl, bc
1850 ED 4B A6 23                             ld      bc, (word_23A6)
1854 71                                      ld      (hl), c
1855 23                                      inc     hl
1856 70                                      ld      (hl), b
1857 23                                      inc     hl
1858 3A 9E 23                                ld      a, (byte_239E)
185B D3 05                                   out     (MROM_PAGE_REG), a
185D ED 4B A2 23                             ld      bc, (word_23A2)
1861 03                                      inc     bc
1862 ED 43 A2 23                             ld      (word_23A2), bc
1866 ED 5B C6 23                             ld      de, (word_23C6)
186A 1B                                      dec     de
186B ED 53 C6 23                             ld      (word_23C6), de
186F C9                                      ret
186F                         ; End of function sub_183B
186F
1870
1870                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1870
1870
1870                         sub_1870:                               ; CODE XREF: sub_1676+8p
1870 C5                                      push    bc
1871 E5                                      push    hl
1872 DB 05                                   in      a, (MROM_PAGE_REG)
1874 32 9E 23                                ld      (byte_239E), a
1877 3E F5                                   ld      a, 0F5h ; ')'
1879 D3 05                                   out     (MROM_PAGE_REG), a
187B 21 00 40                                ld      hl, 4000h
187E 01 00 04                                ld      bc, 400h
1881
1881                         loc_1881:                               ; CODE XREF: sub_1870+17j
1881 36 FF                                   ld      (hl), 0FFh
1883 23                                      inc     hl
1884 0B                                      dec     bc
1885 78                                      ld      a, b
1886 B1                                      or      c
1887 20 F8                                   jr      nz, loc_1881
1889 3A 9E 23                                ld      a, (byte_239E)
188C D3 05                                   out     (MROM_PAGE_REG), a
188E E1                                      pop     hl
188F C1                                      pop     bc
1890 C9                                      ret
1890                         ; End of function sub_1870
1890
1890                         ; ---------------------------------------------------------------------------


                            ; unreferenced function, duplicated sub_1924
                            sub_1891:       push    bc
                                            push    de
                                            push    hl
                                            push    ix
                                            ld      ix,addr_23B7
                                            ld      e,(ix+0)
                                            ld      a,e
                                            add     a,1fh
                                            ld      e,a
                                            ld      d,(ix+1)
                                            ld      l,(ix+2)
                                            ld      bc, 0400h
                                            ld      (word_23BB),bc
                                            ld      hl, 0000h
                                            ld      (word_23BD),hl
                                            ld      a, 02h
                                            ld      (byte_23B6),a

                            l18b9:          in      a,(WATCHDOG_REG)
                                            or      08h
                                            out     (WATCHDOG_REG),a
                                            ld      ix, addr_2396
                                            ld      bc,(word_23BB)
                                            ld      (ix+0),c
                                            ld      (ix+1),b
                                            ld      (ix+2),e
                                            ld      (ix+3),d
                                            ld      (ix+4),l
                                            push    de
                                            push    hl
                                            ld      bc,(word_23BD)
                                            ld      (ix+5),c
                                            ld      (ix+6),b
                                            ld      (ix+7),05h
                                            ld      hl, addr_2396
                                            ld      b, 00h
                                            call    l3b0f
                                            pop     hl
                                            pop     de
                                            ld      a,(byte_23B6)
                                            dec     a
                                            ld      (byte_23B6),a
                                            and     a
                                            jr      z,l191e
                                            push    hl
                                            ld      hl,(word_23BD)
                                            ld      bc,l0200
                                            add     hl,bc
                                            ld      (word_23BD),hl
                                            pop     hl
                                            ld      bc,(word_23BB)
                                            inc     b
                                            inc     b
                                            ld      (word_23BB),bc
                                            ld      a,b
                                            cp      08h
                                            jr      nz,l18b9
                                            ld      b,00h
                                            ld      (word_23BB),bc
                                            inc     e
                                            jr      l18b9

                            l191e:          pop     ix
                                            pop     hl
                                            pop     de
                                            pop     bc
                                            ret


1924
1924                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1924
1924
1924                         sub_1924:                               ; CODE XREF: sub_1676+5p
1924 C5                                      push    bc
1925 D5                                      push    de
1926 E5                                      push    hl
1927 DD E5                                   push    ix
1929 DD 21 B7 23                             ld      ix, addr_23B7
192D DD 5E 00                                ld      e, (ix+0)
1930 DD 56 01                                ld      d, (ix+1)
1933 DD 6E 02                                ld      l, (ix+2)
1936 01 00 00                                ld      bc, 0
1939 ED 43 BB 23                             ld      (word_23BB), bc
193D 21 00 00                                ld      hl, 0
1940 22 BD 23                                ld      (word_23BD), hl
1943 3E 20                                   ld      a, 20h
1945 32 B6 23                                ld      (byte_23B6), a
1948
1948                         loc_1948:                               ; CODE XREF: sub_1924+78j
1948                                                                 ; sub_1924+81j
1948 DD 21 96 23                             ld      ix, addr_2396
194C ED 4B BB 23                             ld      bc, (word_23BB)
1950 DD 71 00                                ld      (ix+0), c
1953 DD 70 01                                ld      (ix+1), b
1956 DD 73 02                                ld      (ix+2), e
1959 DD 72 03                                ld      (ix+3), d
195C DD 75 04                                ld      (ix+4), l
195F D5                                      push    de
1960 E5                                      push    hl
1961 ED 4B BD 23                             ld      bc, (word_23BD)
1965 DD 71 05                                ld      (ix+5), c
1968 DD 70 06                                ld      (ix+6), b
196B DD 36 07 04                             ld      (ix+7), 4
196F 21 96 23                                ld      hl, addr_2396
1972 06 00                                   ld      b, 0
1974 CD 0F 3B                                call    sub_3B0F
1977 E1                                      pop     hl
1978 D1                                      pop     de
1979 3A B6 23                                ld      a, (byte_23B6)
197C 3D                                      dec     a
197D 32 B6 23                                ld      (byte_23B6), a
1980 A7                                      and     a
1981 28 24                                   jr      z, loc_19A7
1983 E5                                      push    hl
1984 2A BD 23                                ld      hl, (word_23BD)
1987 01 00 02                                ld      bc, 200h
198A 09                                      add     hl, bc
198B 22 BD 23                                ld      (word_23BD), hl
198E E1                                      pop     hl
198F ED 4B BB 23                             ld      bc, (word_23BB)
1993 04                                      inc     b
1994 04                                      inc     b
1995 ED 43 BB 23                             ld      (word_23BB), bc
1999 78                                      ld      a, b
199A FE 08                                   cp      8
199C 20 AA                                   jr      nz, loc_1948
199E 06 00                                   ld      b, 0
19A0 ED 43 BB 23                             ld      (word_23BB), bc
19A4 1C                                      inc     e
19A5 18 A1                                   jr      loc_1948
19A7                         ; ---------------------------------------------------------------------------
19A7
19A7                         loc_19A7:                               ; CODE XREF: sub_1924+5Dj
19A7 DD E1                                   pop     ix
19A9 E1                                      pop     hl
19AA D1                                      pop     de
19AB C1                                      pop     bc
19AC C9                                      ret
19AC                         ; End of function sub_1924
19AC


19AD
19AD                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
19AD
19AD
19AD                         sub_19AD:                               ; CODE XREF: sub_1676+A6p
19AD C5                                      push    bc
19AE D5                                      push    de
19AF E5                                      push    hl
19B0 DD E5                                   push    ix
19B2 DD 21 B7 23                             ld      ix, addr_23B7
19B6 DD 5E 00                                ld      e, (ix+0)
19B9 DD 56 01                                ld      d, (ix+1)
19BC DD 6E 02                                ld      l, (ix+2)
19BF 01 00 00                                ld      bc, 0
19C2 ED 43 BB 23                             ld      (word_23BB), bc
19C6 21 00 00                                ld      hl, 0
19C9 22 BD 23                                ld      (word_23BD), hl
19CC 3E 20                                   ld      a, 20h ; ' '
19CE 32 B5 23                                ld      (byte_23B5), a
19D1
19D1                         loc_19D1:                               ; CODE XREF: sub_19AD+78j
19D1                                                                 ; sub_19AD+81j
19D1 DD 21 96 23                             ld      ix, addr_2396
19D5 ED 4B BB 23                             ld      bc, (word_23BB)
19D9 DD 71 00                                ld      (ix+0), c
19DC DD 70 01                                ld      (ix+1), b
19DF DD 73 02                                ld      (ix+2), e
19E2 DD 72 03                                ld      (ix+3), d
19E5 DD 75 04                                ld      (ix+4), l
19E8 D5                                      push    de
19E9 E5                                      push    hl
19EA ED 4B BD 23                             ld      bc, (word_23BD)
19EE DD 71 05                                ld      (ix+5), c
19F1 DD 70 06                                ld      (ix+6), b
19F4 DD 36 07 04                             ld      (ix+7), 4
19F8 21 96 23                                ld      hl, addr_2396
19FB 06 00                                   ld      b, 0
19FD CD 1B 26                                call    sub_261B
1A00 E1                                      pop     hl
1A01 D1                                      pop     de
1A02 3A B5 23                                ld      a, (byte_23B5)
1A05 3D                                      dec     a
1A06 32 B5 23                                ld      (byte_23B5), a
1A09 A7                                      and     a
1A0A 28 24                                   jr      z, loc_1A30
1A0C E5                                      push    hl
1A0D 2A BD 23                                ld      hl, (word_23BD)
1A10 01 00 02                                ld      bc, 200h
1A13 09                                      add     hl, bc
1A14 22 BD 23                                ld      (word_23BD), hl
1A17 E1                                      pop     hl
1A18 ED 4B BB 23                             ld      bc, (word_23BB)
1A1C 04                                      inc     b
1A1D 04                                      inc     b
1A1E ED 43 BB 23                             ld      (word_23BB), bc
1A22 78                                      ld      a, b
1A23 FE 08                                   cp      8
1A25 20 AA                                   jr      nz, loc_19D1
1A27 06 00                                   ld      b, 0
1A29 ED 43 BB 23                             ld      (word_23BB), bc
1A2D 1C                                      inc     e
1A2E 18 A1                                   jr      loc_19D1
1A30                         ; ---------------------------------------------------------------------------
1A30
1A30                         loc_1A30:                               ; CODE XREF: sub_19AD+5Dj
1A30 DD E1                                   pop     ix
1A32 E1                                      pop     hl
1A33 D1                                      pop     de
1A34 C1                                      pop     bc
1A35 C9                                      ret
1A35                         ; End of function sub_19AD
1A35
1A36
1A36                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
1A36
1A36
1A36                         sub_1A36:                               ; CODE XREF: sub_1676+A9p
1A36 C5                                      push    bc
1A37 D5                                      push    de
1A38 E5                                      push    hl
1A39 DD E5                                   push    ix
1A3B DD 21 B7 23                             ld      ix, addr_23B7
1A3F DD 5E 00                                ld      e, (ix+0)
1A42 7B                                      ld      a, e
1A43 C6 1F                                   add     a, 1Fh
1A45 5F                                      ld      e, a
1A46 DD 56 01                                ld      d, (ix+1)
1A49 DD 6E 02                                ld      l, (ix+2)
1A4C 01 00 04                                ld      bc, 400h
1A4F ED 43 BB 23                             ld      (word_23BB), bc
1A53 21 00 00                                ld      hl, 0
1A56 22 BD 23                                ld      (word_23BD), hl
1A59 3E 02                                   ld      a, 2
1A5B 32 B5 23                                ld      (byte_23B5), a
1A5E
1A5E                         loc_1A5E:                               ; CODE XREF: sub_1A36+7Cj
1A5E                                                                 ; sub_1A36+85j
1A5E DD 21 96 23                             ld      ix, addr_2396
1A62 ED 4B BB 23                             ld      bc, (word_23BB)
1A66 DD 71 00                                ld      (ix+0), c
1A69 DD 70 01                                ld      (ix+1), b
1A6C DD 73 02                                ld      (ix+2), e
1A6F DD 72 03                                ld      (ix+3), d
1A72 DD 75 04                                ld      (ix+4), l
1A75 D5                                      push    de
1A76 E5                                      push    hl
1A77 ED 4B BD 23                             ld      bc, (word_23BD)
1A7B DD 71 05                                ld      (ix+5), c
1A7E DD 70 06                                ld      (ix+6), b
1A81 DD 36 07 05                             ld      (ix+7), 5
1A85 21 96 23                                ld      hl, addr_2396
1A88 06 00                                   ld      b, 0
1A8A CD 1B 26                                call    sub_261B
1A8D E1                                      pop     hl
1A8E D1                                      pop     de
1A8F 3A B5 23                                ld      a, (byte_23B5)
1A92 3D                                      dec     a
1A93 32 B5 23                                ld      (byte_23B5), a
1A96 A7                                      and     a
1A97 28 24                                   jr      z, loc_1ABD
1A99 E5                                      push    hl
1A9A 2A BD 23                                ld      hl, (word_23BD)
1A9D 01 00 02                                ld      bc, 200h
1AA0 09                                      add     hl, bc
1AA1 22 BD 23                                ld      (word_23BD), hl
1AA4 E1                                      pop     hl
1AA5 ED 4B BB 23                             ld      bc, (word_23BB)
1AA9 04                                      inc     b
1AAA 04                                      inc     b
1AAB ED 43 BB 23                             ld      (word_23BB), bc
1AAF 78                                      ld      a, b
1AB0 FE 08                                   cp      8
1AB2 20 AA                                   jr      nz, loc_1A5E
1AB4 06 00                                   ld      b, 0
1AB6 ED 43 BB 23                             ld      (word_23BB), bc
1ABA 1C                                      inc     e
1ABB 18 A1                                   jr      loc_1A5E
1ABD                         ; ---------------------------------------------------------------------------
1ABD
1ABD                         loc_1ABD:                               ; CODE XREF: sub_1A36+61j
1ABD DD E1                                   pop     ix
1ABF E1                                      pop     hl
1AC0 D1                                      pop     de
1AC1 C1                                      pop     bc
1AC2 C9                                      ret
1AC2                         ; End of function sub_1A36
1AC2



                             ; ---------------------------------------------------------------------------
1AC3 76                      byte_1AC3:      db 16 dup (?)
1AD3 76 76                   word_1AD3:      dw ?
1AD5 76 76                   word_1AD5:      dw ?
1AD7 76                                      db ?
1AD8 76 76                   word_1AD8:      dw ?
1ADA 76                                      db 5 dup(?)
1ADF 76 76                   word_1ADF:      dw ?
1AE1 76 76                   word_1AE1:      dw ?
1AE3 76 76                   word_1AE3:      dw ?
1AE5 76 76                   word_1AE5:      dw ?
1AE7 76 76                   word_1AE7:      dw ?
1AE9 76 76                   word_1AE9:      dw ?
1AEB 76 76                   word_1AEB:      dw ?
1AED 76 76                   word_1AED:      dw ?
1AEF 76 76                   word_1AEF:      dw ?
1AF1 76 76                   word_1AF1:      dw ?
1AF3 76 76                   word_1AF3:      dw ?
1AF5 76                                      db 0200h dup (?)
1CF5 76                      byte_1CF5:      db ?
1CF6 76                      byte_1CF6:      db ?
1CF7 76                      byte_1CF7:      db ?
1CF8 76                      byte_1CF8:      db ?
1CF9 76 76                   word_1CF9:      dw ?
1CFB 76 76                   word_1CFB:      dw ?
1CFD 76                                      db 8 dup (?)
1D05 76 76                   word_1D05:      dw ?
1D07 76 76                   word_1D07:      dw ?
1D09 76                                      db 01ech dup(?)
1EF5 76 76                   word_1EF5:      dw ?
1EF7 76 76                   word_1EF7:      dw ?
1EF9 76 76                   word_1EF9:      dw ?
1EFB 76 76                   word_1EFB:      dw ?
1EFD 76                                      db ?
1EFE 76 76                   word_1EFE:      dw ?
1F00 76                      byte_1F00:      db ?
1F01 76 76                   word_1F01:      dw ?
1F03 76 76                   word_1F03:      dw ?
1F05 76                                      db ?
1F06 76 76                   word_1F06:      dw ?
1F08 76                      byte_1F08:      db 0405h dup(?)
230D 76 76                   word_230D:      dw ?


230F 00 00                   word_230F:      dw 0
2311 00                                      db    0, 0, 0, 9, 1Fh, 8
2317 00 00                   word_2317:      dw 0
2319 00                                      db    0, 0, 0, 9, 1Fh, 8

231F 76 76                   word_231F:      dw ?
2321 76 76                   word_2321:      dw ?
2323 76 76                   word_2323:      dw ?
2325 76 76                   word_2325:      dw ?
2327 76 76                   word_2327:      dw ?
2329 76 76                   word_2329:      dw ?
232B 76 76                   word_232B:      dw ?
232D 76 76                   word_232D:      dw ?
232F 76 76                   word_232F:      dw ?
2331 00                      byte_2331:      db 0
2332 76 76                   word_2332:      dw ?
2334 76                      byte_2334:      db  32 dup(?)
2354 00                                      db  11 dup(0)
235F 76                                      db  16 dup(?)
236F 00                      byte_236F:      db 0
2370 00                      byte_2370:      db 0
2371 00                      byte_2371:      db 0
2372 00                      byte_2372:      db 0
2373 00                      byte_2373:      db 0
2374 00                      byte_2374:      db 0
2375 00                      byte_2375:      db 0
2376 00                      byte_2376:      db 0
2377 00 00                   word_2377:      dw 0
2379 00                                      db    0
237A 00 00                   word_237A:      dw 0
237C 00                                      db    0
237D 00 00                   word_237D:      dw 0
237F 00                      byte_237F:      db 0
2380 00                      byte_2380:      db 0
2381 00                                      db    0,0,0
2384 00 00                   word_2384:      dw 0
2386 00 00                   word_2386:      dw 0
2388 00 00                   word_2388:      dw 0
238A 00                                      db    0,0
238C 00 00                   word_238C:      dw 0
238E 00                                      db    0,0
2390 00                      byte_2390:      db 0
2391 00                                      db  0,0,0,0,0
2396                         addr_2396:      db  8 dup(0)
239E 00                      byte_239E:      db 0

239F 76                      byte_239F:      db ?
239F
23A0 76                                      db  ?,?
23A2 76 76                   word_23A2:      dw ?
23A4 76 76                   word_23A4:      dw ?
23A6 76 76                   word_23A6:      dw ?
23A8 76 76                   word_23A8:      dw ?
23AA 76                                      db  ?,?,?,?
23AE 76 76                   word_23AE:      dw ?
23B0 76 76                   word_23B0:      dw ?
23B2 76                      byte_23B2:      db ?
23B3 76                      byte_23B3:      db ?
23B4 76                                      db  ?
23B5 76                      byte_23B5:      db ?
23B6 76                      byte_23B6:      db ?


23B7 76                      addr_23B7:      db  ?,?,?,?
23BB 76 76                   word_23BB:      dw ?
23BD 76 76                   word_23BD:      dw ?
23BF 76 76                   word_23BF:      dw ?
23BF
23C1 00                                      db    0,0,0,0,0

23C6 76 76                   word_23C6:      dw ?
23C6
23C8 00                      byte_23C8:      db 0
23C9 00                      byte_23C9:      db 0




23CA                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
                             ; out: a = 0, 3 (error), -1 (error)
23CA                         detect_nand_devices PROC
23CA C5                                      push    bc
23CB D5                                      push    de
23CC E5                                      push    hl
23CD DD E5                                   push    ix

23CF 06 01                                   ld      b, 1             ; detect main nand device at CE1
23D1 CD 55 24                                call    nand_detect_id
23D4 FE FF                                   cp      0FFh             ; error?
23D6 28 41                                   jr      z, loc_2419      ; yes -> return -1
23D8 FE 03                                   cp      3
23DA 28 3D                                   jr      z, loc_2419      ; yes -> return 3

23DC 32 81 00                                ld      (byte_81), a     ; store result (= 0,1,2), but never gets read from

                                             ; detect all nand devices at CE6,CE5,CE2,CE1
23DF AF                                      xor     a
23E0 32 80 00                                ld      (byte_80), a     ; byte_80 = 0
23E3 0E 00                                   ld      c, 0
23E5 16 06                                   ld      d, 6
23E7 DD 21 94 00                             ld      ix, nand_tbl + 6*2   ; write result to nand_tbl (0088h..0095h)
23EB                         loc_23EB:       ld      a, d
23EC FE 04                                   cp      4
23EE 28 21                                   jr      z, loc_2411      ; continue for CE4
23F0 FE 03                                   cp      3
23F2 28 1D                                   jr      z, loc_2411      ; continue for CE3

23F4 42                                      ld      b, d             ; detect device
23F5 CD 55 24                                call    nand_detect_id
23F8 FE FF                                   cp      0FFh             ; detected?
23FA 28 15                                   jr      z, loc_2411      ; no -> continue
23FC FE 03                                   cp      3
23FE 28 11                                   jr      z, loc_2411      ; no -> continue

2400 DD 75 00                                ld      (ix+0), l        ; store hl
2403 DD 74 01                                ld      (ix+1), h

2406 42                                      ld      b, d             ; a = 1 << d
2407 3E 01                                   ld      a, 1
2409                         loc_2409:       add     a, a
240A 10 FD                                   djnz    loc_2409

240C 21 80 00                                ld      hl, byte_80      ; set device bit d
240F B6                                      or      (hl)
2410 77                                      ld      (hl), a
2411
2411                         loc_2411:       dec     ix               ; next table entry
2413 DD 2B                                   dec     ix
2415 15                                      dec     d
2416 20 D3                                   jr      nz, loc_23EB     ; loop d times
2418 AF                                      xor     a                ; return 0
2419
2419                         loc_2419:       pop     ix
241B E1                                      pop     hl
241C D1                                      pop     de
241D C1                                      pop     bc
241E C9                                      ret
241E                         detect_nand_devices ENDP



241F                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
241F                         ; out: a = 0, 3 (error), -1 (error)
241F                         detect_nand_ce4 PROC
241F C5                                      push    bc
2420 D5                                      push    de
2421 E5                                      push    hl
2422 DD E5                                   push    ix

2424 06 04                                   ld      b, 4           ; detect and device at CE4
2426 CD 55 24                                call    nand_detect_id
2429 FE FF                                   cp      0FFh           ; error?
242B 28 22                                   jr      z, loc_244F    ; yes -> return -1
242D FE 03                                   cp      3
242F 28 1E                                   jr      z, loc_244F    ; yes -> return 3

2431 F5                                      push    af

2432 DD 21 88 00                             ld      ix, byte_88
2436 01 08 00                                ld      bc, 4*2        ; entry for CE4
2439 DD 09                                   add     ix, bc
243B DD 77 00                                ld      (ix+0), a      ; write result (above we wrote l to this place)

243E 06 04                                   ld      b, 4           ; a = 1 << 4
2440 3E 01                                   ld      a, 1
2442                         loc_2442:       add     a, a
2443 10 FD                                   djnz    loc_2442

2445 32 82 00                                ld      (byte_82), a   ; byte_82 = 4
2448 3E 10                                   ld      a, 10h
244A 32 83 00                                ld      (byte_83), a   ; byte_82 = 10h

244D F1                                      pop     af
244E AF                                      xor     a              ; return 0
244F
244F                         loc_244F:       pop     ix
2451 E1                                      pop     hl
2452 D1                                      pop     de
2453 C1                                      pop     bc
2454 C9                                      ret
2454                         detect_nand_ce4 ENDP
2454




2455                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
                             ; in:  a = CEx
                             ; out: a = 0..2, 3 (error), -1 (error)
                             ;      h = ?, l = ?
2455                         nand_detect_id  PROC
2455 C5                                      push    bc
2456 D5                                      push    de
2457 CD 2A 3F                                call    nand_init

245A CD D0 3F                                call    sub_3FD0       ; read status from flash
245D FE 03                                   cp      3
245F CA 56 25                                jp      z, loc_2556    ; if a==3 then leave

2462 CD FE 26                                call    nand_read_id   ; detect nand id
2465 78                                      ld      a, b
2466 FE 98                                   cp      98h
2468 28 0F                                   jr      z, loc_2479
246A FE EC                                   cp      0ECh
246C 28 5B                                   jr      z, loc_24C9
246E FE AD                                   cp      0ADh
2470 28 57                                   jr      z, loc_24C9
2472 FE 20                                   cp      20h
2474 28 53                                   jr      z, loc_24C9
2476 C3 51 25                                jp      loc_2551       ; unknown -> return -1

2479                         ; ---------------------------------------------------------------------------
2479                         loc_2479:       ld      a, c           ; b=98h, c=?
247A FE 75                                   cp      75h
247C CA 96 24                                jp      z, loc_2496
247F FE 76                                   cp      76h
2481 CA 9E 24                                jp      z, loc_249E
2484 FE 79                                   cp      79h
2486 CA A6 24                                jp      z, loc_24A6
2489 FE F1                                   cp      0F1h
248B CA B9 24                                jp      z, loc_24B9
248E FE DA                                   cp      0DAh
2490 CA C1 24                                jp      z, loc_24C1
2493 C3 51 25                                jp      loc_2551
2496                         ; ---------------------------------------------------------------------------
2496                         loc_2496:       ld      hl, 0FCh       ; hl = 0FCh
2499 3E 00                                   ld      a, 0           ; return 0
249B C3 56 25                                jp      loc_2556
249E                         ; ---------------------------------------------------------------------------
249E                         loc_249E:       ld      hl, 1F8h       ; hl = 0FCh
24A1 3E 00                                   ld      a, 0           ; return 0
24A3 C3 56 25                                jp      loc_2556
24A6                         ; ---------------------------------------------------------------------------
24A6                         loc_24A6:       ld      hl, 3F0h       ; hl = 3F0h
24A9 CD 02 27                                call    nand_read_91
24AC 78                                      ld      a, b
24AD FE 24                                   cp      24h
24AF 3E 00                                   ld      a, 0
24B1 C2 56 25                                jp      nz, loc_2556   ; if(b != 24h) return 0
24B4 3E 01                                   ld      a, 1           ; return 1
24B6 C3 56 25                                jp      loc_2556
24B9                         ; ---------------------------------------------------------------------------
24B9                         loc_24B9:       ld      hl, 3F0h       ; hl = 3F0h
24BC 3E 02                                   ld      a, 2           ; return 2
24BE C3 56 25                                jp      loc_2556
24C1                         ; ---------------------------------------------------------------------------
24C1                         loc_24C1:       ld      hl, 7E0h       ; hl = 7E0h
24C4 3E 02                                   ld      a, 2           ; return 2
24C6 C3 56 25                                jp      loc_2556

24C9                         ; ---------------------------------------------------------------------------
24C9                         loc_24C9:       ld      a, c             ; b=0ECh|0ADh|20h, c=?
24CA FE 75                                   cp      75h
24CC CA FA 24                                jp      z, loc_24FA
24CF FE 76                                   cp      76h
24D1 CA 02 25                                jp      z, loc_2502
24D4 FE 79                                   cp      79h
24D6 CA 0A 25                                jp      z, loc_250A
24D9 FE F1                                   cp      0F1h
24DB CA 0A 25                                jp      z, loc_250A
24DE FE 71                                   cp      71h
24E0 CA 1F 25                                jp      z, loc_251F
24E3 FE DA                                   cp      0DAh
24E5 CA 1F 25                                jp      z, loc_251F
24E8 FE DC                                   cp      0DCh
24EA CA 31 25                                jp      z, loc_2531
24ED FE D3                                   cp      0D3h
24EF CA 41 25                                jp      z, loc_2541
24F2 FE D5                                   cp      0D5h
24F4 CA 49 25                                jp      z, loc_2549
24F7 C3 51 25                                jp      loc_2551
24FA                         ; ---------------------------------------------------------------------------
24FA                         loc_24FA:       ld      hl, 0FCh       ; hl = 0FCh
24FD 3E 00                                   ld      a, 0           ; return 0
24FF C3 56 25                                jp      loc_2556
2502                         ; ---------------------------------------------------------------------------
2502                         loc_2502:       ld      hl, 1F8h       ; hl = 1F8h
2505 3E 00                                   ld      a, 0           ; return 0
2507 C3 56 25                                jp      loc_2556
250A                         ; ---------------------------------------------------------------------------
250A                         loc_250A:       cp      79h
250C C2 17 25                                jp      nz, loc_2517
250F 21 F0 03                                ld      hl, 3F0h       ; hl = 3F0h
2512 3E 00                                   ld      a, 0           ; return 0
2514 C3 56 25                                jp      loc_2556
2517                         ; ---------------------------------------------------------------------------
2517                         loc_2517:       ld      hl, 3F0h       ; hl = 3F0h
251A 3E 02                                   ld      a, 2           ; return 2
251C C3 56 25                                jp      loc_2556
251F                         ; ---------------------------------------------------------------------------
251F                         loc_251F:       ld      hl, 7E0h       ; hl = 7E0h
2522 FE 71                                   cp      71h
2524 C2 2C 25                                jp      nz, loc_252C
2527 3E 00                                   ld      a, 0            ; return 0
2529 C3 56 25                                jp      loc_2556
252C                         ; ---------------------------------------------------------------------------
252C                         loc_252C:       ld      a, 2            ; return 2
252E C3 56 25                                jp      loc_2556
2531                         ; ---------------------------------------------------------------------------
2531                         loc_2531:       ld      hl, 0FC0h       ; hl = 0FC0h
2534 7B                                      ld      a, e
2535 FE 15                                   cp      15h
2537 3E 02                                   ld      a, 2
2539 CA 56 25                                jp      z, loc_2556     ; if e == 15h then return 2
253C 3E 00                                   ld      a, 0            ; return 0
253E C3 56 25                                jp      loc_2556
2541                         ; ---------------------------------------------------------------------------
2541                         loc_2541:       ld      hl, 1080h       ; hl = 1080h
2544 3E 02                                   ld      a, 2            ; return 2
2546 C3 56 25                                jp      loc_2556
2549                         ; ---------------------------------------------------------------------------
2549                         loc_2549:       ld      hl, 2100h       ; hl = 2100h
254C 3E 02                                   ld      a, 2            ; return 2
254E C3 56 25                                jp      loc_2556
2551                         ; ---------------------------------------------------------------------------
2551                         loc_2551:       ld      a, 0FFh          ; return -1
2553 C3 56 25                                jp      loc_2556
2551                         ; ---------------------------------------------------------------------------
2556                         loc_2556:       call    nand_deinit
2559 D1                                      pop     de
255A C1                                      pop     bc
255B C9                                      ret
255B                         nand_detect_id  ENDP





255C                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
255C                         sub_255C        PROC
255C CD CA 23                                call    detect_nand_devices
255F CD 1F 24                                call    detect_nand_ce4
2562 C9                                      ret
2562                         sub_255C        ENDP
2562
2563
2563                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2563
2563
2563                         sub_2563:                               ; CODE XREF: sub_9B9+CEp
2563                                                                 ; sub_B7E+33p ...
2563 06 60                                   ld      b, 60h ; '`'
2565 CD 72 3F                                call    sub_3F72
2568 3E D0                                   ld      a, 0D0h ; '-'
256A D3 2A                                   out     (SNAN_CMD_REG), a
256C CD A0 3F                                call    nand_read_status
256F C9                                      ret
256F                         ; End of function sub_2563
256F
2570
2570                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2570
2570
2570                         sub_2570:                               ; CODE XREF: sub_27DE+63p
2570                                                                 ; sub_27DE+80p ...
2570 3E 0F                                   ld      a, 0Fh
2572 B9                                      cp      c
2573 C8                                      ret     z
2574 C5                                      push    bc
2575 D5                                      push    de
2576 DD E1                                   pop     ix
2578 C5                                      push    bc
2579 06 00                                   ld      b, 0
257B CD 7C 3F                                call    sub_3F7C
257E C1                                      pop     bc
257F 3E 35                                   ld      a, 35h ; '5'
2581 D3 2A                                   out     (SNAN_CMD_REG), a
2583 06 40                                   ld      b, 40h ; '@'
2585 DB 70                                   in      a, (B1_MEMMAP_REG)
2587 CB 5F                                   bit     3, a
2589 28 02                                   jr      z, loc_258D
258B 06 80                                   ld      b, 80h ; 'Ç'
258D
258D                         loc_258D:                               ; CODE XREF: sub_2570+19j
258D                                                                 ; sub_2570:loc_258Dj
258D 10 FE                                   djnz    $
258F DD E5                                   push    ix
2591 E1                                      pop     hl
2592 C5                                      push    bc
2593 06 85                                   ld      b, 85h ; 'à'
2595 CD 7C 3F                                call    sub_3F7C
2598 C1                                      pop     bc
2599 06 04                                   ld      b, 4
259B
259B                         loc_259B:                               ; CODE XREF: sub_2570+39j
259B DD E5                                   push    ix
259D E1                                      pop     hl
259E CB 09                                   rrc     c
25A0 DC D4 25                                call    c, sub_25D4
25A3 DD 34 01                                inc     (ix+1)
25A6 DD 34 01                                inc     (ix+1)
25A9 10 F0                                   djnz    loc_259B
25AB C1                                      pop     bc
25AC DD 36 00 04                             ld      (ix+0), 4
25B0 DD 36 01 08                             ld      (ix+1), 8
25B4 06 04                                   ld      b, 4
25B6
25B6                         loc_25B6:                               ; CODE XREF: sub_2570+56j
25B6 DD E5                                   push    ix
25B8 E1                                      pop     hl
25B9 CB 09                                   rrc     c
25BB DC FB 25                                call    c, sub_25FB
25BE DD 7E 00                                ld      a, (ix+0)
25C1 C6 04                                   add     a, 4
25C3 DD 77 00                                ld      (ix+0), a
25C6 10 EE                                   djnz    loc_25B6
25C8 AF                                      xor     a
25C9 DD 77 00                                ld      (ix+0), a
25CC 3E 10                                   ld      a, 10h
25CE D3 2A                                   out     (SNAN_CMD_REG), a
25D0 CD A0 3F                                call    nand_read_status
25D3 C9                                      ret
25D3                         ; End of function sub_2570
25D3
25D4
25D4                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
25D4
25D4
25D4                         sub_25D4:                               ; CODE XREF: sub_2570+30p
25D4 C5                                      push    bc
25D5 16 81                                   ld      d, 81h ; 'ü'
25D7 3E 01                                   ld      a, 1
25D9 D3 01                                   out     (EM_PAGE_LO_REG), a
25DB 3E 85                                   ld      a, 85h ; 'à'
25DD 12                                      ld      (de), a
25DE 3E 02                                   ld      a, 2
25E0 D3 01                                   out     (EM_PAGE_LO_REG), a
25E2 ED A0                                   ldi
25E4 ED A0                                   ldi
25E6 AF                                      xor     a
25E7 D3 01                                   out     (EM_PAGE_LO_REG), a
25E9 06 40                                   ld      b, 40h ; '@'
25EB 3E FF                                   ld      a, 0FFh
25ED 26 81                                   ld      h, 81h ; 'ü'
25EF
25EF                         loc_25EF:                               ; CODE XREF: sub_25D4+23j
25EF 77                                      ld      (hl), a
25F0 77                                      ld      (hl), a
25F1 77                                      ld      (hl), a
25F2 77                                      ld      (hl), a
25F3 77                                      ld      (hl), a
25F4 77                                      ld      (hl), a
25F5 77                                      ld      (hl), a
25F6 77                                      ld      (hl), a
25F7 10 F6                                   djnz    loc_25EF
25F9 C1                                      pop     bc
25FA C9                                      ret
25FA                         ; End of function sub_25D4
25FA
25FB
25FB                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
25FB
25FB
25FB                         sub_25FB:                               ; CODE XREF: sub_2570+4Bp
25FB C5                                      push    bc
25FC 16 81                                   ld      d, 81h ; 'ü'
25FE 3E 01                                   ld      a, 1
2600 D3 01                                   out     (EM_PAGE_LO_REG), a
2602 3E 85                                   ld      a, 85h ; 'à'
2604 12                                      ld      (de), a
2605 3E 02                                   ld      a, 2
2607 D3 01                                   out     (EM_PAGE_LO_REG), a
2609 DD 7E 00                                ld      a, (ix+0)
260C 12                                      ld      (de), a
260D 3E 08                                   ld      a, 8
260F 12                                      ld      (de), a
2610 AF                                      xor     a
2611 D3 01                                   out     (EM_PAGE_LO_REG), a
2613 3E FF                                   ld      a, 0FFh
2615 12                                      ld      (de), a
2616 12                                      ld      (de), a
2617 12                                      ld      (de), a
2618 12                                      ld      (de), a
2619 C1                                      pop     bc
261A C9                                      ret
261A                         ; End of function sub_25FB
261A
261B
261B                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
261B
261B
261B                         sub_261B:                               ; CODE XREF: sub_936+12p
261B                                                                 ; sub_9B9+D7p ...
261B E5                                      push    hl
261C 06 80                                   ld      b, 80h ; 'Ç'
261E CD 7C 3F                                call    sub_3F7C
2621 3E 10                                   ld      a, 10h
2623 D3 CC                                   out     (NAND_ECCCTRL_REG), a
2625 DB 05                                   in      a, (MROM_PAGE_REG)
2627 47                                      ld      b, a
2628 7E                                      ld      a, (hl)
2629 D3 06                                   out     (DMA1_SRCADDR0_REG), a
262B 23                                      inc     hl
262C 7E                                      ld      a, (hl)
262D 4F                                      ld      c, a
262E D3 07                                   out     (DMA1_SRCADDR1_REG), a
2630 23                                      inc     hl
2631 AF                                      xor     a
2632 56                                      ld      d, (hl)
2633 CB 5A                                   bit     3, d
2635 20 23                                   jr      nz, loc_265A
2637 CB 52                                   bit     2, d
2639 28 11                                   jr      z, loc_264C
263B 7A                                      ld      a, d
263C FE 07                                   cp      7
263E 28 16                                   jr      z, loc_2656
2640 CB 69                                   bit     5, c
2642 20 04                                   jr      nz, loc_2648
2644 3E 20                                   ld      a, 20h ; ' '
2646 18 0E                                   jr      loc_2656
2648                         ; ---------------------------------------------------------------------------
2648
2648                         loc_2648:                               ; CODE XREF: sub_261B+27j
2648 3E 10                                   ld      a, 10h
264A 18 0A                                   jr      loc_2656
264C                         ; ---------------------------------------------------------------------------
264C
264C                         loc_264C:                               ; CODE XREF: sub_261B+1Ej
264C CB 69                                   bit     5, c
264E 20 04                                   jr      nz, loc_2654
2650 3E 80                                   ld      a, 80h ; 'Ç'
2652 18 02                                   jr      loc_2656
2654                         ; ---------------------------------------------------------------------------
2654
2654                         loc_2654:                               ; CODE XREF: sub_261B+33j
2654 3E 40                                   ld      a, 40h ; '@'
2656
2656                         loc_2656:                               ; CODE XREF: sub_261B+23j
2656                                                                 ; sub_261B+2Bj ...
2656 D3 05                                   out     (MROM_PAGE_REG), a
2658 3E 40                                   ld      a, 40h ; '@'
265A
265A                         loc_265A:                               ; CODE XREF: sub_261B+1Aj
265A D3 09                                   out     (DMA1_SRCADDR3_REG), a
265C 7A                                      ld      a, d
265D D3 0A                                   out     (DMA1_SRCADDR4_REG), a
265F AF                                      xor     a
2660 D3 0C                                   out     (DMA1_DSTADDR1_REG), a
2662 D3 0D                                   out     (DMA1_DSTADDR2_REG), a
2664 DB 02                                   in      a, (EM_PAGE_HI_REG)
2666 E6 38                                   and     38h ; '8'
2668 CB 3F                                   srl     a
266A CB FF                                   set     7, a
266C D3 0E                                   out     (DMA1_DSTADDR3_REG), a
266E 3E 03                                   ld      a, 3
2670 0F                                      rrca
2671 0F                                      rrca
2672 D3 12                                   out     (DMA1_MODE_REG), a
2674 3E FF                                   ld      a, 0FFh
2676 D3 10                                   out     (DMA1_CNTR_LO_REG), a
2678 3E 01                                   ld      a, 1
267A D3 11                                   out     (DMA1_CNTR_HI_REG), a
267C D3 13                                   out     (DMA1_COMMAND_REG), a          ; start dma transfer
267E 78                                      ld      a, b
267F D3 05                                   out     (MROM_PAGE_REG), a
2681 E1                                      pop     hl
2682 23                                      inc     hl
2683 7E                                      ld      a, (hl)
2684 87                                      add     a, a
2685 C6 04                                   add     a, 4
2687 4F                                      ld      c, a
2688 3E 01                                   ld      a, 1
268A D3 01                                   out     (EM_PAGE_LO_REG), a
268C 3E 85                                   ld      a, 85h ; 'à'
268E 32 23 81                                ld      (8123h), a
2691 3E 02                                   ld      a, 2
2693 D3 01                                   out     (EM_PAGE_LO_REG), a
2695 06 08                                   ld      b, 8
2697 ED 43 23 81                             ld      (8123h), bc
269B AF                                      xor     a
269C D3 01                                   out     (EM_PAGE_LO_REG), a
269E
269E                         loc_269E:
269E DB CC                                   in      a, (NAND_ECCCTRL_REG)            ; verify ECC
26A0 CB 67                                   bit     4, a
26A2 20 FA                                   jr      nz, loc_269E
26A4 67                                      ld      h, a
26A5 DB CD                                   in      a, (NAND_ECC_REG0)
26A7 6F                                      ld      l, a
26A8 22 23 81                                ld      (8123h), hl
26AB DB CE                                   in      a, (NAND_ECC_REG1)
26AD 67                                      ld      h, a
26AE DB CF                                   in      a, (NAND_ECC_REG2)
26B0 6F                                      ld      l, a
26B1 22 23 81                                ld      (8123h), hl
26B4 3E 10                                   ld      a, 10h
26B6 D3 2A                                   out     (SNAN_CMD_REG), a
26B8 CD A0 3F                                call    nand_read_status
26BB C9                                      ret
26BB                         ; End of function sub_261B



26BB
26BC
26BC                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
26BC
26BC
26BC                         sub_26BC:                               ; CODE XREF: sub_BC2+8Fp
26BC                                                                 ; sub_DBF+10Dp ...
26BC C5                                      push    bc
26BD D5                                      push    de
26BE E5                                      push    hl
26BF 06 80                                   ld      b, 80h ; 'Ç'
26C1 CD 7C 3F                                call    sub_3F7C
26C4 E1                                      pop     hl
26C5 D1                                      pop     de
26C6 C1                                      pop     bc
26C7 ED 53 23 81                             ld      (8123h), de
26CB ED 43 23 81                             ld      (8123h), bc
26CF 3E 10                                   ld      a, 10h
26D1 D3 2A                                   out     (SNAN_CMD_REG), a
26D3 CD A0 3F                                call    nand_read_status
26D6 C9                                      ret
26D6                         ; End of function sub_26BC
26D6
26D6                         ; ---------------------------------------------------------------------------
26D7 C5                                      db 0C5h ; +
26D8 01                                      db    1
26D9 FF                                      db 0FFh
26DA FF                                      db 0FFh
26DB CD                                      db 0CDh ; -
26DC BC                                      db 0BCh ; +
26DD 26                                      db  26h ; &
26DE C1                                      db 0C1h ; -
26DF C9                                      db 0C9h ; +
26E0
26E0                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
26E0
26E0
26E0                         sub_26E0:                               ; CODE XREF: sub_D44+5Bp
26E0                                                                 ; sub_26F6p
26E0 C5                                      push    bc
26E1 D5                                      push    de
26E2 06 00                                   ld      b, 0
26E4 CD 7C 3F                                call    sub_3F7C
26E7 3E 30                                   ld      a, 30h ; '0'
26E9 D3 2A                                   out     (SNAN_CMD_REG), a
26EB 06 40                                   ld      b, 40h ; '@'
26ED
26ED                         loc_26ED:                               ; CODE XREF: sub_26E0:loc_26EDj
26ED 10 FE                                   djnz    $
26EF 2A 23 81                                ld      hl, (8123h)
26F2 D1                                      pop     de
26F3 C1                                      pop     bc
26F4 AF                                      xor     a
26F5 C9                                      ret
26F5                         ; End of function sub_26E0
26F5
26F6
26F6                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
26F6
26F6
26F6                         sub_26F6:                               ; CODE XREF: sub_DBF+5Ap
26F6                                                                 ; sub_F02+4Ap
26F6 CD E0 26                                call    sub_26E0
26F9 ED 5B 23 81                             ld      de, (8123h)
26FD C9                                      ret
26FD                         ; End of function sub_26F6
26FD



26FE                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
26FE                         nand_read_id    PROC
26FE 3E 90                                   ld      a, SNAN_CMD_READ_ID
2700 18 02                                   jr      loc_2704
2700                         nand_read_id    ENDP

2702                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2702                         nand_read_91    PROC
2702 3E 91                                   ld      a, SNAN_CMD_READ_ID + 01h

2704                         loc_2704:       push    hl
2705 26 80                                   ld      h, 80h
2707 D3 2A                                   out     (SNAN_CMD_REG), a

2709 06 60                                   ld      b, 60h
270B                         loc_270B:       djnz    $

270D 7E                                      ld      a, (hl)        ; read id (4bytes) from (8000h) into b,c,d,e
270E 47                                      ld      b, a
270F 7E                                      ld      a, (hl)
2710 4F                                      ld      c, a
2711 7E                                      ld      a, (hl)
2712 57                                      ld      d, a
2713 7E                                      ld      a, (hl)
2714 5F                                      ld      e, a

2715 E1                                      pop     hl
2716 C9                                      ret
2716                         nand_read_91    ENDP



2716                         ; ---------------------------------------------------------------------------
2717 76                                      db  10 dup(?)
2721
2721                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2721
2721
2721                         sub_2721:
2721 AF                                      xor     a
2722 CD 00 30                                call    display_bootlogo     ; a=0, returns immediatly
2725 CD 5C 25                                call    sub_255C             ; detect external nand devices
2728 CD B1 0A                                call    sub_AB1              ; search firmware (?)
272B A7                                      and     a
272C C2 00 80                                jp      nz, 8000h            ; failed -> reset??? this location contains undefined data
272F CD 6D 09                                call    sub_96D
2732 A7                                      and     a
2733 C2 3D 2C                                jp      nz, loc_2C3D
2736 3E 01                                   ld      a, 1
2738 CD 00 30                                call    display_bootlogo     ; a=1, display
273B CD 00 06                                call    sub_600
273E A7                                      and     a
273F C2 3D 2C                                jp      nz, loc_2C3D
2742 C9                                      ret
2742                         ; End of function sub_2721
2742
2742                         ; ---------------------------------------------------------------------------
2743 00                      byte_2743:      db 0
2744 00                                      db    0,0
2746 00 00                   word_2746:      dw 0
2748 00 00                   word_2748:      dw 0
274A 00                      byte_274A:      db 0
274B 00                                      db 48h dup(0)
2793 00 00                   word_2793:      dw 0
2795 00                      byte_2795:      db 0
2796 00 00                   word_2796:      dw 0
2798 00 00                   word_2798:      dw 0
279A 00                      byte_279A:      db 0
279B 00 00                   word_279B:      dw 0
279D 00                                      db    0,0
279F 00 00                   word_279F:      dw 0
27A1 00                                      db    0
27A2 00 00                   word_27A2:      dw 0
27A4 00                      byte_27A4:      db 0
27A5 00 00                   word_27A5:      dw 0
27A7 00                      byte_27A7:      db 0
27A8 00 00                   word_27A8:      dw 0
27AA 00 00                   word_27AA:      dw 0
27AC 00                      byte_27AC:      db 0

27AD C9                                      db 0C9h ; +
27AE AF                                      db 0AFh ; »
27AF A3                                      db 0A3h ; ú
27B0 28                                      db  28h ; (
27B1 04                                      db    4
27B2 06                                      db    6
27B3 04                                      db    4
27B4 18                                      db  18h
27B5 02                                      db    2
27B6 06                                      db    6
27B7 01                                      db    1
27B8 CD                                      db 0CDh ; -
27B9 2A                                      db  2Ah ; *
27BA 3F                                      db  3Fh ; ?
27BB CD                                      db 0CDh ; -
27BC D0                                      db 0D0h ; -
27BD 3F                                      db  3Fh ; ?
27BE CD                                      db 0CDh ; -
27BF 4E                                      db  4Eh ; N
27C0 3F                                      db  3Fh ; ?
27C1 A7                                      db 0A7h ; º
27C2 C8                                      db 0C8h ; +
27C3 3E                                      db  3Eh ; >
27C4 01                                      db    1
27C5 C9                                      db 0C9h ; +
27C6
27C6                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
27C6
27C6
27C6                         sub_27C6:                               ; CODE XREF: sub_291F+4p
27C6 D5                                      push    de
27C7 DD E5                                   push    ix
27C9 DB 05                                   in      a, (MROM_PAGE_REG)
27CB F5                                      push    af
27CC 3A 43 27                                ld      a, (byte_2743)
27CF A7                                      and     a
27D0 C4 DE 27                                call    nz, sub_27DE
27D3 AF                                      xor     a
27D4 32 43 27                                ld      (byte_2743), a
27D7 F1                                      pop     af
27D8 D3 05                                   out     (MROM_PAGE_REG), a
27DA DD E1                                   pop     ix
27DC D1                                      pop     de
27DD C9                                      ret
27DD                         ; End of function sub_27C6
27DD
27DE
27DE                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
27DE
27DE
27DE                         sub_27DE:                               ; CODE XREF: sub_27C6+Ap
27DE                                                                 ; sub_2B0A+19p ...
27DE C5                                      push    bc
27DF E5                                      push    hl
27E0 3E F1                                   ld      a, 0F1h ; '±'
27E2 D3 05                                   out     (MROM_PAGE_REG), a
27E4 06 01                                   ld      b, 1
27E6 CD 2A 3F                                call    nand_init
27E9 CD D0 3F                                call    sub_3FD0
27EC 2A 46 27                                ld      hl, (word_2746)
27EF 29                                      add     hl, hl
27F0 CB F4                                   set     6, h
27F2 5E                                      ld      e, (hl)
27F3 23                                      inc     hl
27F4 56                                      ld      d, (hl)
27F5 DD 2A 48 27                             ld      ix, (word_2748)
27F9 DD 4E 00                                ld      c, (ix+0)
27FC DD 46 01                                ld      b, (ix+1)
27FF 70                                      ld      (hl), b
2800 2B                                      dec     hl
2801 71                                      ld      (hl), c
2802 EB                                      ex      de, hl
2803 DD 75 00                                ld      (ix+0), l
2806 DD 74 01                                ld      (ix+1), h
2809 AF                                      xor     a
280A CB 3C                                   srl     h
280C CB 1D                                   rr      l
280E 1F                                      rra
280F CB 3C                                   srl     h
2811 CB 1D                                   rr      l
2813 1F                                      rra
2814 22 96 27                                ld      (word_2796), hl
2817 F6 3F                                   or      3Fh ; '?'
2819 32 95 27                                ld      (byte_2795), a
281C 21 00 00                                ld      hl, 0
281F 22 93 27                                ld      (word_2793), hl
2822 22 98 27                                ld      (word_2798), hl
2825 3A 9F 27                                ld      a, (word_279F)
2828 F6 3F                                   or      3Fh ; '?'
282A 32 9A 27                                ld      (byte_279A), a
282D 2A A0 27                                ld      hl, (word_279F+1)
2830 22 9B 27                                ld      (word_279B), hl
2833 21 92 27                                ld      hl, 2792h
2836 06 3F                                   ld      b, 3Fh ; '?'
2838
2838                         loc_2838:                               ; CODE XREF: sub_27DE+77j
2838 C5                                      push    bc
2839 E5                                      push    hl
283A 4E                                      ld      c, (hl)
283B 21 93 27                                ld      hl, 2793h
283E 11 98 27                                ld      de, 2798h
2841 CD 70 25                                call    sub_2570
2844 E1                                      pop     hl
2845 C1                                      pop     bc
2846 2B                                      dec     hl
2847 DD 21 93 27                             ld      ix, 2793h
284B DD 35 02                                dec     (ix+2)
284E DD 35 07                                dec     (ix+7)
2851 AF                                      xor     a
2852 DD 77 06                                ld      (ix+6), a
2855 10 E1                                   djnz    loc_2838
2857 4E                                      ld      c, (hl)
2858 21 93 27                                ld      hl, 2793h
285B 11 98 27                                ld      de, 2798h
285E CD 70 25                                call    sub_2570
2861 3E 08                                   ld      a, 8
2863 32 99 27                                ld      (word_2798+1), a
2866 3A 9A 27                                ld      a, (byte_279A)
2869 E6 C0                                   and     0C0h ; '+'
286B 32 9A 27                                ld      (byte_279A), a
286E 21 98 27                                ld      hl, 2798h
2871 11 FF AA                                ld      de, 0AAFFh
2874 ED 4B 46 27                             ld      bc, (word_2746)
2878 CD BC 26                                call    sub_26BC
287B 3E 08                                   ld      a, 8
287D 32 94 27                                ld      (word_2793+1), a
2880 3A 95 27                                ld      a, (byte_2795)
2883 E6 C0                                   and     0C0h ; '+'
2885 32 95 27                                ld      (byte_2795), a
2888 21 95 27                                ld      hl, 2795h
288B CD 63 25                                call    sub_2563
288E A7                                      and     a
288F 20 1E                                   jr      nz, loc_28AF
2891 21 93 27                                ld      hl, 2793h
2894 11 FF AF                                ld      de, 0AFFFh
2897 01 FF FF                                ld      bc, 0FFFFh
289A CD BC 26                                call    sub_26BC
289D
289D                         loc_289D:                               ; CODE XREF: sub_27DE+10Cj
289D 06 20                                   ld      b, 20h ; ' '
289F AF                                      xor     a
28A0 21 53 27                                ld      hl, 2753h
28A3
28A3                         loc_28A3:                               ; CODE XREF: sub_27DE+C9j
28A3 77                                      ld      (hl), a
28A4 23                                      inc     hl
28A5 77                                      ld      (hl), a
28A6 23                                      inc     hl
28A7 10 FA                                   djnz    loc_28A3
28A9 CD 4E 3F                                call    nand_deinit
28AC E1                                      pop     hl
28AD C1                                      pop     bc
28AE C9                                      ret
28AF                         ; ---------------------------------------------------------------------------
28AF
28AF                         loc_28AF:                               ; CODE XREF: sub_27DE+B1j
28AF CD D0 3F                                call    sub_3FD0
28B2 21 93 27                                ld      hl, 2793h
28B5 11 FE FF                                ld      de, 0FFFEh
28B8 01 FF FF                                ld      bc, 0FFFFh
28BB CD BC 26                                call    sub_26BC
28BE 21 F4 7F                                ld      hl, 7FF4h
28C1
28C1                         loc_28C1:                               ; CODE XREF: sub_27DE+EAj
28C1                                                                 ; sub_27DE+101j
28C1 2B                                      dec     hl
28C2 56                                      ld      d, (hl)
28C3 2B                                      dec     hl
28C4 5E                                      ld      e, (hl)
28C5 7A                                      ld      a, d
28C6 A3                                      and     e
28C7 3C                                      inc     a
28C8 28 F7                                   jr      z, loc_28C1
28CA 7A                                      ld      a, d
28CB D5                                      push    de
28CC E5                                      push    hl
28CD 11 01 00                                ld      de, 1
28D0 16 00                                   ld      d, 0
28D2 21 4B 27                                ld      hl, 274Bh
28D5 19                                      add     hl, de
28D6 56                                      ld      d, (hl)
28D7 A2                                      and     d
28D8 57                                      ld      d, a
28D9 3A 4A 27                                ld      a, (byte_274A)
28DC BA                                      cp      d
28DD E1                                      pop     hl
28DE D1                                      pop     de
28DF 20 E0                                   jr      nz, loc_28C1
28E1 ED 53 48 27                             ld      (word_2748), de
28E5 3E FF                                   ld      a, 0FFh
28E7 77                                      ld      (hl), a
28E8 23                                      inc     hl
28E9 77                                      ld      (hl), a
28EA C3 9D 28                                jp      loc_289D
28EA                         ; End of function sub_27DE
28EA
28ED
28ED                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
28ED
28ED
28ED                         sub_28ED:                               ; CODE XREF: sub_2B0Ap
28ED                                                                 ; sub_2B81p
28ED 21 A5 27                                ld      hl, 27A5h
28F0 EB                                      ex      de, hl
28F1 01 05 00                                ld      bc, 5
28F4 ED B0                                   ldir
28F6 11 A2 27                                ld      de, 27A2h
28F9 01 03 00                                ld      bc, 3
28FC ED B0                                   ldir
28FE 2A A6 27                                ld      hl, (word_27A5+1)
2901 3A A5 27                                ld      a, (word_27A5)
2904 4F                                      ld      c, a
2905 2A A6 27                                ld      hl, (word_27A5+1)
2908 AF                                      xor     a
2909 C9                                      ret
2909                         ; End of function sub_28ED
2909
2909                         ; ---------------------------------------------------------------------------
290A 3E                                      db  3Eh ; >
290B 01                                      db    1
290C C9                                      db 0C9h ; +
290D 00                                      db    0
290E 00 00                   word_290E:      dw 0                    ; DATA XREF: sub_29BA+7Aw
2910 00                                      db    0
2911 00                                      db    0
2912 00                                      db    0
2913 00                                      db    0
2914 00                      byte_2914:      db 0                    ; DATA XREF: sub_29BA+80w
2915 00 00                   word_2915:      dw 0                    ; DATA XREF: sub_29BA+86w
2917 00 00                   word_2917:      dw 0                    ; DATA XREF: sub_291F+40w
2917                                                                 ; sub_29BA+1Aw ...
2919 00 00                   word_2919:      dw 0                    ; DATA XREF: sub_291F+3Aw
2919                                                                 ; sub_291F+68r ...
291B 00 00                   word_291B:      dw 0                    ; DATA XREF: sub_291F+43w
291B                                                                 ; sub_29BA+5Bw ...
291D 00 08                   word_291D:      dw 800h                 ; DATA XREF: sub_291F+48w
291D                                                                 ; sub_291F:loc_298Er ...
291F
291F                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
291F
291F
291F                         sub_291F:                               ; CODE XREF: sub_600+6Ep
291F DD E5                                   push    ix
2921 FD E5                                   push    iy
2923 CD C6 27                                call    sub_27C6
2926 06 01                                   ld      b, 1
2928 CD 2A 3F                                call    nand_init
292B DB 05                                   in      a, (MROM_PAGE_REG)
292D F5                                      push    af
292E 3E F1                                   ld      a, 0F1h ; '±'
2930 D3 05                                   out     (MROM_PAGE_REG), a
2932 21 00 00                                ld      hl, 0
2935 01 FE 7F                                ld      bc, 7FFEh
2938
2938                         loc_2938:                               ; CODE XREF: sub_291F+22j
2938                                                                 ; sub_291F+27j
2938 0B                                      dec     bc
2939 0A                                      ld      a, (bc)
293A 57                                      ld      d, a
293B 0B                                      dec     bc
293C 0A                                      ld      a, (bc)
293D 5F                                      ld      e, a
293E 19                                      add     hl, de
293F 79                                      ld      a, c
2940 A7                                      and     a
2941 20 F5                                   jr      nz, loc_2938
2943 78                                      ld      a, b
2944 FE 40                                   cp      40h ; '@'
2946 20 F0                                   jr      nz, loc_2938
2948 22 FE 7F                                ld      (7FFEh), hl
294B F1                                      pop     af
294C D3 05                                   out     (MROM_PAGE_REG), a
294E CD 9F 2A                                call    sub_2A9F
2951 CD EC 2A                                call    sub_2AEC
2954 E5                                      push    hl
2955 11 20 00                                ld      de, 20h ; ' '
2958 19                                      add     hl, de
2959 22 19 29                                ld      (word_2919), hl
295C 21 00 00                                ld      hl, 0
295F 22 17 29                                ld      (word_2917), hl
2962 22 1B 29                                ld      (word_291B), hl
2965 26 01                                   ld      h, 1
2967 22 1D 29                                ld      (word_291D), hl
296A 06 1F                                   ld      b, 1Fh
296C
296C                         loc_296C:                               ; CODE XREF: sub_291F+78j
296C C5                                      push    bc
296D 21 17 29                                ld      hl, 2917h
2970 CD 1B 26                                call    sub_261B
2973 DD 21 17 29                             ld      ix, 2917h
2977 DD 7E 01                                ld      a, (ix+1)
297A 3C                                      inc     a
297B 3C                                      inc     a
297C DD 77 01                                ld      (ix+1), a
297F FE 08                                   cp      8
2981 20 0B                                   jr      nz, loc_298E
2983 AF                                      xor     a
2984 DD 77 01                                ld      (ix+1), a
2987 2A 19 29                                ld      hl, (word_2919)
298A 23                                      inc     hl
298B 22 19 29                                ld      (word_2919), hl
298E
298E                         loc_298E:                               ; CODE XREF: sub_291F+62j
298E 3A 1D 29                                ld      a, (word_291D)
2991 3C                                      inc     a
2992 3C                                      inc     a
2993 32 1D 29                                ld      (word_291D), a
2996 C1                                      pop     bc
2997 10 D3                                   djnz    loc_296C
2999 E1                                      pop     hl
299A 11 3F 00                                ld      de, 3Fh ; '?'
299D 19                                      add     hl, de
299E 22 19 29                                ld      (word_2919), hl
29A1 3E 06                                   ld      a, 6
29A3 32 18 29                                ld      (word_2917+1), a
29A6 21 00 3E                                ld      hl, 3E00h
29A9 22 1C 29                                ld      (word_291B+1), hl
29AC 21 17 29                                ld      hl, 2917h
29AF CD 1B 26                                call    sub_261B
29B2 CD 4E 3F                                call    nand_deinit
29B5 FD E1                                   pop     iy
29B7 DD E1                                   pop     ix
29B9 C9                                      ret
29B9                         ; End of function sub_291F
29B9
29BA
29BA                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
29BA
29BA
29BA                         sub_29BA:                               ; CODE XREF: sub_600+3p
29BA DD E5                                   push    ix
29BC FD E5                                   push    iy
29BE 06 01                                   ld      b, 1
29C0 CD 2A 3F                                call    nand_init
29C3 CD 9F 2A                                call    sub_2A9F
29C6 CD EC 2A                                call    sub_2AEC
29C9 E5                                      push    hl
29CA 11 20 00                                ld      de, 20h ; ' '
29CD 19                                      add     hl, de
29CE 22 19 29                                ld      (word_2919), hl
29D1 21 00 00                                ld      hl, 0
29D4 22 17 29                                ld      (word_2917), hl
29D7 06 1F                                   ld      b, 1Fh
29D9
29D9                         loc_29D9:                               ; CODE XREF: sub_29BA+48j
29D9 C5                                      push    bc
29DA 21 17 29                                ld      hl, 2917h
29DD CD 0F 3B                                call    sub_3B0F
29E0 DD 21 17 29                             ld      ix, 2917h
29E4 DD 34 06                                inc     (ix+6)
29E7 DD 34 06                                inc     (ix+6)
29EA DD 7E 01                                ld      a, (ix+1)
29ED 3C                                      inc     a
29EE 3C                                      inc     a
29EF DD 77 01                                ld      (ix+1), a
29F2 FE 08                                   cp      8
29F4 20 0B                                   jr      nz, loc_2A01
29F6 AF                                      xor     a
29F7 DD 77 01                                ld      (ix+1), a
29FA 2A 19 29                                ld      hl, (word_2919)
29FD 23                                      inc     hl
29FE 22 19 29                                ld      (word_2919), hl
2A01
2A01                         loc_2A01:                               ; CODE XREF: sub_29BA+3Aj
2A01 C1                                      pop     bc
2A02 10 D5                                   djnz    loc_29D9
2A04 E1                                      pop     hl
2A05 E5                                      push    hl
2A06 11 3F 00                                ld      de, 3Fh ; '?'
2A09 19                                      add     hl, de
2A0A 22 19 29                                ld      (word_2919), hl
2A0D 21 00 06                                ld      hl, 600h
2A10 22 17 29                                ld      (word_2917), hl
2A13 26 00                                   ld      h, 0
2A15 22 1B 29                                ld      (word_291B), hl
2A18 3E 3E                                   ld      a, 3Eh ; '>'
2A1A 32 1D 29                                ld      (word_291D), a
2A1D 21 17 29                                ld      hl, 2917h
2A20 CD 0F 3B                                call    sub_3B0F
2A23 E1                                      pop     hl
2A24 22 19 29                                ld      (word_2919), hl
2A27 AF                                      xor     a
2A28 32 1B 29                                ld      (word_291B), a
2A2B 21 19 29                                ld      hl, 2919h
2A2E CD 63 25                                call    sub_2563
2A31 21 00 00                                ld      hl, 0
2A34 22 0E 29                                ld      (word_290E), hl
2A37 3A 19 29                                ld      a, (word_2919)
2A3A 32 14 29                                ld      (byte_2914), a
2A3D 2A 1A 29                                ld      hl, (word_2919+1)
2A40 22 15 29                                ld      (word_2915), hl
2A43 06 08                                   ld      b, 8
2A45
2A45                         loc_2A45:                               ; CODE XREF: sub_29BA+A6j
2A45 C5                                      push    bc
2A46 0E 00                                   ld      c, 0
2A48 21 0D 29                                ld      hl, 290Dh
2A4B 11 12 29                                ld      de, 2912h
2A4E CD 70 25                                call    sub_2570
2A51 DD 21 0D 29                             ld      ix, 290Dh
2A55 DD 34 02                                inc     (ix+2)
2A58 DD 34 07                                inc     (ix+7)
2A5B AF                                      xor     a
2A5C DD 77 06                                ld      (ix+6), a
2A5F C1                                      pop     bc
2A60 10 E3                                   djnz    loc_2A45
2A62 DB 05                                   in      a, (MROM_PAGE_REG)
2A64 F5                                      push    af
2A65 3E 01                                   ld      a, 1
2A67 F6 F0                                   or      0F0h ; '='
2A69 D3 05                                   out     (MROM_PAGE_REG), a
2A6B 2A FA 7F                                ld      hl, (7FFAh)
2A6E CD EC 2A                                call    sub_2AEC
2A71 22 19 29                                ld      (word_2919), hl
2A74 32 1B 29                                ld      (word_291B), a
2A77 21 19 29                                ld      hl, 2919h
2A7A CD 63 25                                call    sub_2563
2A7D 21 00 08                                ld      hl, 800h
2A80 22 17 29                                ld      (word_2917), hl
2A83 01 FF FF                                ld      bc, 0FFFFh
2A86 11 FF AF                                ld      de, 0AFFFh
2A89 21 17 29                                ld      hl, 2917h
2A8C CD BC 26                                call    sub_26BC
2A8F F1                                      pop     af
2A90 D3 05                                   out     (MROM_PAGE_REG), a
2A92 CD 4E 3F                                call    nand_deinit
2A95 FD E1                                   pop     iy
2A97 DD E1                                   pop     ix
2A99 06 01                                   ld      b, 1
2A9B CD BC 2A                                call    sub_2ABC
2A9E C9                                      ret
2A9E                         ; End of function sub_29BA
2A9E
2A9F
2A9F                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2A9F
2A9F
2A9F                         sub_2A9F:                               ; CODE XREF: sub_291F+2Fp
2A9F                                                                 ; sub_29BA+9p
2A9F 21 FA 07                                ld      hl, 7FAh
2AA2 22 17 29                                ld      (word_2917), hl
2AA5 21 07 00                                ld      hl, 7
2AA8 22 19 29                                ld      (word_2919), hl
2AAB 2E 00                                   ld      l, 0
2AAD 22 1B 29                                ld      (word_291B), hl
2AB0 26 01                                   ld      h, 1
2AB2 22 1D 29                                ld      (word_291D), hl
2AB5 21 17 29                                ld      hl, 2917h
2AB8 CD D0 3E                                call    sub_3ED0
2ABB C9                                      ret
2ABB                         ; End of function sub_2A9F
2ABB
2ABC
2ABC                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2ABC
2ABC
2ABC                         sub_2ABC:                               ; CODE XREF: sub_29BA+E1p
2ABC E5                                      push    hl
2ABD C5                                      push    bc
2ABE D5                                      push    de
2ABF 48                                      ld      c, b
2AC0 06 00                                   ld      b, 0
2AC2 21 4B 27                                ld      hl, 274Bh
2AC5 09                                      add     hl, bc
2AC6 DB 05                                   in      a, (MROM_PAGE_REG)
2AC8 F5                                      push    af
2AC9 79                                      ld      a, c
2ACA F6 F0                                   or      0F0h ; '='
2ACC D3 05                                   out     (MROM_PAGE_REG), a
2ACE ED 5B F8 7F                             ld      de, (7FF8h)
2AD2 F1                                      pop     af
2AD3 D3 05                                   out     (MROM_PAGE_REG), a
2AD5 0E 00                                   ld      c, 0
2AD7 7A                                      ld      a, d
2AD8 3C                                      inc     a
2AD9 28 0C                                   jr      z, loc_2AE7
2ADB 0E 80                                   ld      c, 80h ; 'Ç'
2ADD 06 08                                   ld      b, 8
2ADF
2ADF                         loc_2ADF:                               ; CODE XREF: sub_2ABC+29j
2ADF 79                                      ld      a, c
2AE0 A2                                      and     d
2AE1 20 04                                   jr      nz, loc_2AE7
2AE3 CB 39                                   srl     c
2AE5 10 F8                                   djnz    loc_2ADF
2AE7
2AE7                         loc_2AE7:                               ; CODE XREF: sub_2ABC+1Dj
2AE7                                                                 ; sub_2ABC+25j
2AE7 71                                      ld      (hl), c
2AE8 D1                                      pop     de
2AE9 C1                                      pop     bc
2AEA E1                                      pop     hl
2AEB C9                                      ret
2AEB                         ; End of function sub_2ABC
2AEB
2AEC
2AEC                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2AEC
2AEC
2AEC                         sub_2AEC:                               ; CODE XREF: sub_291F+32p
2AEC                                                                 ; sub_29BA+Cp ...
2AEC AF                                      xor     a
2AED 06 06                                   ld      b, 6
2AEF
2AEF                         loc_2AEF:                               ; CODE XREF: sub_2AEC+6j
2AEF 29                                      add     hl, hl
2AF0 CE 00                                   adc     a, 0
2AF2 10 FB                                   djnz    loc_2AEF
2AF4 C9                                      ret
2AF4                         ; End of function sub_2AEC
2AF4
2AF5
2AF5                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2AF5
2AF5
2AF5                         sub_2AF5:                               ; CODE XREF: sub_6AB+1Bp
2AF5                                                                 ; sub_6AB+A3p ...
2AF5 E5                                      push    hl
2AF6 D5                                      push    de
2AF7 C5                                      push    bc
2AF8 DD E5                                   push    ix
2AFA CD 0A 2B                                call    sub_2B0A
2AFD A7                                      and     a
2AFE CC 0F 3B                                call    z, sub_3B0F
2B01 CD 4E 3F                                call    nand_deinit
2B04 DD E1                                   pop     ix
2B06 C1                                      pop     bc
2B07 D1                                      pop     de
2B08 E1                                      pop     hl
2B09 C9                                      ret
2B09                         ; End of function sub_2AF5
2B09
2B0A
2B0A                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2B0A
2B0A
2B0A                         sub_2B0A:                               ; CODE XREF: sub_2AF5+5p
2B0A CD ED 28                                call    sub_28ED
2B0D A7                                      and     a
2B0E C0                                      ret     nz
2B0F DB 05                                   in      a, (MROM_PAGE_REG)
2B11 F5                                      push    af
2B12 3A 43 27                                ld      a, (byte_2743)
2B15 A7                                      and     a
2B16 28 12                                   jr      z, loc_2B2A
2B18 ED 5B 46 27                             ld      de, (word_2746)
2B1C AF                                      xor     a
2B1D EB                                      ex      de, hl
2B1E ED 52                                   sbc     hl, de
2B20 EB                                      ex      de, hl
2B21 20 07                                   jr      nz, loc_2B2A
2B23 CD DE 27                                call    sub_27DE
2B26 AF                                      xor     a
2B27 32 43 27                                ld      (byte_2743), a
2B2A
2B2A                         loc_2B2A:                               ; CODE XREF: sub_2B0A+Cj
2B2A                                                                 ; sub_2B0A+17j
2B2A 3E F1                                   ld      a, 0F1h ; '±'
2B2C D3 05                                   out     (MROM_PAGE_REG), a
2B2E 06 01                                   ld      b, 1
2B30 CD 2A 3F                                call    nand_init
2B33 29                                      add     hl, hl
2B34 CB F4                                   set     6, h
2B36 5E                                      ld      e, (hl)
2B37 23                                      inc     hl
2B38 56                                      ld      d, (hl)
2B39 EB                                      ex      de, hl
2B3A AF                                      xor     a
2B3B CB 3C                                   srl     h
2B3D CB 1D                                   rr      l
2B3F CB 19                                   rr      c
2B41 1F                                      rra
2B42 CB 3C                                   srl     h
2B44 CB 1D                                   rr      l
2B46 CB 19                                   rr      c
2B48 17                                      rla
2B49 17                                      rla
2B4A 17                                      rla
2B4B 22 A8 27                                ld      (word_27A8), hl
2B4E 2E 00                                   ld      l, 0
2B50 67                                      ld      h, a
2B51 22 A5 27                                ld      (word_27A5), hl
2B54 79                                      ld      a, c
2B55 32 A7 27                                ld      (byte_27A7), a
2B58 3A A4 27                                ld      a, (byte_27A4)
2B5B 32 AC 27                                ld      (byte_27AC), a
2B5E 2A A2 27                                ld      hl, (word_27A2)
2B61 22 AA 27                                ld      (word_27AA), hl
2B64 21 A5 27                                ld      hl, 27A5h
2B67 F1                                      pop     af
2B68 D3 05                                   out     (MROM_PAGE_REG), a
2B6A AF                                      xor     a
2B6B C9                                      ret
2B6B                         ; End of function sub_2B0A
2B6B
2B6C
2B6C                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2B6C
2B6C
2B6C                         sub_2B6C:                               ; CODE XREF: sub_673+2Ap
2B6C                                                                 ; sub_8AF+33p
2B6C E5                                      push    hl
2B6D D5                                      push    de
2B6E C5                                      push    bc
2B6F DD E5                                   push    ix
2B71 CD 81 2B                                call    sub_2B81
2B74 A7                                      and     a
2B75 CC 1B 26                                call    z, sub_261B
2B78 CD 4E 3F                                call    nand_deinit
2B7B DD E1                                   pop     ix
2B7D C1                                      pop     bc
2B7E D1                                      pop     de
2B7F E1                                      pop     hl
2B80 C9                                      ret
2B80                         ; End of function sub_2B6C
2B80
2B81
2B81                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
2B81
2B81
2B81                         sub_2B81:                               ; CODE XREF: sub_2B6C+5p
2B81 CD ED 28                                call    sub_28ED
2B84 A7                                      and     a
2B85 C0                                      ret     nz
2B86 DB 05                                   in      a, (MROM_PAGE_REG)
2B88 F5                                      push    af
2B89 3A 43 27                                ld      a, (byte_2743)
2B8C A7                                      and     a
2B8D 28 0E                                   jr      z, loc_2B9D
2B8F ED 5B 46 27                             ld      de, (word_2746)
2B93 EB                                      ex      de, hl
2B94 AF                                      xor     a
2B95 ED 52                                   sbc     hl, de
2B97 EB                                      ex      de, hl
2B98 28 48                                   jr      z, loc_2BE2
2B9A
2B9A                         loc_2B9A:                               ; CODE XREF: sub_2B81+B9j
2B9A CD DE 27                                call    sub_27DE
2B9D
2B9D                         loc_2B9D:                               ; CODE XREF: sub_2B81+Cj
2B9D C5                                      push    bc
2B9E 3E 01                                   ld      a, 1
2BA0 32 43 27                                ld      (byte_2743), a
2BA3 22 46 27                                ld      (word_2746), hl
2BA6 3E F1                                   ld      a, 0F1h ; '±'
2BA8 D3 05                                   out     (MROM_PAGE_REG), a
2BAA 29                                      add     hl, hl
2BAB CB F4                                   set     6, h
2BAD 23                                      inc     hl
2BAE 7E                                      ld      a, (hl)
2BAF 11 01 00                                ld      de, 1
2BB2 16 00                                   ld      d, 0
2BB4 21 4B 27                                ld      hl, 274Bh
2BB7 19                                      add     hl, de
2BB8 56                                      ld      d, (hl)
2BB9 A2                                      and     d
2BBA 28 05                                   jr      z, loc_2BC1
2BBC 21 F8 7F                                ld      hl, 7FF8h
2BBF 18 03                                   jr      loc_2BC4
2BC1                         ; ---------------------------------------------------------------------------
2BC1
2BC1                         loc_2BC1:                               ; CODE XREF: sub_2B81+39j
2BC1 21 FA 7F                                ld      hl, 7FFAh
2BC4
2BC4                         loc_2BC4:                               ; CODE XREF: sub_2B81+3Ej
2BC4 32 4A 27                                ld      (byte_274A), a
2BC7 22 48 27                                ld      (word_2748), hl
2BCA 5E                                      ld      e, (hl)
2BCB 23                                      inc     hl
2BCC 56                                      ld      d, (hl)
2BCD EB                                      ex      de, hl
2BCE CB 3C                                   srl     h
2BD0 CB 1D                                   rr      l
2BD2 CB 19                                   rr      c
2BD4 CB 3C                                   srl     h
2BD6 CB 1D                                   rr      l
2BD8 CB 19                                   rr      c
2BDA ED 43 9F 27                             ld      (word_279F), bc
2BDE 22 A0 27                                ld      (word_279F+1), hl
2BE1 C1                                      pop     bc
2BE2
2BE2                         loc_2BE2:                               ; CODE XREF: sub_2B81+17j
2BE2 C5                                      push    bc
2BE3 06 01                                   ld      b, 1
2BE5 CD 2A 3F                                call    nand_init
2BE8 AF                                      xor     a
2BE9 CB 39                                   srl     c
2BEB 1F                                      rra
2BEC CB 39                                   srl     c
2BEE 1F                                      rra
2BEF 06 00                                   ld      b, 0
2BF1 21 53 27                                ld      hl, 2753h
2BF4 09                                      add     hl, bc
2BF5 17                                      rla
2BF6 38 15                                   jr      c, loc_2C0D
2BF8 17                                      rla
2BF9 38 09                                   jr      c, loc_2C04
2BFB 17                                      rla
2BFC CB 46                                   bit     0, (hl)
2BFE 20 33                                   jr      nz, loc_2C33
2C00 CB C6                                   set     0, (hl)
2C02 18 1C                                   jr      loc_2C20
2C04                         ; ---------------------------------------------------------------------------
2C04
2C04                         loc_2C04:                               ; CODE XREF: sub_2B81+78j
2C04 17                                      rla
2C05 CB 4E                                   bit     1, (hl)
2C07 20 2A                                   jr      nz, loc_2C33
2C09 CB CE                                   set     1, (hl)
2C0B 18 13                                   jr      loc_2C20
2C0D                         ; ---------------------------------------------------------------------------
2C0D
2C0D                         loc_2C0D:                               ; CODE XREF: sub_2B81+75j
2C0D 17                                      rla
2C0E 38 09                                   jr      c, loc_2C19
2C10 17                                      rla
2C11 CB 56                                   bit     2, (hl)
2C13 20 1E                                   jr      nz, loc_2C33
2C15 CB D6                                   set     2, (hl)
2C17 18 07                                   jr      loc_2C20
2C19                         ; ---------------------------------------------------------------------------
2C19
2C19                         loc_2C19:                               ; CODE XREF: sub_2B81+8Dj
2C19 17                                      rla
2C1A CB 5E                                   bit     3, (hl)
2C1C 20 15                                   jr      nz, loc_2C33
2C1E CB DE                                   set     3, (hl)
2C20
2C20                         loc_2C20:                               ; CODE XREF: sub_2B81+81j
2C20                                                                 ; sub_2B81+8Aj ...
2C20 21 9E 27                                ld      hl, 279Eh
2C23 17                                      rla
2C24 77                                      ld      (hl), a
2C25 23                                      inc     hl
2C26 7E                                      ld      a, (hl)
2C27 E6 C0                                   and     0C0h ; '+'
2C29 B1                                      or      c
2C2A 77                                      ld      (hl), a
2C2B 2B                                      dec     hl
2C2C 2B                                      dec     hl
2C2D C1                                      pop     bc
2C2E F1                                      pop     af
2C2F D3 05                                   out     (MROM_PAGE_REG), a
2C31 AF                                      xor     a
2C32 C9                                      ret
2C33                         ; ---------------------------------------------------------------------------
2C33
2C33                         loc_2C33:                               ; CODE XREF: sub_2B81+7Dj
2C33                                                                 ; sub_2B81+86j ...
2C33 2A 46 27                                ld      hl, (word_2746)
2C36 C1                                      pop     bc
2C37 CD 4E 3F                                call    nand_deinit
2C3A C3 9A 2B                                jp      loc_2B9A
2C3A                         ; End of function sub_2B81
2C3A
2C3D                         ; ---------------------------------------------------------------------------
2C3D                         ; START OF FUNCTION CHUNK FOR sub_2721
2C3D
2C3D                         loc_2C3D:                               ; CODE XREF: sub_2721+12j
2C3D                                                                 ; sub_2721+1Ej
2C3D 21 00 90                                ld      hl, 9000h
2C40 11 00 00                                ld      de, 0
2C43 01 00 0C                                ld      bc, 0C00h
2C46 ED B0                                   ldir
2C48 31 00 01                                ld      sp, 100h
2C4B C3 00 00                                jp      loc_0
2C4B                         ; END OF FUNCTION CHUNK FOR sub_2721
2C4B                         ; ---------------------------------------------------------------------------



2C4E 76                                      org 3000h



3000
3000                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3000
3000
3000                         display_bootlogo:
3000 32 C4 34                                ld      (byte_34C4), a   ; not necessary
3003 FE 00                                   cp      0                ; if a==0 then ret
3005 28 02                                   jr      z, locret_3009
3007 18 01                                   jr      loc_300A
3009                         ; ---------------------------------------------------------------------------
3009
3009                         locret_3009:                            ; CODE XREF: display_bootlogo+5j
3009 C9                                      ret
300A                         ; ---------------------------------------------------------------------------
300A
300A                         loc_300A:                               ; CODE XREF: display_bootlogo+7j
300A DB 05                                   in      a, (MROM_PAGE_REG)
300C 47                                      ld      b, a
300D F6 07                                   or      7
300F D3 05                                   out     (MROM_PAGE_REG), a
3011 DB 70                                   in      a, (B1_MEMMAP_REG)
3013 4F                                      ld      c, a
3014 CB EF                                   set     5, a
3016 CB E7                                   set     4, a
3018 D3 70                                   out     (70h), a
301A 78                                      ld      a, b
301B 32 C0 34                                ld      (byte_34C0), a
301E 79                                      ld      a, c
301F 32 C1 34                                ld      (byte_34C1), a
3022 AF                                      xor     a
3023 D3 EF                                   out     (0EFh), a
3025 D3 C1                                   out     (0C1h), a
3027 3E 01                                   ld      a, 1
3029 D3 F2                                   out     (0F2h), a
302B D3 F0                                   out     (0F0h), a
302D 3E 76                                   ld      a, 76h ; 'v'
302F D3 F1                                   out     (0F1h), a
3031 DB FE                                   in      a, (0FEh)
3033 F6 10                                   or      10h
3035 D3 FE                                   out     (0FEh), a
3037 DB EE                                   in      a, (0EEh)
3039 F6 08                                   or      8
303B F6 05                                   or      5
303D E6 FD                                   and     0FDh ; '²'
303F D3 EE                                   out     (0EEh), a
3041 CD A8 31                                call    sub_31A8
3044 DB 02                                   in      a, (EM_PAGE_HI_REG)
3046 32 C3 34                                ld      (byte_34C3), a

3049 3E 18                                   ld      a, 18h               ; set ext mem to CE3 (LCM/display)
304B D3 02                                   out     (EM_PAGE_HI_REG), a

304D DB 00                                   in      a, (0)
304F 32 B8 32                                ld      (byte_32B8), a
3052 F6 41                                   or      41h ; 'A'
3054 D3 00                                   out     (0), a
3056 0E 01                                   ld      c, 1
3058 16 FE                                   ld      d, 0FEh ; '¦'
305A DB EF                                   in      a, (0EFh)
305C E6 FE                                   and     0FEh ; '¦'
305E D3 EF                                   out     (0EFh), a
3060 DB F0                                   in      a, (0F0h)
3062 F6 01                                   or      1
3064 D3 F0                                   out     (0F0h), a
3066 DB F1                                   in      a, (0F1h)
3068 E6 FE                                   and     0FEh ; '¦'
306A D3 F1                                   out     (0F1h), a
306C DB F3                                   in      a, (GPIO_C_ENABLE_REG)
306E F6 04                                   or      4
3070 E6 BF                                   and     0BFh ; '+'
3072 D3 F3                                   out     (GPIO_C_ENABLE_REG), a
3074 DB F2                                   in      a, (0F2h)
3076 B1                                      or      c
3077 D3 F2                                   out     (0F2h), a
3079 D3 F2                                   out     (0F2h), a
307B D3 F2                                   out     (0F2h), a
307D A2                                      and     d
307E D3 F2                                   out     (0F2h), a
3080 D3 F2                                   out     (0F2h), a
3082 D3 F2                                   out     (0F2h), a
3084 D3 F2                                   out     (0F2h), a
3086 D3 F2                                   out     (0F2h), a
3088 B1                                      or      c
3089 D3 F2                                   out     (0F2h), a
308B D3 F2                                   out     (0F2h), a
308D D3 F2                                   out     (0F2h), a
308F 0E A2                                   ld      c, 0A2h ; 'ó'
3091 CD 80 31                                call    sub_3180
3094 0E A1                                   ld      c, 0A1h ; 'í'
3096 CD 80 31                                call    sub_3180
3099 0E C0                                   ld      c, 0C0h ; '+'
309B CD 80 31                                call    sub_3180
309E 0E 27                                   ld      c, 27h ; '''
30A0 CD 80 31                                call    sub_3180
30A3 0E 81                                   ld      c, 81h ; 'ü'
30A5 CD 80 31                                call    sub_3180
30A8 3E 0C                                   ld      a, 0Ch
30AA 4F                                      ld      c, a
30AB CD 80 31                                call    sub_3180
30AE 0E 2F                                   ld      c, 2Fh ; '/'
30B0 CD 80 31                                call    sub_3180
30B3 0E AF                                   ld      c, 0AFh ; '»'
30B5 CD 80 31                                call    sub_3180
30B8 0E A4                                   ld      c, 0A4h ; 'ñ'
30BA CD 80 31                                call    sub_3180
30BD 0E B0                                   ld      c, 0B0h ; '¦'
30BF CD 80 31                                call    sub_3180
30C2 0E 10                                   ld      c, 10h
30C4 CD 80 31                                call    sub_3180
30C7 0E 00                                   ld      c, 0
30C9 CD 80 31                                call    sub_3180
30CC 06 84                                   ld      b, 84h ; 'ä'
30CE DB F4                                   in      a, (GPIO_C_DATA_REG)
30D0 F6 04                                   or      4
30D2 D3 F4                                   out     (GPIO_C_DATA_REG), a
30D4 AF                                      xor     a
30D5
30D5                         loc_30D5:                               ; CODE XREF: display_bootlogo+D8j
30D5 32 01 80                                ld      (8001h), a
30D8 10 FB                                   djnz    loc_30D5
30DA 0E B1                                   ld      c, 0B1h ; '¦'
30DC CD 80 31                                call    sub_3180
30DF 0E 10                                   ld      c, 10h
30E1 CD 80 31                                call    sub_3180
30E4 0E 00                                   ld      c, 0
30E6 CD 80 31                                call    sub_3180
30E9 06 84                                   ld      b, 84h ; 'ä'
30EB DB F4                                   in      a, (GPIO_C_DATA_REG)
30ED F6 04                                   or      4
30EF D3 F4                                   out     (GPIO_C_DATA_REG), a
30F1 AF                                      xor     a
30F2
30F2                         loc_30F2:                               ; CODE XREF: display_bootlogo+F5j
30F2 32 01 80                                ld      (8001h), a
30F5 10 FB                                   djnz    loc_30F2
30F7 0E B2                                   ld      c, 0B2h ; '¦'
30F9 CD 80 31                                call    sub_3180
30FC 0E 10                                   ld      c, 10h
30FE CD 80 31                                call    sub_3180
3101 0E 00                                   ld      c, 0
3103 CD 80 31                                call    sub_3180
3106 06 84                                   ld      b, 84h ; 'ä'
3108 DB F4                                   in      a, (GPIO_C_DATA_REG)
310A F6 04                                   or      4
310C D3 F4                                   out     (GPIO_C_DATA_REG), a
310E AF                                      xor     a
310F
310F                         loc_310F:                               ; CODE XREF: display_bootlogo+112j
310F 32 01 80                                ld      (8001h), a
3112 10 FB                                   djnz    loc_310F
3114 0E B3                                   ld      c, 0B3h ; '¦'
3116 CD 80 31                                call    sub_3180
3119 0E 10                                   ld      c, 10h
311B CD 80 31                                call    sub_3180
311E 0E 00                                   ld      c, 0
3120 CD 80 31                                call    sub_3180
3123 06 84                                   ld      b, 84h ; 'ä'
3125 DB F4                                   in      a, (GPIO_C_DATA_REG)
3127 F6 04                                   or      4
3129 D3 F4                                   out     (GPIO_C_DATA_REG), a
312B AF                                      xor     a
312C
312C                         loc_312C:                               ; CODE XREF: display_bootlogo+12Fj
312C 32 01 80                                ld      (8001h), a
312F 10 FB                                   djnz    loc_312C
3131 DB 4E                                   in      a, (WATCHDOG_REG)
3133 F6 08                                   or      8
3135 D3 4E                                   out     (WATCHDOG_REG), a

3137 06 80                                   ld      b, 80h
3139 0E B0                                   ld      c, 0B0h
313B 21 C0 32                                ld      hl, BOOTLOGO       ; ref. to bootlogo
313E                         loc_313E:       call    sub_316D           ; sub_316d(hl, b=80h, c=B0h..B3h)
3141 0C                                      inc     c
3142 3A C5 34                                ld      a, (byte_34C5)
3145 3D                                      dec     a
3146 32 C5 34                                ld      (byte_34C5), a
3149 20 F3                                   jr      nz, loc_313E       ; loop 4 times

314B DB 4E                                   in      a, (WATCHDOG_REG)
314D F6 08                                   or      8
314F D3 4E                                   out     (WATCHDOG_REG), a
3151 0E AF                                   ld      c, 0AFh ; '»'
3153 CD 80 31                                call    sub_3180
3156 3A B8 32                                ld      a, (byte_32B8)
3159 D3 00                                   out     (0), a
315B 3A C3 34                                ld      a, (byte_34C3)
315E D3 02                                   out     (EM_PAGE_HI_REG), a
3160 3A C0 34                                ld      a, (byte_34C0)
3163 47                                      ld      b, a
3164 3A C1 34                                ld      a, (byte_34C1)
3167 D3 70                                   out     (70h), a
3169 78                                      ld      a, b
316A D3 05                                   out     (MROM_PAGE_REG), a
316C C9                                      ret
316C                         ; End of function display_bootlogo
316C
316D
316D                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
316D
316D                          ; hl -> logo
316D                         sub_316D:
316D C5                                      push    bc
316E CD 80 31                                call    sub_3180       ; write c
3171 0E 10                                   ld      c, 10h
3173 CD 80 31                                call    sub_3180       ; write 10h
3176 0E 00                                   ld      c, 0
3178 CD 80 31                                call    sub_3180       ; write 00h
317B CD 8D 31                                call    sub_318D
317E C1                                      pop     bc
317F C9                                      ret
317F                         ; End of function sub_316D
317F
3180
3180                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3180
3180
3180                         sub_3180:                               ; CODE XREF: display_bootlogo+91p
3180                                                                 ; display_bootlogo+96p ...
3180 C5                                      push    bc
3181 DB F4                                   in      a, (GPIO_C_DATA_REG)
3183 E6 FB                                   and     0FBh ; 'v'
3185 D3 F4                                   out     (GPIO_C_DATA_REG), a
3187 79                                      ld      a, c
3188 32 00 80                                ld      (8000h), a
318B C1                                      pop     bc
318C C9                                      ret
318C                         ; End of function sub_3180
318C
318D
318D                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
318D
318D
318D                         sub_318D:                               ; CODE XREF: sub_316D+Ep
318D DB F4                                   in      a, (GPIO_C_DATA_REG)
318F F6 04                                   or      4
3191 D3 F4                                   out     (GPIO_C_DATA_REG), a
3193
3193                         loc_3193:                               ; CODE XREF: sub_318D+Bj
3193 7E                                      ld      a, (hl)
3194 32 01 80                                ld      (8001h), a
3197 23                                      inc     hl
3198 10 F9                                   djnz    loc_3193
319A C9                                      ret
319A                         ; End of function sub_318D





319A
319A                         ; ---------------------------------------------------------------------------
319B C5                                      db 0C5h ; +
319C 06                                      db    6
319D 20                                      db  20h
319E C5                                      db 0C5h ; +
319F 06                                      db    6
31A0 FF                                      db 0FFh
31A1 10                                      db  10h
31A2 FE                                      db 0FEh ; ¦
31A3 C1                                      db 0C1h ; -
31A4 10                                      db  10h
31A5 F8                                      db 0F8h ; °
31A6 C1                                      db 0C1h ; -
31A7 C9                                      db 0C9h ; +
31A8
31A8                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
31A8
31A8
31A8                         sub_31A8:                               ; CODE XREF: display_bootlogo+41p
31A8 F5                                      push    af
31A9 C5                                      push    bc
31AA E5                                      push    hl
31AB 21 BC 32                                ld      hl, 32BCh
31AE CB B6                                   res     6, (hl)
31B0 1A                                      ld      a, (de)
31B1 32 BE 32                                ld      (byte_32BE), a
31B4 FE 00                                   cp      0
31B6 28 04                                   jr      z, loc_31BC
31B8 CB F6                                   set     6, (hl)
31BA 0E 03                                   ld      c, 3
31BC
31BC                         loc_31BC:                               ; CODE XREF: sub_31A8+Ej
31BC                                                                 ; sub_31A8+1Cj
31BC 0D                                      dec     c
31BD 28 07                                   jr      z, loc_31C6
31BF CD D1 31                                call    sub_31D1
31C2 FE 00                                   cp      0
31C4 28 F6                                   jr      z, loc_31BC
31C6
31C6                         loc_31C6:                               ; CODE XREF: sub_31A8+15j
31C6 E1                                      pop     hl
31C7 C1                                      pop     bc
31C8 F1                                      pop     af
31C9 C9                                      ret
31C9                         ; End of function sub_31A8
31C9
31CA
31CA                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
31CA
31CA
31CA                         sub_31CA:                               ; CODE XREF: sub_3209+7p
31CA                                                                 ; sub_321B+7p ...
31CA F5                                      push    af
31CB C5                                      push    bc
31CC 00                                      nop
31CD 00                                      nop
31CE C1                                      pop     bc
31CF F1                                      pop     af
31D0 C9                                      ret
31D0                         ; End of function sub_31CA
31D0
31D1
31D1                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
31D1
31D1
31D1                         sub_31D1:                               ; CODE XREF: sub_31A8+17p
31D1 E5                                      push    hl
31D2 C5                                      push    bc
31D3 CD 09 32                                call    sub_3209
31D6 3E C0                                   ld      a, 0C0h ; '+'
31D8 06 00                                   ld      b, 0
31DA CD 2D 32                                call    sub_322D
31DD FE 00                                   cp      0
31DF 20 1A                                   jr      nz, loc_31FB
31E1 0E 05                                   ld      c, 5
31E3 21 B9 32                                ld      hl, 32B9h
31E6
31E6                         loc_31E6:                               ; CODE XREF: sub_31D1+21j
31E6 7E                                      ld      a, (hl)
31E7 06 00                                   ld      b, 0
31E9 CD 2D 32                                call    sub_322D
31EC FE 00                                   cp      0
31EE 20 0B                                   jr      nz, loc_31FB
31F0 23                                      inc     hl
31F1 0D                                      dec     c
31F2 20 F2                                   jr      nz, loc_31E6
31F4 3E 01                                   ld      a, 1
31F6 32 BF 32                                ld      (byte_32BF), a
31F9 18 05                                   jr      loc_3200
31FB                         ; ---------------------------------------------------------------------------
31FB
31FB                         loc_31FB:                               ; CODE XREF: sub_31D1+Ej
31FB                                                                 ; sub_31D1+1Dj
31FB 3E 00                                   ld      a, 0
31FD 32 BF 32                                ld      (byte_32BF), a
3200
3200                         loc_3200:                               ; CODE XREF: sub_31D1+28j
3200 CD 1B 32                                call    sub_321B
3203 3A BF 32                                ld      a, (byte_32BF)
3206 C1                                      pop     bc
3207 E1                                      pop     hl
3208 C9                                      ret
3208                         ; End of function sub_31D1
3208
3209
3209                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3209
3209
3209                         sub_3209:                               ; CODE XREF: sub_31D1+2p
3209 F5                                      push    af
320A DB F4                                   in      a, (GPIO_C_DATA_REG)
320C CB 8F                                   res     1, a
320E D3 F4                                   out     (GPIO_C_DATA_REG), a
3210 CD CA 31                                call    sub_31CA
3213 DB F4                                   in      a, (GPIO_C_DATA_REG)
3215 CB 87                                   res     0, a
3217 D3 F4                                   out     (GPIO_C_DATA_REG), a
3219 F1                                      pop     af
321A C9                                      ret
321A                         ; End of function sub_3209
321A
321B
321B                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
321B
321B
321B                         sub_321B:                               ; CODE XREF: sub_31D1:loc_3200p
321B F5                                      push    af
321C DB F4                                   in      a, (GPIO_C_DATA_REG)
321E CB C7                                   set     0, a
3220 D3 F4                                   out     (GPIO_C_DATA_REG), a
3222 CD CA 31                                call    sub_31CA
3225 DB F4                                   in      a, (GPIO_C_DATA_REG)
3227 CB CF                                   set     1, a
3229 D3 F4                                   out     (GPIO_C_DATA_REG), a
322B F1                                      pop     af
322C C9                                      ret
322C                         ; End of function sub_321B
322C
322D
322D                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
322D
322D
322D                         sub_322D:                               ; CODE XREF: sub_31D1+9p
322D                                                                 ; sub_31D1+18p
322D C5                                      push    bc
322E 4F                                      ld      c, a
322F CD 8D 32                                call    sub_328D
3232 DB F3                                   in      a, (GPIO_C_ENABLE_REG)
3234 CB 8F                                   res     1, a
3236 D3 F3                                   out     (GPIO_C_ENABLE_REG), a
3238 DB F3                                   in      a, (GPIO_C_ENABLE_REG)
323A CB EF                                   set     5, a
323C D3 F3                                   out     (GPIO_C_ENABLE_REG), a
323E CD CA 31                                call    sub_31CA
3241 DB F4                                   in      a, (GPIO_C_DATA_REG)
3243 CB C7                                   set     0, a
3245 D3 F4                                   out     (GPIO_C_DATA_REG), a
3247 DB F4                                   in      a, (GPIO_C_DATA_REG)
3249 CB 4F                                   bit     1, a
324B 20 20                                   jr      nz, loc_326D
324D 0E 00                                   ld      c, 0
324F 78                                      ld      a, b
3250 FE 01                                   cp      1
3252 28 0E                                   jr      z, loc_3262
3254 DB F3                                   in      a, (GPIO_C_ENABLE_REG)
3256 CB AF                                   res     5, a
3258 D3 F3                                   out     (GPIO_C_ENABLE_REG), a
325A DB F4                                   in      a, (GPIO_C_DATA_REG)
325C CB 8F                                   res     1, a
325E D3 F4                                   out     (GPIO_C_DATA_REG), a
3260 18 13                                   jr      loc_3275
3262                         ; ---------------------------------------------------------------------------
3262
3262                         loc_3262:                               ; CODE XREF: sub_322D+25j
3262 CD CA 31                                call    sub_31CA
3265 DB F4                                   in      a, (GPIO_C_DATA_REG)
3267 CB 87                                   res     0, a
3269 D3 F4                                   out     (GPIO_C_DATA_REG), a
326B 18 1D                                   jr      loc_328A
326D                         ; ---------------------------------------------------------------------------
326D
326D                         loc_326D:                               ; CODE XREF: sub_322D+1Ej
326D 0E 01                                   ld      c, 1
326F DB F4                                   in      a, (GPIO_C_DATA_REG)
3271 CB CF                                   set     1, a
3273 D3 F4                                   out     (GPIO_C_DATA_REG), a
3275
3275                         loc_3275:                               ; CODE XREF: sub_322D+33j
3275 DB F3                                   in      a, (GPIO_C_ENABLE_REG)
3277 CB CF                                   set     1, a
3279 D3 F3                                   out     (GPIO_C_ENABLE_REG), a
327B CD CA 31                                call    sub_31CA
327E DB F4                                   in      a, (GPIO_C_DATA_REG)
3280 CB 87                                   res     0, a
3282 D3 F4                                   out     (GPIO_C_DATA_REG), a
3284 DB F4                                   in      a, (GPIO_C_DATA_REG)
3286 CB 8F                                   res     1, a
3288 D3 F4                                   out     (GPIO_C_DATA_REG), a
328A
328A                         loc_328A:                               ; CODE XREF: sub_322D+3Ej
328A 79                                      ld      a, c
328B C1                                      pop     bc
328C C9                                      ret
328C                         ; End of function sub_322D
328C
328D
328D                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
328D
328D
328D                         sub_328D:                               ; CODE XREF: sub_322D+2p
328D C5                                      push    bc
328E 06 08                                   ld      b, 8
3290
3290                         loc_3290:                               ; CODE XREF: sub_328D+27j
3290 CB 21                                   sla     c
3292 38 08                                   jr      c, loc_329C
3294 DB F4                                   in      a, (GPIO_C_DATA_REG)
3296 CB 8F                                   res     1, a
3298 D3 F4                                   out     (GPIO_C_DATA_REG), a
329A 18 06                                   jr      loc_32A2
329C                         ; ---------------------------------------------------------------------------
329C
329C                         loc_329C:                               ; CODE XREF: sub_328D+5j
329C DB F4                                   in      a, (GPIO_C_DATA_REG)
329E CB CF                                   set     1, a
32A0 D3 F4                                   out     (GPIO_C_DATA_REG), a
32A2
32A2                         loc_32A2:                               ; CODE XREF: sub_328D+Dj
32A2 CD CA 31                                call    sub_31CA
32A5 DB F4                                   in      a, (GPIO_C_DATA_REG)
32A7 CB C7                                   set     0, a
32A9 D3 F4                                   out     (GPIO_C_DATA_REG), a
32AB CD CA 31                                call    sub_31CA
32AE DB F4                                   in      a, (GPIO_C_DATA_REG)
32B0 CB 87                                   res     0, a
32B2 D3 F4                                   out     (GPIO_C_DATA_REG), a
32B4 10 DA                                   djnz    loc_3290
32B6 C1                                      pop     bc
32B7 C9                                      ret
32B7                         ; End of function sub_328D
32B7
32B7                         ; ---------------------------------------------------------------------------
32B8 00                      byte_32B8:      db 0
32B9 80                                      db  80h,0,0,0,0
32BE 00                      byte_32BE:      db 0
32BF 00                      byte_32BF:      db 0


32C0                        BOOTLOGO:        include "bootlogo.inc"           ;32C0: 512 bytes


34C0 00                      byte_34C0:      db 0
34C1 00                      byte_34C1:      db 0
34C2 00                                      db    0
34C3 00                      byte_34C3:      db 0
34C4 00                      byte_34C4:      db 0
34C5 04                      byte_34C5:      db 4

34C6 62                                      db  62h ; b
34C7 92                                      db  92h ; Æ
34C8 92                                      db  92h ; Æ
34C9 92                                      db  92h ; Æ
34CA 8C                                      db  8Ch ; î
34CB 00                                      db    0
34CC 20                                      db  20h
34CD FC                                      db 0FCh ; n
34CE 22                                      db  22h ; "
34CF 02                                      db    2
34D0 04                                      db    4
34D1 00                                      db    0
34D2 04                                      db    4
34D3 2A                                      db  2Ah ; *
34D4 2A                                      db  2Ah ; *
34D5 2A                                      db  2Ah ; *
34D6 1E                                      db  1Eh
34D7 00                                      db    0
34D8 3E                                      db  3Eh ; >
34D9 10                                      db  10h
34DA 20                                      db  20h
34DB 20                                      db  20h
34DC 10                                      db  10h
34DD 00                                      db    0
34DE 20                                      db  20h
34DF FC                                      db 0FCh ; n
34E0 22                                      db  22h ; "
34E1 02                                      db    2
34E2 04                                      db    4
34E3 00                                      db    0
34E4 00                                      db    0
34E5 22                                      db  22h ; "
34E6 BE                                      db 0BEh ; +
34E7 02                                      db    2
34E8 00                                      db    0
34E9 00                                      db    0
34EA 3E                                      db  3Eh ; >
34EB 10                                      db  10h
34EC 20                                      db  20h
34ED 20                                      db  20h
34EE 1E                                      db  1Eh
34EF 00                                      db    0
34F0 30                                      db  30h ; 0
34F1 4A                                      db  4Ah ; J
34F2 4A                                      db  4Ah ; J
34F3 4A                                      db  4Ah ; J
34F4 7C                                      db  7Ch ; |
34F5 00                                      db    0
34F6 00                                      db    0
34F7 06                                      db    6
34F8 06                                      db    6
34F9 00                                      db    0
34FA 00                                      db    0
34FB 00                                      db    0
34FC 00                                      db    0
34FD 06                                      db    6
34FE 06                                      db    6
34FF 00                                      db    0
3500 00                                      db    0
3501 00                                      db    0
3502 00                                      db    0
3503 06                                      db    6
3504 06                                      db    6
3505 00                                      db    251 dup(0)

3600 76                                      db  0480h dup(?)

3A80 00 00                   word_3A80:      dw 0
3A82 00 00                   word_3A82:      dw 0
3A84 00 00                   word_3A84:      dw 0
3A86 00 08                   word_3A86:      dw 800h
3A88 76 76                   word_3A88:      dw ?
3A8A 76 76                   word_3A8A:      dw ?
3A8C 76                      byte_3A8C:      db ?
3A8D 76                                      db  ?,?,?
3A90 C9                                      db 0C9h ; +
3A91 C9                                      db 0C9h ; +
3A92
3A92                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3A92
3A92
3A92                         sub_3A92:                               ; CODE XREF: sub_3F25j
3A92 E5                                      push    hl
3A93 D5                                      push    de
3A94 C5                                      push    bc
3A95 CD A7 3A                                call    sub_3AA7
3A98 A7                                      and     a
3A99 28 05                                   jr      z, loc_3AA0
3A9B CD 21 3D                                call    sub_3D21
3A9E 3E 01                                   ld      a, 1
3AA0
3AA0                         loc_3AA0:                               ; CODE XREF: sub_3A92+7j
3AA0 CD 4E 3F                                call    nand_deinit
3AA3 C1                                      pop     bc
3AA4 D1                                      pop     de
3AA5 E1                                      pop     hl
3AA6 C9                                      ret
3AA6                         ; End of function sub_3A92
3AA6
3AA7
3AA7                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3AA7
3AA7
3AA7                         sub_3AA7:                               ; CODE XREF: sub_3A92+3p
3AA7 C5                                      push    bc
3AA8 06 01                                   ld      b, 1
3AAA CD 2A 3F                                call    nand_init
3AAD 21 80 3A                                ld      hl, 3A80h
3AB0 EB                                      ex      de, hl
3AB1 01 08 00                                ld      bc, 8
3AB4 ED B0                                   ldir
3AB6 3A 81 3A                                ld      a, (word_3A80+1)
3AB9 47                                      ld      b, a
3ABA E6 07                                   and     7
3ABC 32 81 3A                                ld      (word_3A80+1), a
3ABF 78                                      ld      a, b
3AC0 2A 82 3A                                ld      hl, (word_3A82)
3AC3 CB 3C                                   srl     h
3AC5 CB 1D                                   rr      l
3AC7 1F                                      rra
3AC8 F5                                      push    af
3AC9 11 30 00                                ld      de, 30h ; '0'
3ACC EB                                      ex      de, hl
3ACD AF                                      xor     a
3ACE ED 52                                   sbc     hl, de
3AD0 38 38                                   jr      c, loc_3B0A
3AD2 EB                                      ex      de, hl
3AD3 29                                      add     hl, hl
3AD4 3E 07                                   ld      a, 7
3AD6 A4                                      and     h
3AD7 22 88 3A                                ld      (word_3A88), hl
3ADA 32 89 3A                                ld      (word_3A88+1), a
3ADD CB 3C                                   srl     h
3ADF CB 3C                                   srl     h
3AE1 CB 3C                                   srl     h
3AE3 3A 8A 3A                                ld      a, (word_3A8A)
3AE6 E6 E0                                   and     0E0h ; 'a'
3AE8 B4                                      or      h
3AE9 32 8A 3A                                ld      (word_3A8A), a
3AEC 21 88 3A                                ld      hl, 3A88h
3AEF CD D0 3E                                call    sub_3ED0
3AF2 F1                                      pop     af
3AF3 CB 3C                                   srl     h
3AF5 CB 1D                                   rr      l
3AF7 1F                                      rra
3AF8 CB 3C                                   srl     h
3AFA CB 1D                                   rr      l
3AFC 1F                                      rra
3AFD 32 82 3A                                ld      (word_3A82), a
3B00 22 83 3A                                ld      (word_3A82+1), hl
3B03 21 80 3A                                ld      hl, 3A80h
3B06 3E 01                                   ld      a, 1
3B08 C1                                      pop     bc
3B09 C9                                      ret
3B0A                         ; ---------------------------------------------------------------------------
3B0A
3B0A                         loc_3B0A:                               ; CODE XREF: sub_3AA7+29j
3B0A F1                                      pop     af
3B0B 3E 00                                   ld      a, 0
3B0D C1                                      pop     bc
3B0E C9                                      ret
3B0E                         ; End of function sub_3AA7
3B0E
3B0F
3B0F                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3B0F
3B0F
3B0F                         sub_3B0F:                               ; CODE XREF: sub_8FF+12p
3B0F                                                                 ; sub_9B9+2Ep ...
3B0F C5                                      push    bc
3B10 01 00 02                                ld      bc, 200h
3B13 CD 21 3D                                call    sub_3D21
3B16 C1                                      pop     bc
3B17 C9                                      ret
3B17                         ; End of function sub_3B0F
3B17



3B17                         ; ---------------------------------------------------------------------------
3B18 00                                      db    0
3B19 00                                      db    0
3B1A 00                                      db    0
3B1B 00                                      db    0
3B1C 00                                      db    0
3B1D 20                                      db  20h
3B1E 3B                                      db  3Bh ; ;
3B1F 08                                      db    8

3B20 76                                      db  200h dup(?)

3D20 00                      byte_3D20:      db 0


3D21
3D21                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3D21
3D21
3D21                         sub_3D21:                               ; CODE XREF: sub_3A92+9p
3D21                                                                 ; sub_3B0F+4p ...
3D21 78                                      ld      a, b
3D22 FE 02                                   cp      2               ; dma transfer or copy?
3D24 C2 2C 3D                                jp      nz, loc_3D2C

3D27 CD 86 3D                                call    sub_3D86        ; use dma transfer
3D2A AF                                      xor     a
3D2B C9                                      ret
3D2C
3D2C                         loc_3D2C:                               ; copy memory
3D2C C5                                      push    bc
3D2D E5                                      push    hl
3D2E DB 02                                   in      a, (EM_PAGE_HI_REG)
3D30 57                                      ld      d, a
3D31 3A 20 3D                                ld      a, (byte_3D20)
3D34 BA                                      cp      d
3D35 20 1C                                   jr      nz, loc_3D53
3D37 23                                      inc     hl
3D38 11 19 3B                                ld      de, 3B19h
3D3B 1A                                      ld      a, (de)
3D3C AE                                      xor     (hl)
3D3D E6 06                                   and     6
3D3F 20 12                                   jr      nz, loc_3D53
3D41 23                                      inc     hl
3D42 13                                      inc     de
3D43 1A                                      ld      a, (de)
3D44 BE                                      cp      (hl)
3D45 20 0C                                   jr      nz, loc_3D53
3D47 23                                      inc     hl
3D48 13                                      inc     de
3D49 1A                                      ld      a, (de)
3D4A BE                                      cp      (hl)
3D4B 20 06                                   jr      nz, loc_3D53
3D4D 23                                      inc     hl
3D4E 13                                      inc     de
3D4F 1A                                      ld      a, (de)
3D50 BE                                      cp      (hl)
3D51 28 1C                                   jr      z, loc_3D6F
3D53
3D53                         loc_3D53:                               ; CODE XREF: sub_3D21+14j
3D53                                                                 ; sub_3D21+1Ej ...
3D53 E1                                      pop     hl
3D54 E5                                      push    hl
3D55 23                                      inc     hl
3D56 11 19 3B                                ld      de, 3B19h
3D59 7E                                      ld      a, (hl)
3D5A E6 06                                   and     6
3D5C 12                                      ld      (de), a
3D5D 23                                      inc     hl
3D5E 13                                      inc     de
3D5F 01 03 00                                ld      bc, 3
3D62 ED B0                                   ldir
3D64 21 18 3B                                ld      hl, 3B18h
3D67 CD 86 3D                                call    sub_3D86
3D6A DB 02                                   in      a, (EM_PAGE_HI_REG)
3D6C 32 20 3D                                ld      (byte_3D20), a
3D6F
3D6F                         loc_3D6F:                               ; CODE XREF: sub_3D21+30j
3D6F E1                                      pop     hl
3D70 4E                                      ld      c, (hl)
3D71 23                                      inc     hl
3D72 7E                                      ld      a, (hl)
3D73 E6 01                                   and     1
3D75 47                                      ld      b, a
3D76 23                                      inc     hl
3D77 23                                      inc     hl
3D78 23                                      inc     hl
3D79 23                                      inc     hl
3D7A 5E                                      ld      e, (hl)
3D7B 23                                      inc     hl
3D7C 56                                      ld      d, (hl)
3D7D 21 20 3B                                ld      hl, 3B20h
3D80 09                                      add     hl, bc
3D81 C1                                      pop     bc
3D82 ED B0                                   ldir
3D84 AF                                      xor     a
3D85 C9                                      ret
3D85                         ; End of function sub_3D21
3D85
3D86
3D86                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦

3D86                         ; .................. DMA TRANSFER ..................
                             ; from flash (selected by EM_PAGE_HI_REG) addr 0 to (hl+2..0)

3D86
3D86                         sub_3D86:                               ; CODE XREF: sub_3D21+6p
3D86                                                                 ; sub_3D21+46p
3D86 DB 05                                   in      a, (MROM_PAGE_REG)
3D88 F5                                      push    af
3D89 E5                                      push    hl
3D8A 06 00                                   ld      b, 0
3D8C CD 7C 3F                                call    sub_3F7C

3D8F 3E 30                                   ld      a, 30h               ; unknown samsung command !!!
3D91 D3 2A                                   out     (SNAN_CMD_REG), a

3D93 06 C0                                   ld      b, 0C0h              ; delay
3D95 DB 70                                   in      a, (B1_MEMMAP_REG)
3D97 CB 5F                                   bit     3, a
3D99 28 02                                   jr      z, loc_3D9D
3D9B 06 00                                   ld      b, 0
3D9D                         loc_3D9D:       djnz    $

3D9F 3E 10                                   ld      a, 10h
3DA1 D3 CC                                   out     (NAND_ECCCTRL_REG), a
3DA3 AF                                      xor     a
3DA4 D3 07                                   out     (DMA1_SRCADDR1_REG), a
3DA6 D3 08                                   out     (DMA1_SRCADDR2_REG), a
3DA8 DB 02                                   in      a, (EM_PAGE_HI_REG)
3DAA E6 38                                   and     38h
3DAC CB 3F                                   srl     a
3DAE CB FF                                   set     7, a
3DB0 57                                      ld      d, a
3DB1 D3 09                                   out     (DMA1_SRCADDR3_REG), a

3DB3 7E                                      ld      a, (hl)
3DB4 D3 0B                                   out     (DMA1_DSTADDR0_REG), a
3DB6 23                                      inc     hl
3DB7 7E                                      ld      a, (hl)
3DB8 4F                                      ld      c, a
3DB9 D3 0C                                   out     (DMA1_DSTADDR1_REG), a
3DBB 23                                      inc     hl
3DBC AF                                      xor     a
3DBD 56                                      ld      d, (hl)
3DBE CB 5A                                   bit     3, d
3DC0 20 24                                   jr      nz, loc_3DE6
3DC2 CB 52                                   bit     2, d
3DC4 28 11                                   jr      z, loc_3DD7
3DC6 7A                                      ld      a, d
3DC7 FE 07                                   cp      7
3DC9 28 16                                   jr      z, loc_3DE1
3DCB CB 69                                   bit     5, c
3DCD 20 04                                   jr      nz, loc_3DD3
3DCF 3E 20                                   ld      a, 20h
3DD1 18 0E                                   jr      loc_3DE1
3DD3                         loc_3DD3:                               ; CODE XREF: sub_3D86+47j
3DD3 3E 10                                   ld      a, 10h
3DD5 18 0A                                   jr      loc_3DE1
3DD7                         loc_3DD7:                               ; CODE XREF: sub_3D86+3Ej
3DD7 CB 69                                   bit     5, c
3DD9 20 04                                   jr      nz, loc_3DDF
3DDB 3E 80                                   ld      a, 80h ; 'Ç'
3DDD 18 02                                   jr      loc_3DE1
3DDF                         loc_3DDF:                               ; CODE XREF: sub_3D86+53j
3DDF 3E 40                                   ld      a, 40h ; '@'
3DE1                         loc_3DE1:                               ; CODE XREF: sub_3D86+43j
3DE1 B2                                      or      d
3DE2 D3 05                                   out     (MROM_PAGE_REG), a
3DE4 3E 40                                   ld      a, 40h          ; transfer to internal ram
3DE6                         loc_3DE6:                               ; CODE XREF: sub_3D86+3Aj
3DE6 D3 0E                                   out     (DMA1_DSTADDR3_REG), a

3DE8 7A                                      ld      a, d
3DE9 D3 0F                                   out     (DMA1_DSTADDR4_REG), a

3DEB 3E 03                                   ld      a, 3
3DED 0F                                      rrca
3DEE 0F                                      rrca
3DEF D3 12                                   out     (DMA1_MODE_REG), a       ; a = 0C0h
3DF1 3E FF                                   ld      a, 0FFh                  ; size = 0x1FF bytes
3DF3 D3 10                                   out     (DMA1_CNTR_LO_REG), a
3DF5 3E 01                                   ld      a, 1
3DF7 D3 11                                   out     (DMA1_CNTR_HI_REG), a
3DF9 D3 13                                   out     (DMA1_COMMAND_REG), a    ; start transfer

3DFB E1                                      pop     hl
3DFC E5                                      push    hl
3DFD 23                                      inc     hl
3DFE 7E                                      ld      a, (hl)
3DFF 87                                      add     a, a
3E00 C6 04                                   add     a, 4
3E02 4F                                      ld      c, a
3E03 3E 01                                   ld      a, 1
3E05 D3 01                                   out     (EM_PAGE_LO_REG), a
3E07 16 81                                   ld      d, 81h ; 'ü'
3E09 3E 05                                   ld      a, 5
3E0B 12                                      ld      (de), a
3E0C 3E 02                                   ld      a, 2
3E0E D3 01                                   out     (EM_PAGE_LO_REG), a
3E10 06 08                                   ld      b, 8
3E12 ED 43 23 81                             ld      (8123h), bc
3E16 3E 01                                   ld      a, 1
3E18 D3 01                                   out     (EM_PAGE_LO_REG), a
3E1A 3E E0                                   ld      a, 0E0h ; 'a'
3E1C 12                                      ld      (de), a
3E1D AF                                      xor     a
3E1E D3 01                                   out     (EM_PAGE_LO_REG), a
3E20 ED 4B 23 81                             ld      bc, (8123h)
3E24 ED 5B 23 81                             ld      de, (8123h)
3E28
3E28                         loc_3E28:                               ; CODE XREF: sub_3D86+A6j
3E28 DB CC                                   in      a, (NAND_ECCCTRL_REG)
3E2A CB 67                                   bit     4, a
3E2C 20 FA                                   jr      nz, loc_3E28
3E2E A8                                      xor     b
3E2F 47                                      ld      b, a
3E30 DB CD                                   in      a, (NAND_ECC_REG0)
3E32 A9                                      xor     c
3E33 4F                                      ld      c, a
3E34 DB CE                                   in      a, (NAND_ECC_REG1)
3E36 AA                                      xor     d
3E37 67                                      ld      h, a
3E38 DB CF                                   in      a, (NAND_ECC_REG2)
3E3A AB                                      xor     e
3E3B 6F                                      ld      l, a
3E3C B1                                      or      c
3E3D 20 06                                   jr      nz, loc_3E45
3E3F 78                                      ld      a, b
3E40 B4                                      or      h
3E41 E6 E1                                   and     0E1h ; 'ß'
3E43 28 24                                   jr      z, loc_3E69
3E45
3E45                         loc_3E45:                               ; CODE XREF: sub_3D86+B7j
3E45 13                                      inc     de
3E46 7A                                      ld      a, d
3E47 B3                                      or      e
3E48 28 1F                                   jr      z, loc_3E69
3E4A 79                                      ld      a, c
3E4B AD                                      xor     l
3E4C 6F                                      ld      l, a
3E4D 78                                      ld      a, b
3E4E AC                                      xor     h
3E4F F6 1E                                   or      1Eh
3E51 A5                                      and     l
3E52 3C                                      inc     a
3E53 20 14                                   jr      nz, loc_3E69
3E55 E3                                      ex      (sp), hl
3E56 11 05 00                                ld      de, 5
3E59 19                                      add     hl, de
3E5A 5E                                      ld      e, (hl)
3E5B 23                                      inc     hl
3E5C 56                                      ld      d, (hl)
3E5D 23                                      inc     hl
3E5E 7E                                      ld      a, (hl)
3E5F FE 08                                   cp      8
3E61 28 02                                   jr      z, loc_3E65
3E63 CB F2                                   set     6, d
3E65
3E65                         loc_3E65:                               ; CODE XREF: sub_3D86+DBj
3E65 EB                                      ex      de, hl
3E66 CD 6F 3E                                call    sub_3E6F
3E69
3E69                         loc_3E69:                               ; CODE XREF: sub_3D86+BDj
3E69                                                                 ; sub_3D86+C2j ...
3E69 E1                                      pop     hl
3E6A F1                                      pop     af
3E6B D3 05                                   out     (MROM_PAGE_REG), a
3E6D AF                                      xor     a
3E6E C9                                      ret
3E6E                         ; End of function sub_3D86
3E6E
3E6F
3E6F                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3E6F
3E6F
3E6F                         sub_3E6F:                               ; CODE XREF: sub_3D86+E0p
3E6F C5                                      push    bc
3E70 78                                      ld      a, b
3E71 E6 01                                   and     1
3E73 47                                      ld      b, a
3E74 09                                      add     hl, bc
3E75 F1                                      pop     af
3E76 E6 E0                                   and     0E0h ; 'a'
3E78 17                                      rla
3E79 17                                      rla
3E7A 17                                      rla
3E7B 17                                      rla
3E7C 3C                                      inc     a
3E7D 47                                      ld      b, a
3E7E 3E 80                                   ld      a, 80h ; 'Ç'
3E80
3E80                         loc_3E80:                               ; CODE XREF: sub_3E6F+13j
3E80 CB 07                                   rlc     a
3E82 10 FC                                   djnz    loc_3E80
3E84 AE                                      xor     (hl)
3E85 77                                      ld      (hl), a
3E86 C9                                      ret
3E86                         ; End of function sub_3E6F
3E86
3E86                         ; ---------------------------------------------------------------------------
3E87 00                      byte_3E87:      db 0
3E88 00                      byte_3E88:      db 0
3E89 00                      byte_3E89:      db 0
3E8A 00                                      db    0
3E8B 00                                      db    0
3E8C 8F                                      db  8Fh ; Å
3E8D 3E                                      db  3Eh ; >
3E8E 08                                      db    8

3E8F 76                                      db  40h dup(?)
3ECF 00                      byte_3ECF:      db 0


3ED0
3ED0                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3ED0
3ED0
3ED0                         sub_3ED0:                               ; CODE XREF: sub_3D7+1Ep
3ED0                                                                 ; sub_96D+1Cp ...
3ED0 E5                                      push    hl
3ED1 DB 02                                   in      a, (EM_PAGE_HI_REG)
3ED3 47                                      ld      b, a
3ED4 3A CF 3E                                ld      a, (byte_3ECF)
3ED7 B8                                      cp      b
3ED8 20 16                                   jr      nz, loc_3EF0
3EDA 3A 87 3E                                ld      a, (byte_3E87)
3EDD AE                                      xor     (hl)
3EDE E6 C0                                   and     0C0h ; '+'
3EE0 20 0E                                   jr      nz, loc_3EF0
3EE2 23                                      inc     hl
3EE3 3A 88 3E                                ld      a, (byte_3E88)
3EE6 BE                                      cp      (hl)
3EE7 20 07                                   jr      nz, loc_3EF0
3EE9 23                                      inc     hl
3EEA 3A 89 3E                                ld      a, (byte_3E89)
3EED AE                                      xor     (hl)
3EEE 28 1B                                   jr      z, loc_3F0B
3EF0
3EF0                         loc_3EF0:                               ; CODE XREF: sub_3ED0+8j
3EF0                                                                 ; sub_3ED0+10j ...
3EF0 E1                                      pop     hl
3EF1 E5                                      push    hl
3EF2 01 04 00                                ld      bc, 4
3EF5 09                                      add     hl, bc
3EF6 11 8B 3E                                ld      de, 3E8Bh
3EF9 ED B8                                   lddr
3EFB 7E                                      ld      a, (hl)
3EFC E6 C0                                   and     0C0h ; '+'
3EFE 12                                      ld      (de), a
3EFF EB                                      ex      de, hl
3F00 01 40 00                                ld      bc, 40h ; '@'
3F03 CD 21 3D                                call    sub_3D21
3F06 DB 02                                   in      a, (EM_PAGE_HI_REG)
3F08 32 CF 3E                                ld      (byte_3ECF), a
3F0B
3F0B                         loc_3F0B:                               ; CODE XREF: sub_3ED0+1Ej
3F0B E1                                      pop     hl
3F0C 7E                                      ld      a, (hl)
3F0D 21 8F 3E                                ld      hl, 3E8Fh
3F10 E6 3F                                   and     3Fh ; '?'
3F12 5F                                      ld      e, a
3F13 16 00                                   ld      d, 0
3F15 19                                      add     hl, de
3F16 5E                                      ld      e, (hl)
3F17 23                                      inc     hl
3F18 56                                      ld      d, (hl)
3F19 EB                                      ex      de, hl
3F1A C9                                      ret
3F1A                         ; End of function sub_3ED0
3F1A
3F1A                         ; ---------------------------------------------------------------------------
3F1B 76                                      db  ?
3F1C 76                                      db  ?
3F1D 76                                      db  ?
3F1E 76                                      db  ?
3F1F C3                                      db 0C3h ; +
3F20 21                                      db  21h ; !
3F21 3D                                      db  3Dh ; =
3F22 C3                                      db 0C3h ; +
3F23 D0                                      db 0D0h ; -
3F24 3E                                      db  3Eh ; >
3F25
3F25                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3F25                         sub_3F25:       jp      sub_3A92
3F25





3F25                         ; ---------------------------------------------------------------------------
3F28 00                      em_page_lo_bak:      db 0
3F29 00                      em_page_hi_bak:      db 0

3F2A                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3F2A                         ; input: b = CEx (chip enable line/signal)
3F2A                         nand_init       PROC
3F2A F3                                      di                              ; disable interrupts
3F2B E5                                      push    hl                      ; inc init cntr
3F2C 21 37 00                                ld      hl, 37h
3F2F 34                                      inc     (hl)
3F30 E1                                      pop     hl

3F31 DB 01                                   in      a, (EM_PAGE_LO_REG)     ; store values
3F33 32 28 3F                                ld      (em_page_lo_bak), a
3F36 DB 02                                   in      a, (EM_PAGE_HI_REG)
3F38 32 29 3F                                ld      (em_page_hi_bak), a

3F3B AF                                      xor     a
3F3C D3 01                                   out     (EM_PAGE_LO_REG), a
3F3E 78                                      ld      a, b
3F3F 87                                      add     a, a
3F40 87                                      add     a, a
3F41 87                                      add     a, a
3F42 D3 02                                   out     (EM_PAGE_HI_REG), a

3F44 3E 01                                   ld      a, 1                   ; init nand
3F46 D3 29                                   out     (SNAN_CEMODE_REG), a
3F48 87                      loc_3F48:       add     a, a
3F49 10 FD                                   djnz    loc_3F48
3F4B D3 28                                   out     (NAND_ENABLE_REG), a   ; =0
3F4D C9                                      ret
                             nand_init       ENDP

3F4E                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3F4E                         nand_deinit     PROC
3F4E F5                                      push    af

3F4F 3E 37                                   ld      a, SNAN_CMD_NOP        ; disable nand csm
3F51 D3 2A                                   out     (SNAN_CMD_REG), a

3F53 AF                                      xor     a                      ; deinit nand
3F54 D3 28                                   out     (NAND_ENABLE_REG), a
3F56 D3 29                                   out     (SNAN_CEMODE_REG), a

3F58 3A 28 3F                                ld      a, (em_page_lo_bak)
3F5B D3 01                                   out     (EM_PAGE_LO_REG), a
3F5D 3A 29 3F                                ld      a, (em_page_hi_bak)
3F60 D3 02                                   out     (EM_PAGE_HI_REG), a

3F62 E5                                      push    hl                     ; dec init cntr
3F63 21 37 00                                ld      hl, 37h
3F66 35                                      dec     (hl)
3F67 E1                                      pop     hl
3F68 20 01                                   jr      nz, loc_3F6B           ; if it was our last instance
3F6A FB                                      ei                             ; enable interrupts
3F6B                         loc_3F6B:
3F6B F1                                      pop     af
3F6C C9                                      ret
                             nand_deinit     ENDP



3F6C                         ; ---------------------------------------------------------------------------
3F6D CD                                      db 0CDh ; -
3F6E 89                                      db  89h ; ë
3F6F 3F                                      db  3Fh ; ?
3F70 18                                      db  18h
3F71 13                                      db  13h
3F72
3F72                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3F72
3F72
3F72                         sub_3F72:                               ; CODE XREF: sub_2563+2p
3F72 CD 89 3F                                call    sub_3F89
3F75 18 0C                                   jr      loc_3F83
3F75                         ; End of function sub_3F72
3F75
3F75                         ; ---------------------------------------------------------------------------
3F77 CD                                      db 0CDh ; -
3F78 89                                      db  89h ; ë
3F79 3F                                      db  3Fh ; ?
3F7A 18                                      db  18h
3F7B 05                                      db    5
3F7C
3F7C                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3F7C
3F7C
3F7C                         sub_3F7C:                               ; CODE XREF: sub_2570+Bp
3F7C                                                                 ; sub_2570+25p ...
3F7C CD 89 3F                                call    sub_3F89
3F7F ED A0                                   ldi
3F81 ED A0                                   ldi
3F83
3F83                         loc_3F83:                               ; CODE XREF: sub_3F72+3j
3F83 ED A0                                   ldi
3F85 AF                                      xor     a
3F86 D3 01                                   out     (EM_PAGE_LO_REG), a
3F88 C9                                      ret
3F88                         ; End of function sub_3F7C
3F88
3F89
3F89                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
3F89
3F89
3F89                         sub_3F89:                               ; CODE XREF: sub_3F72p
3F89                                                                 ; sub_3F7Cp
3F89 16 80                                   ld      d, 80h ; 'Ç'
3F8B 3E 70                                   ld      a, 70h ; 'p'
3F8D D3 2A                                   out     (SNAN_CMD_REG), a
3F8F AF                                      xor     a
3F90 D3 01                                   out     (EM_PAGE_LO_REG), a
3F92 3C                                      inc     a
3F93 D3 01                                   out     (EM_PAGE_LO_REG), a
3F95 78                                      ld      a, b
3F96 12                                      ld      (de), a
3F97 3E 02                                   ld      a, 2
3F99 D3 01                                   out     (EM_PAGE_LO_REG), a
3F9B ED A0                                   ldi
3F9D ED A0                                   ldi
3F9F C9                                      ret
3F9F                         ; End of function sub_3F89
3F9F




3FA0                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
                             ; return a = 0, 2, 3 (error)
3FA0                         nand_read_status PROC
3FA0 D5                                      push    de

3FA1 3E 60                                   ld      a, 60h           ; delay
3FA3                         loc_3FA3:       dec     a
3FA4 20 FD                                   jr      nz, loc_3FA3

3FA6 3E 70                                   ld      a, SNAN_CMD_READ_STATE   ; read status from nand
3FA8 D3 2A                                   out     (SNAN_CMD_REG), a

3FAA 57                                      ld      d, a
3FAB                         loc_3FAB:       ld      a, (8002h)         ; = ?
3FAE CB 77                                   bit     6, a
3FB0 20 11                                   jr      nz, loc_3FC3       ; if bit 6 != 0 then device is ready (and not busy)
3FB2 1B                                      dec     de
3FB3 7A                                      ld      a, d
3FB4 B3                                      or      e
3FB5 20 F4                                   jr      nz, loc_3FAB       ; loop
3FB7
3FB7                         loc_3FB7:       ld      a, SNAN_CMD_RESET
3FB9 D3 2A                                   out     (SNAN_CMD_REG), a
3FBB 3E 03                                   ld      a, 3               ; return 3
3FBD 18 0F                                   jr      loc_3FCE
3FBF                         ; ---------------------------------------------------------------------------
3FBF                         loc_3FBF:       ld      a, 2               ; return 2
3FC1 18 0B                                   jr      loc_3FCE
3FC3                         ; ---------------------------------------------------------------------------
3FC3                         loc_3FC3:       ld      a, (8123h)         ; = ?
3FC6 CB 47                                   bit     0, a
3FC8 20 ED                                   jr      nz, loc_3FB7       ; if bit 0 != 0 then return 3 (device had error)
3FCA 17                                      rla
3FCB 30 F2                                   jr      nc, loc_3FBF       ; if bit 7 == 0 then return 2 (=write protected)
3FCD AF                                      xor     a                  ; return 0
3FCE
3FCE                         loc_3FCE:       pop     de
3FCF C9                                      ret
3FCF                         nand_read_status ENDP




3FD0                         ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
                             ; return a = 0,2,3
3FD0                         sub_3FD0        PROC
3FD0 3E FF                                   ld      a, SNAN_CMD_RESET    ; reset nand
3FD2 D3 2A                                   out     (SNAN_CMD_REG), a

3FD4 CD A0 3F                                call    nand_read_status

3FD7 F5                                      push    af                   ; disable nand csm (dont touch a)
3FD8 3E 37                                   ld      a, SNAN_CMD_NOP
3FDA D3 2A                                   out     (SNAN_CMD_REG), a
3FDC F1                                      pop     af

3FDD C9                                      ret
3FDD                         sub_3FD0        ENDP




3FDD                         ; ---------------------------------------------------------------------------
3FDE 76                                      db  ?
3FDF 76                                      db  ?
3FE0 00                                      db   22 dup(0)
3FF6 01                                      db    1,0,1,0,1,0
3FFC AA                                      db 0AAh
3FFD 55                                      db  55h
3FFE 20                                      db  20h
3FFF FA                                      db 0FAh
3FFF                         ; end of 'ROM'
3FFF
3FFF
3FFF                                         end

