📄 vaxeditpc.s
字号:
# if the floating sign has not yet been placed into the destination # string (that is, if significance is not yet set ), then the contents # of the sign register are stored in the output string and significance # is set. # # input parameters: # # r4 - sign character # r5 - address of next character to be stored in output character string # r11<c> - current setting of significance # # output parameters: # # sign character is optionally stored in the output string (if # significance was not yet set). # # r5 - optionally advanced one byte as a result of the store operation # r11<c> - (significance) is unconditionally set #-eo$end_float_routine: bbss $psl$v_c,r11,1f # test and set significance # mark_point end_float_1 .text .text 2 .set table_size, table_size + 1 .word Lend_float_1 - module_base .text 3 .word end_float_1 - module_base .textLend_float_1: movb r4,(r5)+ # store sign character1: rsb #+ # functional description: # # the pattern operator is followed by an unsigned byte integer length. # if the value of the source string is zero, then the contents of the # fill register are stored into the last length bytes of the destination # string. # # input parameters: # # r2 - fill character # r3 - address of "length", number of characters to blank # r5 - address of next character to be stored in output character string # r11<z> - set if input string is zero # # output parameters: # # contents of fill register are stored in last "length" characters # of output string if input string is zero. # # r3 - advanced one byte over "length" # r5 - unchanged # # side effects: # # r8 is destroyed #-eo$blank_zero_routine: # mark_point blank_zero_1 .text .text 2 .set table_size, table_size + 1 .word Lblank_zero_1 - module_base .text 3 .word blank_zero_1 - module_base .textLblank_zero_1: movzbl (r3)+,r8 # get length bbc $psl$v_z,r11,2f # skip rest if source string is zero subl2 r8,r5 # back up destination pointer # mark_point blank_zero_2, restart .text 2 .set table_size,table_size + 1 .word Lblank_zero_2 - module_base .text 3 .word blank_zero_2 - module_base .text 1 .set restart_table_size,restart_table_size+1 .set blank_zero_2_restart,restart_table_size .word Lblank_zero_2 - module_base .textLblank_zero_2:1: movb r2,(r5)+ # store fill character sobgtr r8,1b # check for end of loop2: rsb #+ # functional description: # # if the value of the source string is zero, then the contents of the # fill register are stored into the byte of the destination string # that is "length" bytes before the current position. # # input parameters: # # r2 - fill character # r3 - address of "length", number of characters to blank # r5 - address of next character to be stored in output character string # r11<z> - set if input string is zero # # output parameters: # # contents of fill register are stored in byte of output string # "length" bytes before current position if input string is zero. # # r3 - advanced one byte over "length" # r5 - unchanged # # side effects: # # r8 is destroyed #-eo$replace_sign_routine: # mark_point replace_sign_1 .text .text 2 .set table_size, table_size + 1 .word Lreplace_sign_1 - module_base .text 3 .word replace_sign_1 - module_base .textLreplace_sign_1: movzbl (r3)+,r8 # get length bbc $psl$v_z,r11,1f # skip rest if source string is zero subl3 r8,r5,r8 # get address of indicated byte # mark_point replace_sign_2 .text .text 2 .set table_size, table_size + 1 .word Lreplace_sign_2 - module_base .text 3 .word replace_sign_2 - module_base .textLreplace_sign_2: movb r2,(r8) # store fill character1: rsb #+ # functional description: # # the contents of the fill or sign register are replaced with the # character that follows the pattern operator in the pattern stream. # # eo$load_fill load fill register # # eo$load_sign load sign register # # eo$load_plus load sign register if source string is positive (or zero) # # eo$load_minus load sign register if source string is negative # # input parameters: # # r3 - address of character to be loaded # r11<n> - set if input string is lss zero (negative) # # output parameters: # # if entry is at eo$load_fill, the fill register contents (r2<7:0>) are # replaced with the next character in the pattern stream. # # if one of the other entry points is used (and the appropriate conditions # obtain ), the contents of the sign register are replaced with the next # character in the pattern stream. for simplicity of implementation, the # sign character is stored in r4<7:0> while this routine executes. # # in the event of an exception, the contents of r4<7:0> will be stored # in r2<15:8>, either to conform to the architectural specification of # register contents in the event of a reserved operand fault, or to # allow the instruction to be restarted in the event of an access # violation. # # r3 - advanced one byte over new fill or sign character #-eo$load_fill_routine: # mark_point load_xxxx_1 .text .text 2 .set table_size, table_size + 1 .word Lload_xxxx_1 - module_base .text 3 .word load_xxxx_1 - module_base .textLload_xxxx_1: movb (r3)+,r2 # load new fill character rsbeo$load_sign_routine: # mark_point load_xxxx_2 .text .text 2 .set table_size, table_size + 1 .word Lload_xxxx_2 - module_base .text 3 .word load_xxxx_2 - module_base .textLload_xxxx_2: movb (r3)+,r4 # load new sign character into r4 rsbeo$load_plus_routine: bbc $psl$v_n,r11,eo$load_sign_routine # use common code if plus incl r3 # otherwise, skip unused character rsbeo$load_minus_routine: bbs $psl$v_n,r11,eo$load_sign_routine # use common code if minus incl r3 # otherwise, skip unused character rsb #+ # functional description: # # the significance indicator (c-bit in auxiliary psw) is set or # cleared according to the entry point. # # input parameters: # # none # # output parameters: # # eo$clear_signif r11<c> is cleared # # eo$set_signif r11<c> is set #-eo$clear_signif_routine: bicb2 $psl$m_c,r11 # clear significance rsbeo$set_signif_routine: bisb2 $psl$m_c,r11 # set significance rsb #+ # functional description: # # the pattern operator is followed by an unsigned byte integer length in # the range 1 through 31. if the source string has more digits than # this length, the excess leading digits are read and discarded. if any # discarded digits are non-zero then overflow is set, significance is # set, and zero is cleared. if the source string has fewer digits than # this length, a counter is set of the number of leading zeros to # supply. this counter is stored as a negative number in r0<31:16>. #-eo$adjust_input_routine: # mark_point adjust_input_1 .text .text 2 .set table_size, table_size + 1 .word Ladjust_input_1 - module_base .text 3 .word adjust_input_1 - module_base .textLadjust_input_1: movzbl (r3)+,r8 # get "length" from pattern stream subl3 r8,r0,r8 # is length larger than input length? blequ 3f # branch if yes clrl r9 # clear count of zeros ("r0<31:16>")1: # eo_read .text 1 .set restart_table_size,restart_table_size+1 .word 0f - module_base .text0: bsbw eo_read # get next input digit # cmpb $zero,r7 # is it zero? beql 2f # skip to end of loop if zero bicb2 $psl$m_z,r11 # otherwise, indicate nonzero bisb2 $( psl$m_c | psl$m_v ),r11 # indicate significance and overflow2: sobgtr r8,1b # test for end of loop rsb3: movl r8,r9 # store difference into "r0<31:16>" rsb #+ # functional description: # # the edit operation is terminated. # # the architectural description of editpc divides end processing between # the eo$end routine and code at the end of the main loop. this # implementation performs all of the work in a single place. # # the edit operation is terminated. there are several details that this # routine must take care of. # # 1. the return pc to the main dispatch loop is discarded. # # 2. r3 is backed up to point to the eo$end pattern operator. # # 3. a special check must be made for negative zero to insure that # the n-bit is cleared. # # 4. if any digits still remain in the input string, a reserved # operand abort is taken. # # 5. r2 and r4 are set to zero according to the architecture. # # input parameters: # # r0 - number of digits remaining in input string # r3 - address of one byte beyond the eo$end operator # # 00(sp) - return address in dispatch loop in this module (discarded) # 04(sp) - saved r0 # 08(sp) - saved r1 # 12(sp) - saved r6 # 16(sp) - saved r7 # 20(sp) - saved r8 # 24(sp) - saved r9 # 28(sp) - saved r10 # 32(sp) - saved r11 # 36(sp) - return pc to caller of vax$editpc # # output parameters: # # these register contents are dictated by the vax architecture # # if no overflow has occured, then this routine exits through the rsb # instruction with the following output parameters: # # r0 - length in digits of input decimal string # r1 - address of most significant byte of input decimal string # r2 - set to zero to conform to architecture # r3 - backed up one byte to point to eo$end operator # r4 - set to zero to conform to architecture # r5 - address of one byte beyond destination character string # # psl<v> is clear # # if the v-bit is set, then control is transferred to vax$editpc_overflow # where a check for decimal overflow exceptions is made # # the registers are loaded with their correct contents and then saved on # the stack as follows: # # # 00(sp) - saved r0 # 04(sp) - saved r1 # 08(sp) - saved r2 # 12(sp) - saved r3 # 16(sp) - saved r4 # 20(sp) - saved r5 # 24(sp) - saved r6 # 28(sp) - saved r7 # 32(sp) - saved r8 # 36(sp) - saved r9 # 40(sp) - saved r10 # 44(sp) - saved r11 # 48(sp) - return pc to caller of vax$editpc # # psl<v> is set #-eo$end_routine: addl2 $4,sp # discard return pc to main loop decl r3 # back up pattern pointer one byte bbc $psl$v_z,r11,1f # check for negative zero bicb2 $psl$m_n,r11 # turn off n-bit if zero1: tstl r0 # any digits remaining? bneq editpc_roprand_abort # error if yes tstl r9 # any zeros (r0<31:16>) remaining? bneq editpc_roprand_abort # error if yes clrl r2 # architecture specifies that r2 clrl r4 # and r4 are zero on exit bicpsw $( psl$m_n | psl$m_z | psl$m_v | psl$m_c ) # clear condition codes bispsw r11 # set codes according to saved psw bbs $psl$v_v,r11,2f # get out of line if overflow # popr $^m<r0,r1,r6,r7,r8,r9,r10,r11> # restore saved registers popr $0x0fc3 rsb # return to caller's caller # at this point, we must determine whether the dv bit is set. the tests that # must be performed are identical to the tests performed by the overflow # checking code for the packed decimal routines. in order to make use of # that code, we need to set up the saved registers on the stack to match # the input to that routine. note also that the decimal routines specify # that r0 is zero on completion while editpc dictates that r0 contains the # initial value of "srclen". for this reason, we cannot simply branch to # vax$decimal_exit but must use a special entry point.2: # popr $^m<r0,r1> # restore r0 and r1 popr $0x03 # but preserve condition codes # pushr $^m<r0,r1,r2,r3,r4,r5> # ... only to save them again pushr $0x03f # the condition codes were not changed by the previous two instructions. jmp vax$editpc_overflow # join exit code #+ # functional description: # # this routine stores the intermediate state of an editpc instruction # that has been prematurely terminated by an illegal pattern operator. # these exceptions and access violations are the only exceptions from # which execution can continue after the exceptional condition has been # cleared up. after the state is stored in the registers r0 through r5, # control is transferred through vax$roprand to vax$reflect_fault, where # the appropriate backup method is determined, based on the return pc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -