สำนักงานราชบัณฑิตยสภา
165 ศ. ดร.มงคล เดชนคริ นทร์ วารสารราชบัณฑิตยสถาน ปีที่ ๓๘ ฉบับที่ ๓ ก.ค.-ก.ย. ๒๕๕๖ - 20 - ; Page 5 B_RKP: CALL GET_NUM ;get brkpt addr using DX MOV DI,BR_STAT MOV AL,BYTE PTR[DI] ;get brkpt status CMP AL,0 ;check brkpt status JZ DO_BP ;no brkpt saved; save it CALL BLANK ;send a blank LEA SI,BP_AS ;brkpt alrdy saved CALL S_END ;send message to PC JMP GET_COM ;get next command DO_BP: MOV DI,B_MMA MOV WORD PTR[DI],DX ;save brkpt in rsvd mem MOV SI,DX ;save DX in SI MOV AL,BYTE PTR[SI] ;get byte at brkpt MOV DI,OP_KODE MOV BYTE PTR[DI],AL ;then save it rsvd mem MOV AL,0CCH ;insert brkpt code (CC=>INT 3H) MOV BYTE PTR[SI],AL ;at designated byte MOV DI,BR_STAT MOV BYTE PTR[DI],1 ;set brkpt status flag CALL BLANK LEA SI,BP_SA ;ptr to msg: brkpt saved CALL S_END ;display on PC JMP GET_COM ;get new command ; C Command, Clear breakpoint C_BRP: MOV DI,BR_STAT MOV AL,BYTE PTR[DI] ;check brkpt status CMP AL,1 ;brkpt saved? JZ OP_LD ;yes, brkpt exists CALL BLANK LEA SI,BR_ALC ;ptr to msg: brkpt alrdy saved CALL S_END ;display on PC JMP GET_COM ;get next command OP_LD: CALL BLANK LEA SI,BR_CLR ;ptr to msg: brkpt cleared CALL S_END ;display on PC MOV DI,B_MMA MOV SI,WORD PTR[DI] ;load brkpt addr from rsvd mem MOV DI,OP_KODE MOV AL,BYTE PTR[DI] ;load usr opcode byte MOV BYTE PTR[SI],AL ;restore user prog byte ; Page 6 MOV DI,BR_STAT MOV BYTE PTR[DI],0 ;clear brkpt status flag JMP GET_COM ; D Command, Dump memory contents D_UMP: CALL GET_NUM ;get start addr using DX PUSH DX ;save it on stack CALL BLANK ;send blank to PC CALL GET_NUM ;get end addr using DX POP SI ;retrieve start addr SUB DX,SI ;block length - 1 MOV CX,DX INC CX ;CX = block length MOV DX,SI ;get start addr JMP DO_DMP ;go dump mem CHK_ADR: ;check addr wrap around MOV DX,SI MOV AL,DL ;get lo byte of DX AND AL,0FH ;get lo nibble of DL JNZ NO_ADR ;if 0, no wrap around DO_DMP: CALL CRLF ;start new line CALL H_OUT ;show addr up front CALL BLANK ;plus a blank NO_ADR: CALL BLANK ;send a blank MOV AL,[SI] ;get a byte from mem CALL HTOA ;convert to ascii and show them INC SI ;get next byte LOOP CHK_ADR ;check wrap around JMP GET_COM ;get next command ; E Command, Enter new data for registers I_NIT: MOV SI,0 ;init ptr MOV CX,11 ;cntr for 11 regs I_NEX: CALL BLANK MOV AL,R_LETS[SI] ;reg name, first char CALL C_OUT MOV AL,R_LETS[SI+1] ;reg name, 2nd char CALL C_OUT CALL BLANK
Made with FlippingBook
RkJQdWJsaXNoZXIy NTk0NjM=