--- title: "Stacking the Calculator" type: "article" slug: "stacking-the-calculator" url: "http://localhost/article/stacking-the-calculator/" markdown_url: "http://localhost/article/stacking-the-calculator.md" published_at: "2022-10-07T12:28:28+00:00" modified_at: "2026-07-30T11:05:58+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "In writing programs in Machine Code it is sometimes necessary to bring in data from a BASIC program or from direct input. A simple way is to go to M/C with RANDOMIZE X+USR 65000. That puts X on the calculator stack, from which it may be drawn and used within the M/C program. X may…" category: - name: "CATS Newsletter" slug: "cats-newsletter" taxonomy: "category" url: "http://localhost/category/periodicals/cats-newsletter/" post_tag: - name: "Best of Timex/Sinclair 2068 Articles and Documents" slug: "ts2068best" taxonomy: "post_tag" url: "http://localhost/tag/ts2068best/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Tutorial" slug: "tutorial" taxonomy: "post_tag" url: "http://localhost/tag/tutorial/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "H. Edward Weppler" slug: "h-e-weppler" taxonomy: "indiv" url: "http://localhost/indiv/h-e-weppler/" publication_r: id: 35941 title: "CATS Newsletter" type: "periodical" url: "http://localhost/periodical/cats-newsletter/" authors: "H. E. Weppler" authors_r: - name: "H. Edward Weppler" slug: "h-e-weppler" taxonomy: "indiv" url: "http://localhost/indiv/h-e-weppler/" volume: "6" issue: "1" issues_articles: - id: 39632 title: "CATS v6 n1" type: "issue" url: "http://localhost/issue/cats-v6-n1/" pages: "7" pubdate: "May 1988" archive_link: false --- # Stacking the Calculator In writing programs in Machine Code it is sometimes necessary to bring in data from a BASIC program or from direct input. A simple way is to go to M/C with `RANDOMIZE X+USR 65000`. That puts X on the calculator stack, from which it may be drawn and used within the M/C program. X may be a variable or numerals. That approach may be expanded to stack several numbers. Just include `"X+(...)"` for each added number. For example: ``` RANDOMIZE X3+(X2+(X1+USR 65000)) ``` will put three numbers on the stack, with X1 “on top”. At the end of the M/C program add a line:`"EF A0....38"`, with one A0 for each + sign in the entry. The A0’s put 0’s on the stack to replace the numbers originally stacked and then used in the M/C program.