Jump to content

ivop

Members
  • Posts

    3,338
  • Joined

  • Last visited

  • Days Won

    3

Blog Entries posted by ivop

  1. ivop
    Two months ago I found a SID disassembler at the website of Covert BitOps. I rewrote large parts of it and added support for SAP and NSF (NES) files. It tries to do some simple code-flow analysis to determine code and data blocks. The output is compatible with ATASM. Because I want to avoid it'll bitrot on my harddisk, like so many other of my projects, I decided to post it here. Have fun.
     
    Possible improvements (todo-list):
    * command line option to manually mark blocks as code or data
    * add emulation engine to better handle self-modifying code
    * multiple assembly formats (xasm, mads, et cetera)
    siddasm2.c.gz
  2. ivop
    Here's the 6502 assembler I mentioned recently on the Atari 8-bit forum. The reasons to write this were:
     
    1.) None of the assemblers I tried could generate correct code for code assembled to run in zero page and have forward references to other code in zero page, changing their operand in real-time.
    2.) I wanted to write an assembler in sh (years ago, I came across osimplay, which I thought was pretty neat).
     
    shasm65 is written in sh, the Unix Bourne Shell, with a few extensions used which are not available in all sh incarnations. So far, I have adapted it to work with bash, zsh (~28% faster than bash) and mksh (ksh93, ~52% faster than bash). ash, dash, ksh (ksh88) and pdksh all fail to work, either because they lack array support or do not allow function names to start with a dot. Both issues could be "fixed", but that would make it slower and/or pollute the internal namespace, so I decided against it.
     
    Its syntax is different from all other 6502 assemblers, because an input file is treated as just another shell script, which is sourced by the assembler. Mnemonics are function calls and its arguments are the operands. Labels are defined by using the special function L and assembler directives are functions starting with a dot, like .org, .byte, .word, et cetera. Labels are referenced as shell variable names (ex. jmp $label). Numbers/memory locations can be specified in decimal, hexadecimal (ex. 0xfffe) or octal (ex. 0377).
     
    To fix the main reason for writing this assembler (see point 1. above), shasm65 uses different mnemonics for some addressing modes. For example, loading A from a zero-page location is lda.z. This way, the assembler knows immediately exactly how much storage an instruction requires.
     
    addressing modes: implied no suffix, ex. cli accu .a, ex. rol.a zp .z, ex. lda.z 0xfe zp,x .z, ex. adc.z 128,x zp,y .z, ex. stx.z 64,y (ind,x) .i [,x], ex. lda.i [23,x] (ind),y .i [],y, ex. cmp.i [017],y immediate ., ex. lda. 17 absolute no suffix, ex. dec 0x6ff absolute,x no suffix, ex. inc 0x0678,x absolute,y no suffix, ex. ldx $fubar,y (abs) .i, jmp.i [0xfffe] relative no suffix, ex. beq $loop    
    directives: .org start [dest] start address of next block (optionally loaded at different location) .byte x y z ... include literal bytes (no comma but spaces between the arguments) .word x y z ... include literal 16-bit little-endian words .ascii "ascii string" include literal string .screen "string" include literal string of Antic screen codes .space size reserve size space .align b align to b-bytes boundary .binary filename include _raw_ binary file filename . include source file (shell script, library functions, etc.) L name define label    
    Because both the assembler and the source files it assembles are just shell scripts, you have all of the shell functionality (including calling external applications) as your "macro" language. You can create your own functions, use for loops, tests, if/then/else/fi conditional assembly, arithmetic, all you can think of.
     
    # lines starting with a hash are comments # the code below demonstrates a few of the features START_ADDRESS=0x3000 clear_pages() { # start number_of_pages ldx. 0 txa L loop for foo in `seq $1 0x0100 $(($1+($2-1)*256))` ; do sta $foo,x done inx bne $loop } .org $START_ADDRESS L clear_some_mem # inline unrolled loop to clear 0x4000-0xbfff clear_pages 0x4000 $((0xc0-0x40)) rts L host_info .ascii $(uname -a)    
    There are two built-in functions:
     
    lsb() least-significant byte, ex. lda. `lsb $dlist` msb() most-significant byte, ex. lda. `msb $handler`    
    Variable-, function- and label names should not start with an underscore or a dot. Both are reserved for the assembler itself. Also, all shell reserved words are prohibited.
     
    shasm65 has the following command line options:
     
    -oFILE write output (Atari 8=bit $FF$FF binary format) to FILE -v verbose output -h -help --help -? output credits, license and command line options with a short description and their defaults    
    So, why a shell script? Well, because I can, it is fun, the code is short (~300 lines), it runs on many, many platforms, it provides a very powerful scripting/macro language and it's fun
     
    So, no drawbacks? Yes, there are. Shell scripts are interpreted and therefore shasm65 is a lot slower than the usual assemblers written in C and compiled to native machine code.
     
    I have probably missed describing some features or quirks, but basically, this is it. Have fun
     
    Any questions, post below.
    shasm65-0.91.tar.gz
  3. ivop
    Here's how I made my first cartridge case.
     
    First, I made two molds with tin cure silicone, the cheapest variant. Perhaps I'll make another one with platinum cure later.
    The cost of the molds is about 12,= euro's in total, but they can be reused several times. Not sure how many times yet. Might vary between 20 and 120, judging by the reports I read on the internet.
    It took 10-15 hours to cure until I could take the originals out of the mold. After that, I had them post-cure for two days. I was very pleased with the results.
     
    Pouring the PU was a totally different matter. The silicone had a pot life of 40 minutes, which means I had plenty of time to mix the two components and pour them in the container, but the PU I had bought is a fast curing variant with a pot life of only 2-3 minutes. So when I started with the second mold, it had become way too syrupy. Nevertheless, I managed to get it all in the mold. I unmolded after 60 minutes, let it cure a little longer and then used a vile and sandpaper to clean it up.
     
    IMHO it turned out not too bad for a first try. I have plenty of PU left to try a few times more. By my calculations the cost of one case, not counting the mold, is about 1,25 euro.
     
    Regards,
    Ivo
     
  4. ivop
    I just cross-compiled these from within Debian Linux (wheezy) and instead of only sharing them with the person I did this for, I thought I might just as well share them with everybody. Source code (GPL) is included. The win32 binary has been tested to work with wine under Linux. I cannot test the win64 binary, but it should work as well. Note that this is a command line utility. siddasm2.exe input.sid > output.asm. The output is in atasm format. It takes NSF (NES) and SAP (Atari 8-bit) files as well. Sid files need to be PSID. RSID is not yet supported.

    Edit [2015-07-17]: Updated to v2.2, hopefully fixed /dev/null issue on windows.
    Edit2: added source code.
    siddasm2-2.1-win.zip siddasm2-2.2-win.zip siddasm2-2.2-src.zip
  5. ivop
    I've spent some time reverse-engineering the file format used by Raster's Music Tracker. Included in the zip-file is rmtdump.c, a utility that came to be gradually, while exploring the format. There's also rmtformat.txt that describes the format in pseudo-assembly.
    rmtformat.zip
  6. ivop
    Here's the source code of SID 2 Gumby.
     
    It contains all the songs that were already posted in this thread: http://www.atariage.com/forums/topic/199103-teaser-sid-2-gumby/ plus five more songs:
     
    Hubbard:
    Warhawk Thing On A String One Man And His Droid The Master Of Magic Laxity:
    Wisdom Sources are under the GPL3 license. The ADSR code is more or less the same as was used in atarisid3, so if you are going to patch other songs to play with this player, you might need to patch writes to sid's CTRL registers, too, if the player toggles the gate bit off/on in one frame, otherwise it goes by unnoticed by the ADSR code and the channel will fade-out quickly.
     
    Included is the assembler, all .xex binaries, a script to build all tunes at once and all patched (and sometimes relocated) sid files.
    sid2gumby.zip
  7. ivop
    I was delighted by the positive responses I got on my previous blog entry and on the forum about my SID emulator on the Atari 8-bit. I also was a bit disappointed that it turned out there already was an emulator eight years ago that I did not know about, that sounded pretty much the same as mine (some tunes were better, some were worse IMHO). But, this challenged me to improve my emulation A few days ago, I "broke" the 15kHz boundary, and after some bug fixes, I am pleased to present you "Atari SID III". Included are .xex binaries for International Karate, Freeze, JT42, Cybernoid and Cybernoid II, as are all the sources. Sorry Heaven/TQA, all shasm65 again No more badly tuned radio!
    atarisid3.zip
  8. ivop
    Long time, no blog.
     
    Let's start at the beginning. In 2009 I wrote my first version of a SID Emulator, running directly on the Atari 8-bit hardware. The emulation loop ran in the main loop and synchronisation was done with STA WSYNC. I had created a raw register dump of a .sid file with a modified version of TinySid and every frame I left the main loop a few times for a few cycles to stuff the SID emulation engine with new values. I didn't take long to realize I didn't have quite enough time to do much else.
     
    I wanted to ditch the idea of playing a register dump. Even RLE compressed it took way too much memory to store a decently sized song. I wanted to run the original C64 player routine. That led me to the source code of siddasm and a rewrite with more features, which I called siddasm2 (really original).
     
    I moved the emulation code to page zero to save some cycles, but that did not really help enough. At the same time, I stumbled upon a bug in Atasm and instead of fixing that, I ended up writing my own assembler. I had always wanted to do that. I won't go into details here. See my previous blog entries on shasm65 and siddasm2.
     
    After that, I kind of lost interrest, but a few weeks ago I continued this project. I completely rewrote my SID emulator in shasm65. Now the emulation engine was running of a timer interrupt, leaving the main loop free to periodically call a C64 player routine. This routine had to be patched though to write to shadow SID registers instead of the C64 hardware registers.
     
    This is where siddasm2 came in again. Early in the process of disassembling Laxity's song "Freeze" I noticed that the resulting assembly code couldn't be assembled again by atasm AT ALL. Which shouldn't be the case. I fixed a few bugs in siddasm2 and shortly after that I was able to recreate the .sid file from source code with the help of atasm -r and unix dd (for the header). So far, so good.
     
    Now I was able to patch the source code of 'Freeze' and run it alongside my sid emulation code. I added code that converted the shadow sid registers to values my engine could work with, added ADSR envelope handling, everything I used to do in my modified TinySid. A few debugging sessions later, I had it all working! After that, I disassembled and patched the International Karate tune. This triggered a new bug in my emulation, which is now fixed.
     
    I sent out an example to Freddy (F#Ready on AA), which he turned into a youtube video and posted a link on AA to see what all of you would think about it. And now I figured it's time to release the source code and a few binaries to play with
     
    Attached you'll find version 2.1 of siddasm2.
    A slightly modified shasm65 which is now verbose in hex instead of decimal (but the original shasm65 is still fine to assemble the code, too. The assembler itself did not change).
    .xex binaries for Laxity's Freeze, Rob Hubbard's International Karate and Jeroen Tel's JT42.
    The source code for everything.
     
    Regards and have fun!
    binaries.zip shasm65.zip siddasm2-2.1.zip sid-songs.zip atarisid2.zip
  9. ivop
    On the Atari 8-Bit Forum, Heaven/TQA asked for help with retrieving an ASCII version of his demo sources in Macro-Assembler XE format. Because I recently wrote a detokenizer for Mac/65, I thought it'd be fun to try this file format too. Here's the result. It successfully detokenizes all the sample .ASM files I found in his zip-file, but I'm sure some functionality is missing (at least three assembler directives). If you stumble upon files that fail, please send them to me and I'll update the detokenizer. Or send me the Macro-Assembler XE manual, so I can add all directives at once.
     
    Compile with: gcc -O3 -std=c99 -W -Wall -o demaxe demaxe.c
    Run with: ./demaxe fubar.asm > fubar.txt
     
    Should also work under cygwin/mingw32. If there's interest in a Windows-binary, I might setup a cross-compiler. Leave a message below
    demaxe.c.gz
  10. ivop
    While I was browsing some old source code, I frequently stumbled upon MAC/65 tokenized files. Being too lazy to repeatedly start an emulator to convert them to (AT)ASCII and being unable to find a program online to detokenize them, I set out to write such a program myself. With some luck, I found a description of the format in the form of an old Analog Computing article. After that, it was pretty straightforward. Here's the source. Compile with gcc -W -Wall -O3 -o demac65 demac65.c. If you want line numbers, uncomment the printf statement. If you want all lowercase, there's tr(1). Have fun
    demac65.c.gz
  11. ivop
    Recently I acquired an old Bondi Blue iMac G3 with a PowerPC @266Mhz and 64MB RAM. I upgraded the RAM to 128MB and installed Debian GNU/Linux on it. Runs like a charm. I intend to use it remotely to test big-endian compilations, so I wanted the built-in monitor to be turned off. After searching the net extensively, I was unable to find a solution. setterm -blank 1 does not work (no APM support on a G3), xdpms doesn't work either (no DPMS) and pmset is only available under Mac OS X. I did find a solution though. If you configure Xorg wrongly and select a resolution the monitor can't cope with, it turns itself off. I'd rather not have X installed, but well, a dark server closet is worth the extra few megabytes of disk space And if I need the console because I locked myself out remotely or something, CTRL-ALT-F1 brings back the framebuffer console and turns on the monitor again.
  12. ivop
    I have been back using my Atari 800 XL for about six months now. I bought a MyIDE cart to backup all my old floppies. Most of them were still readable. I did not really like the MyIDE cart though. Well, the cart is fine, it's mainly the patched O.S. It's a pity it doesn't support mixing SIO and IDE devices very well. So, I dug out my old SIO2PC cables. I had one MAX232 version and one using an MC1489. Both looked like crap (they were soldered very badly) so I decided to rebuild one. I "designed" a small PCB for the MAX232 version. Here it is:
     
    Schematic:

     
    PCB: (normal and mirrored version)

     
    Component placement:

  13. ivop
    Last weekend I visited a retro-computer fair. From a distance I thought I saw an Atari XL. Coming closer, it became clear it was something completely different.
     
    There's remarkably little information to be found on the net about this little computer.
     
    Old Computers Museum
    Heimcomputer (Germany)
     
    There's some information about its successor on Wikipedia:
     
    VTech Laser 200
     
    I took a few pictures of the inside. Besides the usual 74LS logic, I determined the following chips on the motherboard:
     
    Motorola MC6847P, Video Display Generator
    2 x Hitachi HM6116P-4, 2048-word x 8-bit High Speed CMOS Static RAM (200ns), total 4kB
    NEC D780C-1 (4 MHz)
    Hitachi HM613128P (128K x 8 ((E?)P?)ROM) ), 16kB
    MC6847.pdf HM6116P.pdf uPD780.pdf
  14. ivop
    I finally compiled all the different Eagle parts I had drawn over the last year into a single Eagle library and adjusted them to be more or less uniform in look. While I was at it, I also added all missing chips and connectors. Currently, it contains the following parts:
     
    74LS08
    74LS14
    74LS51
    74LS74
    74LS138
    74LS158
    74LS375
    4050
    4051
    4164
    6502C/Sally
    6520A/PIA
    27128/OS PROM
    ANTIC
    BASIC ROM
    Cartridge
    Cartridge Socket
    EP8212
    GTIA
    Joystick Port
    Keyboard Socket
    LM358
    MMU
    Monitor Jack
    Parallel Bus Interface
    Parallel Bus Interface Device
    POKEY
    Power Jack
    RF Modulator
    SIO Jack
     
    Basically, it's everything you find on an 800XL motherboard.
     
    Update 2014-04-29: added conversion to Eagle 6.5.0 (XML file format).
    atari.lbr.gz eagle-6.5.0-atari.lbr.gz
×
×
  • Create New...