6502 Assembler and Linker
Posted: Sun Jan 08, 2023 3:19 am
Hi,
I'm building my first homebrew 6502 computer, and have a question about linkers for the 6502 processor.
As a bit of background, I'm mostly a software guy. I'm also a ham radio operator and have done a lot of radio repair and restoration, but my familiarity is primarily analog circuits, particularly vacuum tube equipment. The 6502 was my first processor when I was a kid, and it remains a sentimental favorite. When I saw Ben Eater's videos, I became inspired to build a 6502 breadboard computer as an educational exercise on digital electronics and basic computer hardware.
As of right now, my computer has a working LCD interface, a working PS2 keyboard interface, and I just finished getting a 6551 hooked up to a TTL USB/serial converter. I'm using VASM to assemble my code, and I'm using a windows based computer for the software development. As of right now, all of my code is contained in a single source file (I call it "BIOS.s"), which gets assembled into a binary and burned to the the 28C256 that I'm using as ROM.
What I would like to do next is to start writing code that can be downloaded directly to RAM via the serial port, and I would like to have this code be able to call subroutines in ROM. I can't seem to figure out how to tell the assembler/linker that I want to make calls to a subroutine that is defined in a different source file.
For example, I have a subroutine in BIOS.s called LCD_print_char that prints a character to the LCD screen. Let's say I want to write a separate "hello world" program that will get loaded into RAM at $1000 and executed. How do I tell the assembler/link that I want to call the LCD_print_char that is already present in ROM? I suppose I could look up the addresses for each subroutine and manually code those into my "hello world" program, but that would be painful and there really should be a way to have the assembler/linker do this for me.
Thanks for helping out a beginner!
I'm building my first homebrew 6502 computer, and have a question about linkers for the 6502 processor.
As a bit of background, I'm mostly a software guy. I'm also a ham radio operator and have done a lot of radio repair and restoration, but my familiarity is primarily analog circuits, particularly vacuum tube equipment. The 6502 was my first processor when I was a kid, and it remains a sentimental favorite. When I saw Ben Eater's videos, I became inspired to build a 6502 breadboard computer as an educational exercise on digital electronics and basic computer hardware.
As of right now, my computer has a working LCD interface, a working PS2 keyboard interface, and I just finished getting a 6551 hooked up to a TTL USB/serial converter. I'm using VASM to assemble my code, and I'm using a windows based computer for the software development. As of right now, all of my code is contained in a single source file (I call it "BIOS.s"), which gets assembled into a binary and burned to the the 28C256 that I'm using as ROM.
What I would like to do next is to start writing code that can be downloaded directly to RAM via the serial port, and I would like to have this code be able to call subroutines in ROM. I can't seem to figure out how to tell the assembler/linker that I want to make calls to a subroutine that is defined in a different source file.
For example, I have a subroutine in BIOS.s called LCD_print_char that prints a character to the LCD screen. Let's say I want to write a separate "hello world" program that will get loaded into RAM at $1000 and executed. How do I tell the assembler/link that I want to call the LCD_print_char that is already present in ROM? I suppose I could look up the addresses for each subroutine and manually code those into my "hello world" program, but that would be painful and there really should be a way to have the assembler/linker do this for me.
Thanks for helping out a beginner!