Page 1 of 1

Trouble getting started in assembly

Posted: Sat Jun 29, 2024 7:28 pm
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?

Re: Trouble getting started in assembly

Posted: Sat Jun 29, 2024 9:45 pm
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.

Re: Trouble getting started in assembly

Posted: Sun Jun 30, 2024 6:30 am
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.

Re: Trouble getting started in assembly

Posted: Sun Jun 30, 2024 4:24 pm
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”