2

Consider the following vasm6502 oldstyle code:

 .org $8000 ;Set the start address
 
 lda #%11111111 ;Prepare data all pins to output on PORTB
 sta %0110000000000010 ;Set all pins to output on PORTB
 
 lda #%10101010 ;Prepare data all pins high on PORTB
 sta %0110000000000000 ;Set all pins high on PORTB
 
 .org $fffc
 .word $8000
 .word $0000

Why does .org $fffc place $8000 at 0x7ffc and not at the 0xfffc address?

enter image description here

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
Georgi Peev
  • 912
  • 1
  • 14
  • 25
  • 5
    Because the file starts at `$8000` so everything is offset by that amount. If you load this at `$8000` at runtime, the `$7ffc` will be correctly at `$fffc` – Jester Jan 15 '23 at 16:08
  • `org` isn't actually placed into your executable anywhere. It's just there so that the assembler can correctly translate your `JMP` and `JSR` operands to the correct addresses. The first `org` in your document isn't going to pad your file, but the others will. – puppydrum64 Jan 24 '23 at 13:13

0 Answers0