Part B) Write an assembly program that:

- Load AL by an arbitrary number,
- Check whether it is an odd/even number,
- If it is an odd number, it will be converted to its next larger even number and will be shown in port 0 in the trainer kit.
- If it is an even number, it will be converted to its previous smaller odd number and will be shown in port 0 in the trainer kit.

Assuming the trainer kit has a switch connected to port 1 to input the arbitrary number and a 7-segment display connected to port 0 to output the converted number, the following is an example of an assembly program that fulfills the requirements:

ORG 0000h ; start at address 0000h

start:
MOV A, P1 ; load arbitrary number from port 1 to AL
ANL A, #1h ; check the least significant bit to see whether it is odd/even
JZ even_num ; jump to even_num if it is even (LSB=0)
INC A ; add 1 to odd number to get the next larger even number
JMP display ; jump to display the converted number

even_num:
DEC A ; subtract 1 from even number to get the previous smaller odd number

display:
MOV P0, A ; move the converted number to port 0 to display on the 7-segment display
SJMP $ ; loop indefinitely

END ; end of program

Here is an assembly program that performs the required steps:

1. Start by loading the arbitrary number into the AX register.
2. Perform a bitwise AND operation between AX and 1 to check if it is odd or even.
3. If the result is zero, it means the number is even. In this case, decrement the AX register by 1 to get the previous smaller odd number.
4. If the result is non-zero, it means the number is odd. In this case, add 2 to the AX register to get the next larger even number.
5. Finally, output the result in port 0 of the trainer kit.

Below is the assembly code:

```
MOV AX, <arbitrary_number> ; Replace <arbitrary_number> with the desired value

AND AL, 1 ; Perform bitwise AND operation with 1 to check if it's odd or even
CMP AL, 0 ; Check if the number is even

JE even ; If even, go to even label

odd: ; Label for odd numbers
ADD AX, 2 ; Add 2 to AX to get the next larger even number
JMP output ; Jump to the output label

even: ; Label for even numbers
DEC AX ; Decrement AX by 1 to get the previous smaller odd number

output: ; Common output label
MOV <port_address>, AX ; Replace <port_address> with the address of port 0

HLT ; Halt the program

```

Please note that you need to replace `<arbitrary_number>` with the desired number and `<port_address>` with the actual address of port 0 in your trainer kit.