IRC log started Sat Nov 20 14:07 > OK. > Now Rick, I must warn you that there is a strict Wildstar policy in effect here, so if things get out of hand I may have to banish you. > As to betas, nope, no new beta -- 1.6 is it. > As to hockey, what can I say? Robin Harbron Rules! *** Topic for #slang: SuperCPU required! *** #slang MagerValp!cl3polof@panini.cling.gu.se 1100975535 Pub: #slang Wildstar @Wyndex @RobinH @MagerValp ah *Wildstar* Can you tell me what the policy is keyboard works much better when plugged in *Wildstar* I am primarily keeping quiet. > I've noticed that... gotta find a fresh 3.5" disk for this... > Rick: Yup, just behave yourself and all will be well :) hrm 25, write error,01,00 bummer trying another disk... > No rush. there we go copying files serslave has many faults, but it sure is fast copy done heh ah fudge still have the bug where it doesn't copy files with spaces in the name > I have to delete files to make everything fit on a .d81 now. The source is, like, big. > Ah, sorry about that. oookay all fixed loadingz0r slangz0r > Now, do we have any sort of agenda here, or is it just free-form? (scan erp well... groepaz was also interested > Like, do you want to talk about specific things, or code and ask questions as we go, or ...? but he timed out a while ago basically, i have a free evening, and a fresh copy of slang :) > OK :) > If things slow down I will start going back and forth between here and my floor, but I have the afternoon. > (Um, that would be the floor I am putting in.) a-ha so libraries we have them noe? now > Yes! > (Sorry, got one more thing to do... brb...) > OK, we've actually always had libraries, it's just that nowthe system is much more useful/practical. > All a library is is a set of (sub)routines. alright > They might be fixed in memory somewhere (an external asm library, say Mr. Mouse or Blarg or lib3d) and local variables? > They might be a relocatable file (REL). cool > And they might be a PUT file to be compiled. > Also, they might be Slang code, or asm code. > But the point is that it's just a set of routines. > The idea here is to interface to those routines in a simple/useful way. right > So, take the core library. > I put two versions in the .zip -- "core.c.s" and "core.l". Core.l is a REL file for use by the linker. > core.c.s is a file you can just load in to the editor. > What I did is take one of my standard libraries (diskio, in this case) that I use all the time in asm, and extract a few routines. no core.c.s in slangb16.zip got the ext file and the l file > Ah, putcore.c.s > I renamed it to keep confusion down. > Actually, let me back up a second. > Let's take the case of an external, pre-compiled library, say Blarg. > Blarg has a little jump table to call routines for setting up bitmap mode, drawing lines, and so forth. right > (I'm just going to take each of the three different library types in turn.) > So let's say the call to the line routine is at $C006. > And the line routine wants four variables set up: x1,y1,x2,y2 all 16-bit signed. > What you can do is write a line of code like: > (Oh, and let's say those variables are in zero page, at $69-70) > So you can write a line of code like: > sub asm line(int x1@$69, int y1@$6b, int x2@$6d, int y2@$6f) > Oops: > sub asm line@$c006(int x1@$69, int y1@$6b, int x2@$6d, int y2@$6f) > And now you can make calls like > line(10,10,300,190) > from a program. excellent > So let me go through that line of code quickly. yeah, being able to specify exactly how args are passed makes it easy to interface existing code > "sub" of course means "define a subroutine", but the "asm" modified says to just set up the variables, and not start a new scope or whatever. > i.e. sub asm is for calling routines that exist elsewhere in some other form. ahh > The rest is self-explanatory, I think. what's the difference between sub asm and sub ext then? > "sum asm" is like "pretend there's the following subroutine" > "ext" is a linker command. oh > With sub asm, you'll always use an @-var for the subroutine. > And all of the variables, too. Nothing is allocated, just the names are set up. > With ext, the subroutine and all of the variable addresses will be resolved at link time. > Here are some forbidden things: *** Greg_-_ (~ajirc@mki3-pl-ri46.kos.net) has joined channel #slang oh hey greg > sub asm ext > Hola Greg > sub ext blah@... -- no ext @-vars. k, making sense > Let me stay focused on the original thing, though, and explain all that in a few minutes. *** Greg_2 (~ajirc@mki7-pl-ri8.kos.net) has joined channel #slang ah. hi. :) > The bottom line is that for a fixed library -- something you load separately -- you can set up a list of sub asm stubs to interface the code in a natural way. > Hola Greg :) :) > The really important thing in 1.6 is the addition of @a @ax etc. as "variables". > Since lots of asm routines pass variables in the registers. yeah man, lost 9-8 in the semi-final... not even making it to the final this year *** Signoff: Greg_-_ (Ping timeout: 182 seconds) > You mean... Robin Harbron doesn't rule? > I'm crushed. Apparently not :/ Oh well, about time this guy who beat me made it to the final... :) > Greg: Want me to repeat anything? Like, so you know what we're talking about? :) Slang might good for writing Wings appz i dunno hmmm, but I guess the code/test cycle would be a real hassle ah,I just dropped in cuz I'm having a hard time concentrating on anything else atm. wings is written in and around C g :) > works for me! It's written in 65816 assembly. well, right, yeah and C :) yeah. we'd need a slang compiler that runs in WiNGs for it to be really useful. > OK then, the next type of library would be a PUT-library -- a library of routines that you can include in your own programs. > I mean, a library of _source code_ routines to include in a program. basically #include? > Sort-of, but not really, since you have #include header files for all sorts of precompiled libs. sure, but all #include does is insert the ascii source from another file at that point > Yeah. but like .include or whatever the assembler directive is :) hactually > But I don't want to confuse this with C libraries. consider calling it "include" :) > Well, one reason I've been avoiding that is that I don't want people putting "includes" all at the top of the program and then wondering why things don't work. > The Sirius command is "PUT". > So, have a look at printdemo.s > You'll notice the last line of the code is something like PUT "putcore.c.s" printtest.g.s :) > Which is like appending the file putcore.c.s to the code. > Heh :) erm single quotes? > Doesn't matter. > At least, I think it doesn't matter... k > Go ahead and compile it. > (and run it, for that matter) btw, after assemble it'd be good if you could start the code with S or something > As opposed to exiting to the monitor? right just a shortcut > OK, I'll give it some thought. saves typing "g 1000" a lot :) > (Problem #1 arises if you're compiling, say, a program with a BASIC header) right > Anyways, I'll give it some thought. > Assuming it runs, go ahead and load in the file "putcore.c.s" > Putcore is just a subset of my "diskio" library that I use in pretty much all my programs. gah... my fingers insist on typing out the .s stupid fingers > It has a mult/div routine, a printnum routine, a strout routine, etc. > Heh. > I did two things to the code. > First, I renamed all the variables to have a ] in front of them. which makes it look kinda weird imho... heh > A variable like "]loop" is actually valid in Sirius, but nobody uses them, so I've sorta mentally reserved them for compiler use. k > Yup, but the reason I did that is so that it won't conflict with any vars in a slang program. > This is not a great way to do a library, btw. But this is a special case. > That is, unless you start creating vars like ]mult16 there will be no conflicts -. > The second thing that I added was a set of sub asm statements down at the end of the code. right... > So all that code does is create a couple of Slang subroutine interfaces. That's it. > I could have created slang subroutines, with the assembly code as the subroutine, instead of using sub asm, but I was testing things. > Now, check this out: just a quickie > In the printtest code, comment out the PUT line (put a * or a ; in the first column) are () optional for subroutines with no args? > No -- required. k > I could make it optional, but decided not to. yeah > So anyways, comment out that line and compile the program -- you should get an error. ahhh, DisableTimerAIRQ isn't a subroutine, gotcha yup, got error informing me of my lameness brb, getting a drink > The trick here is that the "print" command actually calls that subroutine. > Like, the compiler is looking in the source code for a routine called "]strout" or whatever it is. > Not outside of the source code -- actually as part of the source code. > So that PUT file just adds the subroutines that print is looking for. > You could totally fake PRINT out by creating a different routine. > subroutine > with the same name. > But that's why ] is reserved :). > Similarly, multiplication and division call the ]mult16 and ]div16 routines in the core library. > The third type of library -- using the linker -- works the same way, but now the routines are resolved at link time. > I'll explain that in a bit... hmmkay so if we want to use print, we have to "put 'putcore.c.s'" at the end? > Yup. > Technically you could append it, but that's a Bad Idea. k > For reasons of new library revisions, etc. > Anyways, does that make sense? sure > It's really simple, but maybe I've made it more complicated. > The bottom line is just what you said: to use print _or_ to use multiplication/division you need to have the core library. > And if you're not using the linker, you need to PUT it. k is there a GetKey command? > There's actually a sort-of exception: I've added the command "sprint" which doesn't require the library, but only prints strings. > Not yet. k > Very easy to add, however. > I think the syntax will be getkey(a) > Also, inupt(a) > 1st question though: do you expect getkey to wait for a keypress or not? > Like, there'll be one command that waits and another that doesn't, I just have to decide on a naming convention. both :P well, getkey and waitkey > Yeah, something like that. Anyways, that's just a matter of updating the slangdef file. > Very easy. > Ready for the third kind of library, a linker library? actually, i started coding a tetris here... :) and i'm not sure how i define a subroutine that returns a variable and would sub asm getkey@$ffe4()<-k@A be correct? > unfortunately no. > @A doesn't currently work for return variables. Bummer. ah... hrm > A really simple thing you can do, though, is: > sub getkey<-byte key > jsr $ffe4 > sta key > rts > Kinda retarded, but... s/retarded/straightforward/ not sub getkey()<-byte key? > There's another thing which I haven't implemented yet which is coming next time. > Yeah, getkey()<-... k oh, and could i get "endsub" as an alias for rts? :) > Yeah, it's in there. > endsub oh, ah, ok > I don't remember if I've put string comparisons in yet or not. > Like, no if a$ = 'a' k and then key=getkey()<-key? > Instead you'll have to if a=65 kind of crap. > Yup! cool > Well, not really -- getkey(key) would be cool. maybe you should have 'x' be chars, and "x" be strings? > The nice thing about having ' and " valid is that you can use one when you need the other quote in the string. true > Anyways, I think I've got it all worked out how to do it, I just need to implement it :) > What the delineation is is whether it's a single character. hrm program crashed :P how do i get back to slang? > sys 54016 > Always be sure to end your program with a brk. Yeah, kind-of obnoxious. > I will be adding an "endbrk" and "endrts" command or some such. > 54016 is $d300, btw. *** Signoff: Greg_2 (Ping timeout: 182 seconds) back k, that did the trick > The brk? sys54016 > Ah :) code never reached my brk :) guess this'd be a good time to show me the debugger... heh > Robin usually puts a line in that maps NMI to 54016 ah > So you can hit restore to go right back to the editor. > Alrighty then, debugger. > Unless it's easier to just use print statements or whatever. return@$0318, return=$d300? > yeah, int nmi@$0318 or whatever k > Do you have 16M? sure do > Lemme show you something really quick. > Exit to the monitor. > Then type "i 080000" > That's where your program text is stored while the editor is working on it. > Now type "i f4fa00" or so. > You should again see your program text around there somewhere. yeah > When you exit to the monitor or to basic, the source code is copied as high as it will go. > This frees up lower areas of SuperRAM for program use. > But the reason I mention this is that if you ever have a really bad crash, that for some reason hoses the 54016 restart, you can manually save the text from jammon. > In Case Of Emergency > Just so you know! good to know so... debug? > Ah. > Sorry, was afk. > Stick a brk at some point before the bug. Or we can start from $1000. yeah, it b0rks in the first loop, $1000 is ok > OK, once the brk is in there, start the program from the monitor and it will immediately pop you out at the brk. > What is the loop code, btw? > Or, what does the loop do? repeat > (Well, what's the loop _supposed_ to do :) k=waitkey()<-k if k=32 Game() endif until k=51 > And what does Game() do? start with space, quit with q nuthin :) > But it has an endsub? yup > OK > This should be easy from the debugger. > Go ahead and add the brk, and g 1000 k > Now type !d > ! toggles stuff' !d toggles "debugging mode", which is mostly a display mode. > Then type "d" to disassemble starting from the current point. > You should see the code on the right, with the "brk" instruction highlighted. yep > Now you can use "z" to single step through the code. z has the same syntax as d. Type "z ", where is the brk address+1. > Now you can just type "z" to execute the highlighted instruction. hmm that skipped two steps weird lemme restart > The first one? > What z does is execute the instruction, then stop at the next instruction. just atpyo ahem > OK :) though the first command is sprint and it printed the string then froze yep tried again > OK, here's something to be aware of. > In the assembler, "do 0" will disable assembly, and "fin" will finish the do conditional. > So this is a really handy way to comment out huge sections of code. k still shouldn't i be zingle ztepping the print routine? > Just bracket it with a "do 0/fin" -- this allows you to zero in on code that might be causing problems. > Does the brk occur before the sprint? yup > Then yeah, you should see the sprint. weird removed the sprint z 100b same thing (just no message) runs full tilt does it enter jsr's? > So the sprint is causing the problem? not anymore, i commented it out > You can toggle whether it follows jsr's. it goes into my repeat/while and loops forever no cursor back > ? indeed > Well, just start from z 1000 > If it's only at 100b :) > What is the sprint line, btw? > sprint "press a key" or something? yeah > What's the exact line? ok, jsr $100e :P er -ok when it hits a jsr, it goes into full speed > Meaning it no longer single steps? > Is the loop inside the jsr? > Rather, what's at the jsr? yes > OK. the repeat loop > By default, single-stepping does not follow subroutines. > To toggle this, type !j ah > Then it will go into the subroutines. there we go :) > Sorry! :) hrm > But you'll want to turn this off for, say, jsr $ffd2 now if i could also see my source at the same time... right m 080000? > Yeah, I've thought about that. Basically it's a good memory excercise. > You can do that, but do it from the non-debugging mode. > Type !d > Then i 080000 ah ugh, disassembly doesn't follow the z display z cursor > ? like a jsr off the current display > Oh, hit d again. well yeah might want to make that automagic though :) > I'll think about it. > The thing is, sometimes you're in a loop that's slightly bigger than the screen, say. also, making return on an empty line repeat the last command would be nice > For what sort of situation? z z z z :) > Well...... we'll see :) hrm, now it's waiting for $c6 how do i write 1 to $c6? > Use m > Then cursor over the line. exit !d mode? > m 00c6 probably > Either way. didn't like it in !d mode > The kernal is going to not like it though. didn't like it in normal mode either > Like, Jammon uses the kernal, so it'll take effect immediately. ohhh hah d'oh > :) > One thing you can do is fudge it. > This is just your getkey routine, right? > Code should look like > jsr wherever ýeah > lda xxxx > sta yyyy have'em return 51? > just load .A with 51 (using the cursor) then z from that sta yyyy instruction. > Oooh, let me show you another cool command. > Exit debugging mode, and type "n 'q'" > n is "number"; you could also do "n 51" changed lda $c6 to lda #$01 > Ah. ahh > And it will print the number in base 10, 16, and the ascii char. Really useful :) > Argument can be in decimal, hex, binary, or ascii, I think. bug found > Yes? k=$51, not k=51 :P > Ah, bummer. stoopid but hey, now i know how the debugger works > Why did that make it crash, though? It was just in the busy loop? > Yeah! just a busy loop ok program quits on q, and prints "GAME'D" on space > I think that the debugger is probably less-useful for slang programs; like, a simple print statement would have found that one fast. that's like 23-27% of Tetris > Heh :) heh, everyone's using 23-27% nowadays... yeah, hard to follow slang code compiler output isn't quite what it could be i guess... > The next core release will include a block move command -- useful for, say, copying down the default charset to modify it. > Well, it's actually pretty good. > The compiler output, that is. certainly does the job > Some thing you see that are goofy-looking are there on purpose. > Because the compiler can't look ahead, only behind. ah > Or because it has to preserve a register, or whatever. > Sometimes it's signed/unsigned stuff, too -- like, using a uint instead of an int will make things much simpler. doesn't seem to reuse regs though like lda foo sta bar lda foo sta baz instead of lda foo sta bar sta baz *** Signoff: RobinH (Read error: Connection reset by peer) > The problem is that no longer works for ints, say. > It _does_ keep track of X and Y stuff, though. k really minor issue though > But if you find cases where that can be fixed, I'll implement it. ok, so to see how the linker works... > I've tried to keep that kind of stuff to a minimum -- really breaks my heart seeing the compiler output some things. let's put the display code in a different buffer > Ah, simple linker thing. i now have a main(), a DisplayTitle(), and a Game() > In different buffers? no, one buffer still > What do you want to link? :) in the next one i'll do ClearScreen(), DrawBoard(), and DrawPiece() > Ah, I see. then link the two > As long as we're clear that the linker is somehwat more obnoxious for smaller programs. sure > i.e. that this is just for practice :) right-o used to linkers now, use it with cc65 all the time > k > And are you using putcore? no > OK. > Because I'll also show you how to link the core library in. well, won't do any harm will it > There's two steps if using the core library with the linker. > Want to do a quick test? sure > OK. > Try typing a program like the following: > rel > put 'core.ext.s' > byte b > b = -3*2 > print "b=" b <- note could also have done print "b=",b > brk > Then compile. > That PUT at the top contains lines like "sub ext ]mult16(...)" -- you can look at it in the editor. > But that first PUT is what's critical here. > Then save the output code to some file, like "ptest". SAVE'D > Then, in a different buffer, do something like > link $c000 > ptest.l > core.l > and compile. yep, worked just dandy ...what's wdm $42 though? er wdm $3d before the brk > "b=" :) > In assembly, that's like > jsr STROUT oooh ah hehe > txt 'b=' > dfb 00 gotcha > And THAT is a big pain when single-stepping, btw. > What you have to do is put a BRK after the 00 -- where STROUT returns to. > Using something like "b c01e" or whatever to set the breakpoint. > z will just put a brk right after the JSR STROUT, call STROUT, and get all confused. yeah > Anyways, the thing I wanted to point out is that the core interface is contained in core.ext.s, and the actual routines aren't present until link time. don't think any debuggers i know of that handles that gracefully > Without that put "core.ext.s" line it won't work. k so how do i make my own? > Right. should all my files start with rel, or just all but the "main" one? > Three commands: REL, EXT, and ENT > Any relocatable file starts with REL. > i.e. any file to be used with the linker. > So, all files start with REL :) > (Except the one containing the link command) k > If a routine somewhere wants to access a subroutine (or a variable!) in a different module, you have to do two things. > Actually, first load in the file "slang.ext" > To see the syntax of a sub ext. no such file in my zip > Well, slang.ext.s nope > There has to be -- we used it in the PUT above :) you mean core.ext.s? > Ah, sorry, core.ext.s > bleah hokay > You'll notice that instead of "sub asm" it contains a bunch of sub ext. yup > So all it's doing is setting up some EXTernal interfaces to be resolved at link time. > The actual subroutines are contained in the "core.l" file. > And the interfaces tell the REL module how to call them. so... > So let's say you have PROG1 and PROG2 i need an extra file with sub ext, that i PUT into the main file? > And PROG1 wants to call a subroutine in PROG2. > Nah, just type the "sub ext" line directly into the file. k > PROG1 needs to have a line like "sub ext ...." > And PROG2 needs to have the sub be a "sub ent ..." > So you can just cut and paste, really. hmm and sub ext needs the full prototype with args and all? > Yeah -- because it needs to know how to pass the args (size, signed, place, etc.) damn, wish i had tv-in on my PC, i could give you a direct feed of my monitor... k > Maybe it helps to think of it as a "ghost" subroutine. and for variables? just a plain C prototype :) > Same thing. "int ext blah" > That says, "create a variable called "blah", and treat it like an int, but it's outside of the program somewhere" what was the "for" syntax again? > for i=1:n step blah > (I think :) endfor? > yeah. > Or next. > I should have posted a slang example using the linker on the BBS. well i'll post my tetris code working or not :) should be a good example hmm possible editor display bug when lines are > 40 chars it prints / in column 40 and on the next screen it starts with char 41 > Yeah, that's intentional. so you can see char 39 and 41, but 40 is hidden under / > Right. ? but then you can't see what's written there > Well, on the occasions where you really need to see it you can use ins/del :P > Basically any method is obnoxious. > I could use half-screens, etc. etc. > Like, ctrl-k could move over a half-screen, or whatever. > But they're all irritating in one way or another. make it move 39 chars to the right abc/def > Yup, that's an option too. instead of abc/ef > I'll think about it :) :) > (I mean, really, I will! :) hmm, i have to compile and save object file to disk before linking? > Unfortunately, yes. > With big files -- big codes -- this isn't as big of a deal. > But I will make it so that you can compile directly to disk. some kind of makefile-ish buffer would be cool link $1000 assemble tetris.s to tetris.l :) > Good heavens, no. hehe > The whole idea is to not have to recompile. true > I will post my Slang example sometime. > Linking takes 14 seconds. > If I had to compile it all, each time? Ouch. Minutes. > I hate to even think about it! hehe that erp that's the thing with make though, it only recompiles if the source has changed if not, it grabs the old binary > Right -- but for that you need a datestamp or something. > But there's no reason for that here. well, if the buffer is in ram, check if it's modified nah > Like, you compile it when you compile it, then you're done. would've just saved me all of like three keystrokes right now :P > And keep the link file in a buffer. and since i'm learning, i'm jumping around a lot when you're actually working on something, it's smoother aaanyway unresolved external hmm > Did you declare it as an ENT? > In the code where it actually resides? sure did sub ent ClearScreen() *code* endsub sub ent DrawBoard() *code* endsub then > OK in tetris.s i have two sub ext foo() > sub ext ClearScreen() ? yepo > OK, what's the linkfile look like? and DrawBoard link $1000 tetris.l screen.l > And you're sure that the .l files are correct? (Like, didn't accidentally save both as tetris.l?" right you are tet.l hmm no wait i *have* tet.l in the link file > I am trying it... just a sec... hrm actually uresolved EXT: clearscreen lower case is it case sensitive? > Yeah, that's fine. > No. > OK, my little program worked. > Two sub ents, two sub exts yeah... hmm > I even used ClearScreen and DrawBoard :) dunno what i'm doing wrong, but it's probably something stupid > Basically I am just relieved that it works. > That there's not some horrible bug I've overlooked. > Try compiling and saving them again? sub ext ClearScreen() at the top of tetris.s, just after rel > ok yeah, trying again > What I did was create two files. First one is > rel > sub ext ClearScreen() > sub ext DrawBoard() > byte b > b=1 > ClearScreen() > DrawBoard() > inc $d020 > brk > The second program is > rel > sub ent ClearScreen() > lda #00 > sta $d020 > endsub > sub ent DrawBoard() > lda #00 > sta $d021 > endsub yep worked this time must've been something silly > Great! :) > "OK it worked" is like music to my ears. didn't print the text though and it didn't draw the board... hmm > heh > BTW, have you checked out spritedemo.s? yeah > ok gnnf brain is slowing down here maybe we should call it a night i should have enough to keep me going for a while > Sounds good. > Talk to you in a few days. :) *** MagerValp has left channel #slang *** Signoff: Wildstar (Quit: Leaving) *** Window LOG is OFF IRC log ended Sat Nov 20 23:16