📄 s12sermon2r1.lst
字号:
1134 621 ;bulk erase all the rest
1135 622 ;********************************************************************
1136 623
1137 624 a00FA42 C604 ldab #FlashBlks ; select lowest page of the highest bank
1138 625 a00FA44 53 decb ;
1139 626 a00FA45 271F beq EraseDone ; if single block device quit
1140 627 a00FA47 C630 ldab #LowestPage ; select lowest bank
1141 628 a00FA49 5B30 BlockLoop: stab PPAGE ; must match array selection
1142 629 a00FA4B 54 lsrb ; calculate the value of the block select bits based
1143 630 a00FA4C 54 lsrb ; on bits 3:2 of the PPAGE register value. (<256k)
1144 631 a00FA4D CD02 00 ldy #SectorSize ; get high byte of size
1145 632 a00FA50 8D02 00 cpy #$0200 ; if larger than $200 shift again
Metrowerks HC12-Assembler
(c) COPYRIGHT METROWERKS 1987-2003
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
1146 633 a00FA53 2701 beq nBlockLoop ; otherwise skip ahead
1147 634 a00FA55 54 lsrb ; on bits 4:3 of the PPAGE register value. (512k)
1148 635 a00FA56 51 nBlockLoop: comb
1149 636 a00FA57 C403 andb #$03 ; mask off all but the lower 2 bits.
1150 637 a00FA59 7B01 03 stab FCNFG ; select the block to erase.
1151 638 a00FA5C 0710 bsr BulkErase ; erase it
1152 639 a00FA5E D630 ldab PPAGE ;get ppage back
1153 640 a00FA60 CB04 addb #PagesBlk ;
1154 641 a00FA62 C13B cmpb #($3F-PagesBlk) ; see if last block
1155 642 a00FA64 2BE3 bmi BlockLoop
1156 643
1157 644 a00FA66 180B 3D00 EraseDone: movb #$3D,PPAGE ;select bank in array0
00FA6A 30
1158 645
1159 646 a00FA6B 06F8 AF OkCommand: jmp CommandOK ;back to no error and prompt
1160 647
1161 648 a00FA6E 34 BulkErase: pshx ;save address
1162 649 a00FA6F CE80 00 ldx #Window ;must point into bank
1163 650 a00FA72 6A00 staa ,x ;latch address to erase
1164 651 a00FA74 180B 4101 movb #MassErase,FCMD ; Select mass erase
00FA78 06
1165 652 a00FA79 180B 8001 movb #CBEIF,FSTAT ;register the command
00FA7D 05
1166 653 a00FA7E A7 nop ;wait a few cycles for
1167 654 a00FA7F A7 nop ;command to sync.
1168 655 a00FA80 A7 nop
1169 656 a00FA81 B601 05 ChkDoneF: ldaa FSTAT ;wait for CBEIF=CCIF=1 (cmnd done)
1170 657 a00FA84 2AFB bpl ChkDoneF ;loop if command buffer full (busy)
1171 658 a00FA86 48 asla ;moves CCIF to MSB (set/clear N bit)
1172 659 a00FA87 2AF8 bpl ChkDoneF ;loop if CCIF=0 (not done)
1173 660 a00FA89 30 pulx ;get address back
1174 661 a00FA8A 3D rts
1175 662 ;Erase 'b' (accumulator) sectors beginning at address 'x' (index register)
1176 663 ;
1177 664 a00FA8B B796 ErsSectors: exg b,y ;put the sector count in y.
1178 665 a00FA8D 6C00 ErsSectLp: std ,x
1179 666 a00FA8F 180B 4001 movb #SecErase,FCMD ;perform a sector erase.
00FA93 06
1180 667 a00FA94 16FD 7F jsr DoOnStack ;finish command from stack-based sub
1181 668 a00FA97 97 tsta ;check for 0=OK
1182 669 a00FA98 2608 bne ErsSectErr ;back to prompt-flash erase error
1183 670 a00FA9A 1AE2 0200 leax SectorSize,x ;point to the next sector.
1184 671 a00FA9E 0436 EC dbne y,ErsSectLp ;continue to erase remaining sectors.
1185 672 a00FAA1 3D rts
1186 673
1187 674 a00FAA2 3A ErsSectErr: puld ; clear stack
1188 675 a00FAA3 204A bra ErsPageErr
1189 676
1190 677 a00FAA5 16FD 2D ErsPage: jsr abClr ; abort commands and clear errors
1191 678 a00FAA8 D630 ldab PPAGE ; get current ppage
1192 679
1193 680 a00FAAA 54 lsrb ; calculate the value of the block select bits based
1194 681 a00FAAB 54 lsrb ; on bits 3:2 of the PPAGE register value. (<256k)
1195 682 a00FAAC CD02 00 ldy #SectorSize ; get high byte of size
1196 683 a00FAAF 8D02 00 cpy #$0200 ; if larger than $200 shift again
1197 684 a00FAB2 2701 beq ErsPage1 ; otherwise skip ahead
1198 685 a00FAB4 54 lsrb ; on bits 4:3 of the PPAGE register value. (512k)
1199 686 a00FAB5 51 ErsPage1: comb
1200 687 a00FAB6 C403 andb #$03 ; mask off all but the lower 2 bits.
1201 688 a00FAB8 7B01 03 stab FCNFG ; select the block to erase.
1202 689 a00FABB D630 ldab PPAGE ; get current ppage
1203 690 a00FABD C13F cmpb #$3F ; is it the page with the monitor
1204 691 a00FABF 2611 bne ErsFullPage ; no then erase all of page
1205 692 a00FAC1 CE02 00 ldx #SectorSize ; select sector size
Metrowerks HC12-Assembler
(c) COPYRIGHT METROWERKS 1987-2003
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
1206 693 a00FAC4 CC38 00 ldd #((BootStart-$c000)) ; get size - protected amount
1207 694 a00FAC7 1810 idiv ; compute total number of sectors
1208 695 ; minus the bootblock.
1209 696 a00FAC9 B754 tfr x,d ; get number of sectors in B
1210 697 a00FACB CE80 00 ldx #Window ; point to the start of the PPAGE window.
1211 698 a00FACE 07BB bsr ErsSectors ; go erase the PPAGE window a sector at a time.
1212 699 a00FAD0 2011 bra EraPageStat ; back to no error and prompt
1213 700
1214 701 a00FAD2 CE02 00 ErsFullPage: ldx #SectorSize ; select sector size
1215 702 a00FAD5 CC40 00 ldd #$4000 ; Window size
1216 703 a00FAD8 1810 idiv ; compute total number of sectors
1217 704 a00FADA B754 tfr x,d ; get number of sectors in B
1218 705 a00FADC CE80 00 ldx #Window ; point to the start of the PPAGE window.
1219 706 a00FADF 07AA bsr ErsSectors ; go erase the PPAGE window a sector at a time.
1220 707 a00FAE1 2000 bra EraPageStat ;back to no error and prompt
1221 708
1222 709 a00FAE3 B601 05 EraPageStat: ldaa FSTAT
1223 710 a00FAE6 8430 anda #$30 ;mask all but PVIOL or ACCERR
1224 711 a00FAE8 2605 bne ErsPageErr ;back to prompt-flash error
1225 712 a00FAEA 86E0 ldaa #ErrNone ;code for no errors ($E0)
1226 713 a00FAEC 06F8 B1 jmp Prompt ;ready for next command
1227 714
1228 715 a00FAEF 86E6 ErsPageErr: ldaa #ErrFlash ;code for Flash error ($E6)
1229 716 a00FAF1 06F8 B1 jmp Prompt ;ready for next command
1230 717
1231 718 ;*********************************************************************
1232 719 ;* Read Byte Command - read specified address and return the data
1233 720 ;* 8-bit command code from host to SCI0 RxD
1234 721 ;* 16-bit address (high byte first) from host to SCI0 RxD
1235 722 ;* 8-bit data sent back to host through SCI0 TxD
1236 723 ;*********************************************************************
1237 724 a00FAF4 16FC 71 RdByteCmd: jsr getX ;get address to read from
1238 725 a00FAF7 A600 ldaa ,x ;read the requested location
1239 726 a00FAF9 16FC 85 jsr PutChar ;send it out SCI0
1240 727 a00FAFC 06F8 AF jmp CommandOK ;ready for next command
1241 728
1242 729 ;*********************************************************************
1243 730 ;* Read Word Command - read specified block of data
1244 731 ;* 8-bit command code from host to SCI0 RxD
1245 732 ;* 16-bit address (high byte first) from host to SCI0 RxD
1246 733 ;* 16-bit number sent back to host through SCI0 TxD
1247 734 ;* Special case of block read.
1248 735 ;*********************************************************************
1249 736 a00FAFF 16FC 71 RdWordCmd: jsr getX ;get address to read from
1250 737 a00FB02 EC00 sendExit: ldd ,x ;read the requested location
1251 738 a00FB04 16FC 85 jsr PutChar ;send it out SCI0
1252 739 a00FB07 180F tba
1253 740 a00FB09 16FC 85 jsr PutChar ;send it out SCI0
1254 741 a00FB0C 06F8 AF jmp CommandOK ;ready for next command
1255 742
1256 743 ;*********************************************************************
1257 744 ;* Read Command - read specified block of data
1258 745 ;* 8-bit command code from host to SCI0 RxD
1259 746 ;* 16-bit address (high byte first) from host to SCI0 RxD
1260 747 ;* 8-bit number of bytes-1 to sent back to host through SCI0 TxD
1261 748 ;*********************************************************************
1262 749 a00FB0F 16FC 71 ReadCmd: jsr getX ;get address to read from
1263 750 a00FB12 16FC 7C jsr GetChar ;get number of bytes to read
1264 751 a00FB15 180E tab
1265 752 a00FB17 52 incb ;correct counter (0 is actually 1)
1266 753 a00FB18 A600 ReadNext: ldaa ,x ;read the requested location
1267 754 a00FB1A 16FC 85 jsr PutChar ;send it out SCI0
1268 755 a00FB1D 08 inx
1269 756 a00FB1E 53 decb
Metrowerks HC12-Assembler
(c) COPYRIGHT METROWERKS 1987-2003
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
1270 757 a00FB1F 26F7 bne ReadNext
1271 758 a00FB21 86E0 ldaa #ErrNone ;code for no errors ($E0)
1272 759 a00FB23 06F8 B1 xPrompt: jmp Prompt ;ready for next command
1273 760
1274 761 ;*********************************************************************
1275 762 ;* Write Command - write specified block of data
1276 763 ;* 8-bit command code from host to SCI0 RxD
1277 764 ;* 16-bit address (high byte first) from host to SCI0 RxD
1278 765 ;* 8-bit number of bytes-1 to write from host to SCI0 TxD
1279 766 ;* 8-bit values to write
1280 767 ;* this
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -