Trouble getting started in assembly

All aspects of programming on the Commander X16.
Post Reply
Chrisjan89
Posts: 2
Joined: Sat Jun 29, 2024 7:18 pm

Question Trouble getting started in assembly

Post by Chrisjan89 »

Hi have some knowledge of 6502 assembly from working on the C64 and the NES.
I have a little bit trouble getting started with the X16.

As what I can read the following code should write the character A to the screen and change the color.

Code: Select all

.org $080d
.segment "STARTUP"
.segment "INIT"
.segment "ONCE"
.segment "CODE"

    lda #$00
    sta $9F25
    lda #$20
    sta $9F22
    lda #$00
    sta $9F20
    lda #$00
    sta $9F21

    lda #$41
    sta $9F23
    lda #$12
    sta $9F23

    rts
However nothing happens. I can get the kernal routine to write the character on the screen, but I would like to do directly. I followed many tutorials, but must of the times nothing happens. I tested both in the emulator and on the real hardware. Any pointers to what am I doing wrong?
DragWx
Posts: 342
Joined: Tue Mar 07, 2023 9:07 pm

Re: Trouble getting started in assembly

Post by DragWx »

The tutorials you're using are outdated.

According to official documentation, when the X16's default text mode is being used, the VRAM for the text is located at VERA $1B000..1EBFF. There was once a time when text mode was at $00000, but it's not there anymore.
Chrisjan89
Posts: 2
Joined: Sat Jun 29, 2024 7:18 pm

Re: Trouble getting started in assembly

Post by Chrisjan89 »

Thanks for the reply. I will definitely try this when I get home. I guess following outdated tutorials hurt me and I need to compare all adresses with the documentation.
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: Trouble getting started in assembly

Post by unartic »

Also be aware of how text mode works. It is basically a tilemap of 128x128 tiles from which a subset is displayed depending on the screen mode you’re in.

So if you write to vram directly you have to account for line wrapping yourself.

Also when writing to vram you are writing screen codes, instead of petscii chars. So writing $01 will be an “A”
Post Reply