// File: rockytriton[P]dreamsys_emu_gb/src/io.cpp
// Function: dsemu::io::init()
void init() {
    IO_WRITE_HANDLER noWrite = [](byte b) -> void { };

    handlerMap[0xFF43] = std::make_pair(readScrollX, writeScrollX);
    handlerMap[0xFF42] = std::make_pair(ppu::getYScroll, ppu::setYScroll);
    handlerMap[0xFF40] = std::make_pair(readLCDControl, writeLCDControl);
    handlerMap[0xFF41] = std::make_pair(readLCDStats, writeLCDStats);
    handlerMap[0xFF44] = std::make_pair(ppu::getCurrentLine, noWrite);
    handlerMap[0xFF46] = std::make_pair(readDMS, writeDMA);

    ADD_MEMORY_HANDLER(0xFF45);
    ADD_MEMORY_HANDLER(0xFF47);
    ADD_MEMORY_HANDLER(0xFF48);
    ADD_MEMORY_HANDLER(0xFF49);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
leaq -0x9(%rbp), %rdi
callq 0x167c0
movq %rax, -0x8(%rbp)
leaq -0x12f(%rip), %rdi      # 0x16410
leaq -0x126(%rip), %rsi      # 0x16420
callq 0x17300
movq %rax, -0x20(%rbp)
movq %rdx, -0x18(%rbp)
movw $0xff43, -0x22(%rbp)    # imm = 0xFF43
leaq 0x19088(%rip), %rdi     # 0x2f5e8
leaq -0x22(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0x20(%rbp), %rsi
callq 0x17420
leaq 0xed4(%rip), %rdi       # 0x17450
leaq 0xedd(%rip), %rsi       # 0x17460
callq 0x17300
movq %rax, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
movw $0xff42, -0x3a(%rbp)    # imm = 0xFF42
leaq 0x1904b(%rip), %rdi     # 0x2f5e8
leaq -0x3a(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0x38(%rbp), %rsi
callq 0x17420
leaq -0x149(%rip), %rdi      # 0x16470
leaq -0x140(%rip), %rsi      # 0x16480
callq 0x17300
movq %rax, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
movw $0xff40, -0x52(%rbp)    # imm = 0xFF40
leaq 0x1900e(%rip), %rdi     # 0x2f5e8
leaq -0x52(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0x50(%rbp), %rsi
callq 0x17420
leaq -0x1b6(%rip), %rdi      # 0x16440
leaq -0x1ad(%rip), %rsi      # 0x16450
callq 0x17300
movq %rax, -0x68(%rbp)
movq %rdx, -0x60(%rbp)
movw $0xff41, -0x6a(%rbp)    # imm = 0xFF41
leaq 0x18fd1(%rip), %rdi     # 0x2f5e8
leaq -0x6a(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0x68(%rbp), %rsi
callq 0x17420
leaq 0xb71d(%rip), %rdi      # 0x21d50
leaq -0x8(%rbp), %rsi
callq 0x17480
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movw $0xff44, -0x82(%rbp)    # imm = 0xFF44
leaq 0x18f94(%rip), %rdi     # 0x2f5e8
leaq -0x82(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0x80(%rbp), %rsi
callq 0x17420
leaq -0x163(%rip), %rdi      # 0x16510
leaq -0x1da(%rip), %rsi      # 0x164a0
callq 0x17300
movq %rax, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
movw $0xff46, -0x9a(%rbp)    # imm = 0xFF46
leaq 0x18f4b(%rip), %rdi     # 0x2f5e8
leaq -0x9a(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0x98(%rbp), %rsi
callq 0x17420
leaq -0x9d(%rbp), %rdi
leaq -0x9e(%rbp), %rsi
callq 0x167e0
movw $0xff45, -0xa2(%rbp)    # imm = 0xFF45
leaq 0x18f0d(%rip), %rdi     # 0x2f5e8
leaq -0xa2(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0x9c(%rbp), %rsi
callq 0x16810
leaq -0xa5(%rbp), %rdi
leaq -0xa6(%rbp), %rsi
callq 0x16860
movw $0xff47, -0xaa(%rbp)    # imm = 0xFF47
leaq 0x18ecf(%rip), %rdi     # 0x2f5e8
leaq -0xaa(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0xa4(%rbp), %rsi
callq 0x16890
leaq -0xad(%rbp), %rdi
leaq -0xae(%rbp), %rsi
callq 0x168e0
movw $0xff48, -0xb2(%rbp)    # imm = 0xFF48
leaq 0x18e91(%rip), %rdi     # 0x2f5e8
leaq -0xb2(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0xac(%rbp), %rsi
callq 0x16910
leaq -0xb5(%rbp), %rdi
leaq -0xb6(%rbp), %rsi
callq 0x16960
movw $0xff49, -0xba(%rbp)    # imm = 0xFF49
leaq 0x18e53(%rip), %rdi     # 0x2f5e8
leaq -0xba(%rbp), %rsi
callq 0x17340
movq %rax, %rdi
leaq -0xb4(%rbp), %rsi
callq 0x16990
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)