8051dumper.lst 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. tpasm 1.5 Assembling on Sun May 10 00:05:09 2020
  2. Source File: 8051dumper.asm
  3. Line Loc Object/(Value) T Source
  4. ----- -------- -------------- - ------
  5. 1 00000000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6. 2 00000000 ;; 8051dumper.asm: Dump internal ROM contents of 8051 to serial port.
  7. 3 00000000 ;;
  8. 4 00000000 ;;
  9. 5 00000000
  10. 6 00000000 PROCESSOR 8051
  11. 7 00000000 INCLUDE "SFR.asm"
  12. 1 00000000 ;; 8051/8052 Special-Function Registers...
  13. 72 00000000 ;; ...8051/8052 Special-Function Registers
  14. 73 00000000
  15. 8 00000000
  16. 9 00000000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  17. 10 00000000 ;; GPIOs
  18. 11 00000000 ;;
  19. 12 00000000 OUT_EA ALIAS "P1.0" ; Inverted and connected to EAn pin
  20. 13 00000000 OUT_REDLEDn ALIAS "P1.1" ; Red LED in RESET button
  21. 14 00000000 OUT_GRNLEDn ALIAS "P1.2" ; Green LED in START button
  22. 15 00000000 IN_GRNBTNn ALIAS "P1.3" ; Green START button
  23. 16 00000000 IN_R32Kn ALIAS "P1.4" ; Dump size knob: 8058 (32k)
  24. 17 00000000 IN_R16Kn ALIAS "P1.5" ; Dump size knob: 8054 (16k)
  25. 18 00000000 IN_R8Kn ALIAS "P1.6" ; Dump size knob: 8052 (8k)
  26. 19 00000000 IN_R4Kn ALIAS "P1.7" ; Dump size knob: 8051 (4k)
  27. 20 00000000
  28. 21 00000000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. 22 00000000 ;; Internal RAM (uninitialized data segment)
  30. 23 00000000 ;;
  31. 24 00000000 SEGU "IRAM"
  32. 25 00000000
  33. 26 00000000 ; 0x00..0x1F contains the four register banks.
  34. 27 00000000 ; 0x20..0x2F is the bit addressable area.
  35. 28 00000000 ; 0x30..0x7F is the scratch pad area.
  36. 29 00000000
  37. 30 00000000 ORG 0x0030
  38. 31 00000030 IROMSIZE: DS 1 ; High byte of internal ROM size
  39. 32 00000031 CKSUM: DS 1 ; Checksum accumulator for line
  40. 33 00000032 HINYBBLE: DS 1 ; Temp buffer for HEXBYTE
  41. 34 00000033 LONYBBLE: DS 1 ; Temp buffer for HEXBYTE
  42. 35 00000034
  43. 36 00000034 ; Intel Hex line buffer for 16 byte record
  44. 37 00000034 BUF_START: DS 1 ; Start code ":"
  45. 38 00000035 BUF_BYTECOUNT: DS 2 ; Byte count "10"
  46. 39 00000037 BUF_ADDR: DS 4 ; Start address of record
  47. 40 0000003B BUF_RECTYPE: DS 1 ; Record type
  48. 41 0000003C BUF_DATA: DS 32 ; Record data
  49. 42 0000005C BUF_CKSUM: DS 2 ; Checksum
  50. 43 0000005E BUF_EOL: DS 3 ; CRLF and terminating NUL
  51. 44 00000061
  52. 45 00000061
  53. 46 00000061
  54. 47 00000061 ; Rest of RAM is stack. Initial stack pointer should be 1 byte before
  55. 48 00000061 ; beginning of stack because PUSH operations pre-increment the stack pointer.
  56. 49 00000061 STACK: DS 0x0080-$
  57. 50 00000080
  58. 51 00000080
  59. 52 00000080 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  60. 53 00000080 ;; Code segment starting at base of external program memory EEPROM
  61. 54 00000080 ;;
  62. 55 00000080 SEG "code"
  63. 56 00000000
  64. 57 00000000 ; Reset vector (3 bytes)
  65. 58 00000000 ORG 0x0000
  66. 59 00000000 02 80 81 RESET: LJMP MAIN
  67. 60 00000003
  68. 61 00000003 ; External Request 0 Interrupt Service Routine (8 bytes)
  69. 62 00000003 ORG 0x0003
  70. 63 00000003 02 81 88 ER0_ISR: LJMP ERROR
  71. 64 00000006
  72. 65 00000006 ; Internal Timer/Counter 0 Interrupt Service Routine (8 bytes)
  73. 66 00000006 ORG 0x000B
  74. 67 0000000B 02 81 88 ITC0_ISR: LJMP ERROR
  75. 68 0000000E
  76. 69 0000000E ; External Request 1 Interrupt Service Routine (8 bytes)
  77. 70 0000000E ORG 0x0013
  78. 71 00000013 02 81 88 ER1_ISR: LJMP ERROR
  79. 72 00000016
  80. 73 00000016 ; Internal Timer/Counter 1 Interrupt Service Routine (8 bytes)
  81. 74 00000016 ORG 0x001B
  82. 75 0000001B 02 81 88 ITC1_ISR: LJMP ERROR
  83. 76 0000001E
  84. 77 0000001E ; Internal Serial Port Interrupt Service Routine (8 bytes)
  85. 78 0000001E ORG 0x0023
  86. 79 00000023 02 81 88 ISP_ISR: LJMP ERROR
  87. 80 00000026
  88. 81 00000026 ; 8052 TF2 and EXF2 Interrupt Service Routine (8 bytes)
  89. 82 00000026 ORG 0x002B
  90. 83 0000002B 02 81 88 TF2_ISR: LJMP ERROR
  91. 84 0000002E
  92. 85 0000002E
  93. 86 0000002E
  94. 87 0000002E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  95. 88 0000002E ;; Following code/data will be accessed in a mirror image of the 32k EEPROM
  96. 89 0000002E ;; at 0x8000. We will raise the EAn pin with a GPIO in order to overlay
  97. 90 0000002E ;; internal ROM at address 0x0000. We will not use any interrupts because
  98. 91 0000002E ;; interrupt vectors will contain unpredictable code from internal ROM.
  99. 92 0000002E ;;
  100. 93 0000002E ORG 0x0032
  101. 94 00000032 RORG 0x8032
  102. 95 00000032
  103. 96 00000032 38 30 35 31 64 IDSTR: DB "8051dumper v1.0 by NF6X", 0x0D, 0x0A, 0x00
  104. 75 6D 70 65 72
  105. 20 76 31 2E 30
  106. 20 62 79 20 4E
  107. 46 36 58 0D 0A
  108. 00
  109. 97 0000004C 45 52 52 4F 52 KNOBSTR: DB "ERROR: Could not read ROM size knob!", 0x0D, 0x0A, 0x00
  110. 3A 20 43 6F 75
  111. 6C 64 20 6E 6F
  112. 74 20 72 65 61
  113. 64 20 52 4F 4D
  114. 20 73 69 7A 65
  115. 20 6B 6E 6F 62
  116. 21 0D 0A 00
  117. 98 00000073 3A 30 30 30 30 ENDSTR: DB ":00000001FF", 0x0D, 0x0A, 0x00
  118. 30 30 30 31 46
  119. 46 0D 0A 00
  120. 99 00000081
  121. 100 00000081 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  122. 101 00000081 ;; Main entry point
  123. 102 00000081 ;;
  124. 103 00000081 MAIN:
  125. 104 00000081 75 A8 00 MOV IE, #0x00 ; Disable all interrupts
  126. 105 00000084 75 90 FF MOV P1, #0xFF ; GPIOs all input/high
  127. 106 00000087 75 81 60 MOV SP, #STACK-1 ; Initialize stack pointer
  128. 107 0000008A a CLR OUT_EA ; Select INTERNAL ROM at 0x0000
  129. 107 0000008A C2 90 A CLR P1.0
  130. 108 0000008C
  131. 109 0000008C
  132. 110 0000008C ; Configure serial port for Mode 1, 9600 8n1
  133. 111 0000008C ; SMOD = 0 ==> K = 1
  134. 112 0000008C ; Oscillator frequency = 11.0592 MHz
  135. 113 0000008C ; TH1 = 256 - (K * Fosc)/(32 * 12 * Baud)
  136. 114 0000008C ; TH1 = 256 - (1 * 11059200)/(32 * 12 * 9600) = 253 = 0xFD
  137. 115 0000008C 75 87 00 MOV PCON, #0x00 ; SMOD = 0
  138. 116 0000008F 75 98 50 MOV SCON, #0x50 ; Mode 1
  139. 117 00000092 75 89 21 MOV TMOD, #0x21 ; T1: Mode 2, T0: Mode 1
  140. 118 00000095 75 8D FD MOV TH1, #0xFD ; 9600 baud
  141. 119 00000098 75 8B FD MOV TL1, #0xFD ; 9600 baud
  142. 120 0000009B a SETB TCON_TR1 ; Enable timer
  143. 120 0000009B D2 8E A SETB TCON.6
  144. 121 0000009D
  145. 122 0000009D
  146. 123 0000009D ; Send ID string
  147. 124 0000009D 90 80 32 MOV DPTR, #IDSTR
  148. 125 000000A0 31 AF ACALL SENDROM
  149. 126 000000A2
  150. 127 000000A2
  151. 128 000000A2 ; Blink green LED until green START button pressed.
  152. 129 000000A2 ; Flash LED 2x per second at 20% duty cycle, checking
  153. 130 000000A2 ; button every 100ms.
  154. 131 000000A2 a WAITSTART: CLR OUT_GRNLEDn ; On for 100ms
  155. 131 000000A2 C2 92 A WAITSTART: CLR P1.2
  156. 132 000000A4 31 8E ACALL DELAY100ms
  157. 133 000000A6 a JNB IN_GRNBTNn, READKNOB ; Button pressed?
  158. 133 000000A6 30 93 18 A JNB P1.3, READKNOB
  159. 134 000000A9 a SETB OUT_GRNLEDn ; Off for 400ms
  160. 134 000000A9 D2 92 A SETB P1.2
  161. 135 000000AB 31 8E ACALL DELAY100ms
  162. 136 000000AD a JNB IN_GRNBTNn, READKNOB ; Button pressed?
  163. 136 000000AD 30 93 11 A JNB P1.3, READKNOB
  164. 137 000000B0 31 8E ACALL DELAY100ms
  165. 138 000000B2 a JNB IN_GRNBTNn, READKNOB ; Button pressed?
  166. 138 000000B2 30 93 0C A JNB P1.3, READKNOB
  167. 139 000000B5 31 8E ACALL DELAY100ms
  168. 140 000000B7 a JNB IN_GRNBTNn, READKNOB ; Button pressed?
  169. 140 000000B7 30 93 07 A JNB P1.3, READKNOB
  170. 141 000000BA 31 8E ACALL DELAY100ms
  171. 142 000000BC a JNB IN_GRNBTNn, READKNOB ; Button pressed?
  172. 142 000000BC 30 93 02 A JNB P1.3, READKNOB
  173. 143 000000BF 80 E1 SJMP WAITSTART
  174. 144 000000C1
  175. 145 000000C1 ; Read dump size knob and begin dumping code.
  176. 146 000000C1 a READKNOB: SETB OUT_GRNLEDn ; Green LED off
  177. 146 000000C1 D2 92 A READKNOB: SETB P1.2
  178. 147 000000C3
  179. 148 000000C3 a .TST32K: JB IN_R32Kn, .TST16K ; Knob set to 32k?
  180. 148 000000C3 20 94 05 A .TST32K: JB P1.4, .TST16K
  181. 149 000000C6 75 30 80 MOV IROMSIZE, #0x80 ; Yes, 32k
  182. 150 000000C9 80 20 SJMP INITBUF
  183. 151 000000CB a .TST16K: JB IN_R16Kn, .TST8K ; Knob set to 16k?
  184. 151 000000CB 20 95 05 A .TST16K: JB P1.5, .TST8K
  185. 152 000000CE 75 30 40 MOV IROMSIZE, #0x40 ; Yes, 16k
  186. 153 000000D1 80 18 SJMP INITBUF
  187. 154 000000D3 a .TST8K: JB IN_R8Kn, .TST4K ; Knob set to 8k?
  188. 154 000000D3 20 96 05 A .TST8K: JB P1.6, .TST4K
  189. 155 000000D6 75 30 20 MOV IROMSIZE, #0x20 ; Yes, 8k
  190. 156 000000D9 80 10 SJMP INITBUF
  191. 157 000000DB a .TST4K: JB IN_R4Kn, .TSTFAIL ; Knob set to 4k?
  192. 157 000000DB 20 97 05 A .TST4K: JB P1.7, .TSTFAIL
  193. 158 000000DE 75 30 10 MOV IROMSIZE, #0x10 ; Yes, 4k
  194. 159 000000E1 80 08 SJMP INITBUF
  195. 160 000000E3 90 80 4C .TSTFAIL: MOV DPTR, #KNOBSTR ; Cannot read knob!
  196. 161 000000E6 31 AF ACALL SENDROM
  197. 162 000000E8 02 81 88 LJMP ERROR
  198. 163 000000EB
  199. 164 000000EB
  200. 165 000000EB ; Initialize the line buffer and ROM data pointer
  201. 166 000000EB 75 34 3A INITBUF: MOV BUF_START, #':'
  202. 167 000000EE 75 35 31 MOV BUF_BYTECOUNT, #'1'
  203. 168 000000F1 75 36 30 MOV BUF_BYTECOUNT+1, #'0'
  204. 169 000000F4 75 5E 0D MOV BUF_EOL, #0x0D
  205. 170 000000F7 75 5F 0A MOV BUF_EOL+1, #0x0A
  206. 171 000000FA 75 60 00 MOV BUF_EOL+2, #0x00
  207. 172 000000FD 90 00 00 MOV DPTR, #0000
  208. 173 00000100
  209. 174 00000100
  210. 175 00000100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  211. 176 00000100 ;; Dump one Intel Hex record of 16 bytes at a time until done.
  212. 177 00000100 ;; Toggle red LED for each line to show activity.
  213. 178 00000100 ;;
  214. 179 00000100 E5 83 DUMPLOOP: MOV A, DPH ; Has DPTR hit end of IROM?
  215. 180 00000102 B5 30 02 CJNE A, IROMSIZE, DUMPRECORD
  216. 181 00000105 80 2E SJMP EOF ; Finished with IROM
  217. 182 00000107
  218. 183 00000107 ; Dump one 16-byte record
  219. 184 00000107 DUMPRECORD:
  220. 185 00000107 a CPL OUT_REDLEDn
  221. 185 00000107 B2 91 A CPL P1.1
  222. 186 00000109 75 31 10 MOV CKSUM, #0x10 ; Init checksum w/ record length
  223. 187 0000010C 78 37 MOV R0, #BUF_ADDR ; Point to address field
  224. 188 0000010E E5 83 MOV A, DPH ; High address byte
  225. 189 00000110 31 40 ACALL HEXBYTE
  226. 190 00000112 E5 82 MOV A, DPL ; Low address byte
  227. 191 00000114 31 40 ACALL HEXBYTE
  228. 192 00000116 E4 CLR A ; Record type
  229. 193 00000117 31 40 ACALL HEXBYTE
  230. 194 00000119
  231. 195 00000119 E4 DUMPBYTE: CLR A ; Read byte from IROM
  232. 196 0000011A 93 MOVC A, @A+DPTR
  233. 197 0000011B 31 40 ACALL HEXBYTE ; Add it to line buffer
  234. 198 0000011D E5 82 MOV A, DPL ; End of record?
  235. 199 0000011F 54 0F ANL A, #0x0F
  236. 200 00000121 C3 CLR C
  237. 201 00000122 94 0F SUBB A, #0x0F
  238. 202 00000124 60 03 JZ EOR ; Yes, at end of 16-byte record
  239. 203 00000126 A3 INC DPTR ; No, increment IROM pointer
  240. 204 00000127 80 F0 SJMP DUMPBYTE ; Add next byte
  241. 205 00000129
  242. 206 00000129 E5 31 EOR: MOV A, CKSUM ; Add checksum to record
  243. 207 0000012B F4 CPL A
  244. 208 0000012C 24 01 ADD A, #1
  245. 209 0000012E 31 40 ACALL HEXBYTE
  246. 210 00000130 31 78 ACALL SENDRECORD ; Send out this record
  247. 211 00000132 A3 INC DPTR
  248. 212 00000133
  249. 213 00000133 80 CB SJMP DUMPLOOP
  250. 214 00000135
  251. 215 00000135
  252. 216 00000135 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  253. 217 00000135 ;; Send out end of file record, turn green LED on and red LED off,
  254. 218 00000135 ;; and loop forever.
  255. 219 00000135 ;;
  256. 220 00000135 90 80 73 EOF: MOV DPTR, #ENDSTR
  257. 221 00000138 31 AF ACALL SENDROM
  258. 222 0000013A a CLR OUT_GRNLEDn ; Green LED on
  259. 222 0000013A C2 92 A CLR P1.2
  260. 223 0000013C a SETB OUT_REDLEDn ; Red LED off
  261. 223 0000013C D2 91 A SETB P1.1
  262. 224 0000013E 80 FE SJMP $
  263. 225 00000140
  264. 226 00000140
  265. 227 00000140 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  266. 228 00000140 ;; Add hex representation of A to buffer at R0 and accumulate checksum.
  267. 229 00000140 ;;
  268. 230 00000140 F5 32 HEXBYTE: MOV HINYBBLE, A ; Add byte to checksum
  269. 231 00000142 F5 33 MOV LONYBBLE, A
  270. 232 00000144 25 31 ADD A, CKSUM
  271. 233 00000146 F5 31 MOV CKSUM, A
  272. 234 00000148
  273. 235 00000148 E5 32 MOV A, HINYBBLE ; Isolate high nybble
  274. 236 0000014A C4 SWAP A
  275. 237 0000014B 54 0F ANL A, #0x0F
  276. 238 0000014D 24 30 ADD A, #'0'
  277. 239 0000014F F5 32 MOV HINYBBLE, A
  278. 240 00000151 C3 CLR C
  279. 241 00000152 94 3A SUBB A, #':'
  280. 242 00000154 40 06 JC .LO
  281. 243 00000156 E5 32 MOV A, HINYBBLE
  282. 244 00000158 24 07 ADD A, #7
  283. 245 0000015A F5 32 MOV HINYBBLE, A
  284. 246 0000015C
  285. 247 0000015C E5 33 .LO: MOV A, LONYBBLE ; Isolate low nybble
  286. 248 0000015E 54 0F ANL A, #0x0F
  287. 249 00000160 24 30 ADD A, #'0'
  288. 250 00000162 F5 33 MOV LONYBBLE, A
  289. 251 00000164 C3 CLR C
  290. 252 00000165 94 3A SUBB A, #':'
  291. 253 00000167 40 06 JC .STHI
  292. 254 00000169 E5 33 MOV A, LONYBBLE
  293. 255 0000016B 24 07 ADD A, #7
  294. 256 0000016D F5 33 MOV LONYBBLE, A
  295. 257 0000016F
  296. 258 0000016F E5 32 .STHI: MOV A, HINYBBLE ; Store high nybble hex char
  297. 259 00000171 F6 MOV @R0, A
  298. 260 00000172 08 INC R0
  299. 261 00000173 E5 33 MOV A, LONYBBLE ; Store low nybble hex char
  300. 262 00000175 F6 MOV @R0, A
  301. 263 00000176 08 INC R0
  302. 264 00000177
  303. 265 00000177 22 RET
  304. 266 00000178
  305. 267 00000178
  306. 268 00000178 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  307. 269 00000178 ;; Send out the current record.
  308. 270 00000178 ;;
  309. 271 00000178 78 34 SENDRECORD: MOV R0, #BUF_START ; Init pointer
  310. 272 0000017A E6 .SENDCHAR: MOV A, @R0 ; Get next char
  311. 273 0000017B 60 0A JZ .DONE ; Done if it is NUL
  312. 274 0000017D a CLR SCON_TI ; Send byte
  313. 274 0000017D C2 99 A CLR SCON.1
  314. 275 0000017F F5 99 MOV SBUF, A
  315. 276 00000181 a JNB SCON_TI, $ ; Loop until character sent
  316. 276 00000181 30 99 FD A JNB SCON.1, $
  317. 277 00000184 08 INC R0
  318. 278 00000185 80 F3 SJMP .SENDCHAR
  319. 279 00000187 22 .DONE: RET
  320. 280 00000188
  321. 281 00000188
  322. 282 00000188 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  323. 283 00000188 ;; Error handler
  324. 284 00000188 ;; Turn on red LED and loop forever.
  325. 285 00000188 ;;
  326. 286 00000188 a ERROR: SETB OUT_GRNLEDn ; Green LED off
  327. 286 00000188 D2 92 A ERROR: SETB P1.2
  328. 287 0000018A a CLR OUT_REDLEDn ; Red LED on
  329. 287 0000018A C2 91 A CLR P1.1
  330. 288 0000018C 80 FE SJMP $
  331. 289 0000018E
  332. 290 0000018E
  333. 291 0000018E
  334. 292 0000018E
  335. 293 0000018E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  336. 294 0000018E ;; Delay 100ms
  337. 295 0000018E ;; Uses Timer 0, delaying 50ms twice
  338. 296 0000018E ;; Oscillator frequency = 11.0592 MHz
  339. 297 0000018E ;; ==> 50ms = 11059200 / (12 * 20) = 46080 = 0xB400 counts
  340. 298 0000018E ;; ==> (TH0,TL0) = 0x10000 - 0xB400 = 0x4C00
  341. 299 0000018E ;; This all ignores subroutine call overhead and so forth.
  342. 300 0000018E ;;
  343. 301 0000018E a DELAY100ms: CLR TCON_TR0 ; Timer off
  344. 301 0000018E C2 8C A DELAY100ms: CLR TCON.4
  345. 302 00000190 75 8C 4C MOV TH0, #0x4C ; 50ms delay
  346. 303 00000193 75 8A 00 MOV TL0, #0x00
  347. 304 00000196 a CLR TCON_TF0 ; Clear overflow
  348. 304 00000196 C2 8D A CLR TCON.5
  349. 305 00000198 a SETB TCON_TR0 ; Timer on
  350. 305 00000198 D2 8C A SETB TCON.4
  351. 306 0000019A a JNB TCON_TF0, $ ; Wait for overflow
  352. 306 0000019A 30 8D FD A JNB TCON.5, $
  353. 307 0000019D a CLR TCON_TR0 ; Timer off
  354. 307 0000019D C2 8C A CLR TCON.4
  355. 308 0000019F 75 8C 4C MOV TH0, #0x4C ; 50ms delay
  356. 309 000001A2 75 8A 00 MOV TL0, #0x00
  357. 310 000001A5 a CLR TCON_TF0 ; Clear overflow
  358. 310 000001A5 C2 8D A CLR TCON.5
  359. 311 000001A7 a SETB TCON_TR0 ; Timer on
  360. 311 000001A7 D2 8C A SETB TCON.4
  361. 312 000001A9 a JNB TCON_TF0, $ ; Wait for overflow
  362. 312 000001A9 30 8D FD A JNB TCON.5, $
  363. 313 000001AC a CLR TCON_TR0 ; Timer off
  364. 313 000001AC C2 8C A CLR TCON.4
  365. 314 000001AE 22 RET
  366. 315 000001AF
  367. 316 000001AF
  368. 317 000001AF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  369. 318 000001AF ;; Send NUL-terminated string in ROM pointed to by DPTR.
  370. 319 000001AF ;; Trashes A, DPTR
  371. 320 000001AF ;;
  372. 321 000001AF E4 SENDROM: CLR A ; Get byte from ROM
  373. 322 000001B0 93 MOVC A, @A+DPTR
  374. 323 000001B1 60 0A JZ .DONE ; Done if it is NUL
  375. 324 000001B3 a CLR SCON_TI ; Send byte
  376. 324 000001B3 C2 99 A CLR SCON.1
  377. 325 000001B5 F5 99 MOV SBUF, A
  378. 326 000001B7 a JNB SCON_TI, $ ; Loop until character sent
  379. 326 000001B7 30 99 FD A JNB SCON.1, $
  380. 327 000001BA A3 INC DPTR ; Send next byte
  381. 328 000001BB 80 F2 SJMP SENDROM
  382. 329 000001BD 22 .DONE: RET
  383. 330 000001BE
  384. 331 000001BE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  385. 332 000001BE ;;
  386. 333 000001BE END
  387. Segment Listing
  388. MinAddr MaxAddr Segment
  389. -------- -------- -------
  390. 00000000 000001BD code
  391. 00000030 0000007F IRAM
  392. Symbol Table Listing
  393. Value U Name
  394. -------- - ----
  395. 000000E0 * ACC
  396. 000000F0 * B
  397. 00000037 BUF_ADDR
  398. 00000035 BUF_BYTECOUNT
  399. 0000005C * BUF_CKSUM
  400. 0000003C * BUF_DATA
  401. 0000005E BUF_EOL
  402. 0000003B * BUF_RECTYPE
  403. 00000034 BUF_START
  404. 00000031 CKSUM
  405. 0000818E DELAY100ms
  406. 00000083 DPH
  407. 00000082 DPL
  408. 00008119 DUMPBYTE
  409. 00008100 DUMPLOOP
  410. 00008107 DUMPRECORD
  411. 00008073 ENDSTR
  412. 00008135 EOF
  413. 00008129 EOR
  414. 00000003 * ER0_ISR
  415. 00000013 * ER1_ISR
  416. 00008188 ERROR
  417. 00008140 HEXBYTE
  418. 0000815C HEXBYTE@LO
  419. 0000816F HEXBYTE@STHI
  420. 00000032 HINYBBLE
  421. 00008032 IDSTR
  422. 000000A8 IE
  423. 000080EB INITBUF
  424. 000000B8 * IP
  425. 00000030 IROMSIZE
  426. 00000023 * ISP_ISR
  427. 0000000B * ITC0_ISR
  428. 0000001B * ITC1_ISR
  429. 0000804C KNOBSTR
  430. 00000033 LONYBBLE
  431. 00008081 MAIN
  432. 00000080 * P0
  433. 00000090 P1
  434. 000000A0 * P2
  435. 000000B0 * P3
  436. 00000087 PCON
  437. 000000D0 * PSW
  438. 000000CB * RCAP2H
  439. 000000CA * RCAP2L
  440. 000080C1 READKNOB
  441. 000080CB READKNOB@TST16K
  442. 000080C3 * READKNOB@TST32K
  443. 000080DB READKNOB@TST4K
  444. 000080D3 READKNOB@TST8K
  445. 000080E3 READKNOB@TSTFAIL
  446. 00000000 * RESET
  447. 00000099 SBUF
  448. 00000098 SCON
  449. 00008178 SENDRECORD
  450. 00008187 SENDRECORD@DONE
  451. 0000817A SENDRECORD@SENDCHAR
  452. 000081AF SENDROM
  453. 000081BD SENDROM@DONE
  454. 00000081 SP
  455. 00000061 STACK
  456. 000000C8 * T2CON
  457. 00000088 TCON
  458. 0000002B * TF2_ISR
  459. 0000008C TH0
  460. 0000008D TH1
  461. 000000CD * TH2
  462. 0000008A TL0
  463. 0000008B TL1
  464. 000000CC * TL2
  465. 00000089 TMOD
  466. 000080A2 WAITSTART
  467. 00000001 * __8051
  468. Assembled in 3 passes
  469. Total assembly time 00:00:00
  470. Total Errors: 0
  471. Total Warnings: 0