Jump to content
IGNORED

6502 Cross Assembling


Recommended Posts

And syntax colouring! Which is trifling enough, but it makes quite a difference for me!

 

If anyone were thinking about following the cross-assembler route I absolutely recommend they use JAC!'s 'wudsn' add-in for Eclipse. That is pretty much the perfect IDE for atari assebmler work in my opinion.

  • Like 1
Link to comment
Share on other sites

It's not just modern PCs either, cross assembly has been around since "the olde days" with all manner of do-it-yourself solutions being put together by developers over the years. i've seen Amstrad PCW word processors, 386 DOS boxes and C128s assembling code for a target C64 (or in one case a C16 if memory serves) for example and there's other reports in interviews of Amstrad CPCs, Amigas, Atari STs, Sage IVs, mainframes, a second example of the target machine or indeed whatever else the programmers could hack together; the legendary Jet Set Willy for the Spectrum was assembled with a TRS-80 and some of Jeff Minter's later VIC 20 releases were i believe built on a C64.

 

As soon as someone explained the basics of cross assembly to me i sat down and started thinking about how to bodge my own system together!

Link to comment
Share on other sites

Yep - with you there TMR. Cross-assembly is the only real way to right even semi-serious programmes in atari assembler in my opinion. It CAN be done, even inside a Altirra virtual computer but it is TEDIOUS and prone to error.

 

I believe 'Behind Jaggi Lines' was effectively cross-assembled as the late lamented LucasArts wrote a complete emulator for the atari to run on their mainframe and then cross assembled code for it from workstations.

Link to comment
Share on other sites

Yeah, i've spoken to people who've coded games in native assemblers that worked purely in RAM (in fact that's what i was using for a few years on the C64 myself, until being introduced to cross assembly and modifying the assembler to use a homebrewed link cable), others who have written games and demos using machine code monitors (i've done this as well now i think about it, although the projects were never finished/released) and even one guy who's pretty much completed a version of Cosmic Ark on the C64 with the VICE emulator's machine code monitor...!

 

There's been some truly bizarre examples of homebrew cross assembly rigs over the years as well, including the rumours about SNES cracking groups using C64s to assemble code!

Link to comment
Share on other sites

Most people here probably do things in either one of two ways:

1) Use emulators.

2) Use native machines with speeded up I/O (some modern device connected into it).

 

People do this because waiting for the I/O of the systems was the biggest thing that we cannot stand nowadays, hey, we didn't even like it back in the 80s.

 

So I don't understand why people would then love the time and hassle it takes to compile something natively.

 

But each to their own... it's your own decision.

Link to comment
Share on other sites

  • 2 weeks later...

Despite myself I am starting to feel like maybe you chaps were right all along and MADS is the best way to go... Humbling but true. It does seem to work VERY well inside wudsn and the source level debugging from Altirra is nice too!!! Could one of you tell me which is the command-line switch that displays the results of the assembly in wudsn's 'output' window? ATasm does this automatically, but I am sure MADS can be convinced to do so.

Link to comment
Share on other sites

This page http://gury.atari8.info/effectus/rtl.htm

 

has a link to an "equates" file (a common name for it): http://gury.atari8.info/effectus/docs/lib/equates.asm

 

Not entirely comprehensive, but a starting point. Hunt around for equates files. I have an equates.m65 (on another computer, not here) for Mac/65 that has all the hardware registers in it.

Link to comment
Share on other sites

Mine:

 

