Part B) Write a x86 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 input number is stored in the AL register, the following assembly code will check if it is even or odd, perform the necessary conversion and display the result in port 0:

mov bl, 1 ; store divisor in BL
and al, 1 ; check if LSB of AL is set (odd number)
jz even_no ; if not, jump to even number conversion
inc al ; increment AL by 1 to get next even number
out 0, al ; display result in port 0 (trainer kit)
jmp exit ; jump to end of program

even_no:sub al, 1 ; decrement AL by 1 to get previous odd number
out 0, al ; display result in port 0 (trainer kit)

exit: ret ; end of program

Note that the code uses the AND instruction to check if the least significant bit (LSB) of the AL register is set, which indicates an odd number. If the LSB is not set, the number is even and the program jumps to the corresponding conversion instructions. The INC and SUB instructions are used to change the number to the next even number or previous odd number, respectively. Finally, the OUT instruction sends the result to port 0 in the trainer kit.

Sure! Here's an x86 assembly program that accomplishes these steps:

```assembly
section .data
prompt_msg db 'Enter a number: ' ; Prompt message
odd_msg db 'Odd number: ' ; Message for odd numbers
even_msg db 'Even number: ' ; Message for even numbers

section .text
global _start

_start:
; Display prompt message
mov eax, 4
mov ebx, 1
mov ecx, prompt_msg
mov edx, 14
int 0x80

; Read input number
mov eax, 3
mov ebx, 0
mov ecx, number
mov edx, 1
int 0x80

; Check if number is odd or even
mov al, byte [number]
and al, 0x01 ; Mask out all bits except the least significant bit

cmp al, 0 ; Check if number is even
je even

odd:
; Convert odd number to next even number (add 1)
inc byte [number]

; Display the converted even number
mov eax, 4
mov ebx, 1
mov ecx, odd_msg
mov edx, 12
int 0x80

jmp exit

even:
; Convert even number to previous odd number (subtract 1)
dec byte [number]

; Display the converted odd number
mov eax, 4
mov ebx, 1
mov ecx, even_msg
mov edx, 13
int 0x80

exit:
; Display the converted number in port 0 of the trainer kit
mov eax, 3
mov ebx, 1
mov ecx, number
mov edx, 1
int 0x80

; Exit the program
mov eax, 1
xor ebx, ebx
int 0x80

section .bss
number resb 1 ; Variable to store the input number
```

Make sure you assemble and link this program using NASM and ld respectively before running it.