From: Rick Grevelle Subject: MDISPN Date: Tue, 16 Jun 92 [Mini-instructions: String on level 2, real number on level 1. (Original used system binary; I changed it). Basically same as DISP except it's twice as fast, and MDISPN doesn't do newlines. -jkh-] Just recently I learned that on the average there was a 30% speed penalty in run time due to the page switching in the 48. According to Jake Schwartz it was Hewlett-Packard's Dennis York who alluded to this during the 1992 Handheld User's Conference in Philadelphia. After the experience gained from developing the machine language library builder, I began looking for ways to greatly increase its performance along with other previously written programs. It'll probably come as no surprise, but I fully expect USRLB for the 48 to build some libraries 10 times faster than's now possible. In similar fashion MDISP has been rewritten, and the speed gained is quite enough to make mention of it. While the routine itself is not very large, and could be even shorter at the expense of speed which is usually the case, it's the font table that accounts for the majority of the bytes; 2040 to be exact. The main advantages are of course the speed gained from not having to bank shift the machine each time the font table is accessed, and the flexibility to create or modify existing fonts. In this current version the first 32 fonts not included in the 48's table have been added and were modeled after the ANSI standard used by MS-DOS. Anyone who plans to write and market software for the 48 should consider the advantage of using a customized display routine for applications requiring a great deal of displaying. As is evident from the source code, MDISPN can be easily modified from its present form to meet a variety of needs, and as previously stated it can just as easily be made shorter, but at the sacrifice of speed. In most cases this particular font size is prefered which is why it's shown here, but similar schemes can be written utilizing either the smallest or largest fonts. Also of interest is the additional ability to control the menu label area of the display; MDISPN has an 8 level understanding of the display while DISPN has 7, and could be quite helpful for browser formats using the complete screen. The source code is straight forward: ************************************************************************* ** ** Name: MDISPN ** ** Calls: SavPtr, GetPtr. ** ** Entry: D1[A]: XXXXX = address of level 1 system binary; level 2 string. ** ** Exit: D1[A]: XXXXX+10 = address of level three object. ** ** Trashes Registers: A[W], B[A], C[A], D0[A], D1[A], and ST[0,1]. ** ** Stack Levels: 2 ** ** Purpose: ** ** Displays level 2 string in one of 8 display levels as specified by the ** level 1 system binary, where ONE is the top most level of the display, ** and EIGHT is the bottom of the display usually occupied by menu labels. ** ************************************************************************* DoCode EQU #02DCC SavPtr EQU #0679B GetPtr EQU #05143 NIBASC \HPHP48-E\ object header CON(5) DoCode begin code REL(5) EndMDSP C=DAT1 A c=hhhhh CD1EX d1=(above), c=XXXXX D1=D1+ 5 d1=hhhhh+5 A=DAT1 A a=row number D1=C d1=XXXXX D1=D1+ 5 drops D=D+1 A level 1 C=DAT1 A c=iiiii RSTK=C address saved string D1=D1+ 5 drops D=D+1 A level 2 GOSBVL SavPtr save registers C=0 A A=A-1 A GOC Row1 A=A-1 A GOC Row1 A=A-1 A GOC Row2 A=A-1 A GOC Row3 A=A-1 A GOC Row4 A=A-1 A GOC Row5 A=A-1 A GOC Row6 A=A-1 A GOC Row7 LCHEX 14 D1=HEX 70551 address menu GROB cache GONC PstStRw Row1 LCHEX 14 GOC SetRowN Row2 LCHEX 124 GOC SetRowN Row3 LCHEX 234 GOC SetRowN Row4 LCHEX 344 GOC SetRowN Row5 LCHEX 454 GOC SetRowN Row6 LCHEX 564 GOC SetRowN Row7 LCHEX 674 SetRowN D1=HEX 7055B d1=7055B PstStRw A=DAT1 A a=display write address C=C+A A c=display address RSTK=C saved display address D1=C A d1=(above) LCHEX 10 initialize loop count A=0 W ClrLoop DAT1=A W clear pixels D1=D1+ 16 d1=address next pixels C=C-1 B decrement loop counter GONC ClrLoop C=RSTK c=display address D1=C d1 restored C=RSTK c=iiiii D0=C d0=(above) D0=D0+ 5 d0=iiiii+5 C=DAT0 A c=string length C=C-CON A,5 c=nibbles CSRB.F A c=bytes D0=D0+ 3 d0=address 1st character-2 B=C A b=bytes ST=0 0 clear even pass detect bit ST=0 1 clear over size detect bit LCHEX 00016 c=00016 ?B<=C A GOYES FontTbl ST=1 1 set over size detect bit B=C A b=00016 B=B-1 A b=00015 FontTbl GOSUBL ChrLoop NIBHEX 0000000000515100 NIBHEX E011B111F15111E0 NIBHEX E0F151F111B1F1E0 NIBHEX A0F1F1F1E0400000 NIBHEX 0040E0F1E0400000 NIBHEX 40E0B1B1E040E000 NIBHEX 40E0F1F1E040E000 NIBHEX 000040E040000000 NIBHEX F1F1B111B1F1F100 NIBHEX 000040A040000000 NIBHEX F1F1B151B1F1F100 NIBHEX C18141E01111E000 NIBHEX E01111E040E04000 NIBHEX 60A0202020201000 NIBHEX E121E12121A01000 NIBHEX 4051E0B1E0514000 NIBHEX 103070F170301000 NIBHEX 0181C1F1C1810100 NIBHEX 40E04040E0400000 NIBHEX 2121212121002100 NIBHEX E151516141414100 NIBHEX C120C021C001E000 NIBHEX 000000F1F1000000 NIBHEX 40E04040E040E000 NIBHEX 40E0404040404000 NIBHEX 4040404040E04000 NIBHEX 004080F180400000 NIBHEX 004020F120400000 NIBHEX 00001010F1000000 NIBHEX 0000A0F1A0000000 NIBHEX 000040E0F1F10000 NIBHEX 0000F1F1E0400000 NIBHEX 0000000000000000 NIBHEX 4040404040004000 NIBHEX A0A0A00000000000 NIBHEX A0A0F1A0F1A0A000 NIBHEX 40E150E041F04000 NIBHEX 3031804020918100 NIBHEX 2050502051906100 NIBHEX 4040400000000000 NIBHEX 8040202020408000 NIBHEX 2040808080402000 NIBHEX 00A040F140A00000 NIBHEX 004040F140400000 NIBHEX 0000000060604020 NIBHEX 000000F100000000 NIBHEX 0000000000606000 NIBHEX 0001804020100000 NIBHEX E01191513111E000 NIBHEX 406040404040E000 NIBHEX E01101C02010F100 NIBHEX E01101E00111E000 NIBHEX 80C0A090F1808000 NIBHEX F110F0010111E000 NIBHEX C02010F01111E000 NIBHEX F101804020202000 NIBHEX E01111E01111E000 NIBHEX E01111E101806000 NIBHEX 0060600060600000 NIBHEX 0060600060604020 NIBHEX 8040201020408000 NIBHEX 0000F100F1000000 NIBHEX 1020408040201000 NIBHEX E011018040004000 NIBHEX E01151D15010E100 NIBHEX E01111F111111100 NIBHEX F01111F01111F000 NIBHEX E01110101011E000 NIBHEX 7090111111907000 NIBHEX F11010F01010F100 NIBHEX F11010F010101000 NIBHEX E01110109111E100 NIBHEX 111111F111111100 NIBHEX E04040404040E000 NIBHEX 010101011111E000 NIBHEX 1190503050901100 NIBHEX 101010101010F100 NIBHEX 11B1515111111100 NIBHEX 1111315191111100 NIBHEX E01111111111E000 NIBHEX F01111F010101000 NIBHEX E011111151906100 NIBHEX F01111F050901100 NIBHEX E01110E00111E000 NIBHEX F140404040404000 NIBHEX 111111111111E000 NIBHEX 111111A0A0404000 NIBHEX 1111115151B11100 NIBHEX 1111A040A0111100 NIBHEX 1111A04040404000 NIBHEX F10180402010F100 NIBHEX E02020202020E000 NIBHEX 0010204080010000 NIBHEX E08080808080E000 NIBHEX 40A0110000000000 NIBHEX 000000000000F100 NIBHEX 2020400000000000 NIBHEX 0000E001E111E100 NIBHEX 1010F0111111F000 NIBHEX 0000E1101010E100 NIBHEX 0101E1111111E100 NIBHEX 0000E011F110E000 NIBHEX 40A0207020202000 NIBHEX 0000E01111E101E0 NIBHEX 1010F01111111100 NIBHEX 400060404040E000 NIBHEX 8000C08080809060 NIBHEX 1010905030509000 NIBHEX 604040404040E000 NIBHEX 0000B05151511100 NIBHEX 0000F01111111100 NIBHEX 0000E0111111E000 NIBHEX 0000F01111F01010 NIBHEX 0000E11111E10101 NIBHEX 0000D13010101000 NIBHEX 0000E110E001F000 NIBHEX 2020702020A04000 NIBHEX 000011111111E100 NIBHEX 0000111111A04000 NIBHEX 000011115151A000 NIBHEX 000011A040A01100 NIBHEX 0000111111E101E0 NIBHEX 0000F1804020F100 NIBHEX C02020102020C000 NIBHEX 4040404040404000 NIBHEX 6080800180806000 NIBHEX 0000205180000000 NIBHEX 51A051A051A05100 NIBHEX 000180406090F100 NIBHEX F10011A040A01100 NIBHEX 00F111A0A0400000 NIBHEX C140404050604000 NIBHEX 8041404040502000 NIBHEX F12140804021F100 NIBHEX 3070F0F1F0703000 NIBHEX 0000F1A0A0A0A000 NIBHEX 204080E11111E000 NIBHEX 01804020F100F100 NIBHEX 10204080F100F100 NIBHEX 0080F140F1200000 NIBHEX 0000006190906100 NIBHEX 004080F180400000 NIBHEX 004020F120400000 NIBHEX 4040404051E04000 NIBHEX 40E0514040404000 NIBHEX 0000215180808000 NIBHEX 402040E090906000 NIBHEX 0000E010F010E000 NIBHEX 0000A05141410101 NIBHEX 609090F090906000 NIBHEX 0010102040A01100 NIBHEX 00C02121E0202010 NIBHEX 0000E19090906000 NIBHEX 0000E15040418000 NIBHEX 000090115151A000 NIBHEX 000040A011F10000 NIBHEX F1A0A0A0A0A0A000 NIBHEX E011111111A0B100 NIBHEX 0000E0E0E0000000 NIBHEX 0000A05151A00000 NIBHEX 0000000000000000 NIBHEX 4000404040404000 NIBHEX 0040E15050E14000 NIBHEX C02120702020F100 NIBHEX 11E0111111E01100 NIBHEX 1111A0F140F14000 NIBHEX 4040400040404000 NIBHEX C020E011E0806000 NIBHEX A000000000000000 NIBHEX E01171317111E000 NIBHEX 6080E09060F00000 NIBHEX 0041A050A0410000 NIBHEX 000000F080000000 NIBHEX 000000F000000000 NIBHEX E0117171B111E000 NIBHEX F100000000000000 NIBHEX E0A0E00000000000 NIBHEX 004040F14040F100 NIBHEX E080E020E0000000 NIBHEX E080E080E0000000 NIBHEX 8040000000000000 NIBHEX 0000009090907110 NIBHEX E171716141416100 NIBHEX 0000006060000000 NIBHEX 0000000000408060 NIBHEX 604040E000000000 NIBHEX E01111E000F10000 NIBHEX 0050A041A0500000 NIBHEX 1090502051C10100 NIBHEX 109050A111808100 NIBHEX 3021B06071C10100 NIBHEX 400040201011E000 NIBHEX 2040E011F1111100 NIBHEX 8040E011F1111100 NIBHEX 40A0E011F1111100 NIBHEX A050E011F1111100 NIBHEX A000E011F1111100 NIBHEX E0A0E011F1111100 NIBHEX A15050F15050D100 NIBHEX E011101011E08060 NIBHEX 2040F110F010F100 NIBHEX 8040F110F010F100 NIBHEX 40A0F110F010F100 NIBHEX A000F110F010F100 NIBHEX 2040E0404040E000 NIBHEX 8040E0404040E000 NIBHEX 40A0E0404040E000 NIBHEX A000E0404040E000 NIBHEX 60A0217121A06000 NIBHEX 41A0113151911100 NIBHEX 2040E0111111E000 NIBHEX 8040E0111111E000 NIBHEX 40A0E0111111E000 NIBHEX A050E0111111E000 NIBHEX A000E0111111E000 NIBHEX 0011A040A0110000 NIBHEX 01E0915131E01000 NIBHEX 204011111111E000 NIBHEX 804011111111E000 NIBHEX 40A000111111E000 NIBHEX A00011111111E000 NIBHEX 804011A040404000 NIBHEX 7020E021E0207000 NIBHEX E011F01111F01010 NIBHEX 2040E001E111E100 NIBHEX 8040E001E111E100 NIBHEX 40A0E001E111E100 NIBHEX A050E001E111E100 NIBHEX A000E001E111E100 NIBHEX E0A0E001E111E100 NIBHEX 0000B141F150F100 NIBHEX 0000E11010E18060 NIBHEX 2040E011F110E000 NIBHEX 8040E011F110E000 NIBHEX 40A0E011F110E000 NIBHEX A000E011F110E000 NIBHEX 204000604040E000 NIBHEX 804000604040E000 NIBHEX 40A000604040E000 NIBHEX A00000604040E000 NIBHEX 80C180E090906000 NIBHEX 41A000F011111100 NIBHEX 204000E01111E000 NIBHEX 804000E01111E000 NIBHEX 40A000E01111E000 NIBHEX 41A000E01111E000 NIBHEX A00000E01111E000 NIBHEX 004000F100400000 NIBHEX 000061905121D000 NIBHEX 204000111111E100 NIBHEX 804000111111E100 NIBHEX 40A000111111E100 NIBHEX A00000111111E100 NIBHEX 8040001111E101E0 NIBHEX 0010709090701010 NIBHEX A000001111E101E0 ChrLoop C=RSTK c=address 1st font B=B-1 A decrement character count GOC OvrSzTs RSTK=C D0=D0+ 2 d0=address next character A=0 A a=00000 A=DAT0 B a=000(ascii character) ASL A a=(above)x16 C=C+A A c=address character's font CD0EX c=address current character RSTK=C rstk=(above) P= 8 initialize pixel loop count ?ST=1 0 GOYES EvnLoop OddLoop C=DAT0 B c=byte from font table DAT1=C B set pixel row D1=D1+ 16 \ D1=D1+ 16 d1=next pixel row D1=D1+ 2 / D0=D0+ 2 d0=address next byte P=P+1 decrement loop count GONC OddLoop ST=1 0 set even pass detect bit AD1EX LCHEX 0010F A=A-C A D1=A C=RSTK c=address current character D0=C d0=(above) GOTO ChrLoop OvrSzTs ?ST=1 1 GOYES DoTics GOVLNG GetPtr DoTics D0=C d0=address tic font P= 8 initialize pixel loop count TicLoop C=DAT0 B c=byte from font table CSL A \ CSRB.F A move pixels 2 columns left CSRB.F A / A=DAT1 B C=C!A B add previous pixels DAT1=C B set pixel row D1=D1+ 16 \ D1=D1+ 16 d1=next pixel row D1=D1+ 2 / D0=D0+ 2 d0=address next byte P=P+1 decrement loop count GONC TicLoop GOVLNG GetPtr EvnLoop C=DAT0 B c=byte from font table CSL A \ CSRB.F A move pixels 2 columns left CSRB.F A / A=DAT1 B C=C!A B add previous pixels DAT1=C B set pixel row D1=D1+ 16 \ D1=D1+ 16 d1=next pixel row D1=D1+ 2 / D0=D0+ 2 d0=address next byte P=P+1 decrement loop count GONC EvnLoop ST=0 0 set even pass detect bit AD1EX LCHEX 0010E A=A-C A D1=A C=RSTK c=address current character D0=C d0=(above) GOTO ChrLoop