00:00:00 --- log: started forth/05.03.13 00:26:09 --- join: Serg[GPRS] (~z@193.201.231.126) joined #forth 00:26:31 hi ! 00:27:04 in FASM, can i define macro equal to instruction name, to redefin it hard way ? 00:27:38 i need this for 2-stack idea 00:58:00 --- mode: ChanServ set +o thinfu 02:04:53 --- quit: Sonarman ("leaving") 02:19:55 --- join: aum (7f7dd6dd9b@60-234-138-239.bitstream.orcon.net.nz) joined #forth 02:26:57 --- quit: Serg[GPRS] () 02:34:42 --- join: x2Sx (~x2Sx@ipDynErx74-78.clients.easynet.fr) joined #forth 03:43:14 --- quit: aum () 05:25:44 --- join: aum (8c091e0699@60-234-138-239.bitstream.orcon.net.nz) joined #forth 05:49:55 --- quit: aum () 08:41:08 --- join: Serg[GPRS] (~z@193.201.231.126) joined #forth 08:44:53 Serg[GPRS]: yes, you can define macros equal to the instruction name in FASM 08:45:52 aha, i found out, but considered it unwise and misleading for my purpose 08:46:11 i have trubble w/ macros, may u help me ? 08:46:47 I'll try to 09:24:50 --- join: docl (~docl@dpcbw098059.direcpc.com) joined #forth 09:33:34 --- join: Herkamire (~jason@h000094d30ba2.ne.client2.attbi.com) joined #forth 09:33:34 --- mode: ChanServ set +o Herkamire 10:17:54 --- quit: Serg[GPRS] () 10:31:43 : manage-sarray ( id offset n size type link -- id offset' ) 10:31:43 store-link 0 , , 10:31:43 2 PICK , 3 PICK , 10:31:43 TYPE-ID , 10:31:43 DUP , 10:31:45 * 10:31:47 + 10:31:50 \ reserve additional space for structure tag info 10:31:52 2 CELLS + 10:31:55 ; 10:31:57 ugliest forth evar 10:34:06 what's that from? 10:34:38 some actual code from iTV 10:34:43 well, it was 10:34:47 before jeff fox went over it 10:34:47 :) 10:34:52 http://www.ultratechnology.com/structs.fth 10:35:03 27K of forth source to implement C style structures 10:35:13 ick 10:35:14 I've coded it in a block in pygmyforth 10:36:04 :) 10:36:22 No joke :) 10:36:28 didn't have the late resolving crap 10:36:31 but it worked fine 10:36:44 I still have it, hold... 10:39:23 ( Structures ) 10:39:24 : STRUCT ( -n) 0 ; 10:39:24 : F-ARRAY ( n#-n) CREATE OVER , + DOES> @ + ; 10:39:24 : F-WORD 2 F-ARRAY ; 10:39:24 : F-BYTE 1 F-ARRAY ; 10:39:26 : F-STRUCT ( na-n) F-ARRAY ; 10:39:29 : END-STRUCT CREATE , DOES> @ ; 10:39:31 : UNION ( a-an) 0 ; 10:39:34 : WITH ( an-anb) 0 ; 10:39:36 : END-UNION ( anb-a) MAX OVER , + ; 10:39:39 I did that almost a year ago :) 10:39:50 structure + union, in 0 lines 10:39:52 9* 10:39:53 :) 10:40:53 it was polymorphic too :D 10:41:02 for what i did 10:41:08 made a little crappy program for my cousin 10:41:17 you had a general struct 10:41:25 and you'd "cast" it 10:41:41 so STRUCT-NEXT would give you the link field 10:41:49 STRUCT-DATA the actual struct that this was casted to 10:41:50 ;) 10:43:19 that would work in retroforth if you had a definition for max :) 10:43:20 : struct : union : with 0 ; 10:43:20 : f-word 2 f-array : f-struct : f-array create over , + does> @ + ; 10:43:20 : f-byte 1 f-array ; 10:43:20 ' constant alias end-struct 10:43:21 : end-union max over , + ; 10:43:37 err, typo in the second line.... 10:43:43 : f-word 2 : f-struct : f-array create over , + does> @ + ; 10:43:45 there 10:43:53 :D 10:44:55 structures and unions in 5 lines :) 10:45:16 :) 10:45:18 (I added does> back to retroforth, at least for now...) 10:45:58 --- join: tathi (~josh@pcp01375108pcs.milfrd01.pa.comcast.net) joined #forth 10:52:43 --- join: Sonarman (~snofs@adsl-64-160-164-132.dsl.snfc21.pacbell.net) joined #forth 10:56:38 --- join: qFox (C00K13S@82-169-140-229-mx.xdsl.tiscali.nl) joined #forth 10:59:34 --- join: Serg[GPRS] (~z@193.201.231.126) joined #forth 10:59:47 re 11:00:24 just tryed 'Playboy the mansion' game - good idea but crappy overwhelmed with tycoon strategy ;(( 11:07:18 try darwinia 11:07:22 its a good game 11:07:33 what's it ? 11:07:45 proves that good games nowadays dont need a dvd full of images to be a great game 11:07:52 its an rts, i guess 11:08:14 a whole dvd full of sound and images does NOT make a good game... i totally agree 11:08:23 99% of all games have a play life of about 3 hours for me 11:08:27 then its "bleh" 11:08:28 ble-e-e-etch, i can't play RTS coz my brain creeps apart between units 11:08:46 on the other hand games like the original settlers i STILL play 11:08:48 well, the whole game is about 30meg 11:09:05 its a full 3d environment, using about 10 or so sprites 11:09:05 :p 11:09:16 tiny sprites, i might add 11:09:40 hehe, STUNTS is 1 floppy and i still play it, coz dunno any game where i can build and run stunt tracks 11:10:30 qfox what does it run on/under ? 11:10:34 anything 11:10:41 win 'nix mac 11:10:56 from the makers of uplink, if you know that game 11:11:19 although this is an entirely different game 11:11:26 uplink was a good game as well 11:11:33 if say about erotic game, i wanna one where i can wander all around open world (GTA like) and fu... everyone different ways, upgrading the skills like in Diablo ;))) 11:12:12 go for it 11:12:14 :) 11:12:48 i'm still wondering whether i'll try my modding skills at darwinia, you get the editor when you finish the game 11:12:54 which is not a seriously hard challenge 11:13:31 it gonna bust sparks out of CPU - even balance holding on arbitrary contact points is quite a challenge 11:17:48 a friend of mine tryed to write 'mad positions generator' long ago - that sucked completely 11:18:56 what does that do? 11:20:54 random generator of sex positions ;)) he managed to cope with joints angles, but completely failed with hmm.... weight distribution 11:21:04 haha 11:23:27 we had a lot of LOL on it's ideas ;)) 11:24:18 much harder whan 'walking targets' in shooters ;)) 11:26:43 * Serg[GPRS] dislikes to hold any balance at all ;))) 11:31:21 yeah, i fall asnooze, bye ! 11:31:24 --- quit: Serg[GPRS] () 12:14:23 --- quit: saon (Read error: 110 (Connection timed out)) 12:41:51 --- join: niner (~niner@adsl-68-73-138-118.dsl.wotnoh.ameritech.net) joined #forth 12:56:07 --- nick: Hyrax -> Hyrax|afk 13:00:28 --- join: slava (~slava@CPE00096ba44261-CM000e5cdfda14.cpe.net.cable.rogers.com) joined #forth 13:10:05 --- quit: slava (Read error: 104 (Connection reset by peer)) 13:10:21 --- join: slava_ (~slava@CPE00096ba44261-CM000e5cdfda14.cpe.net.cable.rogers.com) joined #forth 13:10:39 any ppc experts: is blr the same as bclr? 13:10:56 i'm finding powerpc assembly more complicated than x86 13:11:05 and these simplified mnemonics are confusing as hell 13:11:47 slava_: yes 13:11:54 bclr with 20 as argument 13:11:59 ie ALWAYS 13:12:27 slava_: but if you see bclr it's extended mnemonics not simplified :) 13:12:51 ok 13:13:19 but basically all branches are conditional; bclr = branch conditionally to lr, if the condition is ALWAYS (or 20) it's always taken, so it's the samething as branch to lr 13:13:41 ok 13:14:25 well, i've almost reached my goal for today, of being able to push values on the stack :) 13:14:56 :) 13:15:43 you know what's weird? 13:15:47 30: 4e 80 00 20 blr 13:15:51 this is gcc-generated code 13:15:57 that doesn't look like bclr 20 at all 13:16:05 stack management is probably about the trickiest to learn when dealing with powerpc assembly, one can get a bit confused to start with as there's different concepts 13:16:28 well, i mean a forth stack. its pretty straightforward 13:16:29 the red zone for example can be a bit confusing 13:17:17 slava_: it is 13:17:44 it's bclr 20,0 which is blr 13:17:54 ok 13:18:26 the problem is that; I don't remember x86 asm very good though, but a opcode is exactly one byte on the x86 right ? 13:19:07 --- part: niner left #forth 13:19:10 well, 1 or 2 13:19:15 on a powerpc it's 6 bits I think; could be 5 bits, I don't remember exactly 13:19:47 so unless you're really good with masking numbers by head; it can be difficult to figure out what instruction a certain hex sequence may be 13:19:52 however usually branches starts with 4 13:20:03 i have a .b word for that :) 13:24:45 pretty simplified; that means if the 8 digit hex sequence starts with 0 it's a trap or similar, 1 it's multiply, 2 it's a compare, 3 it's an add/sub, 4 it's a branch, 5 it's rotate, 6 it's a or, 7 it's an and, 8 it's a load, 9 it's a store same with a/b (load store resp), c/d floating point instruction 13:25:02 but that's generalized 13:25:40 so 0x81212121 would be some form of load instruction 13:25:56 0x31212121 would be some form of add (subtract) instruction 13:26:00 hmm 13:27:07 that may be very vague, but it can give you a clue if you don't have an disassembler handy and just wanna verify some code you generated on the fly etc. 13:27:29 i use gdb :) 13:27:41 works fine. 13:28:03 but this may be quicker if not precise information is required 13:28:08 -t 13:28:44 so if you see for example "0x60000000" 13:28:49 you know it's an or :) 13:29:08 which is effectively the samething as an nop on the ppc :P 13:29:24 or 0,0,0 13:29:25 conditionals are confusing on ppc 13:29:47 but generally don't do much with them. 13:29:58 I donno if they're confusing; the powerpc is just not suitable for "in head" disassembly 13:33:17 ok, finally i got blr working :) 13:33:43 stw r0,20(r1) <-- is this indexed addressing mode? 13:34:56 no 13:35:17 indexed has an x in the mnemonic 13:35:26 and takes 3 registers as arguments 13:35:55 lbzx r3,r4,r5 would be an indexed instruction for example 13:36:03 ok 13:36:21 in ppc terminology, is a 'word' 32 bits? 13:36:22 or 16? 13:36:22 where EA is calculated as the sum of r4 + r5 13:36:27 it's 32 bits, yes 13:36:29 ok 13:37:06 stw r0,20(r1) stores the value at 20+r1 in r0? 13:37:55 yes 13:37:58 ok 13:37:59 however r0 is a bit specific 13:37:59 er? 13:38:03 you can't use it like that 13:38:04 isnt it the other way around? 13:38:09 ah 13:38:10 yea 13:38:12 eh ya even 13:38:14 doesnt it store = in (20+r1)? 13:38:19 stw stores contents of r0 13:38:26 ok 13:38:27 r0 is always 0 13:38:28 :) 13:38:42 slava_: if it's been an lwz it's been as you said 13:39:18 so swz and lwz are identical except the arguments are swapped? 13:39:39 slava_: no the arguments are the same; it's just the functionality that's swapped :) 13:39:44 ok 13:40:23 --- join: TheBlueWizard (TheBlueWiz@ts001d0737.wdc-dc.xod.concentric.net) joined #forth 13:41:12 like lwz r3,0(r4) is store load contents of 0(r4) into r3, stw r3,0(r4) is store contents of r3 into 0(r4); the first parameter is always the source/destination/result 13:41:27 well destination = value you want to save 13:41:33 or register you want to load into 13:42:05 I donno exactly how to explain it better; it's not that complex; i'm just can't think of a better example right now 13:42:28 ok 13:43:19 it's very similar to lwz r3,offset(r4) is like r3=r4[offset] in C, while stw r3,offset(r4) is r4[offset]=r3 ; I guess one can think of it as the arguments are swapped, but I donno 13:44:06 ok, i got the stw opcode assembling 13:44:08 --- quit: Hyrax|afk (Read error: 104 (Connection reset by peer)) 13:46:59 : PUSH-DS 13:46:59 #! Push r18 to the datastack. 13:46:59 14 14 4 ADDI 13:46:59 18 14 0 STW ; 13:47:02 i think this is right :) 13:47:10 lets see what gdb says 13:47:40 0x3202c0a4: addi r14,r14,4 13:47:40 0x3202c0a8: stw r18,0(r14) 13:47:45 is this an ok way to do it? 13:48:20 define "ok" 13:48:48 "correct" :) 13:49:08 it works; but it's far from an optimal way, also the stack pointer is usually kept in r1 on the powerpc; but it has no "technical" difference other than being coherent 13:49:21 what is a more optimal way? 13:49:24 i don't want to take over r1 13:49:38 a better way would be to store with the offset parameter 13:49:49 but i have to increment r14 anyway 13:49:57 then increment/decrement the stackpointer when all values are stored 13:50:04 oh yes, i see what you mean 13:50:07 now you're generating two instructions per store 13:50:14 instead of technically only one required. 13:50:25 i'll get it working first, then optimize later :) 13:50:25 but it can be tricky to do it another way :) 13:50:35 yea, functionality is always the most important 13:51:07 my x86 backend is a bit lame too, but over time both backends will do optimization 13:52:06 well a lame backend is better than no backend :) 13:53:58 does the instruction cache have to be flushed on powerpc? 13:55:17 yes. 13:55:28 well, flush the dcache, invalidate the icache. 13:55:54 * tathi goes to find the code 13:57:07 I wouldn't use r1 for the stack 13:57:21 C stuff uses it's stack differently than I do 13:57:49 if i didn't have a C substrate i could use registers more optimally on both x86 and ppc 13:58:02 eg, on x86 the ebp register is wasted due to C brain damage 13:58:11 slava_: it's not really an optomization. 13:58:25 just: stwu r18, 4(r14) 13:58:46 oh, that updates r14? 13:58:51 yes 13:58:55 thanks for the tip 13:59:03 _before_ doing the store/load 13:59:22 tathi, it doesn't matter in this case, though? 13:59:34 so stwu r18, x(r14) will add x to r14, and store to that address (leaving x+r14 in r14) 13:59:49 it's important to remember that it is before. 13:59:55 there is no way to change the pointers after 14:00:02 so your pop will be two instructions. 14:00:10 pop would be: 14:00:11 right 14:00:22 addi r14, r14, -4 14:00:45 oops 14:00:52 scratch that 14:00:54 lwz r18, 0(r14) 14:00:57 addi r14, r14, -4 14:01:11 ok, a cache line is 32 bytes. 14:01:31 for each cache line, do dcbf; sync; icbi 14:01:42 and then end up with sync; isync 14:01:49 you can have it so either push or pop is one instruction. and you can also choose if you want the stacks to go up or down. 14:02:13 I do have some actual code if you'd like. 14:02:15 i'm not sure either offers a clear benefit. i guess i push as often as i pop :) 14:02:44 tathi, is there any way to flush the entire icache in one step? 14:03:00 or indeed, does one have to do this before executing code that was just generated? 14:03:18 AFAIK you have to do that 14:03:43 it's not so bad if you remember to do it 14:04:11 we just keep a pointer to where we've flushed to, and have a word that flushes from there to HERE, then updates the pointer 14:04:29 mprotect +x under linux does it. 14:04:38 * slava_ ponders 14:06:06 It is kind of a nuisance. :( 14:06:30 do you have code that does this? 14:06:39 yes. 14:07:12 takes start/end addresses, computes how many cache lines and flushes them. 14:07:27 gas syntax assembly? 14:07:53 yes 14:07:59 cool 14:08:06 can you paste bin it please? 14:08:07 that's the only free PPC assembler that I'm aware of, unfortunately. 14:08:13 sure. 14:10:02 http://paste.lisp.org/display/6575 14:10:42 that's straight from my forth, so it assumes a couple of things. 14:11:03 I could rewrite it to just take start/end addresses in r3/r4 (or whatever) easily enough. 14:11:21 i'd need to call this from C, and my 'here' is compiled.here (compiled is a global struct) 14:14:26 --- quit: docl (Read error: 104 (Connection reset by peer)) 14:16:09 any reason this code gives a segmentation fault? 14:16:10 0x3202c010: stwu r0,0(r14) 14:16:10 0x3202c014: blr 14:16:48 r14 is invalid ? 14:16:58 it shouldn't be 14:16:59 let me check 14:18:51 ok, posted new routine as annotation to the original paste 14:18:59 ok 14:19:17 thanks 14:23:30 are you guys sure that r0 contains 0 ? :) 14:24:10 where? 14:24:22 somebody said this earlier todya 14:24:24 it seems its not true :) 14:24:41 oh, r0 isn't a truly general purpose register. 14:24:54 for several instructions, a value of 0 means a literal 0 rather than register 0. 14:25:22 first address register of indexed addressing, for instance. 14:25:39 oh, ok 14:26:01 and first source register for add immediate. 14:26:35 li rA,LIT = addi rA,"r0",LIT 14:26:50 ah! that's the source of my confusion 14:26:58 so 'li' is not a real instruction either 14:27:02 i was just looking for it :) 14:27:32 slava_: no I said r0 is a special register; it can't be used all the time 14:27:38 k 14:27:47 basically you just use r0 for temporary lr store 14:27:55 like mflr r0; ..... mtlr r0; blr; 14:29:36 Appendix F of that MPCFPE32.pdf is simplified mnemonics, though it doesn't have a short list of all of them. 14:32:12 ok, i can push 16 bit literals on the stack :) :) 14:32:29 :) 14:32:33 what is the idiomatic way to push a 32 bit lit? li followed by an add with shift of some kind? 14:32:39 s/push/store into a register/ 14:33:00 I use lis; ori 14:33:07 ok 14:33:20 lis ra,lit = adds ra,"r0",lit ? 14:33:20 The idiomatic way (I think) is li; addis 14:33:28 or sounds better than add :) 14:33:29 addis, but yes 14:33:32 ok 14:33:58 --- quit: x2Sx (Read error: 145 (Connection timed out)) 14:34:10 yeah, if you do li; addis; you have to adjust the high 16 sometimes because you loaded a _signed_ 16-bit immediate 14:34:24 food, back later 14:34:50 --- join: eiz (d5bcbfb5f8@c-67-164-190-9.client.comcast.net) joined #forth 14:38:13 hey eiz 14:38:16 --- join: x2Sx (~x2Sx@212.180.15.41) joined #forth 14:38:19 i've been getting a lot of help in here :) 14:44:00 good :) 14:49:53 amazing the concentration of PPC folks on this channel ;) 15:02:27 --- quit: qFox ("this quit is sponsored by somebody!") 15:45:09 --- join: rastm2 (~rastm2@adsl-70-248-101-72.dsl.rcsntx.swbell.net) joined #forth 16:01:51 --- quit: tathi ("laters...") 16:41:46 --- quit: Sonarman (Read error: 104 (Connection reset by peer)) 16:45:02 --- join: Sonarman (~snofs@adsl-67-113-235-205.dsl.snfc21.pacbell.net) joined #forth 16:54:53 --- part: thinfu left #forth 17:26:34 --- join: crc2 (crc@bespin.org) joined #forth 17:26:40 --- quit: crc2 (Read error: 131 (Connection reset by peer)) 17:36:06 --- quit: TheBlueWizard (Read error: 104 (Connection reset by peer)) 17:48:00 --- quit: I440r ("Leaving") 17:59:02 --- join: I440r (mark4@rrcs-24-242-160-169.sw.biz.rr.com) joined #forth 18:10:22 --- join: crc2 (crc@bespin.org) joined #forth 18:10:32 --- quit: crc2 (Read error: 104 (Connection reset by peer)) 18:11:53 --- join: crc2 (crc@bespin.org) joined #forth 18:12:00 --- quit: crc2 (Read error: 54 (Connection reset by peer)) 18:12:56 --- join: crc2 (crc@bespin.org) joined #forth 18:15:49 --- quit: crc2 (Remote closed the connection) 18:22:52 goodnight 18:30:00 --- quit: Rockford () 19:11:41 --- join: aum (c530b82bda@60-234-138-239.bitstream.orcon.net.nz) joined #forth 19:26:08 --- join: dupswapdrop (~chatzilla@c-24-118-225-27.mn.client2.attbi.com) joined #forth 19:27:54 --- quit: slava_ ("Leaving") 19:28:27 --- part: dupswapdrop left #forth 19:35:30 --- join: asymptote (~dmesg@68.48.8.92) joined #forth 19:59:56 --- quit: asymptote ("Free the mallocs!") 20:06:43 --- quit: Sonarman ("leaving") 20:07:55 --- quit: rastm2 ("leaving") 20:13:12 --- join: asymptote (~dmesg@68.48.8.92) joined #forth 20:35:40 --- quit: asymptote ("Free the mallocs!") 20:35:45 --- join: Quartus (~trailer@ansuz.pair.com) joined #forth 21:13:35 --- join: saon (1000@c-24-129-90-197.se.client2.attbi.com) joined #forth 23:10:52 --- quit: aum () 23:59:59 --- log: ended forth/05.03.13