ivop's Profile
Reputation: 5
Neutral
- Active Posts:
- 74 (0.13 per day)
- Most Active In:
- Atari 8-Bit Computers (71 posts)
- Joined:
- 14-August 08
- Profile Views:
- 4,712
- Last Active:
Yesterday, 1:23 PM- Currently:
- Offline
Latest Visitors
-
cyco130 
10 Feb 2010 - 5:34 -
Irgendwer 
06 Feb 2010 - 4:45 -
atari2600land 
02 Feb 2010 - 2:42 -
mikey 
08 Jan 2010 - 7:56 -
jaybird3rd 
27 Dec 2009 - 2:35
Visit this blog
Reverse Engineering the Macro-Assembler XE File Format
Posted 30 Jan 2010
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
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
demac65: detokenize MAC/65 files
Posted 21 Jan 2010
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
Atari Eagle parts library
Posted 8 Jan 2010
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.
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.
shasm65 - a 6502 assembler in sh
Posted 30 Oct 2009
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 mode. 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.
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.
There are two built-in functions:
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:
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.
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 mode. 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.
Turn monitor off in console mode Linux on an iMac G3
Posted 20 Aug 2009
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.
My Information
- Member Title:
- Star Raider
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
-
- Location:
- The Netherlands
Contact Information
- E-mail:
- Private
- Website URL:
-
http://ivop.free.fr/
Friends
ivop hasn't added any friends yet.

Sign In
Register
Help
Send me a message
Find Topics
Find Posts
Display name history
Comments
ivop has no profile comments yet. Why not say hello?