sbasm3 icon indicating copy to clipboard operation
sbasm3 copied to clipboard

Address calculations in SC/MP still not working on page wrap

Open ianrolfe opened this issue 2 years ago • 1 comments

I was pleased to see that you have made changes to the relative addressing on the SC/MP module, and I have been trying to re-assemble the MK14 SCIOS ROM from source. I installed SBASM from sbasm-master.zip downloaded from here and the scios assembled without errors. However,there seems to be a problem on negative offsets calculated from P3:

0052-                115        ;                          Tape Interface Routines.
0052-                116        ; ****************************************************************************
00D5-                117        Count   .EQ    0D5h
00D6-                118        Len     .EQ    0D6h
0052-                119        ; ****************************************************************************
0052-                120        ;                 Store to Tape. P1^Data,@Count is the bytes
0052-                121        ; ****************************************************************************
0052-C5 01           122 (  18) ToTape: ld      @1(1)                   ; E := (P1), increment P1
0054-01              123 (   7)         xae
0055-C4 01           124 (  10)         ldi     1                       ; A := 1 (the bit pattern)
0057-CB 00           125 (  18) Next1:  st      Count(3)                ; Save in Count (P3)
0059-C4 01           126 (  10)         ldi     1                       ; set F0 to 1
005B-07              127 (   6)         cas
005C-8F 08           128 ( 13+)         dly     8                       ; Delay 8 Cycles
005E-C3 00           129 (  18)         ld      Count(3)                ; A = Count & E
0060-50              130 (   6)         ane                             ; test if bit is set...
0061-98 07           131 (9/11)         jz      Zero
0063-8F 18           132 ( 13+)         dly     018h                    ; (bit is 1) Delay $18 cycles
0065-C4 00           133 (  10)         ldi     0                       ; set F0 to 0 again
0067-07              134 (   6)         cas
0068-90 05           135 (  11)         jmp     CDone
006A-C4 00           136 (  10) Zero:   ldi     0                       ; bit is zero (set F0 to 0)
006C-07              137 (   6)         cas
006D-8F 18           138 ( 13+)         dly     018h                    ; Delay $18 Cycles

The instruction "sta Count(3)" should generate CB D5 whereas it is generating CB 00. I compared the output with a listing someone had done with TASM and verified that this was the case. For your conveience I have attached the source for SCIOS in case it is useful. scios.zip

ianrolfe avatar Jul 16 '21 19:07 ianrolfe