;================================================================================
; System equates, Atari XL + mads [NRV 2009]
;================================================================================
;----------------------------------------
; GTIA:
;----------------------------------------
M0PF = $D000 ; read only
M1PF = $D001 ; read only
M2PF = $D002 ; read only
M3PF = $D003 ; read only
P0PF = $D004 ; read only
P1PF = $D005 ; read only
P2PF = $D006 ; read only
P3PF = $D007 ; read only
M0PL = $D008 ; read only
M1PL = $D009 ; read only
M2PL = $D00A ; read only
M3PL = $D00B ; read only
P0PL = $D00C ; read only
P1PL = $D00D ; read only
P2PL = $D00E ; read only
P3PL = $D00F ; read only
TRIG0 = $D010 ; read only
TRIG1 = $D011 ; read only
TRIG2 = $D012 ; read only
TRIG3 = $D013 ; read only
PAL = $D014 ; read only

HPOSP0 = $D000 ; write only
HPOSP1 = $D001 ; write only
HPOSP2 = $D002 ; write only
HPOSP3 = $D003 ; write only
HPOSM0 = $D004 ; write only
HPOSM1 = $D005 ; write only
HPOSM2 = $D006 ; write only
HPOSM3 = $D007 ; write only
SIZEP0 = $D008 ; write only
SIZEP1 = $D009 ; write only
SIZEP2 = $D00A ; write only
SIZEP3 = $D00B ; write only
SIZEM = $D00C ; write only
GRAFP0 = $D00D ; write only
GRAFP1 = $D00E ; write only
GRAFP2 = $D00F ; write only
GRAFP3 = $D010 ; write only
GRAFM = $D011 ; write only
COLPM0 = $D012 ; write only
COLPM1 = $D013 ; write only
COLPM2 = $D014 ; write only
COLPM3 = $D015 ; write only
COLPF0 = $D016 ; write only
COLPF1 = $D017 ; write only
COLPF2 = $D018 ; write only
COLPF3 = $D019 ; write only
COLBK = $D01A ; write only
PRIOR = $D01B ; write only
VDELAY = $D01C ; write only
GRACTL = $D01D ; write only
HITCLR = $D01E ; write only
CONSOL = $D01F ; read and write

;----------------------------------------
; POKEY:
;----------------------------------------
POT0 = $D200 ; read only
POT1 = $D201 ; read only
POT2 = $D202 ; read only
POT3 = $D203 ; read only
POT4 = $D204 ; read only
POT5 = $D205 ; read only
POT6 = $D206 ; read only
POT7 = $D207 ; read only
ALLPOT = $D208 ; read only
KBCODE = $D209 ; read only
RANDOM = $D20A ; read only
SERIN = $D20D ; read only
IRQST = $D20E ; read only
SKSTAT = $D20F ; read only

AUDF1 = $D200 ; write only
AUDC1 = $D201 ; write only
AUDF2 = $D202 ; write only
AUDC2 = $D203 ; write only
AUDF3 = $D204 ; write only
AUDC3 = $D205 ; write only
AUDF4 = $D206 ; write only
AUDC4 = $D207 ; write only
AUDCTL = $D208 ; write only
STIMER = $D209 ; write only
SKREST = $D20A ; write only
POTGO = $D20B ; write only
SEROUT = $D20D ; write only
IRQEN = $D20E ; write only
SKCTL = $D20F ; write only

;----------------------------------------
; PIA:
;----------------------------------------
PORTA = $D300 ; read and write
PORTB = $D301 ; read and write
PACTL = $D302 ; read and write
PBCTL = $D303 ; read and write

;----------------------------------------
; ANTIC:
;----------------------------------------
VCOUNT = $D40B ; read only
PENH = $D40C ; read only
PENV = $D40D ; read only
NMIST = $D40F ; read only

DMACTL = $D400 ; write only
CHACTL = $D401 ; write only
DLISTL = $D402 ; write only
DLISTH = $D403 ; write only
HSCROL = $D404 ; write only
VSCROL = $D405 ; write only
PMBASE = $D407 ; write only
CHBASE = $D409 ; write only
WSYNC = $D40A ; write only
NMIEN = $D40E ; write only
NMIRES = $D40F ; write only

