# Exact Calculator: Design Example, Large Integer Manipulation, and Memory Options

This calculator can manipulate large integer values with operations such as And, Or, Xor, Not, power functions, and find the biggest divisor/smallest multiplicand/factorial. It also has memory options to save/retrieve values using M1/Mn. The hardware consists of a keyboard with 64 8x8 keys, 8 seven-segment display, timer options (hh:mm:ss), 8086 in minimum mode, half of address space for RAM and half for EPROM, and a 5MHz crystal clock.

• Uploaded on | 0 Views
• latoya

## About Exact Calculator: Design Example, Large Integer Manipulation, and Memory Options

PowerPoint presentation about 'Exact Calculator: Design Example, Large Integer Manipulation, and Memory Options'. This presentation describes the topic on This calculator can manipulate large integer values with operations such as And, Or, Xor, Not, power functions, and find the biggest divisor/smallest multiplicand/factorial. It also has memory options to save/retrieve values using M1/Mn. The hardware consists of a keyboard with 64 8x8 keys, 8 seven-segment display, timer options (hh:mm:ss), 8086 in minimum mode, half of address space for RAM and half for EPROM, and a 5MHz crystal clock.. The key topics included in this slideshow are Exact calculator, large integer values, memory options, keyboard, seven-segment display, timer, 8086, RAM, EPROM, crystal clock,. Download this presentation absolutely free.

## Presentation Transcript

1. A Design Example An Exact Calculator

2. Exact Calculator Manipulating Large Integer Values Operations: + , - , *, / , % , And, Or, Xor, Not, Power Functions Biggest Divisor, Smallest Multiplicand, Factoriel, .. Memory Options Save (M1 Mn), Retrieve, X, Y, X Y

3. Hardware Specifications Keyboard with 64 (8x8) Keys 8 Seven-Segment Display Timer Options: hh mm ss 8086 in Minimum Mode Half of Address Space for RAM and the other half for EPROM 5MHz Crystal for Clock

4. CPU Pins in Minimum Mode Min Mode Vcc

5. 8086 System Minimum mode Latch Buffer

6. 8284 Clock Generator for 8086 an 18-pin chip specially designed to be used with 8088/86 microprocessors, It provides the clock and synchronization for the microprocessor, also provides the READY signal for the insertion of wait states into the CPU bus cycle.

7.

8. 8 Fully Buffered 8086

9. Bank Write and Bank Read Control Logic Bank Write Control Logic Bank Read Control Logic BHE BHE WR RD A0 A0 2 EPROMs Each 256KB = 256Kx8 = Eight 27512 or 28512 2 SRAMs Each 256KB = 256Kx8 = Eight 62512 or 61512 Total 1M

10. A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE WE D0 - D7 D8 - D15 A1-A16 A1-A16 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 G1 G2 A17 A18 A19 A0 DEN Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 G1 G2 A17 A18 A19 BHE DEN RD RD RD RD RD RD RD RD WR WR WR WR WR WR WR WR SRAMs

11. A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 D0 D1 D2 D3 D4 D5 D6 D7 CS OE D0 - D7 D8 - D15 A1-A16 A1-A16 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 G1 G2 A17 A18 A19 A0 DEN Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 A0 A1 A2 G1 G2 A17 A18 A19 BHE DEN RD RD RD RD RD RD RD RD EPROMs

12. Main Program ORG 0FFF0H ;Address FFFF0 XOR AX,AX ;AX=0 MOV DS,AX ;DS=0 MOV AH,80H ;AX=8000H MOV SS,AX ;STACK From 80000H MOV SP,0FFFFH JMP 0F000H:100 ORG 100H ;Address F0100 CLI CALL INIT_KEYBOARD CALL INIT_DISPLAY CALL INIT_TIMER CALL INIT_8259 STI Main_LOOP: CALL GETCH ;Scan Code Available in AL CALL Process_Key JMP Main_LOOP Its for the Segment F000

13. Peripherals 8255 (Keyboard) 8255 (Display) Timer 8254 8259 Interrupt Controller

