Jump to content
ilmenit

shortest 8bx16b multiplication by 16

Recommended Posts

Interesting!

DBED: A0 04     LDY #$04
DBEF: 18        CLC
DBF0: 36 04     ROL $04,X   ;RAMLO
DBF2: 36 03     ROL $03,X   ;CASINI+1
DBF4: 36 02     ROL $02,X   ;CASINI
DBF6: 36 01     ROL $01,X   ;NGFLAG
DBF8: 36 00     ROL $00,X   ;LNFLG
DBFA: 26 EC     ROL $EC     ;FRX
DBFC: 88        DEY
DBFD: D0 F0     BNE $DBEF
DBFF: 60        RTS

And if you set Y yourself, and jump to $DBEF, you can multiply by other multiples of two, too :)

Edited by ivop
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I plan to prepare a sizecoding essay for using OS. There is a lot of useful stuff there.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, ivop said:

Interesting!

DBED: A0 04     LDY #$04
DBEF: 18        CLC
DBF0: 36 04     ROL $04,X   ;RAMLO
DBF2: 36 03     ROL $03,X   ;CASINI+1
DBF4: 36 02     ROL $02,X   ;CASINI
DBF6: 36 01     ROL $01,X   ;NGFLAG
DBF8: 36 00     ROL $00,X   ;LNFLG
DBFA: 26 EC     ROL $EC     ;FRX
DBFC: 88        DEY
DBFD: D0 F0     BNE $DBEF
DBFF: 60        RTS

 

Nice. Of course, the labels RAMLO, CASINI, etc. are meaningless here, and confusing, because this is never called with X being zero.

Share this post


Link to post
Share on other sites
On 1/4/2022 at 5:24 PM, ilmenit said:

I plan to prepare a sizecoding essay for using OS. There is a lot of useful stuff there.

Cool! I recently thought of going through the OS, looking for interesting code that ends with an rts, but if you already have done so... :)

 

23 hours ago, ClausB said:

Nice. Of course, the labels RAMLO, CASINI, etc. are meaningless here, and confusing, because this is never called with X being zero.

Yeah, they are meaningless in this context. They were generated by the builtin atari800 disassembler and I didn't remove them.

 

Share this post


Link to post
Share on other sites
57 minutes ago, sanny said:

Is this going to work with any OS version?

No. This is about sizecoding and needs specific requirements for the computer/emulator to run it properly.

 

Most of the time it is 800XL with rev.2 OS and NO BASIC.

 

For example:

    lda #2
    jsr $ef9c       ; set graphics mode

won't work with anything other then the previous mentioned requirements. No BASIC if you want to write directly into the screen memory of the just set graphics mode. Et cetera.... :)

 

It's not about being compatible, it's about being as small as possible, and then do something neat.

Share this post


Link to post
Share on other sites
On 1/5/2022 at 8:30 PM, ivop said:

It's not about being compatible, it's about being as small as possible, and then do something neat.

Something neat that does not work :D

 

It is cheating IMHO. A 256-byte intro, which uses illegal OS calls, is not really equally the same as another 256-byte intro which does not use that. They should not be in the same category.

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, drac030 said:

Something neat that does not work :D

 

It is cheating IMHO. A 256-byte intro, which uses illegal OS calls, is not really equally the same as another 256-byte intro which does not use that. They should not be in the same category.

Devil's advocate here, but is anything being done in 256-bytes (as a demo) not "cheating" at everything it's doing?

Share this post


Link to post
Share on other sites

I somewhat agree with @drac030, but on the other hand, other platforms have their ROMs, too, to exploit. I did a couple of C64 entries for the first Lovebyte compo, first time programming for the C64, and you can "exploit" the header for a few preloaded constants. Is that cheating? The C64 does not have segments while loading like we have on the Atari. I can exploit that by assuming the first segment is also the run address, and the second segment is just C4 02 C5 02 12 34, which is six bytes. lda #val, sta abs twice is ten bytes. Is that cheating?

 

Looking into doing something for the Apple ][ or Oric! And exploit every ROM there is ;)

Edited by ivop
  • Like 1

Share this post


Link to post
Share on other sites
41 minutes ago, ivop said:

Looking into doing something for the Apple ][ or Oric! And exploit every ROM there is ;)

Apple 2 has a great ROM routines.

If we call using system specific properties a cheating then we could close the whole category of 256 (and less) 🙂 On all the platforms (not only 8bit) they are in use in such intros.

  • Like 2

Share this post


Link to post
Share on other sites
On 1/5/2022 at 1:28 PM, sanny said:

Is this going to work with any OS version?

This routine is in the floating point ROM. Did that change with OS versions?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...