Keypad reading on the WonderSwan requires being mindful of two things: * signals take a little bit of time to stabilize after enabling a specific input row, and * having to read each input row separately Here is an example routine which reads and combines keypad data into the register CX, albeit with the contents of AL being destroyed (clobbered) as part of the operation.
    ; read the first input row into bits 8-11
	mov	al, 0x10
	out	0xB5, al
    ; as the DAA opcode lasts 10 cycles, it is used here as a delay to allow keypad output signals to settle
	daa
	in	al, 0xB5
	and	al, 0x0F
	mov	ch, al

    ; read the second input row into bits 4-7
	mov	al, 0x20
	out	0xB5, al
	daa
	in	al, 0xB5
	shl	al, 4
	mov	cl, al

    ; read the third input row into bits 0-3
	mov	al, 0x40
	out	0xB5, al
	daa
	in	al, 0xB5
	and	al, 0x0F
	or	cl, al

    ; the full keypad readout is now in CX
To save a few bytes, one can also reserve DX by replacing in/out 0xB5 with in/out dx and setting DX to 0xB5.