===REGISTERS=== --------- =GENERAL PURPOSE= NAME USUAL USES AX accumulator BX pointer CX loop counter DX temporary storage BP pointer to base of stack frame SI Source of information pointer DI Destination of information pointer CS Prog segment being run =SPECIALIST (usuable as GP)= BP Base pointer (base address in stack segment) SP Stack pointer - cannot be used as an index =SPECIALIST (unusable as GP)= CS code segment used with IP, the instruction pointer to find the next m/c code instruction at CS:IP DS data segment SS stack segment stack Used with SP as SS:SP ES extra segment FS extra segment (not present in 8088-80286) GS extra segment (not present in 8088-80286) IP instruction pointer - instruction offset =FLAGS= 1 CF or C Carry flag - Set if an operation needs a carry or a borrow. Otherwise reset (set to 0) 2 PF or P Parity flag - Set if last operation contains an even number of bits set at 1. Otherwise reset 3 AF Aux carry flag - Set if carry or borrow occurs in high nibble low nibble (more below) 4 ZF or Z Zero flag - Set if an operation finishes at 0 otherwise reset. 5 SF Sign flag - Copy of Most Significant Byte of a result. 6 OF Overflow flag - When set indicates that the signed operation is out of range. Else reset. 7 IF Interrupt enable - If set then CPU recognises maskable interrupts 8 DF or D Direction - If set then auto decrementation takes place otherwise auto incrementation (for some instructions only) 9 TF Trap - If set the CPU only does one instruction at a time. Used in debugging ===INSTRUCTIONS=== ------------ ==ASSEMBLY== -------- OUT 0x70, al ;output the value in al to port 70hex MOV ax,[bx] ;load acc with the value at address bx start: ; label LOOP start ; decrement cx and go back to start MUL bx ; multiply the contents of bx with the contents of ax PUSH arg1 ; arg1 onto the stack CALL sum CLD ; clear direction flag RET ; return POP bp ; restore bp ADD ax,[bp + 6] ; add stack location (not top) to ax ==MACHINE CODE== ------------