Ray Gillman Posted December 21, 2022 Share Posted December 21, 2022 As I continue to stumble across assembly language routines used within basic like this (image). Using the string address as a hook/entry point for basic to do three things at once. 1. launch high speed 6502 code from within BASIC, 2. pass value(s) to the code to work upon, 3. return a value from the ASM code back to BASIC (in this case X). What I would like to do is collect many more of these and store them all like a toolbox library. Quick easy way to add them to your BASIC program is LIST the desired code out to a LST TXT file and then ENTER that code from disk into your current program being coded. For this to be convenient the routines need to be stored at obscure line numbers like 28000-30000? This routine was just grabbed off of an old ANTIC disk which was creating a menu of files from the disk. Filling time by plugging these codes into a hex editor to get the ASM program code to look at. This one has the following ascii/atascii codes for what that is worth (shrug) 68 68 E2 80 A6 C3 95 68 E2 80 A6 C3 94 C2 A9 20 C2 A8 E2 80 98 C3 94 C3 88 C3 90 C3 BB 60 00 1 Quote Link to comment Share on other sites More sharing options...
+MrFish Posted December 21, 2022 Share Posted December 21, 2022 There's just such a collection here: BASIC Turbocharger Probably won't meet all your needs; but it covers a pretty good base. 3 Quote Link to comment Share on other sites More sharing options...
Ray Gillman Posted December 21, 2022 Author Share Posted December 21, 2022 Very nice - now if I could just find a good PENTE source code I wont have to try and write something cheezy - suddenly it's the 80's again Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 21, 2022 Share Posted December 21, 2022 Putting machine code into strings in that format doesn't always work, there are a few values (29 , 34 and 125) come to mind, I think there is one other. To use those values, you have to build the string i.e. A$="1GHJ%^&LJKHHGG" A$(LEN(A$)+1)=CHR$(34): REM PUT IN DOUBLE QUOTE " A$(LEN(A$)+1)="KSJHKAKL(*&67788" Quote Link to comment Share on other sites More sharing options...
dmsc Posted December 21, 2022 Share Posted December 21, 2022 Hi! 19 hours ago, Ray Gillman said: As I continue to stumble across assembly language routines used within basic like this (image). Using the string address as a hook/entry point for basic to do three things at once. 1. launch high speed 6502 code from within BASIC, 2. pass value(s) to the code to work upon, 3. return a value from the ASM code back to BASIC (in this case X). What I would like to do is collect many more of these and store them all like a toolbox library. Quick easy way to add them to your BASIC program is LIST the desired code out to a LST TXT file and then ENTER that code from disk into your current program being coded. For this to be convenient the routines need to be stored at obscure line numbers like 28000-30000? This routine was just grabbed off of an old ANTIC disk which was creating a menu of files from the disk. Filling time by plugging these codes into a hex editor to get the ASM program code to look at. This one has the following ascii/atascii codes for what that is worth (shrug) 68 68 E2 80 A6 C3 95 68 E2 80 A6 C3 94 C2 A9 20 C2 A8 E2 80 98 C3 94 C3 88 C3 90 C3 BB 60 00 Your hex codes does not correspond to the ATASCII characters in the picture - just by inspection there are 16 ATASCII characters and you have 31 codes 😛 The correct codes are: 68 68 85 D5 68 85 D4 A9 00 A8 91 D4 C8 D0 FB 60 This correspond to the following assembly: pla pla sta $D5 pla sta $D4 lda #$00 tay loop: sta ($D4),y iny bne loop rts So, what it does is clear 256 bytes of memory, at the given address, to zero, and is called with the argument 1536, so it is clearing the "page 6". In FastBasic, this is the same as: MSET 1536, 256, 0 IMHO, if you plan on using a lot of pre written assembly routines in your BASIC program, it would be better to try learning assembly by reading and understanding the source of the routines. Have Fun! Quote Link to comment Share on other sites More sharing options...
Ray Gillman Posted December 21, 2022 Author Share Posted December 21, 2022 (edited) 12 hours ago, TGB1718 said: Putting machine code into strings in that format doesn't always work, there are a few values (29 , 34 and 125) come to mind, I think there is one other. To use those values, you have to build the string i.e. A$="1GHJ%^&LJKHHGG" A$(LEN(A$)+1)=CHR$(34): REM PUT IN DOUBLE QUOTE " A$(LEN(A$)+1)="KSJHKAKL(*&67788" I remember 34 works if you just add it to the string with chr$(34), 125 is the clear screen code not sure about that one and 28 29 are the arrow up and down keys. 155 is 9B I don't see a command for that and 1C (28) doesn't show up in my compiler code list. 1D is ORA absolute,X so that may be a problem. I'll try using it with the same CHR$(29) to add it to a string to see if it works like 34. 125 ADC Absolute, X is an important one even more so than 29. I'd wager it has to be added manually as well to work Edited December 21, 2022 by Ray Gillman Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 22, 2022 Share Posted December 22, 2022 (edited) The problem codes are the ones that affect the screen when you LIST the program so if for instance you string had 125 as a value, when you try to ?/list the string, it clears the screen Did a bit of testing and the values that cause issues are 29, 125, 155 & 253 Not sure of the significance of 29, but it does cause the cursor to move to the top of the screen. 125 obviously clear screen 155 Atari carriage return 253 Bell character all others seem to be insertable into a string that can be listed in BASIC so only those 4 need the addition to the string using CHR$() Little program that puts a space where the offending characters are, so string prints ok without them Edited December 22, 2022 by TGB1718 2 Quote Link to comment Share on other sites More sharing options...
phaeron Posted December 22, 2022 Share Posted December 22, 2022 That's strange, only EOL ($9B) should be giving issues. 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.