0

現在pdp-11のコードに取り組んでいますが、このエラー「奇数ワードアドレス」が発生するので、インターネットで検索してこれを見つけました:奇数アドレスエラー:ワードオートインクリメントまたはオートデクリメント命令で使用されるレジスタが奇数になる場合に発生します。そして、私はそれらが何を意味するのか理解できませんでした! 誰かが私を助けることができますか?

      main:   mov #0,r0  ; r0 is the index of the Moves array
        mov #0,r1  ; r1 is the index of the Cols of the Board
        mov nCols,r3  ; r3 is the label of the Rows of the Board
        mul nRows-1,r3
        .even
        add #Board,r3
        movb r3,FR  ;FR is the first row in board

even:   movb r1,r5       ; here we are in even row 
        add Moves(r0),r5
        movb #0,r4
        div nCols,r4
        mov r5,sharet
        mul nCols,r4
        sub r4,r3   
        br chick_row

chick_row:mov r3,help   ;here we gonne chick if the row is even or uneven
        mov FR,r5
        sub help,r5
        mov #0,r4
        div nCols,r4          
        mov r4,r5
        mov #0,r4
        div #2,r4           
        cmpb #0,r5
        beq Reven
        br  Runeven  


uneven: mov nCols,r5  ;now we are in uneeven row and we want to add the moves and see if it leads us to even or uneven
        sub r1,r5
        sub #1,r5
        add Moves(r0),r5
        mov #0,r4
        div nCols,r4
        mov r5,sharet
        mul nCols,r4
        sub r4,r3
        br chick_row



Reven:  mov sharet,r1       
        br findC             


Runeven:mov nCols,r1     
        sub sharet,r1
        sub #1,r1
        br findC


loopEnd:add #1,r0        ;we increased r0 and now we are going to chick if the current row is even or not
        mov r3,help      ;here we gonne chick if the row is even or uneven
        mov FR,r5
        sub help,r5
        mov #0,r4
        div nCols,r4          
        mov r4,r5
        mov #0,r4
        div #2,r4            
        cmpb #0,r5
        beq even
        br  uneven

findC:  mov r3,currentCell                        ; find the current cell after adding the current move
        add r1,currentCell
        ; check the value of the current cell
        cmpb currentCell,'L
        beq isLadder
        cmpb currentCell,'S
        beq isSnake
        cmpb #currentCell,#Board
        blo errorC 
        add currentCell,Score
        br  loopEnd


isLadder:mov r3,FR
        sub #Board,FR
        cmpb FR,nCols
        blo errorLadder
        sub nCols,r3
        mov r3,currentCell
        add r1,currentCell
        cmpb currentCell,'L
        beq isLadder
        add currentCell,Score
        br  loopEnd

isSnake:mov r3,r4
        mov nCols,r5
        mul nRows-1,r5
        add #Board,r5
        sub r5,r4
        cmpb r4,nCols
        blo errorSnake
        add nCols,r3
        mov r3,currentCell
        add r1,currentCell
        cmpb currentCell,'S
        beq isSnake
        add currentCell,Score
        br  loopEnd


errorLadder:mov #1,Score
            br Failure

errorSnake: mov #0,Score
            br Failure

errorC:     mov #2,Score
            br Failure

gameEnd:    mov #Board,r4     ; check if the game ended successfully..
            add nCols,r5
            sub #1,r5
            cmpb currentCell,r5
            beq Success
            mov #3,Score
            br Failure

Failure: mov #'F,Output
        halt
Success: mov #'S,Output
        halt



.=torg + 2000
currentCell:   .word 0
lastRow:       .word 0
FR:            .word 0 
help:          .word 0
sharet:        .word 0

.=torg + 5000

nCols:  .word 5
nRows:  .word 3
Board:  .byte 2,  3, 'S, 'L,  0
    .byte 5, 'L,  6, 'S,  6
    .byte 1, 'L, 'S,  1, 'L

Moves:  .byte 4, 5, 4, '@

; Outputs
.even 
Output:   .blkw 1
Score:    .blkw 1
numMoves: .blkw 1
4

1 に答える 1