;----------------------------------------
; Shadow registers:
;----------------------------------------
SDMCTL = 559 ; shadow of DMACTL
GPRIOR = 623 ; shadow of PRIOR
PCOLR0 = 704 ; shadow of COLPM0
COLOR0 = 708 ; shadow of COLPF0
RTCLOCK = 20
ATRACT = 77
CHBAS = 756 ; shadow of CHBASE
CH = 764
CHACT = 755
SDLSTL = 560 ; display list address
VDSLST = 512 ; DLI address
PADDL0 = 624 ; 0-228 , shadow of POT0
PTRIG0 = 636 ; 0 = PRESSED , shadow of PTRG0
STICK0 = 632 ; 0000 = RLDU , shadow of PORTA
STRIG0 = 644 ; 0 = PRESSED , shadow of TRIG0
COLDST = 580 ; non zero --> do a cold start when pressing the reset key

;----------------------------------------
; VBI:
;----------------------------------------
XITVB_I = 58463
XITVB_D = 58466
VBI_I = 6
VBI_D = 7
NORMAL_VBI_I = 49378
NORMAL_VBI_D = 49802
SETVBV = 58460
VVBLKI = 546
VVBLKD = 548
XITVB = XITVB_D

;----------------------------------------
; Handler vectors:
;----------------------------------------
NMIH_VECTOR = 65530
RESH_VECTOR = 65532
IRQH_VECTOR = 65534

;----------------------------------------
; I/O:
;----------------------------------------
CIOV = $E456 ; (58454)
SIOV = $E459 ; (58457)

;----------------------------------------
; Bit values:
;----------------------------------------
; DMA values
DV_DMA_ON = %00100000
DV_PM_ONE_LINE = %00010000
DV_PLAYERS_ON = %00001000
DV_MISSILES_ON = %00000100
DV_WIDE_PF = %00000011
DV_NORMAL_PF = %00000010
DV_NARROW_PF = %00000001

; Display list values
DL_DLI_MASK = %10000000
DL_LMS_MASK = %01000000
DL_VSCROLL_MASK = %00100000
DL_HSCROLL_MASK = %00010000
DL_JMP = 1
DL_JVB = 65
DL_BLANK_1 = 0
DL_BLANK_2 = 16
DL_BLANK_3 = 32
DL_BLANK_4 = 48
DL_BLANK_5 = 64
DL_BLANK_6 = 80
DL_BLANK_7 = 96
DL_BLANK_8 = 112

; Antic graphic modes
GM_CHAR_A2 = 2 ; 2 colors, 40x24, 960b, 40xline, 8 scanlines
GM_CHAR_A6 = 6 ; 4 colors, 20x24, 480b, 40xline, 8 scanlines
GM_CHAR_A7 = 7 ; 4 colors, 20x12, 240b, 20xline, 16 scanlines
GM_CHAR_A4 = 4 ; 5 colors, 40x24, 960b, 40xline, 8 scanlines
GM_CHAR_A5 = 5 ; 5 colors, 40x12, 480b, 40xline, 16 scanlines
GM_CHAR_A3 = 3 ; 2 colors, 40x24, 760b, 40xline, 10 scanlines

