Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ASM code as slow as basic one in Double HIRES!!

153 views
Skip to first unread message

Cyril Thibout

unread,
May 9, 2013, 11:11:46 AM5/9/13
to
Hi

I just tried to write an ASM piece of code for Apple IIe Double HIRES with the french ARLEQUIN (chat mauve) library.

This code just switch to DHR and write 15 "X" upon a different background each time.

The big surprise is that the MErlin8 ASM program is as slow as the basic one.

If you don't have the arlequin soft or book , please tell me.

But can you tell me why the ASM version is no faster than the basic one?

thanks

cyril



BASIC code:

10 & WINDOW(0,19,0,191,1): & BACK(4): & MODE(2)
15 & COL(0): & DISPLAY(2)
20 FOR B = 1 TO 15: & BACK(B): & WRITE("X"): NEXT
30 GET A$: & DISPLAY(0): END


ASM (MErlin8)version :

* programme DHR
ORG $8000

WINDOW JSR $1FF0
DFB #$24
DW PCOORD
BACK JSR $1FF0
DFB #$0C
DW PBACK
MODE JSR $1FF0
DFB #$3C
DW PMODE
COL JSR $1FF0
DFB #$08
DW PCOL
DISPLAY JSR $1FF0
DFB #$6C
DW PDISP


LDX #$0F
BOUCLE STX PBACKX
BACKX JSR $1FF0
DFB #$0C
DW PBACKX
WRITEX JSR $1FF0
DFB $40
DW WRITELIST

DEX
BNE BOUCLE


RTS

PCOORD DW $00
DW $13
DW $00
DW $BF
DW $01
PBACK DW $04
PMODE DW $02
PCOL DW $00
PDISP DW $02
PBACKX DW $0F
WRITELIST DW ADPATH
ADPATH DB 1
ASC "X"

Antoine Vignau

unread,
May 9, 2013, 12:20:33 PM5/9/13
to
1. I'd rather use DA instead if DW
2. The ampersand handling routine is probably well optimized!
3. The DHGR routines are probably not optimized.

Antoine

Michael J. Mahon

unread,
May 9, 2013, 1:11:53 PM5/9/13
to
Consider where the program is spending it's time.

If it is spending 99% of its time in the graphics routines and 1% in your
calling code, then causing your calling code to run infinitely fast will
result in a 1% speedup in the program.

This is why it works so well to use BASIC to handle user I/O and file
I/O--there is no need for speed when all the time is spent waiting for the
user or the disk!

To optimize a program efficiently, profile it to determine where it is
spending significant time. These are the only routines worth optimizing.

-michael - NadaNet 3.1 and AppleCrate II: http://home.comcast.net/~mjmahon

Bill Buckels

unread,
May 9, 2013, 6:47:22 PM5/9/13
to

"Cyril Thibout" <in...@pulsar-informatique.com> wrote:
> This code just switch to DHR and write 15 "X" upon a different background
> each time.
> The big surprise is that the MErlin8 ASM program is as slow as the basic
> one.
> But can you tell me why the ASM version is no faster than the basic one?

Hi Cyril.

Ok... both languages use the same ROM routines and run on the same processor
so this is no surprise.

How does Aztec C do?

When I wrote my font routines for DHR mode I used my 4 bit pattern bitmasks,
NOTted the background, then ANDed the color. I would NOT write this in BASIC
, AND neither would I write these in pure ASM.

Nor did I.

Check-out http://www.aztecmuseum.ca/AppleX.zip for the DHGR code with
source. You can tweak the code either in C or ASM.

Other strategies can be applied. Difficult to do in ASM or BASIC. More
difficult if you don't write your own routines.

Bill


Phil Tubb

unread,
May 13, 2013, 2:46:21 AM5/13/13
to
On Thursday, May 9, 2013 8:11:46 AM UTC-7, Cyril Thibout wrote:
> Hi
>
> I just tried to write an ASM piece of code for Apple IIe Double HIRES with the french ARLEQUIN (chat mauve) library.
>
>
> This code just switch to DHR and write 15 "X" upon a different background each time.
>
>

Does anything in this package help you any?
http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Software/Applications/ALF%20HGR6/

BLuRry

unread,
May 13, 2013, 3:06:20 PM5/13/13
to
That package looks really impressive! I must admit it has piqued my interest. :-)

-B
0 new messages