The Atari Lynx consists of the 65C02 with custom hardware for graphics and sound.
If you come from Atari 8bit or Apple, there are no illegal opcodes anymore like lax, but a lot new nice opcodes like stz. :-)
Setting up your development platform for the Atari Lynx:
Below size coding examples use Lyxass as assembler and are using the in-official DevKit new_bll.
But any other 6502 assembler is suitable. Best if it can assemble the extra opcodes of the 65C02 (like BBRx or RMBx).
The Lynx boot ROM will decrypt the "boot sector" of a Lynx card image. It is done in chunks of 50bytes. Maximum are 5 chunks, hence the limit of a "boot sector" is 250 bytes, but the last byte must be zero.
Currently Felix is the most accurate Emulator, though only running yet on Windows platform.
It is currently available via GitHub.
If you want to run the code on a real Lynx, you should have a SD card for the Lynx (AgaCard, LynxGD) and also a USB<->Serial adapter.
After the boot-rom has decrypted the boot-sector, some things are pre-defined:
- CPU Registers:
A = 0 X = 0 Y = 2 P = undefined S = undefined
- Zero page
$00 - 0 $01 - 0 $02 - 0
Main memory is cleared to zero despite a $5000..%$50aa where decryption code is placed.
- Bank switching
ROM, Mikey and Suzy are mapped, Vector table is ROM.
The sprite engine is not setup.
The Lynx display is 160x102 pixels which are linear organized as 4 bit per pixel. Hence the screen is little less than 8K. The pixel value is a pointer to the color look up table. The Lynx can display black and 4095 colors. The color table is split up into a green and an blue-red part (so not RGB but GBR).
Getting something on screen
After the ROM has deciphered the boot sector the display memory is at $2000, background color (that is pen 0) is black, all other entries are $f despite entry 14 which is also 0.
So to fill the screen simply do:
lda #$ff ldx #0 ldy #$20 ; round(160*102/2/256) loop: sta $2000,x inx bne loop inc loop+2 ; Self modify dey bne loop
Tips 'n' tricks
A nice trick with the new opcodes to limit a counter:
lda counter ; 2 inc ; 1 and #3 ; 2 sta counter ; 2 = 7 bytes
inc counter ; 2 rmb2 counter ; 2 => 4 bytes
Set a counter (previously 0) to a power-of-two (here 32)
lda #32 ; 2 sta counter ; 2 => 4
smb5 counter ; 2
To be added soon.
Make some noise
To be added soon.