HOME AUTOMATION Posted June 11, 2020 Share Posted June 11, 2020 (edited) What I'm getting here, is that you want to convert DECIMAL 42 to HEX >2A. But all the examples here depend on the assembler resolving this. In order to convert user's DECIMAL input into HEX, during execution, you'll need a program that treats your user's input as though it were decimal. Edited June 11, 2020 by HOME AUTOMATION 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 11, 2020 Author Share Posted June 11, 2020 (edited) I ended up writing a small routine that, using my example of an asterisk, with two decimal values on the screen,(42). I read each value one at a time into R1. subtracted 48 from both values, d52 And d50 That brings it all down to d4 and d2. Manipulate them until they become h42. And my next test is to see if they will produce >2A in R1...hmm This test put a "B" on the screen... I'll review my code.. Of course this put a B because, again it's a hex 42, not decimal 42 Hmm Edited June 11, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 11, 2020 Author Share Posted June 11, 2020 (edited) I'll try subtracting h18 and see if that helps. Update. Yes that works, but only if the input value was less than"50". I haven't tried lower values than "42" yet to see if they are ok. And I've already taken care of values "1-9". So now I just need to test values "10-42". I suppose I can just make adjustment code to make up the difference in the numbers higher than 50. ?? TBD Edited June 11, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
+mizapf Posted June 11, 2020 Share Posted June 11, 2020 (edited) Am I correct to assume that you read two ASCII characters for decimal digits (ASCII 48..57) and want to get the value in a register? If so, remove the offset 48 from each character, multiply the first by 10, and add the second on it. When I look at your code, I'd say you mixed up hexadecimal and decimal handling. You have two characters ("4" = 0x34 = 52, "2" = 0x32 = 50), subtract 0x30 from each one, but then you assemble both values to a hexadecimal number. You'll have to decide: * Your input represents a hexadecimal number. In that case your asterisk would be entered as 2A; the first byte is 0x32, the second is 0x41. For A..F you have to subtract 0x37 = 55. That is, you must check cases 0..9 and A..F. Then you can assemble both digits to a single number. * Your input represents a decimal number. Then your asterisk is entered as 42; you get both digits as values 4 and 2, multiply 4 by 10 which yields decimal 40 (=0x28) and add the 2, resulting in 42 (=0x2A). Edited June 11, 2020 by mizapf 1 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted June 11, 2020 Share Posted June 11, 2020 As much as I enjoy seeing your mind grow stronger... ...I couldn't stand to watch you suffer any longer. Besides I'm getting hungry! o.k. this could perhaps use a little restructuring, but works(tested somewhat). ...too tired to comment. Spoiler DEF RUN REF VSBR,VMBW BUFF TEXT '042' RUN LI R0,931 LI R1,BUFF LI R2,3 BLWP @VMBW CLR R1 LI R3,10 LI R4,3 CLR R5 LI R6,1 CLR R7 LI R0,933 JMP DECODE OUT RT INCMUL DEC R4 JEQ OUT DEC R0 MOV R6,R5 MPY R3,R5 DECODE BLWP @VSBR SWPB R1 CI R1,>40 JLE NEXT AI R1,->37 JMP NEXT2 NEXT AI R1,->30 NEXT2 CI R1,0 JNE ADD JMP INCMUL ADD A R6,R7 DEC R1 JNE ADD JMP INCMUL END R0=SCREEN ADDR. R1=CURRENT VALUE R2=RESERVED R3=MULTIPLIER R4=DIGIT/LOOP COUNTER R5=PRODUCT/PLACE VALUE MULTIPLIER(COPIED) R6=PRODUCT/PLACE VALUE MULTIPLIER R7=ACCUMULATOR CHARGE: ...that's Scooby Snacks. ...and the number is sexagesimal! P.S. Your running up a tab now! 1 1 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted June 11, 2020 Share Posted June 11, 2020 But in this code, you allow for digits 0-9 and A-F, but use the power 10, not 16? You're confusing me. ? This means when you have "04C" in BUFF, the value would be decimal 52. 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted June 11, 2020 Share Posted June 11, 2020 Well, The ASCII numerals needed to be converted to HEXADECIMAL, and they are a subset of HEXADECIMAL. So, I let the previously provided code do that. The Handling of A-F, is of course, a bonus feature. That way users get what they pay for when entering mal-data. Besides, I'm leaving error-handling, to the projects Artist. P.S. 4C, goes well with Scooby Snacks. However, the c-key is pretty far from the numerals. P.P.S. I'm only taking credit for the parts that work as anticipated. 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 11, 2020 Author Share Posted June 11, 2020 11 hours ago, GDMike said: I'm still trying to get your code to work..it's in R1 in a loop counting backwards from>FFF something. Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted June 11, 2020 Share Posted June 11, 2020 Retested... I'm using Classic99, Before first line executes. After last line executes. Result is in R7. 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 11, 2020 Author Share Posted June 11, 2020 I've got it working beautifully with one and two input numbers and I have plans to make it work with all three maybe by today or tomorrow but thank you for your assistance and I'm right where I need to be. I'll do a video soon thanks again. Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 11, 2020 Author Share Posted June 11, 2020 Only characters below 50 work so far. VID_20200611_164523689.mp4 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 11, 2020 Author Share Posted June 11, 2020 (edited) Ahhh. Yes, characters from 1-?? Not sure yet, still testing. But my ASCII chars above 50 work now. VID_20200611_193300152.mp4 Edited June 12, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 15, 2020 Author Share Posted June 15, 2020 (edited) Ok, I've got an update. And I didn't spell "special" correct because I was using one hand, but anyway I think you can tell what's going on. I can now call char(nn) where "nn" is any character from 1-99. Also includes a leading zero for those that want proper numbers. ie, "07" instead of "7' but whatever, I had to make it work regardless, but I've been working out the bugs in my two digit char display and I had to get it right. Next up, I'll be concluding the rest of the set, 100-254. VID_20200614_215316215.mp4 Edited June 15, 2020 by GDMike 1 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted June 15, 2020 Share Posted June 15, 2020 I am happy that the code does what you want but I am not clear on what the feature is for. On the surface it looks like you are writing an ascii value to the screen which displays the appropriate letter. How does the Super Notes user use this? Maybe this is just a test bed for future work. (?) 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 15, 2020 Author Share Posted June 15, 2020 (edited) Ahh. Yes, well there are characters NOT on the keyboard that a user might need to place, one such character is, I found, the cent mark opposed to the dollar mark, another would be the celcius and farenheit, IF I defined those, or how about cell characters, left,top,sides etc, to make a cell or divider. I'm sure there are other characters as I haven't reviewed what should be included. So this allows the user to call up a character, a help key could be presented to show the current ASCII chart of what is defined. OR I could just allow the user to create their own char and have it placedvon the screen. I think this is just fine for now. Plus I've gotta move on to file access... but I needed to get this outta my way. Edited June 15, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
+TheBF Posted June 15, 2020 Share Posted June 15, 2020 26 minutes ago, GDMike said: Ahh. Yes, well there are characters NOT on the keyboard that a user might need to place, one such character is, I found, the cent mark opposed to the dollar mark, another would be the celcius and farenheit, IF I defined those, or how about cell characters, left,top,sides etc, to make a cell or divider. I'm sure there are other characters as I haven't reviewed what should be included. So this allows the user to call up a character, a help key could be presented to show the current ASCII chart of what is defined. OR I could just allow the user to create their own char and have it placedvon the screen. I think this is just fine for now. Plus I've gotta move on to file access... but I needed to get this outta my way. Ahh. That's cool. It's like the SYMBOL table in Microsoft word but you select with a text command. Nice idea. 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 16, 2020 Author Share Posted June 16, 2020 Yes, well I had to make the command line for my disk access commands like save dsk1.disk or old dsk2.super So I started thinking while I was making the command line and I said shoot, what if somebody want to make some kind of cell or divider, or place a character that wasn't on the keyboard. ..a ha. This solved it. I just got to finish it up I think maybe by tomorrow or the next day. 3 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 17, 2020 Author Share Posted June 17, 2020 R0=SCREEN ADDR. R1=CURRENT VALUE R2=RESERVED R3=MULTIPLIER R4=DIGIT/LOOP COUNTER R5=PRODUCT/PLACE VALUE MULTIPLIER(COPIED) R6=PRODUCT/PLACE VALUE MULTIPLIER R7=ACCUMULATOR Wow. This was incredible ? I'm not sure if I was missing anything but for some reason I had to end up adding 7 to R7? But anyway I figured it by watching the registers in action. Thanks again, Mr automation! It's exactly what I was looking for. FYI, I came up with a longer routine myself that captured the first 2 characters of the 3 that are present. These are the three that kick off the whole math thing. And my math had to add 6 for every 10 characters in the first 100 acsii codes. Anyway, it did work, but your routine is so much better. Thank you again..I'm so excited to be finishing this section. 1 Quote Link to comment Share on other sites More sharing options...
+9640News Posted June 17, 2020 Share Posted June 17, 2020 It's great that you are creating "special" characters. I guess one question is what happens at print time??? 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 17, 2020 Author Share Posted June 17, 2020 3 hours ago, BeeryMiller said: It's great that you are creating "special" characters. I guess one question is what happens at print time??? Not sure. I'm just trying to get to saving to a file. I'll be so happy just to get there. Quote Link to comment Share on other sites More sharing options...
+9640News Posted June 17, 2020 Share Posted June 17, 2020 3 minutes ago, GDMike said: Not sure. I'm just trying to get to saving to a file. I'll be so happy just to get there. Fully understand. I just wanted to point out that issue before you invested some serious time into all kinds of character features to make sure you were going down a path that would have those characters printable. If you are thinking about the path of the dot matrix printer to our standard RS232 port, that would be a separate challenge than printing to a PI.PIO (PDF) route with a TIPI. The latter could be tricky as well, however, once "defined", you could probably write to a standard format and all things would be good. That's just a guess though. I have followed some of your progress in this topic. Is there something about saving a file you are trying resolve, or is it just a matter of writing code to do the file save? Beery 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 17, 2020 Author Share Posted June 17, 2020 (edited) 5 hours ago, BeeryMiller said: The code for saving and loading files just hasn't been started yet. I'm going to try and attempt doing that as early as this week. I need to finish my call char routine, cleaning up loose ends, then the fun begins. I'll first get a memory map built, as a reference sheet to aid me, of where my pages exist, the length and also where I have free memory and where that is. I expect that will be needed. And then I need to figure out what terminology I'll use for the call, as in save DSK.xxxx and old DSK.zzz, or whatever that would be. But I haven't put much thought into it yet. Let me know what else to plan for. Edited June 17, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 17, 2020 Author Share Posted June 17, 2020 Ok. Looks like the call char routine, as far as calling it and having it perform, is done. VID_20200617_120342754.mp4 1 Quote Link to comment Share on other sites More sharing options...
+9640News Posted June 17, 2020 Share Posted June 17, 2020 1 hour ago, GDMike said: The code for saving and loading files just hasn't been started yet. I'm going to try and attempt doing that as early as this week. I need to finish my call char routine, cleaning up loose ends, then the fun begins. I'll first get a memory map built, as a reference sheet to aid me, of where my pages exist, the length and also where I have free memory and where that is. I expect that will be needed. And then I need to figure out what terminology I'll use for the call, as in save DSK.xxxx and old DSK.zzz, or whatever that would be. But I haven't put much thought into it yet. Let me know what else to plan for. As far as terminology, let me throw this out to you. Consider using LF (Load File) and SF (Save File) which are commands TI-Writer uses. There is also PF for Print File. Using each of those commands, by themselves, then pulls up the request to give the path to save/load/print. That would reduce line parsing. Beery 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted June 17, 2020 Author Share Posted June 17, 2020 (edited) The latest update of SNP and another program for clearing memory of >6000->7FFF called SC There's a what's this file for directions Oops, I made mention of the"HIST" file and forgot to include it. Sorry, I'll get it there. I had a version of SC that allowed silencing the beeping beep. But I lost it, I dunno where it is. I can tell this vers. Was incomplete as I can see option 8 is still there... but opt 5 does the same thing..oh well Btw, F5 has some commands, Call beep, call honk, call color (FB) and call char(1-254). DSKA0061.dsk Edited June 17, 2020 by GDMike Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.