Wla's RAM handling totally broken?
Posted: Sun Apr 01, 2007 12:54 pm
Currently I use .defines for addresses of variables in RAM:
Nevermind that wla seems to lack sane constant definitions of the form
In ca65 and other assemblers, you just do
and the assembler puts the variable at the next open address in zero page (or .bss for the rest of RAM). You can interleve these freely, allowing each source file to define its variables at the top without conflict with others.
I figured I'd try to use wla's .ramsection to define these. OK, slot 0 is RAM, slot 1 is ROM. Let's define some code, some variables, then more code:
But wla for some reason inserts a zero byte in the ROM output!
As you can see, it properly put variable at address $200, but inserted the zero byte in ROM at address $8002. OK, fine, I can accept a few zero bytes inserted at random places between routines. But when I try to use .ramsection for zero page variables, I get a linker error when using them (I'm using this for the SPC-700 CPU, but the same issues apply to the 6502):
But the linker fails:
This fixes it:
This is insane to go through, when the assembler's job is to simplify things for you.
Code: Select all
.define variable $10Code: Select all
variable = $10Code: Select all
.zeropage
variable: .byte 0
.code
lda variable ; uses zero-page addressing
... more codeI figured I'd try to use wla's .ramsection to define these. OK, slot 0 is RAM, slot 1 is ROM. Let's define some code, some variables, then more code:
Code: Select all
.memorymap
defaultslot 1
slotsize $100
slot 0 $200
slot 1 $8000
.endme
.rombankmap
bankstotal 1
banksize $100
banks 1
.endro
; OK, some "code"
.bank 0 slot 1
.byte $11,$22
; A variable
.RAMSECTION "1" slot 0
variable: db
.ends
; More "code"
.bank 0 slot 1
.byte $33,$44
.word variableCode: Select all
vv What the hell is this inserted byte?
11 22 00 33 44 00 02
^^^^^ Couldn't be this, which is at address $200Code: Select all
.memorymap
defaultslot 1
slotsize $100
slot 0 $000 ; address 0 now for zero page
slot 1 $8000
.endme
.rombankmap
bankstotal 1
banksize $100
banks 1
.endro
.RAMSECTION "1" slot 0
variable: db
.ends
.bank 0 slot 1
mov a,variable ; same as lda variable (from zero page)Code: Select all
test.a:19: FIX_REFERENCES: Too large distance (-32259 bytes from $8002 to
$200 "variable") for a 8bit reference.Code: Select all
mov a,<variable