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 | RLOOP TD INDEV | |
| 3 | JEQ RLOOP | |
| 4 | RD INDEV | |
| 5 | COMP NULL | |
| 6 | JEQ EXIT | |
| 7 | STCH BUFFER, X | |
| 8 | TIX K100 | |
| 9 | JLT RLOOP | |
| 10 | EXIT STX LENGTH | |
| 11 | RSUB | |
| 12 | ZERO WORD 0 | |
| 13 | NULL WORD 0 | |
| 14 | K100 WORD 1 | |
| 15 | INDEV BYTE X ‘F1’ | |
| 16 | LENGTH RESW 1 | |
| 17 | BUFFER RESB 100 |
Leave a Reply