GDMike Posted July 23, 2019 Share Posted July 23, 2019 On 7/22/2019 at 8:05 AM, TheBF said: Can you explain why my JNE $+4 didn't work? I assumed I would jump 4 lines of code forward no matter what those lines said? Then I assumed, because I'm Not finding much info on $, that I should add 2 bytes for each line?..that didn't work either. Quote Link to comment Share on other sites More sharing options...
+FarmerPotato Posted July 23, 2019 Share Posted July 23, 2019 5 minutes ago, GDMike said: Can you explain why my JNE $+4 didn't work? I assumed I would jump 4 lines of code forward no matter what those lines said? Then I assumed, because I'm Not finding much info on $, that I should add 2 bytes for each line?..that didn't work either. Think of $ as the label to the left of current line. youre better off using real labels until you really understand how instructions are stored. But The way to be really sure is to look at the listing file to see how many words apart your target is. Some instructions are 2 bytes, but if they have addresses or immediate arguments, these add another word. JNE $+2 is a no-op JNE $+4 will skip over a simple instruction like DECT or A R4,R5 JNE $+6 will skip over LI R0,1234 or MOV R4,@>A000 JNE $+8 will skip over MOV @>2002,@>8C00 1 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 23, 2019 Share Posted July 23, 2019 (edited) As I understand it JMP $+4 will jump 4 BYTES forward not 4 lines of code. So you have to understand how many bytes are between where $ is and where you want to jump to. As a rule of thumb, register to register instruction are 2 bytes. Immediate instructions are 4 bytes and address to address instruction are 6 bytes (i think) You could make some tests by putting some routines in memory and then JMP $+2 or JMP $+4 ETC... to see which routine runs. It's why the assembler gives us labels, ? but you can make label-less code work as farmer potato demonstrated. what he said Edited July 23, 2019 by TheBF 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 23, 2019 Share Posted July 23, 2019 (edited) I've been using labels, but I've tried two bytes, one byte, but you're saying, what he's saying, which is I have to actually count up bytes used, as in if I had LI R0,750 million!, I get it.i was afraid of that answer..Darn it. Lol but it's great for simple instructions as you said... thank you! Edited July 23, 2019 by GDMike Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted July 24, 2019 Share Posted July 24, 2019 Another gotcha with jump instructions is that the target address must be within -128 to +127 words (-256 to +254 bytes) of the instruction following the jump instruction. The machine code for a jump instruction stores the assembler-calculated word offset as a signed byte, hence the limitation in the jump range. When the jump instruction is executed, this offset is converted to a byte offset and added to the current Program Counter (PC) to get the jump’s target address. The PC always points to the next instruction to be executed, which, in this case and before adding the byte offset for the jump, is the instruction following the jump instruction. If you would rather think of the jump range in terms of the address of the jump instruction, just add one to each end of the word range, making the range -127 to +128 words (-254 to +256 bytes) from the address of the jump instruction. ...lee 2 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 24, 2019 Share Posted July 24, 2019 (edited) 18 hours ago, GDMike said: Can you explain why my JNE $+4 didn't work? I assumed I would jump 4 lines of code forward no matter what those lines said? Then I assumed, because I'm Not finding much info on $, that I should add 2 bytes for each line?..that didn't work either. in the example: B000 0600 DEC R0 B002 10FE JNE $-2 i like no labels B004 C2FA MOV *R10+,R11 B006 045B RT line B002 jumps to line B000. "conditional loop" if changed to: B000 0600 DEC R0 B002 10FE JNE $+4 i like no labels B004 C2FA MOV *R10+,R11 B006 045B RT line B002 would jump to line B006. "return" if changed to: B000 0600 DEC R0 B002 10FE JNE $+4 i like no labels B004 A80F A R15,@BNK B006 A000 B008 045B RT line B002 would jump to line B006. But A000 is not an instuction! this is also wrong: if changed to: B000 0600 DEC R0 B002 10FE JNE $+4 i like no labels B004 C820 MOV @>AA00,@BNK B006 AA00 B008 A000 B00A 045B RT line B002 would jump to line B006. But AA00 is not an instuction! ...hope this helps a little? <<<corrected>>>... #936 Edited July 24, 2019 by HOME AUTOMATION made a little boo-boo here ...see correction below 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 24, 2019 Share Posted July 24, 2019 Oh yeah, I forgot there is still that limitation of how far it can jump! it's not a B..ohh can't B goto like >FFFF or something? Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 24, 2019 Share Posted July 24, 2019 I was just testing you... No, really I used line-by-line assembler to crunch the op-codes... Then I juggled the addresses around in notpad(sic). I did overlook the offset limits a little. ...anyway sounds like you'll go far at this! P.S. too bad B is unconditional. 1 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted July 24, 2019 Share Posted July 24, 2019 3 hours ago, GDMike said: Oh yeah, I forgot there is still that limitation of how far it can jump! it's not a B..ohh can't B goto like >FFFF or something? No, to >FFFE. But our machine is very forgiving, you can also go to FFFF, but it will ignore the last bit. Other architecture will throw a Bus Error at you. 1 Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted July 24, 2019 Share Posted July 24, 2019 On 7/23/2019 at 10:12 AM, GDMike said: I'm also not finding a DEV folder on WHTECH. I was looking for R.A.G. source. Here's the Assembler folder on WHT for you 1 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 24, 2019 Share Posted July 24, 2019 (edited) 9 hours ago, HOME AUTOMATION said: I was just testing you... No, really I used line-by-line assembler to crunch the op-codes... Then I juggled the addresses around in notpad(sic). I did overlook the offset limits a little. ...anyway sounds like you'll go far at this! P.S. too bad B is unconditional. I stayed up a little too late last night... The offset limits are within range here. But... I'd forgotten to update the op-codes for B002 in the last 3 examples! Fixed! In THIS UPDATED example: B000 0600 DEC R0 B002 10FE JNE $-2 i like no labels B004 C2FA MOV *R10+,R11 B006 045B RT line B002 jumps to line B000. "conditional loop" if changed to: B000 0600 DEC R0 B002 1001 JNE $+4 i like no labels B004 C2FA MOV *R10+,R11 B006 045B RT line B002 would jump to line B006. "return" if changed to: B000 0600 DEC R0 B002 1001 JNE $+4 i like no labels B004 A80F A R15,@BNK B006 A000 B008 045B RT line B002 would jump to line B006. But A000 is not an instuction! this is also wrong: if changed to: B000 0600 DEC R0 B002 1002 JNE $+6 i like no labels B004 C820 MOV @>AA00,@BNK B006 AA00 B008 A000 B00A 045B RT line B002 would jump to line B008. But A000 is not an instuction! ...I hope this is a little better? I can see! Edited July 24, 2019 by HOME AUTOMATION spelling 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 24, 2019 Share Posted July 24, 2019 If the safe wasn't all locked up I'd get in there and find you a medal!!! Superb* 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 24, 2019 Share Posted July 24, 2019 4 hours ago, Ksarul said: Here's the Assembler folder on WHT for you Yup..I scourged around in here before..I believe that assembler was written in GPL... thank you!!! Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 25, 2019 Share Posted July 25, 2019 (edited) If it were disassembled into something that could be edited into usable source code it would be cool. There are some things I'd change on the original, like screen size of display area, a count-down timer of lines left to compile etc...I love what he did with making it dont get me wrong. ( I know, learn GPL and it would all make sense right). Edited July 25, 2019 by GDMike Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 25, 2019 Share Posted July 25, 2019 On this platform... more like 1/2 sense ...1/3 if you include a high level language! Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted July 25, 2019 Share Posted July 25, 2019 On 7/24/2019 at 2:36 PM, GDMike said: ..I believe that assembler was written in GPL... thank you!!! I don't think it is GPL because it runs fine on my computer which only has RAM - there is no gram kracker or final grom. As far as I know there is no way to make GPL run from RAM. For what it's worth, the simpler TI assembler is considerably faster than RAGASM 1 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted July 25, 2019 Share Posted July 25, 2019 Doesn't Tombstone City(disk version) run from RAM by setting up a GLP like environment... I think I've seen other examples. not sure exactly how it works though. 1 Quote Link to comment Share on other sites More sharing options...
Tursi Posted July 25, 2019 Share Posted July 25, 2019 Tombstone City is assembly, it's one of the examples from the Editor/Assembler disk. I've not looked at the cartridge version to see what's on it... 1 Quote Link to comment Share on other sites More sharing options...
+arcadeshopper Posted July 25, 2019 Share Posted July 25, 2019 1 hour ago, senior_falcon said: I don't think it is GPL because it runs fine on my computer which only has RAM - there is no gram kracker or final grom. As far as I know there is no way to make GPL run from RAM. For what it's worth, the simpler TI assembler is considerably faster than RAGASM wrong. Many grom games were converted to run from ram with a little code to copy the grom image to ram then execute.. runs great..from disk or rom cart.. needs 32k tho if your copy needs 32k, that's what it's doing. 2 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted July 25, 2019 Share Posted July 25, 2019 (edited) 1 hour ago, Tursi said: Tombstone City is assembly, it's one of the examples from the Editor/Assembler disk. I've not looked at the cartridge version to see what's on it... One EPROM, one GROM, the latter with only little code in it (< 0x580 byte). Seems to be just a link to the ROM. 6000: DATA >AA,>01,>01,>00,>00,>00,>60,>10 6008: DATA >00,>00,>00,>00,>00,>00,>00,>00 6010: DATA >00,>00,>60,>23,>0E 6015: TEXT 'TOMBSTONE CITY' 6023: DST >0900,@>834A 6027: CALL GROM@>0018 602A: MOVE >0010 BYTES FROM GROM@>6077 TO VDP@>0C80 6031: MOVE >0032 BYTES FROM GROM@>6087 TO VDP@>0AE0 6038: MOVE >0030 BYTES FROM GROM@>60B7 TO VDP@>0B40 603F: MOVE >0010 BYTES FROM GROM@>60E7 TO VDP@>0B80 6046: MOVE >00B8 BYTES FROM GROM@>60F7 TO VDP@>0BC0 604D: MOVE >0008 BYTES FROM GROM@>61AF TO VDP@>0CC0 6054: MOVE >0010 BYTES FROM GROM@>6067 TO VDP@>0384 605B: BACK >06 605D: MOVE >03CC BYTES FROM GROM@>61B7 TO VDP@>1002 6065: XML >70 Edited July 25, 2019 by mizapf Added GPL code 2 1 Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted July 26, 2019 Share Posted July 26, 2019 It looks like that little code snippet is mostly moving the environment setup data to VDP RAM. 2 Quote Link to comment Share on other sites More sharing options...
RXB Posted July 26, 2019 Share Posted July 26, 2019 I get so sick of seeing this hate for GPL when in fact it is the most easy way to do something with little code an gets the job done. To do this with Assembly would take some hacks and would not be compatible with most configurations. Take a look at above GPL code it loads VDP screen menu and also character set into VDP RAM, then executes Assembly from Scratch PAD. Try to write something like that in Assembly without the 4K of support routines in RAM to run it, try to pull that off using only 1073 bytes of memory like GPL did above. 1 Quote Link to comment Share on other sites More sharing options...
Asmusr Posted July 26, 2019 Share Posted July 26, 2019 (edited) I don't think anyone expressed a hate for GPL. But I think that TI used GROMs not only as a way to distribute GPL but also to provide data for machine code programs otherwise stored in ROMs (e.g. Parsec), and also as a copy protection mechanism. Edited July 26, 2019 by Asmusr 2 Quote Link to comment Share on other sites More sharing options...
Tursi Posted July 26, 2019 Share Posted July 26, 2019 (edited) 3 hours ago, RXB said: I get so sick of seeing this hate for GPL when in fact it is the most easy way to do something with little code an gets the job done. To do this with Assembly would take some hacks and would not be compatible with most configurations. Take a look at above GPL code it loads VDP screen menu and also character set into VDP RAM, then executes Assembly from Scratch PAD. Try to write something like that in Assembly without the 4K of support routines in RAM to run it, try to pull that off using only 1073 bytes of memory like GPL did above. Sorry Rich.. you know I think GPL is okay and definitely has its place, but you made the challenge. challenge.lst No support code needed, 342 bytes. But I don't think the GPL code provided takes anywhere near 1073 bytes... what were you including? Edited July 26, 2019 by Tursi upload listing, not source 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 27, 2019 Share Posted July 27, 2019 Yep, I Know there is a whole package and something to learn with gpl, I wouldn't mind learning, but it just seemed everything went towards basic, Forth, or assembly from what I've seen exposed. Was it just intended to write to ROMs and package up that way? 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.