Sunday 6 October 2019

RetroChallenge 2019/10: Akalabeth Text Routine Speed-up

First mission complete
Intro Screen
I've made the text routine faster again.  I realized that no single letter or number used more than 7 draw commands, and since I encode and use the actual numbers for each draw command, I could encode every character using only 7 digits instead of 9. That's a substantial reduction of processing for each character.

Here is the new routine:

0 CLS:CLEAR500:DIMT,A,G,A$,B$,A$(58),I,J,M$,P(5),C$(5),C(5),M$(10),ML(10,1),MZ(10,1):I=64:J=47:GOTO15
1 DRAW"BD6":FORG=1TOLEN(M$):A=ASC(MID$(M$,G)):IFA>ITHENA=(A-I)*7:FORT=ATOA+6:DRAWA$(ASC(MID$(A$,T))):NEXT:DRAW"BR8":NEXT:DRAW"BL255BD2":RETURN
2 IFA>JTHENA=(A-J)*7:FORT=ATOA+6:DRAWA$(ASC(MID$(B$,T))):NEXT:DRAW"BR8":NEXT:DRAW"BL255BD2":RETURN
3 DRAW"BR8":NEXT:DRAW"BL255BD2":RETURN
REM       A      B      C      D      E      F      G      H      I      J      K      L      M      N      O      P      Q      R      S      T      U      V      W      X      Y      Z
15 A$="      10345671256700123600014567001234670123070002345671250700900000014560001250780000008912345801234500123456012347000234570123400023567000000789120456024007091245609205078902045671340670"
16 B$="      123456000000891346700345670024507002356700123567034500001234567234570034000090000700"
17 A$(48)="":A$(49)="NU3":A$(50)="BU3U3BD6":A$(51)="BU6NR5BD6":A$(52)="BR5BU3U3BD6BL5":A$(53)="BR5NU3BL5":A$(54)="NR5":A$(55)="BU3NR5BD3":A$(56)="BU6BR3D3BD3BL3":A$(57)="BR3NU3BL3"

I'm now up to AKALABETH_MCX12.TXT in terms of versions of the source. I'm not sure if there are any other possible speed-ups hiding in the code, but you never know.  Also made some changes to the introductory screen to put all the questions on one screen.  Be nice to add some instructions too, but memory is at a premium.  In fact, I had to pare down some of the messages that get displayed when you enter Lord British's Castle for your various missions. So in case people were wondering, the arrow controls for movement are:

   I
J K L

And the other commands are as follows:

A=attack
S=stats
Space=pass turn (wait)
P=Turn pause combat messages on or off


No comments:

Post a Comment