ASCII Code Table HEX DEC CHR Ctrl HEX
ASCII Code Table HEX DEC CHR Ctrl HEX DEC 00 01 02 03 04 05 06 07 08 09 0 A 0 B 0 C 0 D 0 E 0 F 10 11 12 13 14 15 16 17 18 19 1 A 1 B 1 C 1 D 1 E 1 F 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 NUL SOH STX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC 1 DC 2 DC 3 DC 4 NAK SYN ETB CAN EM SUB ESC FS GS RS US ^@ ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M ^N ^O ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z 20 21 22 23 24 25 26 27 28 29 2 A 2 B 2 C 2 D 2 E 2 F 30 31 32 33 34 35 36 37 38 39 3 A 3 B 3 C 3 D 3 E 3 F 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 CHR SP ! ” # $ % & ’ ( ) * + , . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? HEX DEC 40 41 42 43 44 45 46 47 48 49 4 A 4 B 4 C 4 D 4 E 4 F 50 51 52 53 54 55 56 57 58 59 5 A 5 B 5 C 5 D 5 E 5 F 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 CHR @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ ] ^ _ HEX DEC 60 61 62 63 64 65 66 67 68 69 6 A 6 B 6 C 6 D 6 E 6 F 70 71 72 73 74 75 76 77 78 79 7 A 7 B 7 C 7 D 7 E 7 F 96 97 98 99 100 101 102 103 104 105 106 107 108 109 100 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 CHR ` a b c d e f g h I j k l m n o p q r s t u v w x y z { | } ~ DEL EECC 250 - Shaaban #1 lec #13 Winter 99 1 -17 -2000
ASCII-Encoded Decimal To Binary Conversion • • Subroutine DECBIN, assumes A 0 to point at the highest character of a valid five character ASCII-encoded decimal number with a maximum value 65535 The decimal number is converted to a one word binary value stored in the low word of D 0 DECBIN NEXTD ORG CLR. L MOVEQ CLR. L MOVE. B SUBI. B MULU ADD. W SUBI. B BNE RTS $1000 D 0 #5, D 6 D 1 (A 0)+, D 1 #$30, D 1 #10, D 0 D 1, D 0 #1, D 6 NEXTD Initialize loop counter to get five digits Clear new digit holding register Get one ASCII digit from memory Subtract ASCII bias $30 Multiply D 0 by 10 Add new digit to binary value in D 0 Decrement counter If not done get next digit EECC 250 - Shaaban #2 lec #13 Winter 99 1 -17 -2000
Binary To ASCII-Coded Decimal Conversion • • Subroutine BINDEC, converts binary value in the lower word of register D 0 into an ASCIIcoded decimal string. Address where resulting ASCII string should be stored is given in A 0 This routine does not eliminate leading zeroes when the value is less than 10000 BINDEC DIGIT ORG MOVE. W BSR MOVE. B ADDI. B MOVE. B RTS $1000 D 0, D 6 #10000, D 5 DIGIT #100, D 5 DIGIT #10, D 5 DIGIT D 6, D 1 #$30, D 1, (A 0)+ ANDI. L DIVU MOVE. B ADDI. B MOVE. B SWAP RTS #$0 FFFF, D 6 D 5, D 6, D 1 #$30, D 1, (A 0)+ D 6 Make a copy of input number Get 10000 s digit Get 100 s digit Get 1 s digit Add ASCII bias Store 1 s ASCII digit in memory Clear upper word of D 6 Divide D 6 by D 5 Load result digit in D 1 Add ASCII bias Store ASCII digit in memory Get remainder EECC 250 - Shaaban #3 lec #13 Winter 99 1 -17 -2000
- Slides: 3