14. Address Decoding for the Peripherals 8086 8255A PPI A0 A1 Latch (373) Display Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 X0 X1 X2 A0 A1 A2 A3 A4 A5 A6 A7 CS 8259 A0 CS AD0-AD7 D0-D7 Buffer ALE Keyboard Address: 000XXPP0 Timer Address: 010XXPP0 Display Address: 011XXPP0 8259 Address: 110XXXP0 IR0 IR1 Keyboard Timer 8259

15. Address Assignment DISPLAY_SEGMENTS EQU 0 DISPLAY_GND EQU 2 DISPLAY_CTRL EQU 6 KEYBOARD_ROW EQU 40H KEYBOARD_COL EQU 42H KEYBOARD_CTRL EQU 46H TIMER_CH0 EQU 80H TIMER_CH1 EQU 82H TIMER_CH2 EQU 84H TIMER_CTRL EQU 86H P8259_0 EQU 11000000b P8259_1 EQU 11000010b

16. Keys ;Scan Codes. There are 64 keys. codes are from 32 to 95 ;These codes are Available: ; 32=space 33=! 37=% 38=& 42=* 43=+ 45=- 46=. 47=/ 48-57=0-9 61== 65-90=A-Z 94=^ RIGHT_ARROW EQU 34 PAGE_RIGHT EQU 35 END_OF_RIGHT EQU 36 LEFT_ARROW EQU 39 PAGE_LEFT EQU 40 END_OF_LEFT EQU 41 TOMEMORY EQU 44 RECALLMEMORY EQU 45 LogicalOR EQU 58 POWER EQU 59 BiggestDivisor EQU 60 SmallestDivisor EQU 62 Factorial EQU 63 CLEAR EQU 64 CLEARALL EQU 91

17. Data ORG 2000H X_VALUE DB 1000H DUP(?) Y_VALUE DB 1000H DUP(?) M_VALUE DB 8000H DUP(?) ;Eight KEY_BUFF DB 16 DUP(?) DISPLAY_DATA DB 8 DUP (?) KEY_head DB 0 KEY_tail DB 0 DISPLAY_Counter DB 0 ;Identifies which segment should be shown GND_DRIVER DB 11111110B X_SIZE DW 0 ; Size of X register in bytes Y_SIZE DW 0 M_SIZE DW 8 DUP (0) DISPLAY_START DW 0

18. 8255 Control Word

19. Keyboard Initialization INIT_KEYBOARD: MOV AL,00001011B ;Mode0 output for A ;Mode 0 input for B ;input for C OUT KEYBOARD_CTRL,AL MOV AL,0FFH ;OFF All Rows OUT KEYBOARD_ROW,AL XOR AL,AL ;Reset FIFO MOV [Key_head],AL MOV [Key_tail],AL RET

20. Keyboard Scanning SCAN_KEYBOARD: MOV BL,0 ;The scan code MOV AH,11111110B ;Row activation Number Next_Row: MOV AL,AH OUT KEYBOARD_ROW,AL IN AL,KEYBOARD_COL CMP AL,0FFH JNE Detect_Key ROL AH,1 ADD BL,8 CMP BL,64 JNE Next_Row MOV BL,0FFH RET Detect_Key: INC BL RCR AL,1 JC Detect_Key ADD BL,31 ;To have codes from 32 to 95 RET

21. Keyboard Interrupt KEYBOARD_INT: PUSH AX PUSH BX CALL SCAN_KEYBOARD JE END_KEY MOV AL,BL ;Saving scan code MOV BX,offset KEY_BUFF MOV BL,[KEY_head] MOV [BX],AL INC BL AND BL,0FH ;Only 16 bytes are saved MOV [Key_head],BL END_KEY: POP BX POP AX IRET

22. GETCH GETCH: MOV BX,KEY_BUFF MOV BL,[KEY_tail] wait_for_key: MOV AL,[Key_head] CMP AL,BL JE Wait_for_key MOV AL,[BX] INC BL MOV [Key_tail],BL RET

23. Key Processing Process_key: MOV BX,Function_Table SUB AL,32 MUL AL,2 MOV AH,0 ADD BX,AX MOV BX,[BX] JMP [BX] Function_Table DW offset SPACE_PROCESS DW offset NOT_PROCESS