Two Stop Bitsnew | comments | tags | ask | submitlogin
Emulating 6502 (6502 emulation simplicity renaissance) (zserge.com | ia)
5 points by bmonkey325 130 days ago | 3 comments
  • ddingus 129 days ago
    The hardest thing for me transitioning away from Motorola / MOS assembly code was the change over from AT&T syntax to Intel style.

    A hex value or address is preceded by a dollar sign:

    $C010 + $FE

    $00:60:AA:B0:C1:FF

    Etc...

    Also, binary was a percent sign:

    $0f = %00001111

    Two bits per pixel was %%, allowing the digits 0 through 3.

    There were lots of other differences but just too many to list here. Frankly, I don't miss those as much as I do the dollar sign for Hex.

    To this day, I have to bend my brain into reading 0xC010 as $C010... Grrr....

    Of course, one can commit the mortal sin of programming say, X86 using AT&T syntax.... Yeah, I can feel the rage from here still for having done that. LOLOL

  • ddingus 129 days ago
    In the addressing mode section, the author missed out on a good opportunity to explain the Zero Page more completely.

    Chuck Peddle intended the Z-page to act as 128 "registers" with each one potentially acting as a pointer, with an offset into RAM.

    STA ($ZP), X

    The address is formed by taking $ZP and $ZP+1 little endian style, then adding X to it.

    ZP = $00 +1 = $C0 X = $10 A = $FE

    The contents of A ($FE) would be written to $C000 + $10, which is $C010.

    Zero page, is really core to writing bigger code on the chip successfully, and without using self-modifying code.

    However, self modifying code can be considerably faster and many of us went right to it when trying to push a lot of pixels on our graphics screens!

    Basically, one would take absolute indexed, and modify the address bytes in a loop.

    STA $C010, X

    That address gets modified, say stepping 40 bytes at a time so that the X register could index to any byte in a scanline and the address points to the left most "0" byte of a given scanline. For real speed, one could put a few of these instructions in a loop, and modify them in various ways to get a lot of writes to the screen in fewer cycles than it would take to update the Z page pointer.

    Fun times!

  • bmonkey325 130 days ago
    Here’s is the emulator If you want to learn more https://gist.github.com/zserge/e5a18c954ab18b5b07be7ff516b53...
lists | rss | source
Search:
Two Stop Bits is a discussion web site about retro computing and gaming.