📄 vaxeditpc.s
字号:
# r5 - address of next character to be stored in output character string # # implicit input: # # several registers are used to contain intermediate state, passed # from one action routine to the next. # # r7 - contains lastest digit from input stream (output from eo_read) # r11 - pseudo-psw that contains the saved condition codes # # side effects: # # the remaining registers are used as scratch by the action routines. # # r6 - scratch register used only by access violation handler # r7 - output parameter of eo_read routine # r8 - scratch register used by pattern-specific routines # # output parameters: # # the actual output depends on the pattern operator that is currently # executing. the routine headers for each routine will describe the # specific output parameters. #- #+ # functional description: # # this routine reads the next digit from the input packed decimal # string and passes it back to the caller. # # input parameters: # # r0 - updated length of input decimal string # r1 - address of next byte of input decimal string # r9 - count of extra zeros (see eo$adjust_input) # # (sp) - return address to caller of this routine # # note that r9<15:0> contains the data described by the architecture as # appearing in r0<31:16>. in the event of an restartable exception # (access violation or reserved operand fault due to an illegal pattern # operator), the contents of r9<15:0> will be stored in r0<31:16>. in # order for the instruction to be restarted, the "zero count" (the # contents of r9) must be preserved. while any available field will do # in the event of an access violation, the use of r0<31:16> is clearly # specified for a reserved operand fault. # # output parameters: # # The behavior of this routine depends on the contents of r9 # # r9 is zero on input # # r0 - updated by one # r1 - updated by one if r0<0> is clear on input # r7 - next decimal digit in input string # r9 - unchanged # # psw<z> is set if the digit is zero, clear otherwise # # r9 is nonzero (lss 0) on input # # r0 - unchanged # r1 - unchanged # r7 - zero # r9 - incremented by one (toward zero) # # psw<z> is set # # notes: # #-eo_read: tstl r9 # check for "r0" lss 0 bneq 2f # special code if nonzero decl r0 # insure that digits still remain blss 3f # reserved operand if none blbc r0,1f # next code path is flip flop # r0 was even on input (and is now odd), indicating that we want the low # order nibble in the input stream. the input pointer r1 must be advanced # to point to the next byte. # mark_point read_1 .text .text 2 .set table_size, table_size + 1 .word read_1 - module_base .text 3 .word read_1 - module_base .textLread_1: extzv $0,$4,(r1)+,r7 # load low order nibble into r7 rsb # Return with information in Z-bit # r0 was odd on input (and is now even), indicating that we want the high # order nibble in the input stream. the next pass through this routine will # pick up the low order nibble of the same input byte. # mark_point read_2 .text .text 2 .set table_size, table_size + 1 .word Lread_2 - module_base .text 3 .word read_2 - module_base .textLread_2:1: extzv $4,$4,(r1 ),r7 # load high order nibble into r7 rsb # return with information in z-bit # r9 was nonzero on input, indicating that zeros should replace the original # input digits.2: incl r9 # advance r9 toward zero clrl r7 # behave as if we read a zero digit rsb # return with z-bit set # the input decimal string ran out of digits before its time. the architecture # dictates that r3 points to the pattern operator that requested the input # digit and r0 contains a -1 when the reserved operand abort is reported. # it is not necessary to load r0 here. r0 already contains -1 because it # just turned negative3: decl r3 # back up r3 to current pattern operator addl2 $8,sp # discard two return pcs brw editpc_roprand_abort # branch aid for reserved operand abort #+ # functional description: # # insert a fixed character, substituting the fill character if # not significant. # # input parameters: # # r2 - fill character # r3 - address of character to be inserted if significance is set # r5 - address of next character to be stored in output character string # r11<c> - current setting of significance # # output parameters: # # character in pattern stream (or fill character if no significance) # is stored in the the output string. # # r3 - advanced beyond character in pattern stream # r5 - advanced one byte as a result of the store operation #-eo$insert_routine: bbc $psl$v_c,r11,1f # skip next if no significance # mark_point insert_1 .text .text 2 .set table_size, table_size + 1 .word Linsert_1 - module_base .text 3 .word insert_1 - module_base .textLinsert_1: movb (r3)+,(r5)+ # store "ch" in output string rsb # mark_point insert_2 .text .text 2 .set table_size, table_size + 1 .word Linsert_2 - module_base .text 3 .word insert_2 - module_base .textLinsert_2:1: movb r2,(r5)+ # store fill character incl r3 # skip over unused character rsb #+ # functional description: # # the contents of the sign register are placed into the output string. # # input parameters: # # r4 - sign character # r5 - address of next character to be stored in output character string # # output parameters: # # sign character is stored in the the output string. # # r5 - advanced one byte as a result of the store operation #-eo$store_sign_routine: # mark_point store_sign_1 .text .text 2 .set table_size, table_size + 1 .word Lstore_sign_1 - module_base .text 3 .word store_sign_1 - module_base .textLstore_sign_1: movb r4,(r5)+ # store sign character rsb #+ # functional description: # # the contents of the fill register are placed into the output string # a total of "repeat" times. # # input parameters: # # r2 - fill character # r5 - address of next character to be stored in output character string # # -1(r3)<3:0> - repeat count is stored in right nibble of pattern operator # # output parameters: # # fill character is stored in the output string "repeat" times # # r5 - advanced "repeat" bytes as a result of the store operations #-eo$fill_routine: # mark_point fill_1 .text .text 2 .set table_size, table_size + 1 .word Lfill_1 - module_base .text 3 .word fill_1 - module_base .textLfill_1: extzv $0,$4,-1(r3 ),r8 # get repeat count from pattern operator # mark_point fill_2, restart .text 2 .set table_size,table_size + 1 .word Lfill_2 - module_base .text 3 .word fill_2 - module_base .text 1 .set restart_table_size,restart_table_size+1 .set fill_2_restart,restart_table_size .word Lfill_2 - module_base .textLfill_2:1: movb r2,(r5)+ # store fill character sobgtr r8,1b # test for end of loop rsb #+ # functional description: # # the right nibble of the pattern operator is the repeat count. for # repeat times, the following algorithm is executed. the next digit is # moved from the source to the destination. if the digit is non-zero, # significance is set and zero is cleared. if the digit is not # significant (i.e., is a leading zero) it is replaced by the contents # of the fill register in the destination. #-eo$move_routine: # mark_point move_1 .text .text 2 .set table_size, table_size + 1 .word Lmove_1 - module_base .text 3 .word move_1 - module_base .textLmove_1: extzv $0,$4,-1(r3 ),r8 # get repeat count1: # 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 this digit zero? beql 3f # branch if yes bisb2 $psl$m_c,r11 # indicate significance bicb2 $psl$m_z,r11 # also indicate nonzero # mark_point move_2, restart .text 2 .set table_size,table_size + 1 .word Lmove_2 - module_base .text 3 .word move_2 - module_base .text 1 .set restart_table_size,restart_table_size+1 .set move_2_restart,restart_table_size .word Lmove_2 - module_base .textLmove_2:2: addb3 $zero,r7,(r5)+ # store digit in output stream sobgtr r8,1b # test for end of loop rsb3: bbs $psl$v_c,r11,2b # if significance, then store digit # mark_point move_3, restart .text 2 .set table_size,table_size + 1 .word Lmove_3 - module_base .text 3 .word move_3 - module_base .text 1 .set restart_table_size,restart_table_size+1 .set move_3_restart,restart_table_size .word Lmove_3 - module_base .textLmove_3: movb r2,(r5)+ # otherwise, store fill character sobgtr r8,1b # test for end of loop rsb #+ # functional description: # # the right nibble of the pattern operator is the repeat count. for # repeat times, the following algorithm is executed. the next digit # from the source is examined. if it is non-zero and significance is # not yet set, then the contents of the sign register is stored in the # destination, significance is set, and zero is cleared. if the digit # is significant, it is stored in the destination, otherwise the # contents of the fill register is stored in the destination. #-eo$float_routine: # mark_point float_1 .text .text 2 .set table_size, table_size + 1 .word Lfloat_1 - module_base .text 3 .word float_1 - module_base .textLfloat_1: extzv $0,$4,-1(r3 ),r8 # get repeat count1: # eo_read .text 1 .set restart_table_size,restart_table_size+1 .word 0f - module_base .text0: bsbw eo_read # get next input digit bbs $psl$v_c,r11,2f # if significance, then store digit # cmpb $zero,r7 # is this digit zero? beql 3f # branch if yes. store fill character. # mark_point float_2,restart .text 2 .set table_size,table_size + 1 .word Lfloat_2 - module_base .text 3 .word float_2 - module_base .text 1 .set restart_table_size,restart_table_size+1 .set float_2_restart,restart_table_size .word Lfloat_2 - module_base .textLfloat_2: movb r4,(r5)+ # store sign bisb2 $psl$m_c,r11 # indicate significance bicb2 $psl$m_z,r11 # also indicate nonzero # mark_point float_3,restart .text 2 .set table_size,table_size + 1 .word Lfloat_3 - module_base .text 3 .word float_3 - module_base .text 1 .set restart_table_size,restart_table_size+1 .set float_3_restart,restart_table_size .word Lfloat_3 - module_base .textLfloat_3:2: addb3 $zero,r7,(r5)+ # store digit in output stream sobgtr r8,1b # test for end of loop rsb3: # mark_point float_4,restart .text 2 .set table_size,table_size + 1 .word Lfloat_4 - module_base .text 3 .word float_4 - module_base .text 1 .set restart_table_size,restart_table_size+1 .set float_4_restart,restart_table_size .word Lfloat_4 - module_base .textLfloat_4: movb r2,(r5)+ # otherwise, store fill character sobgtr r8,1b # test for end of loop rsb #+ # functional description: #
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -