Image Map Image Map
Results 1 to 6 of 6

Thread: Question about Apple 6502 assembly syntax (DOS 3.3)

  1. #1
    Join Date
    Jan 2007
    Location
    Pacific Northwest, USA
    Posts
    34,138
    Blog Entries
    18

    Default Question about Apple 6502 assembly syntax (DOS 3.3)

    In the DOS 3.3 listing from here, I see the following code:

    Code:
    38C2:A0 00          046 POSTNB16    LDY #$0         ; USER DATA BUF IDX.            ; T0S2 TODO
    38C4:A2 56          047 POST1       LDX #$56        ; INIT NBUF2 INDEX.
    38C6:CA             048 POST2       DEX             ; NBUF IDX $55 TO $0
    38C7:30 FB          049             BMI POST1       ; WRAPAROUND IF NEG.            ;↑
    38C9:B9 00 3B       050             LDA NBUF1,Y
    38CC:5E 00 3C       051             LSR NBUF2,X     ; SHIFT 2 BITS FROM
    38CF:2A             052             ROL A           ; CURRENT NBUF2 NIBL
    38D0:5E 00 3C       053             LSR             ; INTO CURRENT NBUF1
    38D3:2A             054             ROL A           NIBL.                           ; === Page 102 ===
    38D4:91 3E          055             STA (BUF),Y     BYTE OF USER DATA.
    38D6:C8             056             INY             NEXT USER BYTE.
    38D7:C4 26          057             CPY T0          DONE IF EQUAL T0.
    38D9:D0 EB          058             BNE POST2                                       ; ^
    38DB:60             059             RTS             RETURN.
    In particular, the instruction at $38D0 lacks operands and is interpreted identically with the instruction at $38CC. Is this a feature of the assembler used for Apple DOS? Seems like an error to me.

  2. #2
    Join Date
    Feb 2009
    Location
    Southern California, USA
    Posts
    2,910

    Default

    You are right, it must be an error in the listing. The OP Code $5E is a shift right with an absolute indexed address mode so the absolute memory address and index register notation is missing from the symbolic listing. The only implied address form for LSR would have the opcode of $4A and it would be a one byte instruction.

  3. #3
    Join Date
    Jan 2007
    Location
    Pacific Northwest, USA
    Posts
    34,138
    Blog Entries
    18

    Default

    The code does work with the missing operand supplied; I was wondering if this was a quirk of the Apple 6502 assembler.

  4. #4
    Join Date
    Jun 2012
    Location
    UK - Worcester
    Posts
    3,794

    Default

    Sometimes listing files got ‘doctored’. If I remember correctly the original Sinclair MK14 SCIOS listing didn’t have the correct mnemonics for the generated binary either. This definitely wasn’t a mistake with the assembler, but either deliberately introduced on purpose, or accidentally introduced during the document publishing process.

    Dave

  5. #5

    Default

    The history I remember hearing is that Paul Laughton cross-assembled DOS from bigger computer (attached link to Paul's recollection). It does seem odd that the assembler would output code like that. Usually the opcodes with implied operands target the accumulator. So either a bug/feature of the cross-assembler (somehow remembering the operand of the previous usage of the opcode) or the operand got lost in translation to a modern format.

    http://www.laughton.com/Apple/Apple.html

    Maybe an IMSAI was involved, too. From the Huston brother's collection:

    http://vi.vipr.ebaydesc.com/ws/eBayI...rsion=35956813
    Last edited by resman; March 8th, 2020 at 08:55 AM. Reason: Additiona info from Huston Brothers

  6. #6
    Join Date
    Jan 2007
    Location
    Pacific Northwest, USA
    Posts
    34,138
    Blog Entries
    18

    Default

    What struck me as odd was that the comment on the line was perfectly intact, so a transmission error would seem not to be the issue.

    DOS 3.3 is interesting for its quirkiness (lots of "why did they do it that way?")

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •