Category: Assembly Language
System Software – SIC/XE Program to clear 20 byte string to empty
Problem Statement Write a sequence of instructions for SIC/XE to clear a 20-byte string to all blanks. Solution Line Number(ac) Code Description 1 LDX ZERO 2 LOOP LDCH BLANK 3 STCH STR1,X 4 TIX TWENTY 5 JLT LOOP 6 STR1 RESW 20 7 BLANK BYTE C ‘ ‘ 8 ZERO WORD 0 9 TWENTY WORD 20
System Software – SIC Program to swap the values of ALPHA and BETA
Problem Statement Write a sequence of instructions for SIC to swap the values of ALPHA and BETA. Solution Line Number(ac) Code Description 1 LDA ALPHA Load the value of ALPHA in Accumulator 2 STA GAMMA Store the value of Accumulator to GAMMA 3 LDA BETA Load the value of BETA to Accumulator 4 STA ALPHA Store the value of Accumulator to ALPHA 5 LDA GAMMA…
System Software – SIC/XE Program to find the maximum element in the array and store result in MAX
Problem Statement Assume that ALPHA is an array of 100 words. Write a sequence of instructions for SIC/XE to find the maximum element in the array and store results in MAX. Solution Line Number Code Comment LDS #3 LDT #300 LDX #0 CLOOP LDA ALPHA, X COMP MAX JLT NOCH STA MAX…
System Software – SIC/XE Program to multiply two arrays
Problem Statement Assume that ALPHA and BETA are the two arrays of 100 words. Another array of GAMMA elements are obtained by multiplying the corresponding ALPHA element by 4 and adding the corresponding BETA elements. Solution Line Number Code Comments 1 LDS #3 2 LDT #300 3 LDX #0 4 ADDLOOP LDA ALPHA, X 5 MUL #4 6 ADD BETA,…
System Software – SIC/XE program to clear 20 byte string using Immediate addressing mode.
Problem Statement Write a sequence of instructions for SIC/XE to clear a 20-byte string to all blanks. Use immediate addressing and register-to-register instructions to make the process as efficient as possible. Solution Line Number(ac) Code Description 1 LDT #20 2 LDX #0 3 LOOP LDCH #0 4 STCH STR1,X 5 TIXR T 6 JLT LOOP 7 STR1 RESW 20…
System Software – SIC/XE Program to divide BETA by GAMMA and set quotient and remainder
Problem Statement Write a sequence of instructions for SIC/XE to divide BETA by GAMMA, setting ALPHA to the integer portion of the quotient and DELTA to the remainder. Use register-to-register instructions to make the calculation as efficient as possible. Solution Line Number(ac) Code Description 1 LDA BETA Load the value of BETA to accumulator 2 LDS GAMMA Load the value of GAMMA to register S…
System Software – SIC/XE Program to set 100 elements of the array to 0 using immediate addressing mode
Problem Statement Assume that ALPHA is an array of 100 words. Write a sequence of instructions for SIC/XE to set all 100 elements of the array to 0. Use immediate addressing and register-to-register instructions to make the process as efficient as possible. Solution Line Number Code Comments 1 LDS #3 2 LDT #300 3 LDX #0 4 LOOP LDA #0 5…
System Software – SIC Program to set ALPHA equal to integer portion of BETA/GAMMA
Problem Statement Write a sequence of instructions for SIC to set ALPHA equal to the integer portion of BETA / GAMMA. Assume that ALPHA and BETA are defined as in Fig. 1.3(a). Solution Line Number(ac) Code Description 1 LDA BETA Load the value of BETA to accumulator 2 DIV GAMMA Divide the value of accumulator by GAMMA 3 STA ALPHA Store the value of accumulator…
System Software – SIC/XE Program to write a subroutine for SIC that writes record on to device 05
Problem Statement Suppose that RECORD contains a 100-byte record. Write a subroutine for SIC that will write this record on to device 05. Solution Line Number Code Comment 1 JSUB WRREC 2 WRREC LDX ZERO 3 WLOOP TD OUTPUT 4 JEQ WLOOP 5 LDCH RECORD, X 6 WD OUTPUT 7 TIX LENGTH 8 JLT WLOOP 9 RSUB…
System Software – SIC Program to set ALPHA equal to Product of Beta and Gamma
Problem Statement Write a sequence of instructions for SIC to set ALPHA equal to the product of BETA and GAMMA. Assume that ALPHA, BETA, and GAMMA are defined as in Fig. 1.3(a). Solution Line Number(ac) Code Description 1 LDA BETA Load the value of BETA in Accumulator 2 MUL GAMMA Multiply the value of GAMMA with accumulator and the result will be stored in Accumulator…
System Software – SIC/XE Program to set ALPHA=GAMMA*BETA-9 using Register Operation
Problem Statement Write a sequence of instructions for SIC/XE to set ALPHA=GAMMA*BETA-9 using register operation. Solution Line Number(ac) Code Description 1 LDA GAMMA 2 MUL BETA 3 SUB 9 4 STA ALPHA
System Software – SIC/XE Program to arrange an array of 100 words in ascending order
Problem Statement Suppose that ALPHA is an array of 100 words. Write a sequence of instruction for SIC/XE to arrange the 100 words in ascending order and store result in an array BETA of 100 elements. Solution Line Number Code Comments 1 SORT START 0 2 OUTER LDX INDEX 3 LDS ARR1,X 4 LDX #0 5 INNER LDT ARR1,X 6…
System Software – SIC/XE Program to write a subroutine for SIC that will read a record into a buffer
Problem Statement Write a subroutine for SIC that will read a record into a buffer. The record may be any length from 1 to 100 bytes. The end of record is marked with a “null” character (ASCII code 00). The subroutine should place the length of the record read into a variable named LENGTH. Solution Line Number Code Comments 1 RDREC LDX ZERO 2…
System Software – SIC/XE Program to divide BETA by GAMMA and set ALHPA to floating quotient
Problem Statement Write a sequence of instructions for SIC/XE to divide BETA by GAMMA, setting ALPHA to the value of the quotient, rounded to the nearest integer. Use register-to-register instructions to make the calculation as efficient as possible. Solution Line Number(ac) Code Description 1 LDF BETA 2 DIVF GAMMA 3 FIX 4 STA ALPHA 5 ALPHA RESW 1 6 BETA…
System Software – SIC/XE program to copy a character string to another string
Write a SIC/XE program a program to copy a character string to another char string
System Software – Given the target address generated for the following machine instruction
System Software – Given the target address generated for the following machine instruction
System Software – SIC/XE Program to set ALPHA equal to 4 * BETA – 9.
Problem Statement Write a sequence of instructions for SIC/XE to set ALPHA equal to 4 * BETA – 9. Assume that ALPHA and BETA are defined as in Fig 1.3(b). Use immediate addressing for the constants. Solution Line Number(ac) Code Description 1 LDA BETA Load the value of BETA in Accumulator 2 LDS #4 Load the value 4 to Register S 3 MULR S,A Multiply…
System Software – SIC program to set 100 elements of array to Zero
Problem Statement Suppose that ALPHA is an array of 100 words, as defined in Fig. 1.5(a). Write a sequence of instructions for SIC to set all 100 elements of the array to 0. Solution Line Number(ac) Code Description 1 LDA ZERO 2 STA INDEX 3 LOOP LDX INDEX 4 LDA ZERO 5 STA ALPHA, X 6 LDA INDEX 7…
System Software – SIC/XE Program to Write a subroutine to read a record into a buffer
Problem Statement Write a subroutine for SIC/XE that will read a record into a buffer. The record may be any length from 1 to 100 bytes. The end of record is marked with a “null” character (ASCII code 00). The subroutine should place the length of the record read into a variable named LENGTH. Use immediate addressing and register-to-register instructions to make the process as…