[HP71B] ASCII codes; where it is?
|
07-20-2023, 10:11 AM
(This post was last modified: 07-22-2023 04:37 PM by floppy.)
Post: #1
|
|||
|
|||
[HP71B] ASCII codes; where it is?
Hello,
when we see the line 300 of REVERSI JF GARNIER we have (Basic) Code: 300 IF P1=30 THEN PRINT CHR$(27)&"%"&CHR$(0)&CHR$(19)&"OUT OF PIECES" @ GOTO 660 What is the parameter used with these CHR$ (integer) and what is the corresponding output string? I could not find the list integer <-> character for HP71B by using CHR$ Update: the whole reversi file as attachment since I printed it in ilper and could not find it printed in the web. HP71B 4TH/ASM/Multimod, HP41CV/X/Y & Nov64d, PILBOX, HP-IL 821.62A & 64A & 66A, Deb11 64b-PC & PI2 3 4 w/ ILPER, VIDEO80, V41 & EMU71, DM41X |
|||
07-20-2023, 11:14 AM
Post: #2
|
|||
|
|||
RE: [HP71B] ASCII codes; where it is?
Hello,
it is all described in the HP-71B Reference Manual (which you can occasionally find in paper form on eBay, buy it from the museum site here in digital form or download for free as pdf from other HP museum sites - the search engine of your choice will certaninly direct you there). CHR$ takes any numerical value as argument rounds it to an integer and performs modulo 256 on it so it will get mapped to the range 0...255. The output is a one character string. The ASCII code table and display escape sequences used by the HP-71B can be found on pages 322-328 of that manual. For example the CHR$(27) followed by a "%" sign is an escape sequence for positioning the cursor to a specific location. I am prettiy confident that CHR$ called from the FORTH module works in exactly the same way. Regards Max |
|||
07-20-2023, 12:16 PM
Post: #3
|
|||
|
|||
RE: [HP71B] ASCII codes; where it is?
|
|||
07-20-2023, 01:30 PM
Post: #4
|
|||
|
|||
RE: [HP71B] ASCII codes; where it is?
If you are more familiar with C, CHR$() is really just a cast to make the HP71 think the integer is a character, or like the C idiom '\27'.
|
|||
07-20-2023, 01:55 PM
(This post was last modified: 07-20-2023 01:56 PM by Martin Hepperle.)
Post: #5
|
|||
|
|||
RE: [HP71B] ASCII codes; where it is?
(07-20-2023 01:30 PM)KeithB Wrote: If you are more familiar with C, CHR$() is really just a cast to make the HP71 think the integer is a character, or like the C idiom '\27'. Just a small clarification: CHR$() is much more than a cast - it is actually a function, which composes and returns a String containing one character. This requires memory and time. So one should not over-use it. A cast in "C" is ... just a cast - the resulting character is encoded by the compiler and directly embedded in the generated code and no time is lost at runtime. Martin |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)