| Spectrum ROM | Routines |
| Prev: 07642 | Up: Map |
|
The READ command allows for the reading of a DATA list and has an effect similar to a series of LET statements.
|
|||||||
| READ_3 | 07660 | RST 32 | Come here on each pass, after the first, to move along the READ statement. | ||||
|
The address of this entry point is found in the parameter table.
|
|||||||
| READ | 07661 | CALL CLASS_01 | Consider whether the variable has been used before; find the existing entry if it has. | ||||
| 07664 | CALL SYNTAX_Z | Jump forward if checking syntax. | |||||
| 07667 | JR Z,READ_2 | ||||||
| 07669 | RST 24 | Save the current pointer CH-ADD in X-PTR. | |||||
| 07670 | LD (23647),HL | ||||||
| 07673 | LD HL,(23639) | Fetch the current DATA list pointer (DATADD) and jump forward unless a new DATA statement has to be found. | |||||
| 07676 | LD A,(HL) | ||||||
| 07677 | CP "," | ||||||
| 07679 | JR Z,READ_1 | ||||||
| 07681 | LD E,228 | The search is for 'DATA'. | |||||
| 07683 | CALL LOOK_PROG | Jump forward if the search is successful. | |||||
| 07686 | JR NC,READ_1 | ||||||
|
Report E - Out of DATA.
|
|||||||
| 07688 | RST 8 | Call the error handling routine. | |||||
| 07689 | DEFB 13 | ||||||
|
Continue - picking up a value from the DATA list.
|
|||||||
| READ_1 | 07690 | CALL TEMP_PTR1 | Advance the pointer along the DATA list and set CH-ADD. | ||||
| 07693 | CALL VAL_FET_1 | Fetch the value and assign it to the variable. | |||||
| 07696 | RST 24 | Fetch the current value of CH-ADD and store it in DATADD. | |||||
| 07697 | LD (23639),HL | ||||||
| 07700 | LD HL,(23647) | Fetch the pointer to the READ statement and clear X-PTR. | |||||
| 07703 | LD (IY+38),0 | ||||||
| 07707 | CALL TEMP_PTR2 | Make CH-ADD once again point to the READ statement. | |||||
| READ_2 | 07710 | RST 24 | Get the present character and see if it is a ','. | ||||
| 07711 | CP "," | ||||||
| 07713 | JR Z,READ_3 | If it is then jump back as there are further items; otherwise return via either CHECK_END (if checking syntax) or the RET instruction (to STMT_RET). | |||||
| 07715 | CALL CHECK_END | ||||||
| 07718 | RET | ||||||
| Prev: 07642 | Up: Map |