tschak909 Posted May 10, 2020 Share Posted May 10, 2020 ok, what in the hell am I doing wrong, in my INIT... 2300 202023 JSR IHTBS 2303 A50C LDA DOSINI 2305 8DDC26 STA DSAV 2308 A50D LDA DOSINI+1 230A 8DDD26 STA DSAV+1 230D A919 LDA #LOW RESET 230F 850C STA DOSINI 2311 8923 STA #HIGH RESET 2313 850D STA DOSINI+1 2315 18 CLC 2316 6CDC26 JMP (DSAV) 2319 RESET 2319 202023 JSR IHTBS 231C 18 CLC 231D 6CDC26 JMP (DSAV) ; INSERT INTO HATABS 2320 IHTBS PROC DSAV is zero initialized., IHTBS is my insert into HATABS routine. It's 2am and I am about ready to go bash my brains against the wall Quote Link to comment Share on other sites More sharing options...
Rybags Posted May 10, 2020 Share Posted May 10, 2020 (edited) When stealing such vectors then chaining to the "old" value, first ensure it has a valid value. Also, you only need to do it once. If you do so too early in the boot process you might find it hasn't been populated yet. Also (it's been a while since I've browsed the code) during the boot process the BOOTFLG value at 9 doesn't necessarily hold a valid value (I think they use bitshift on it?) Edited May 10, 2020 by Rybags Quote Link to comment Share on other sites More sharing options...
thorfdbg Posted May 10, 2020 Share Posted May 10, 2020 1 hour ago, tschak909 said: ok, what in the hell am I doing wrong, in my INIT... 2300 202023 JSR IHTBS 2303 A50C LDA DOSINI 2305 8DDC26 STA DSAV 2308 A50D LDA DOSINI+1 230A 8DDD26 STA DSAV+1 230D A919 LDA #LOW RESET 230F 850C STA DOSINI 2311 8923 STA #HIGH RESET 2313 850D STA DOSINI+1 2315 18 CLC 2316 6CDC26 JMP (DSAV) 2319 RESET 2319 202023 JSR IHTBS 231C 18 CLC 231D 6CDC26 JMP (DSAV) ; INSERT INTO HATABS 2320 IHTBS PROC DSAV is zero initialized., IHTBS is my insert into HATABS routine. It's 2am and I am about ready to go bash my brains against the wall Two problems: As stated, first ensure that DOSINI is valid at all, i.e. bit 0 of the bootflag $9 is set. If not, use $E4C0 as value of DOSINI because all os revisions ensure that this is an RTS. Second, if you adjust LOMEM, make sure that you call the old init code *first* before initializing your vector. Otherwise, your value of LOMEM will be overwritten again by the value of LOMEM of the init function you are calling. 1 Quote Link to comment Share on other sites More sharing options...
Rybags Posted May 10, 2020 Share Posted May 10, 2020 The boot flag - I'm fairly sure it gets set once the boot process is complete. As an example, it would likely hold an invalid value if you checked it during boot continuation code (load address + 6) Additional to that - only alter LOMEM if it's a coldstart. WARMST (8) should = 00. Quote Link to comment Share on other sites More sharing options...
thorfdbg Posted May 10, 2020 Share Posted May 10, 2020 44 minutes ago, Rybags said: Additional to that - only alter LOMEM if it's a coldstart. WARMST (8) should = 00. Err, no. There are several DOSes that adjust LOMEM on every reset, so if you don't, your lowmem will be overwritten. Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted May 10, 2020 Share Posted May 10, 2020 (edited) Damn... I completely forgot to reset protect the ULTD driver I posted in the other thread. Thanks! Here's the corrected version if it's any use: ultd.s EDIT: Yet more corrections. Edited May 10, 2020 by flashjazzcat Quote Link to comment Share on other sites More sharing options...
drac030 Posted May 10, 2020 Share Posted May 10, 2020 2 hours ago, thorfdbg said: use $E4C0 as value of DOSINI because all os revisions ensure that this is an RTS Except these which do not. Basically do not assume anything about the OS ROM contents except the FP entry points, jump table entry points $e450-$e48e, vector tables at $e400-$e44f and $e48f-$e4be, charsets and CPU vectors. 1 Quote Link to comment Share on other sites More sharing options...
thorfdbg Posted May 10, 2020 Share Posted May 10, 2020 21 minutes ago, drac030 said: Except these which do not. Basically do not assume anything about the OS ROM contents except the FP entry points, jump table entry points $e450-$e48e, vector tables at $e400-$e44f and $e48f-$e4be, charsets and CPU vectors. No, look, this is a documented entry point. It is the last entry in the reserved jump table. Quote Link to comment Share on other sites More sharing options...
Rybags Posted May 10, 2020 Share Posted May 10, 2020 (edited) For my bootable menu loader I needed a guaranteed non volatile RTS to use as an INIT address. $E44C is the init routine for the C : handler. All it does is set the baud rate values followed by RTS. So comes in handy. Edited May 10, 2020 by Rybags Quote Link to comment Share on other sites More sharing options...
drac030 Posted May 10, 2020 Share Posted May 10, 2020 (edited) @thorfdbg There are two reserved vector tables, one at $e49f-$e4ae, the other at $e4af-$e4be. The last entry of the latter (for the init jump) is located at $e4bb-$e4be. That RTS at $e4c0 is only retained in the XL OS because the 400/800 OS has an RTS there (legitimately ending a routine) and certainly there exist some crap software which rely on that location - but that does not make this a "documented entry point". It is just a location some program illegitimately references assuming stuff it should not about the contents of the ROM. Besides, it is certainly not true that "ALL OS revisions" have the RTS at $e4c0, because even omitting my own OS, I can mention at least two other which do not: Turbo-816 OS and earlier versions of Altirra OS. Edited May 10, 2020 by drac030 typo Quote Link to comment Share on other sites More sharing options...
tschak909 Posted May 10, 2020 Author Share Posted May 10, 2020 How am I supposed to jump to dosini and back before I adjust memlo? This is unbelievably frustrating. -Thom Quote Link to comment Share on other sites More sharing options...
Alfred Posted May 10, 2020 Share Posted May 10, 2020 In your RESET routine you have a JSR $XXXX instruction at the start. The code that installs your driver patches the $XXXX with whatever is in DOSINI. Now in the code I sent you, I don't actually check DOSINI to see if it's valid because I'm assuming that some DOS is always loaded and therefore DOSINI is valid. In your case that might not be true, so you need to check DOSINI to see if it's valid (non-zero I suppose, or >$0500) and if it isn't just change that instruction to three NOPs ($EA$EA$EA). That way you invoke all prior handlers which may set MEMLO and then you do your stuff and set the new MEMLO. Quote Link to comment Share on other sites More sharing options...
tschak909 Posted May 10, 2020 Author Share Posted May 10, 2020 Where I am right now, it's patching the old DOSINI for sure, I can see it in amoeba, but things still go sideways.. urgh 2300 START 2300 202F23 JSR IHTBS 2303 A50C LDA DOSINI 2305 8DEB26 STA DSAV 2308 8D1F23 STA RESET+1 230B A50D LDA DOSINI+1 230D 8DEC26 STA DSAV+1 2310 8D2023 STA RESET+2 2313 A91E LDA #LOW RESET 2315 850C STA DOSINI 2317 8923 STA #HIGH RESET 2319 850D STA DOSINI+1 231B 6CEB26 JMP (DSAV) 231E RESET 231E 20FFFF JSR $FFFF ; PATCH. 2321 202F23 JSR IHTBS 2324 A900 LDA #LOW PGEND 2326 8DE702 STA MEMLO 2329 A930 LDA #HIGH PGEND 232B 8DE802 STA MEMLO+1 232E 60 RTS n-asm.atr Quote Link to comment Share on other sites More sharing options...
Alfred Posted May 10, 2020 Share Posted May 10, 2020 You sure it's the installer that is failing ? Nothing obviously wrong with what you posted. Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted May 10, 2020 Share Posted May 10, 2020 2315 850C STA DOSINI 2317 8923 STA #HIGH RESET 2319 850D STA DOSINI+1 STA #HIGH RESET should be LDA #HIGH RESET. 1 Quote Link to comment Share on other sites More sharing options...
Alfred Posted May 10, 2020 Share Posted May 10, 2020 10 minutes ago, flashjazzcat said: 2315 850C STA DOSINI 2317 8923 STA #HIGH RESET 2319 850D STA DOSINI+1 STA #HIGH RESET should be LDA #HIGH RESET. LOL, I stand corrected. Quote Link to comment Share on other sites More sharing options...
tschak909 Posted May 10, 2020 Author Share Posted May 10, 2020 *blush* Thanks, reassembling now. -Thomn Quote Link to comment 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.