+FarmerPotato Posted November 25, 2020 Share Posted November 25, 2020 I know that a DSR ROM can add CALLs to BASIC or XBASIC, but what happens when it provides the same name? Can a DSR ROM override, say, CALL SOUND, intercepting all the calls? Or does the BASIC interpreter always take its version first? Any ideas on how you could pull this off? Quote Link to comment https://forums.atariage.com/topic/313931-can-an-dsr-rom-replace-a-xbasic-call/ Share on other sites More sharing options...
HOME AUTOMATION Posted November 25, 2020 Share Posted November 25, 2020 3 hours ago, FarmerPotato said: Can a DSR ROM override, say, CALL SOUND, intercepting all the calls? Or does the BASIC interpreter always take its version first? I think there are examples of this. Though I am at a loss to recall ...Perhaps XB does this natively for some subs. I was under the impression that BASIC uses the first CALL match it finds. But, scanning starts with peripheral card ROMs, than GROM bases, in reversed order. However, this would seem to indicate otherwise... Calling a subprogram The calling convention is that the subprogram name (with a leading lenght byte) should be placed in VDP memory, with word >8356-57 pointing at the length byte. Then DSRLNK can be called from GPL with CALL G@>0010. This routine first scans the peripheral card ROMs in the order if their CRU addresses, by calling XML >19. It then repeatedly calls XML >1A to scan the GROMs at base >9800, starting with GROM >0000, then >2000, etc upto >E000. It then repeats the process with bases >9804, >9808, upto >983C. If you're curious, here is a disassembly of XML >19 and XML >1A Standard headers 2 Quote Link to comment https://forums.atariage.com/topic/313931-can-an-dsr-rom-replace-a-xbasic-call/#findComment-4684805 Share on other sites More sharing options...
+jedimatt42 Posted November 25, 2020 Share Posted November 25, 2020 In TI BASIC it scans Device ROMs for subprograms with every CALL before looking for built-ins. In XB, it is useless (exaggerating (tm)) as Device ROMs are only scanned in immediate mode. 4 Quote Link to comment https://forums.atariage.com/topic/313931-can-an-dsr-rom-replace-a-xbasic-call/#findComment-4684885 Share on other sites More sharing options...
+FarmerPotato Posted November 25, 2020 Author Share Posted November 25, 2020 2 hours ago, jedimatt42 said: In TI BASIC it scans Device ROMs for subprograms with every CALL before looking for built-ins. In XB, it is useless (exaggerating (tm)) as Device ROMs are only scanned in immediate mode. Thanks. Plain ol' BASIC shines through on this one. XB thinks it is the boss. Alas. Maybe the DSR subprogram code couldn't work in both BASIC and XB anyhow (fetching the arguments etc). Prescan: does XB prescan build a table of user-defined subprograms? I wonder if there might be some loophole there. Something like 1000 SUB SOUND(A,B,C) 1010 CALL LINK("MYCALL", "SOUND", A, B, C) 1020 SUB END where MYCALL looks in the DSR ROMs... or just implements the darn thing that would be in the ROM Quote Link to comment https://forums.atariage.com/topic/313931-can-an-dsr-rom-replace-a-xbasic-call/#findComment-4685007 Share on other sites More sharing options...
+FarmerPotato Posted November 25, 2020 Author Share Posted November 25, 2020 6 hours ago, HOME AUTOMATION said: I think there are examples of this. Though I am at a loss to recall ...Perhaps XB does this natively for some subs. I was under the impression that BASIC uses the first CALL match it finds. But, scanning starts with peripheral card ROMs, than GROM bases, in reversed order. However, this would seem to indicate otherwise... Calling a subprogram The calling convention is that the subprogram name (with a leading lenght byte) should be placed in VDP memory, with word >8356-57 pointing at the length byte. Then DSRLNK can be called from GPL with CALL G@>0010. This routine first scans the peripheral card ROMs in the order if their CRU addresses, by calling XML >19. It then repeatedly calls XML >1A to scan the GROMs at base >9800, starting with GROM >0000, then >2000, etc upto >E000. It then repeats the process with bases >9804, >9808, upto >983C. If you're curious, here is a disassembly of XML >19 and XML >1A Standard headers Following Thierry's excellent (as always) docs. I didn't know any of that. Wow. 1 Quote Link to comment https://forums.atariage.com/topic/313931-can-an-dsr-rom-replace-a-xbasic-call/#findComment-4685024 Share on other sites More sharing options...
RXB Posted November 25, 2020 Share Posted November 25, 2020 (edited) LOL I DID, why I like XB over TI BASIC. My CALL FILES(0) routine in RXB works fine as it does from my Module not a DSR. After all how many DSR ever get updated???? Also in RXB 2020 you can do CALL FILES(15) try that on a normal TI and see what results! In RXB 2020 you get 5624 Stack Bytes Free with CALL FILES(15) Memory address used and free: >1F8F First Free VDP Address >0958 VDP Stack Address Edited November 25, 2020 by RXB missing text Quote Link to comment https://forums.atariage.com/topic/313931-can-an-dsr-rom-replace-a-xbasic-call/#findComment-4685054 Share on other sites More sharing options...
+Lee Stewart Posted November 25, 2020 Share Posted November 25, 2020 10 hours ago, FarmerPotato said: I know that a DSR ROM can add CALLs to BASIC or XBASIC, but what happens when it provides the same name? Can a DSR ROM override, say, CALL SOUND, intercepting all the calls? Or does the BASIC interpreter always take its version first? Any ideas on how you could pull this off? Why not use your own, unique name for SOUND—SOUNDS, say. ...lee 2 Quote Link to comment https://forums.atariage.com/topic/313931-can-an-dsr-rom-replace-a-xbasic-call/#findComment-4685073 Share on other sites More sharing options...
senior_falcon Posted November 25, 2020 Share Posted November 25, 2020 (edited) On 11/25/2020 at 12:39 PM, FarmerPotato said: Thanks. Plain ol' BASIC shines through on this one. XB thinks it is the boss. Alas. Maybe the DSR subprogram code couldn't work in both BASIC and XB anyhow (fetching the arguments etc). Prescan: does XB prescan build a table of user-defined subprograms? I wonder if there might be some loophole there. Something like 1000 SUB SOUND(A,B,C) 1010 CALL LINK("MYCALL", "SOUND", A, B, C) 1020 SUB END where MYCALL looks in the DSR ROMs... or just implements the darn thing that would be in the ROM User subs can be the same name as an XB sub. 10 CALL SOUND(30) 20 END 1000 SUB SOUND(X) 1010 PRINT X 1020 SUBEND This will print 30 Not sure what you're trying to do or if this is even of use. Edited November 27, 2020 by senior_falcon 4 Quote Link to comment https://forums.atariage.com/topic/313931-can-an-dsr-rom-replace-a-xbasic-call/#findComment-4685185 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.