flashjazzcat Posted February 2, 2010 Share Posted February 2, 2010 Right - I've stared at this code long enough. Can someone give me a sense check on this because I think I'm going crazy. I have a loop which calls three routines designed to set up certain locations in extended RAM banks (tab line, pointers, etc). I have a table called BANKTAB which is clearly established to contain the PORTB mask for the MAIN (unbanked) RAM at $4000-$7FFF, followed by the banking values for the extended RAM. BANKTAB begins: F3, CF, CB,C7, C3... These are pre-masked values designed to be written straight to PORTB (OS ROM switched in, BASIC ROM off). This initialisation loop needs to work on all the banks in the list (10 in this case), EXCEPT the main bank (BANKTAB+0) which contains program code. So I have: LDY BANKS BEQ *+3 DEY STY BANK BANKLP ldy bank beq notmainbank lda banktab,y sta portb JSR ERASEALL JSR DEFTABS JSR DEFNAME LDA #0 STA EDITLINE STA EDITLINE+1 DEC BANK bne banklp ; don't set up main bank - it's got code in it ; notmainbank lda banktab sta portb Trouble is, the banked RAM never gets written to. And no matter where I set breakpoints up here, portb always contains $F3. I just wanted to make sure I wasn't going insane... Quote Link to comment Share on other sites More sharing options...
ivop Posted February 2, 2010 Share Posted February 2, 2010 (edited) LDY BANKS BEQ *+3 DEY STY BANK BANKLP BANKS is a memory location or a constant (ldy #BANKS)? And is it >= 2 ? Edited February 2, 2010 by ivop Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted February 2, 2010 Author Share Posted February 2, 2010 (edited) BANKS is a memory location or a constant (ldy #BANKS)? And is it >= 2 ? Sorry, BANKS is a memory location. It contains $0A in the tests. Thankfully, the time it took me to write up the plea for help allowed my mind to clear sufficiently that I could diagnose the problem. The ERASEALL routine was calling STA_LINK_Y, which reads thus: sta_link_y pha lda textbankmask sta portb pla sta (link),y pha lda banktab sta portb pla rts It's expected that textbankmask is pre-initialized to the value at BANKTAB+CURRENT_BANK. Of course I'd missed the fact that ERASEALL called this routine, which resets PORTB to the main bank on exit. So that's why DEFTABS and DEFNAME never operated on the extended bank, and portb always contained $F3 at the end of the loop. Thanks for your help there, anyway. It's appreciated. Edited February 2, 2010 by flashjazzcat 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.