Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - WLA-DX help

Reply to topic
Author Message
  • Joined: 14 Mar 2018
  • Posts: 19
Reply with quote
WLA-DX help
Post Posted: Wed Mar 14, 2018 5:23 am
Hi, I'm trying to use WLA-DX, but the docs are a bit lite and I need to do something complicated... I hoping people here can help as WLA seems to be the main assembler here.

I need to get the linker to put things in the right place, but it seems you must give ORG a numeric value for an address.. So I can't tell it to put code at label defined elsewhere??
Here is what I have now.
File A
.MEMORYMAP
DEFAULTSLOT 0
SLOTSIZE $10000
SLOT 0 $0000
.ENDME

.ROMBANKMAP
BANKSTOTAL 2
BANKSIZE $10000
BANKS 2
.ENDRO

.BANK 0 SLOT 0
.ORG $1c00 ; start of 128 BASIC
.SECTION "CPU_8500" FORCE

; 10 sys 7184
.DB $00,$0C,$1C,$0A,$00,$9E,$20,$37,$31,$38,$34,$00,$00,$00,$00,$00

; ORG $1c10
se
lda #$BE
sta $FF00
lda #195
sta $ffee
lda #<Z80Start
sta $ffef
lda #>Z80Start
sta $fff0
lda #$b0
sta $d505
nop
inc $d020
-   jmp -
Z80Start

.ENDS
and File B
.MEMORYMAP
DEFAULTSLOT 0
SLOTSIZE $10000
SLOT 0 $0000
.ENDME

.ROMBANKMAP
BANKSTOTAL 2
BANKSIZE $10000
BANKS 2
.ENDRO

.BANK 0 SLOT 0
.ORG Z80Start
.SECTION "CPU_Z80" FORCE
ld a,0
ld bc,$d020
out (c),a
inc bc
out (c),a
ld hl,messagetxt
ld de,$0400
ld bc,#20
ldir
- jp -
messagetxt .asc "hello world z80 here"
.ENDS

So I want the contents of File B to be put at Z80Start

Also seems WLA-DX make a min file of 8K, is it just min, or does it make in multiples of 8K, so 8K->16K not 8198 bytes for example. If so is there a way to stop it?

I hope to eventually get to the SMS, is WLA-DX really the best Z80 assembler? I get that it has build in "do things for SMS" but in terms of standard assembler features is there better?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14685
  • Location: London
Reply with quote
Post Posted: Wed Mar 14, 2018 7:10 am
It has limitations on what it can do in terms of the symbols resolution, which can be frustrating. The biggest advantages for me are the automatic section placement and built in knowledge of paging. It looks like you're taking advantage of its ability to link multiple CPUs' code into a single binary, which I'm guessing is fairly rare.

These days support happens in the GitHub issues, but you may not get much response.

Could you change it so the 6502 (?) code uses a label from the Z80 code, rather than having the 6502 code try to control the Z80 location? The linker is quite predictable in terms of section placement so you can probably get the actual locations to be as you wish, if it's really necessary.

On the last point, it always produces complete banks, as it's targeting ROM.
  View user's profile Send private message Visit poster's website
  • Joined: 14 Mar 2018
  • Posts: 19
Reply with quote
Post Posted: Wed Mar 14, 2018 8:27 am
Playing with it some more.. I think the issues are in WLA-6510... I'm going to try WLA-6502 when my AntiVirus will let it run, its a "rare" file, WLA-Z80 it seems to know all about.

WLA-6510 makes an 8K .o file while WLA-Z80 makes a 440 byte .o file (now that I have bodged it to be able to assemble) This causes more issues as the linker won't put anything into the 8K file from 6510, as it thinks it needs all of it.

The problem with giving the variable to the Z80 is I still need to give the Z80 an ORG and make sure nothing else is already at that location. The 8500 code needs to be a $01c00, the Z80 code can mostly be anywhere after the 8500 code( just closer to the 8500 code the better ), just I need to know where bits of it are from the 8500 code, and make sure the Z80 code knows where the 6502 code is for switch-overs.

Is there a way to assemble code at a location, but for a different PC?
So the code lives in "RAM/ROM" @$8750 for example, but the code is to be run from RAM so you copy the code to say $0400 and then run the code at $0400 all of it jumps etc are based upon it being at $0400?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14685
  • Location: London
Reply with quote
Post Posted: Wed Mar 14, 2018 9:00 am
You can let the Z80 section be free so the org is just a lower bound, the linker finds space for it.

Any time I've had something mildly complex I've usually resorted to assembling the parts individually and then pulling them in by .incbin, but that's usually because the memory maps need to differ too.
  View user's profile Send private message Visit poster's website
  • Joined: 14 Mar 2018
  • Posts: 19
Reply with quote
Post Posted: Sun Apr 22, 2018 12:35 pm
Turns out that if you have a number on the end of a section name it makes the section have that many bytes in it..
So .SECTION "CPU_8500" means make a section CPU that is 8500 bytes big. Hence about 8K.

Like wise one should take care to never use a name like
LEVEL_DATA_1 as that will make a section 1 byte big ;)
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!