📄 s12sermon2r1.lst
字号:
824 311 a00F8A8 16FC 85 jsr PutChar ;send error code (1st prompt char)
825 312 a00F8AB 8608 ldaa #StatCold ;status code for cold start ($08)
826 313 a00F8AD 200C bra EndPrompt ;finish warm start prompt
827 314 ;
828 315 ; normal entry point after a good command
829 316 ; Prompt is an alt entry point if an error occurred during a command
Metrowerks HC12-Assembler
(c) COPYRIGHT METROWERKS 1987-2003
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
830 317 ; endPrompt is an alternate entry for Trace1, Break (SWI), Halt,
831 318 ; or warm/cold resets so an alternate status value can be sent
832 319 ; with the prompt
833 320 ;
834 321
835 322 a00F8AF 86E0 CommandOK: ldaa #ErrNone ;code for no errors ($E0)
836 323 a00F8B1 16FC 85 Prompt: jsr PutChar ;send error code
837 324 a00F8B4 96CA ldaa flagReg ;0 means monitor active mode
838 325 a00F8B6 8408 anda #RunFlag ;mask for run/monitor flag (SCI WAKE)
839 326 a00F8B8 44 lsra ;shift flag to LSB
840 327 a00F8B9 44 lsra ; for output as status
841 328 a00F8BA 44 lsra ;$00=monitor active, $01=run
842 329 a00F8BB 16FC 85 EndPrompt: jsr PutChar ;send status code
843 330 a00F8BE 863E ldaa #'>'
844 331 a00F8C0 16FC 85 jsr PutChar ;send 3rd character of prompt seq
845 332
846 333 ;test flagReg for run / DBG arm status.
847 334 a00F8C3 4FCA 080A brclr flagReg,RunFlag,Prompt1 ;no exit if run flag clr
848 335 a00F8C7 4FCA 2003 brclr flagReg,ArmFlag,PromptRun ;If DBG was not armed just run
849 336 a00F8CB 4C20 40 bset DBGC1,ARM ;re-arm DBG module
850 337 a00F8CE 06FC 61 PromptRun: jmp GoCmd ;run mode so return to user program
851 338
852 339
853 340 a00F8D1 16FC 7C Prompt1: jsr GetChar ;get command code character
854 341 a00F8D4 CEF8 EA ldx #commandTbl ;point at first command entry
855 342 a00F8D7 A100 CmdLoop: cmpa ,x ;does command match table entry?
856 343 a00F8D9 270B beq DoCmd ;branch if command found
857 344 a00F8DB 1A03 leax 3,x
858 345 a00F8DD 8EF9 2F cpx #tableEnd ;see if past end of table
859 346 a00F8E0 26F5 bne CmdLoop ;if not, try next entry
860 347 a00F8E2 86E1 ldaa #ErrCmnd ;code for unrecognized command
861 348 a00F8E4 20CB bra Prompt ;back to prompt; command error
862 349
863 350 a00F8E6 EE01 DoCmd: ldx 1,x ;get pointer to command routine
864 351 a00F8E8 0500 jmp ,x ;go process command
865 352 ;
866 353 ; all commands except GO, Trace_1, and Reset to user code - jump to
867 354 ; Prompt after done. Trace_1 returns indirectly via a SWI.
868 355 ;
869 356 ;*********************************************************************
870 357 ;* Command table for bootloader/monitor commands
871 358 ;* each entry consists of an 8-bit command code + the address of the
872 359 ;* routine to be executed for that command.
873 360 ;*********************************************************************
874 361 a00F8EA A1 commandTbl: fcb $A1
875 362 a00F8EB FAF4 fdb RdByteCmd ;read byte
876 363 a00F8ED A2 fcb $A2
877 364 a00F8EE FB7F fdb WtByteCmd ;write byte
878 365 a00F8F0 A3 fcb $A3
879 366 a00F8F1 FAFF fdb RdWordCmd ;read word of data
880 367 a00F8F3 A4 fcb $A4
881 368 a00F8F4 FB99 fdb WtWordCmd ;write word of data
882 369 a00F8F6 A5 fcb $A5
883 370 a00F8F7 FB6A fdb RdNextCmd ;read next word
884 371 a00F8F9 A6 fcb $A6
885 372 a00F8FA FBA1 fdb WtNextCmd ;write next word
886 373 a00F8FC A7 fcb $A7
887 374 a00F8FD FB0F fdb ReadCmd ;read n bytes of data
888 375 a00F8FF A8 fcb $A8
889 376 a00F900 FB26 fdb WriteCmd ;write n bytes of data
890 377 a00F902 A9 fcb $A9
891 378 a00F903 FBBF fdb RdRegsCmd ;read CPU registers
892 379 a00F905 AA fcb $AA
893 380 a00F906 FC16 fdb WriteSpCmd ;write SP
Metrowerks HC12-Assembler
(c) COPYRIGHT METROWERKS 1987-2003
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
894 381 a00F908 AB fcb $AB
895 382 a00F909 FC0E fdb WritePcCmd ;write PC
896 383 a00F90B AC fcb $AC
897 384 a00F90C FC06 fdb WriteIYCmd ;write IY
898 385 a00F90E AD fcb $AD
899 386 a00F90F FBFE fdb WriteIXCmd ;write IX
900 387 a00F911 AE fcb $AE
901 388 a00F912 FBF0 fdb WriteDCmd ;write D
902 389 a00F914 AF fcb $AF
903 390 a00F915 FBE8 fdb WriteCcrCmd ;write CCR
904 391 a00F917 B1 fcb $B1
905 392 a00F918 FC61 fdb GoCmd ;go
906 393 a00F91A B2 fcb $B2
907 394 a00F91B FC39 fdb Trace1Cmd ;trace 1
908 395 a00F91D B3 fcb $B3
909 396 a00F91E F943 fdb HaltCmd ;halt
910 397 a00F920 B4 fcb $B4
911 398 a00F921 F97C fdb ResetCmd ;reset - to user vector or monitor
912 399 ; $B5 - Command not implemented
913 400 a00F923 B6 fcb $B6 ;code - erase flash command
914 401 a00F924 F9ED fdb EraseAllCmd ;erase all flash and eeprom command routine
915 402 a00F926 B7 fcb $B7 ;return device ID
916 403 a00F927 F92F fdb DeviceCmd
917 404 a00F929 B8 fcb $B8 ;erase current flash bank selected in PPAGE
918 405 a00F92A FAA5 fdb ErsPage
919 406 a00F92C B9 fcb $B9 ;Bulk erase eeprom if available
920 407 a00F92D F9BB fdb EraseEECmd ;
921 408 0000 F92F tableEnd: equ * ;end of command table marker
922 409
923 410 ;*********************************************************************
924 411 ;* Device ID Command - Ouputs hex word from device ID register
925 412 ;*********************************************************************
926 413 a00F92F 86DC DeviceCmd: ldaa #$DC ;get part HCS12 descripter
927 414 a00F931 16FC 85 jsr PutChar ;out to term
928 415 a00F934 961A ldaa PARTIDH ;get part ID high byte
929 416 a00F936 16FC 85 jsr PutChar ;out to term
930 417 a00F939 961B ldaa PARTIDL ;get part ID low byte
931 418 a00F93B 16FC 85 jsr PutChar ;out to term
932 419 a00F93E 86E0 ldaa #ErrNone ;error code for no errors
933 420 a00F940 06F8 B1 jmp Prompt ;ready for next command
934 421
935 422
936 423 ;*********************************************************************
937 424 ;* Halt Command - halts user application and enters Monitor
938 425 ;* This command is normally sent by the debugger while the user
939 426 ;* application is running. It changes the state variable in order
940 427 ;* to stay in the monitor
941 428 ;*********************************************************************
942 429 a00F943 4DCA 08 HaltCmd: bclr flagReg,RunFlag ;run/mon flag = 0; monitor active
943 430 a00F946 86E0 ldaa #ErrNone ;error code for no errors
944 431 a00F948 16FC 85 jsr PutChar ;send error code
945 432 a00F94B 8602 ldaa #StatHalt ;status code for Halt command
946 433 a00F94D 06F8 BB jmp EndPrompt ;send status and >
947 434 ;*********************************************************************
948 435 ;* Halt or continue user code by Rx interrupt of SCI. User code will
949 436 ;* continue if Run load switch is in run position and a resonable
950 437 ;* Sci user vector is found.
951 438 ;*********************************************************************
952 439 a00F950 4F20 4006 SciIsr: brclr DBGC1,ARM,SciIsr1 ;Arm not set so continue
953 440 ;above must be brclr as COF will be
954 441 ;Stored in trace buffer
955 442 a00F954 4CCA 20 bset flagReg,ArmFlag ;Save ARM flag
956 443 a00F957 4D20 40 bclr DBGC1,ARM ;Arm bit in Dbgc1 cleared to stop DBG
957 444 a00F95A 4C0C 01 SciIsr1: bset SwPullup,mSwPullup ;enable pullup on monitor sw
Metrowerks HC12-Assembler
(c) COPYRIGHT METROWERKS 1987-2003
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
958 445 a00F95D 4CCA 08 bset flagReg,RunFlag ;set run/mon flag (run mode)
959 446 a00F960 C600 ldab #AllowSci0 ; defined in the .def file
960 447 a00F962 C101 cmpb #$01 ; is it set?
961 448 a00F964 2610 bne SciIsrExit ; if AllowSci0 is set
962 449 ; Test run switch to allow user
963 450 ; Sci0 function to run
964 451 ;**********************************************************************
965 452 ;* Force monitor if SwPort bit SWITCH = 0
966 453 ;* Note: this port is configured after reset as input with pull-up
967 454 ;* if this pin in not connect sci0 will be directed to user sci0
968 455 ;**********************************************************************
969 456 a00F966 D600 ldab SwPort ;get port value
970 457 a00F968 C540 bitb #Switch ;test the sw bit
971 458 a00F96A 270A beq SciIsrExit
972 459 ;*********************************************************************
973 460 ;* This routine checks for an unprogrammed SCI0 user interrupt
974 461 ;* vector and returns to monitor if execution of an unprogrammed
975 462 ;* user SCI0 vector is attempted
976 463 ;*********************************************************************
977 464 a00F96C FDF7 D6 ldy $F000+(vector20-BootStart) ; Get user SCI vector
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -