Deja Vu #09
13 ноября 1999 |
|
Coding - Conversion of numbers from the stack calculator in the character string.
(C) Ilya Morozov / Death Moroz __________________________________________ Conversion of numbers from the stack calculator a character string. With a built-in calculator, the results are on top of the stack kalkulyatornogo in integral form. To print them a routine Print_FP.No it prints the standard tools, which are now rarely used. Typically, the program works with own procedures for printing, for example, 42 characters per line. It can be attributed to a new flow. But it must be pretty close communication with the operating system Spekki.Predpochtitelney simply convert that number into a string of characters and dispose of it at their discretion. But program for such a transformation will rather complicated and cumbersome. Simply take advantage of the ROM. The first thing that comes to mind - Print_ FP. It prints the number from the top of the stack calculator in the current thread. Means to substitute procedure for deriving the symbol of the procedure sending bytes in memory. But far too cumbersome. However Print_FP with their work creates a symbolic representation numbers, and only then calls the routine. The buffer is in the workspace calculator at # 5CA1-# 5CAA.Eto two memory calculator MEM3 and MEM4. Now, simply as an Inference Procedure for the flow of supply and RET cause Print_FP, to consider a string representation of numbers. This is easier, though still need to fiddle with the channels. Simply only use for this function calculator STR $. Converter takes 7 bytes. CONVERT RST # 28; call calculator DB # 2E, # 38; Teams calculator: ; STR $ converts the number in the string. , Now on the stack the parameters of this ; Thong. In DE-address, in BC-length. ; END_CALC - output from the calculator. CALL # 2BF1; Sub-STK-FETCH rewritten ; Vaeth number from the stack calculator ; In registers A, B, C, D, E. And since ; After surgery STR $ stack we find ; Converge options thong, then they , Transferred to a pair of DE and BC. RET That's it. It remains to copy the string in a more secure place than the workspace interpreter.
Other articles:
Similar articles:
В этот день... 21 November