Menu

#1974 A monitor error in x128 Bank1 c64mode

v3.x
closed-fixed
None
Monitor
2024-01-06
2023-12-27
No

In x128, when b1c64mode.prg is executed, the mode setup code is copied to bank 1 $3800-. When Monitor is activated, it sees the byte $3800 as $2f, yet in memory it is really $a9 = 169 (LDA #). The copied code is otherwise listed correctly.

3 Attachments

Discussion

  • Jussi Ala-Könni

    It worked in r43499 and r43787, but r44109 has the error. In the in-between r44070 b1c64mode.prg did not work.

     

    Last edit: Jussi Ala-Könni 2023-12-27
  • Olaf Seibert

    Olaf Seibert - 2023-12-29

    Yes, I can reproduce it if I run x128 -default b1c64mode.prg, then go into the monitor:

    Available banks (some may be equivalent to others):
    *default    *cpu    ram     rom     io  ram00-01    intfunc     extfunc     cart    c64rom  vdc     
    (C:$e5d1) d 3800 3800 
    .C:3800  2F 40 8D    RLA $8D40
    (C:$3803) bank ram01
    (C:$3803) d 3800 3800 
    .C:3800  A9 40       LDA #$40
    (C:$3802) 
    
     
  • Olaf Seibert

    Olaf Seibert - 2023-12-29

    I was the last one to touch the monitor code that reads the memory for the D and M commands, but I think I traced this to something else.

    To trace what the monitor is reading, I set a breakpoint at c128mem.c:mem_bank_peek()
    -> case bank256_cpu:
    -> mem_peek_with_config(mem_config which is 7
    -> no special case applies, so at the bottom
    -> mem_peek_with_config_c64(config
    -> ram_peek_c64(addr)

            uint8_t *b = mem_read_base_tab[mem_config][addr >> 8];
            if ((addr & 0xff) == 0) {
                return zero_peek(addr);
            } else if ((addr & 0xff) == 1) {
                return one_peek(addr);
            }
            return b[addr];
    

    I didn't write the 128 banking code (I just know it was much more complicated than previously thought) but I strongly suspect that these comparisons should be

            if ((addr & 0xff00) == 0x0000) {
            if ((addr & 0xff00) == 0x0100) {
    

    @oldwoman37, do you agree?

    Oh, and in the call from mem_peek_with_config_c64(config to ram_peek_c64(), the config parameter is lost and instead the global mem_config is used. That is incorrect, but will probably always work anyway since the only value for config that the monitor will ever use will be the current_config.

     

    Last edit: Olaf Seibert 2023-12-29
    • Roberto Muscedere

      Yes, this seems like it would be a problem. Please go ahead and commit the change. My current changes would break everything else.

       
  • Jussi Ala-Könni

    When the CPU I/O port $00 value is changed from $2f, then the address $3800 value in the monitor changes accordingly. Here the change is from $2f > $af = 175.

    The error occurs in normal C64 mode as well.

     

    Last edit: Jussi Ala-Könni 2023-12-30
  • Olaf Seibert

    Olaf Seibert - 2024-01-02

    I committed the proposed fix in r44940. Please retest when the build is available from https://github.com/VICE-Team/svn-mirror/releases . Thanks!

     
    • Querino

      Querino - 2024-01-02

      i tested it before, and it solved the issue for me. but i am no experienced user.

       
  • Jussi Ala-Könni

    After a quick test I see no problems.

     
  • Olaf Seibert

    Olaf Seibert - 2024-01-06
    • status: open --> closed-fixed
    • assigned_to: Olaf Seibert
     
  • Olaf Seibert

    Olaf Seibert - 2024-01-06

    Great! I'll close this one then.

     

Log in to post a comment.