76
µPD750008 USER'S MANUAL
5.1.3 Digital I/O Port Manipulation Instructions
All I/O ports contained in the µPD750008 are mapped to data memory space, so that all data memory
manipulation instructions can be used. Table 5-3 lists the instructions that are particularly useful for I/O pin
manipulation and their application ranges.
(1) Bit manipulation instructions
For digital I/O ports PORT0 to PORT8, specific address bit direct addressing (fmem.bit) and specific
address bit register indirect addressing (pmem.@L) can be used. This means that bit manipulation can
be freely performed for these ports regardless of MBE and MBS settings.
Example P50 is ORed with P41, then the result is output to P61.
SET1 CY ; CY <– 1
AND1 CY,PORT5.0 ; CY <– CY P50
OR1 CY,PORT4.1 ; CY <– CY P41
SKT CY
BR CLRP
SET1 PORT6.1 ; P61 <– 1
.
.
.
CLRP : CLR1 PORT6.1 ; P61 <– 0
(2) 4-bit manipulation instructions
All 4-bit memory manipulation instructions including the IN, OUT, MOV, XCH, ADDS, and INCS
instructions can be used. However, before these instructions can be executed, memory bank 15 must
be selected.
Examples 1. The contents of the accumulator are output to port 3.
SEL MB15 ; or CLR1 MBE
OUT PORT3,A
2. The value of the accumulator is added to the data output on port 5, then the result is output.
SET1 MBE
SEL MB15
MOV HL,#PORT5
ADDS A,@HL ; A <– A+PORT5
NOP
MOV @HL,A ; PORT5 <– A
3. Whether the data on port 4 is greater than the value of the accumulator is tested.
SET1 MBE
SEL MB15
MOV HL,#PORT4
SUBS A,@HL ; A < PORT4
BR NO ; NO
; YES