; Basic graphic modes
GM_CHAR_G0 = 2 ; 2 colors, 40x24, 960b, 40xline, 8 scanlines
GM_CHAR_G1 = 6 ; 4 colors, 20x24, 480b, 40xline, 8 scanlines
GM_CHAR_G2 = 7 ; 4 colors, 20x12, 240b, 20xline, 16 scanlines
GM_CHAR_G12 = 4 ; 5 colors, 40x24, 960b, 40xline, 8 scanlines
GM_CHAR_G13 = 5 ; 5 colors, 40x12, 480b, 40xline, 16 scanlines
GM_PIXEL_G3 = 8 ; 4 colors, 40x24, 240b, 10xline, 8 scanline
GM_PIXEL_G4 = 9 ; 2 colors, 80x48, 480b, 10xline, 4 scanline
GM_PIXEL_G5 = 10 ; 4 colors, 80x48, 960b, 20xline, 4 scanline
GM_PIXEL_G6 = 11 ; 2 colors, 160x96, 1920b, 20xline, 2 scanline
GM_PIXEL_G7 = 13 ; 4 colors, 160x96, 3840b, 40xline, 2 scanline
GM_PIXEL_G8 = 15 ; 2 colors, 320x192, 7680b, 40xline, 1 scanline
GM_PIXEL_G14 = 12 ; 2 colors, 160x192, 3840b, 20xline, 1 scanline
GM_PIXEL_G15 = 14 ; 4 colors, 160x192, 7680b, 40xline, 1 scanline
GM_PIXEL_G9 = 15 ; 1 color, 80x192, 7680b, 40xline, 1 scanline
GM_PIXEL_G10 = 15 ; 9 colors, 80x192, 7680b, 40xline, 1 scanline
GM_PIXEL_G11 = 15 ; 16 colors, 80x192, 7680b, 40xline, 1 scanline

; Prior values
PRV_PM_PRIORITY_1 = %00000001
PRV_PM_PRIORITY_2 = %00000010
PRV_PM_PRIORITY_3 = %00000100
PRV_PM_PRIORITY_4 = %00001000
PRV_FIFTH_PLAYER = %00010000
PRV_PM_OVERLAP = %00100000
PRV_GTIA_9 = %01000000
PRV_GTIA_10 = %10000000
PRV_GTIA_11 = %11000000

; Consol values:
CNV_START_MASK = %001
CNV_OPTION_MASK = %010
CNV_SELECT_MASK = %100

; Stick values:
STV_RIGHT_MASK = %1000
STV_LEFT_MASK = %0100
STV_DOWN_MASK = %0010
STV_UP_MASK = %0001
STICK_MASK_RIGHT = %1000
STICK_MASK_LEFT = %0100
STICK_MASK_DOWN = %0010
STICK_MASK_UP = %0001
STICK_VALUE_RIGHT = %0111
STICK_VALUE_LEFT = %1011
STICK_VALUE_DOWN = %1101
STICK_VALUE_UP = %1110

 

It only have the special chips (I don't use the OS that much, I should just erase the "Shadow registers", "VBI" and "I/O" areas :D), but also the read/write versions of the same register and some section for "constants" (like the DL values and some bits values).. so you could say that there is still room for someone to write the "definitive" version of the equates file, starting with all the versions in this thread.

  • Like 1
Link to comment
Share on other sites

And done!

 

This is the entire list of memory labels and addresses compiled straight from 'Mapping The Atari'. I have incorporated the errata and addendum section in to the main file. The XL/XE appendix contains many duplications and is therefore a separate file.

 

There may well be errors, although I have tried to catch the more obvious OCR artefacts. Also, in places there are duplications of the same label and I have commented out the second occurence. Most intriguingly there are also labels which have the same name as an assembler pseudo-op. at least in MADS. These have also been ';'ed. Unlike the excellent examples above I have not included any commentary or explanations, which I really should.

 

Atari 8-Bit Memory Constants.asm

Atari 8-Bit Memory Constants - XL-XE.asm

Edited by morelenmir
Link to comment
Share on other sites

another plus: you can use C/C++/Python to do the heavy lifting when it comes to generating data, converting from other map editor/graphics editor formats, compressing code and data, etc.

 

The little experimental thing I'm playing with on the C64 at the moment (Although I intend to get it running on the A8 afterwards) uses a python script to compress a relative shedload of data (down to about 350kb), cross-compile some code that runs from RAM using ACME assembler, and then builds a raw easyflash-compatible cartridge image using another python script and then calls the VICE cartridge maker tool to make an emulator-compatible .crt file.

 

it takes about a minute and a half to build the cartridge image from scratch, or about a second if you don't have to do the data generation.

Edited by sack-c0s
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...