Post the fun code you found!

Here you can ask questions or provide insights about how to use efficiently 6502 assembly code on the Oric.
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Post the fun code you found!

Post by Godzil »

As some already know, I'm playing with the disassembly of the various Jasmin ROM, and found some interesting assembly construction in the Jasmin ROM:

Code: Select all

LFE0D:  dey                                     ; FE0D 88                       .
        cpy     #$FF                            ; FE0E C0 FF                    ..
        beq     LFE1B                           ; FE10 F0 09                    ..
        lda     LFE63,y                         ; FE12 B9 63 FE                 .c.
        sta     L0400,y                         ; FE15 99 00 04                 ...
        clc                                     ; FE18 18                       .
        bcc     LFE0D                           ; FE19 90 F2                    ..
LFE1B:  lda     #$01                            ; FE1B A9 01                    ..
I hope that the T-DOS was better coded!
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Post the fun code you found!

Post by Dbug »

One reason I could see for the clc/bcc is to want to keep the code relocatable by using only relative branching.
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: Post the fun code you found!

Post by Godzil »

That's true that the 6502 does not have a BRA (Branch Always) like instruction, anyway, PIC was not really the in thing at the time, maybe the code was made by hand and not using an assembler, but personally, it's easier to provide the good address of an instruction than calculate the offset to apply for a Bxx intruction ;)

But anyway, I found this code funny, and I'm pretty sure that it is not optimal.
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Post the fun code you found!

Post by Dbug »

Well, I had to use this kind of weird thing for the boot sector of the Defence-Force demos.

Typically if both the Atmos and the Telestrat have a Microdisc system, they don't load the boot sector at the same address in memory so any code that uses absolute addressing will just crash and burn.

Perhaps the Jasmin rom is doing similar things?
Godzil
Squad Leader
Posts: 774
Joined: Sat May 21, 2011 7:21 pm
Location: Between UK and France
Contact:

Re: Post the fun code you found!

Post by Godzil »

I don't know if this code is move elsewhere, but it's one of the first thing the ROM does, so it should not move around in RAM.
Post Reply