--- title: "TS2068 ROM Bugs" type: "article" slug: "ts2068-rom-bugs-2" url: "http://localhost/article/ts2068-rom-bugs-2/" markdown_url: "http://localhost/article/ts2068-rom-bugs-2.md" published_at: "2026-12-01T10:02:13+00:00" modified_at: "2026-12-01T10:02:13+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "6.4.2 RAMTOP - When the machine stack and OS RAM code is moved to Chunk 7, the User Defined Graphics area is moved down in RAM by 2112 bytes (840H) to make room for the stack and OS RAM routines at the top of memory. The pointer in UDG is updated, however, the value in…" post_tag: - name: "Full Text" slug: "fulltext" taxonomy: "post_tag" url: "http://localhost/tag/fulltext/" indiv: - name: "Alex Burr (K5XY)" slug: "alex-burr" taxonomy: "indiv" url: "http://localhost/indiv/alex-burr/" publication: "QZX" publication_r: id: 21219 title: "QZX" type: "periodical" url: "http://localhost/periodical/qzx/" authors: "Alex Burr (K5XY)" volume: "9" issue: "4" issues_articles: - id: 70174 title: "QZX v9 n4" type: "issue" url: "http://localhost/issue/qzx-v9-n4/" pages: "3-4" pubdate: "March 1991" related_articles: - id: 83407 title: "TS2068 Bugs" type: "article" url: "http://localhost/article/ts2068-bugs-2/" archive_link: false volumeissue: "v9n4" --- # TS2068 ROM Bugs 6.4.2 RAMTOP – When the machine stack and OS RAM code is moved to Chunk 7, the User Defined Graphics area is moved down in RAM by 2112 bytes (840H) to make room for the stack and OS RAM routines at the top of memory. The pointer in UDG is updated, however, the value in RAMTOP is not modified to insure that the relocated UDG area as well as the OS code and stack are protected from expansion of the BASIC program. You can avoid problems by setting RAMTOP via a CLEAR command specifying an address no greater than 63255 (F717H) prior to invoking the Video Mode Change Service. This reserves space between RAMTOP and the end of memory of 2280 bytes (8E8H) utilized as: ``` 168 bytes (A8H) User Defined Graphics (21 X 8) 2112 bytes (840H) Machine Stack and OS Routines ---- ------ 2280 (8E8H) Example: RAMTOP = 63255 (F717H) + Reserved Area 2280 (08E8H) ----- ------- 65535 (FFFFH) ``` The software packages in Appendix C are written assuming that RAMTOP is set to 57343 (DFFFH) or lower to protect the machine code which is loaded beginning at 57344 (E000H). 6.4.3 NEW Command – If you have used the Video Mode Change Service to open the second display file and now wish to execute the NEW command, you should first return the computer to “normal” mode by calling the video mode service with A=zero. This returns the User Defined Graphics and other RAM structures to their normal locations. If you don’t do this, the UDG area will remain in the alternate location and, if you have not corrected RAMTOP as explained above, part or all of your UDG area could be cleared to zeros by the NEW command. 6.4.4 VIDMOD – When Mode 128 (80H) is designated for activating the Primary Display File in Dual Screen Mode the System Variable VIDMOD at 23746 (5CC2H) is set to zero instead of to 128. This creates a potential problem if the 17 ms. interruption occurs before VIDMOD can be corrected since the interruption fielder will branch to Chunk 3 instead of to Chunk 7 and Chunk 3 is now in use for the second display file. This problem is corrected by disabling the interruption prior to calling the Video Mode Change Service and setting VIDMOD to the correct value prior to re-enabling it. NOTE: On an initial access changing video mode from normal to Mode 128, the interruption is re-enabled within the Video Mode Change Service itself after copying the stack and other Chunk 3 data to Chunk 7. This cannot be corrected, but has not proven to present a problem in actual use. At the point where the interruption is first enabled, the Chunk 3 code is still intact allowing for correct processing of one interruption, and the path length from there to the point of correcting VIDMOD is apparently less than 17 ms. The interruption is also re-enabled within the Video Mode Change Service if you have applied the patches for the BANK_ENABLE and RESTORE_STATUS routines (Section 6.5.4) which are executed in connection with inserting space into the RAM to open the second display file. Again, this has not proven to be a problem in actual use. 6.4.4 Interruption Inhibit – By setting Bit 6 of Port 0FFH to a 1, the normal 17 ms. interruption generated from the SCLD to the Z80A CPU will be inhibited. When Port 0FFH is written to by the Video Mode Change Service, Bit 6 is forced to zero. If you wish to inhibit the normal interruption via this mechanism, and also plan to use the Video Mode Change Service, it is recommended that you first invoke the service to remap the RAM and open the second display file, then set Bit 6 of Port 0FFH to inhibit the normal interruption and write your own routine(s) for subsequent changing of the video mode setting that do not involve remapping the RAM. In this way you can maintain the value in Bit 6. ### 6.5 OS RAM Routines In patching the OS RAM routines, care must be taken not to relocate CALL and JP instructions since this affects the modification of the code when it is moved between Chunks 3 and 7. All of the code containing actual addresses must be modified to reflect the relocation and this is done using a table in the Extension ROM. Since the table cannot be changed, none of these instructions can be moved. Also, any CALL or JP instructions added must be modified by you when the code is relocated. 6.5.1 Function Dispatcher -For a variety of reasons such as conflict with use of the IX Register, incorrect entries in the ROM Function Dispatcher Jump Table, etc. some Service Codes have been deleted from the Function Dispatcher table (Table 3.3.4-2). In addition, the following correction to the GET_STATUS routine is required in order to successfully utilize the Function Dispatcher from a cartridge. Source: TS2068 Technical Manual