Posted By
   rudis on 2012-01-15 14:03:43
   |   ca65 lowbyte
  played little bit with asm 
  --8<---
  .setcpu "6502" .org $1001 .word *
  .word link .word 2012	; zeilennummer .byte $9e	; sys-token .byte "4109"	; adresse .byte $00	; zeilenende .byte $00,$00 link: 		sei 		ldx #<myvbl-2 		stx $312 		ldx #>myvbl 		stx $313 		cli 		rts
  myvbl: 		inc $ff19 		jmp $ce42
  		jsr $fff6
 
  -->8--
  so if i don't write 
 ldx #<myvbl-2    but
 ldx #<myvbl  the adress is 2 bytes to high. WHY???
  |   
 | 
Posted By
   gerliczer on 2012-01-15 14:19:19
  |   Re: ca65 lowbyte
  Is it any better if you try it with
 .org $ffe .word $1001 ? Anyway, I think you should move the label "link" before the line ".byte $00,$00" because the way it is written now makes the basic line linking wrong. At least I think so.
  |   
 | 
Posted By
   siz on 2012-01-15 14:29:24
  |   Re: ca65 lowbyte
  Gerliczer is right: you put the load address (.word *) after your .org $1001 and that shifts the rest of your code by two bytes. So you should write: .org $1001 -2 (which is $fff and not $ffe  ) .word $1001 ...and the rest Also gerliczer is right in case of the placement of the link label too.
  |   
 | 
Posted By
   rudis on 2012-01-15 15:01:10
   |   Re: ca65 lowbyte
  works like a charm now.  
  many thanks
  |   
 | 
Posted By
   gerliczer on 2012-01-15 16:21:03
  |   Re: ca65 lowbyte
  Half an hour later I realized too that the correct address for the .org directive should be $fff. siz was much quicker than me. Another idea would be leaving it as rudis wrote it originally and inserting a .org *-2  line after the load address word. This works only if the compiler supports such syntax and more than one .org directive in one source.
  |   
 |