|
Post by Mairtrus on Aug 4, 2011 10:07:50 GMT -5
What tomman said, except for 2 things: First, whatever controller port can be used for serial communication. The Sega Meganet used the EXT port since nothing else used it, and that left free the controller ports. However, it's not recommended to use the controller ports in serial mode, since you can achieve higher transfer speeds if you implement you own communication protocol with the MD (there are enough pins that can be used for data transfer and handshaking) in parallel mode. And second, the expansion port is more suitable for high speed transfer of data in parallel, and it's not so difficult to manipulate. I made a small plate to control a HDD with only a few OR gates.
|
|
|
Post by Mairtrus on Jul 14, 2011 17:36:23 GMT -5
Hai guys. Sorry for bump this not-so-old thread, but I have a few subroutines that I believe someone will find usefull: This one allows you to change the Link property of a sprite:
Declare Asm Sub LinkSprite(d0.w,d1.w) move #$2700,sr lsl.w #3,d0 addi.w #$2C02,d0 swap d0 move.w #2,d0 move.l d0,4(a4) nop nop move.w (a4),d2 nop nop move.b d1,d2 addi.l #$40000000,d0 nop nop move.l d0,4(a4) move.w d2,(a4) move #$2000,sr End Sub and use like this:
LinkSprite SpriteHandler,LinkNumber The next one is used to change the form of a sprite:
Declare Asm Sub ResizeSprite(d0.w,d1.w,d2.w) move #$2700,sr lsl.w #3,d0 addi.w #$2C02,d0 swap d0 move.w #2,d0 move.l d0,4(a4) sub.b #1,d1 andi.w #3,d1 lsl.b #2,d1 move.w (a4),d3 sub.b #1,d2 andi.b #3,d2 or.b d2,d1 addi.l #$40000000,d0 lsl.w #8,d1 move.b d3,d1 move.l d0,4(a4) move.w d1,(a4) move #$2000,sr End Sub
and use like this
ResizeSprite SpriteHandler,NewHeight,NewWidth (NewWidth and NewHeight take values from 1 to 4) This last one is my latest achievement, and probably the only thing on the MD I hadn't learned how to use...yet:
Declare Asm Sub DmaCopy(d0.l,d1.w,d2.l) move #$2700,sr move.w #$9300,d3 lsr.w #1,d1 move.b d1,d3 move.w d3,4(a4) lsr.w #8,d1 addi.w #$100,d3 move.b d1,d3 move.w d3,4(a4) lsr.w #1,d0 addi.w #$100,d3 move.b d0,d3 move.w d3,4(a4) lsr.w #8,d0 addi.w #$100,d3 move.b d0,d3 move.w d3,4(a4) lsr.w #8,d0 andi.b #$7F,d0 addi.w #$100,d3 move.b d0,d3 move.w d3,4(a4) lsl.l #2,d2 lsr.w #2,d2 addi.l #$804000,d2 swap d2 move.l d2,4(a4) move #$2000,sr End Sub and use like this:
DmaCopy lblptr&(YourData)+SomethingIfYouWant,NumberOfBytesToCopy,StartPosition If someone doesn't catch it yet, the DMA allows you to load data into the VRAM at a higher speed than normal, since it's the VDP who process the data, and not the M68K, freeing it for doing whatever else(Tiido has done some wonderful demos using this technique).
|
|
|
Post by Mairtrus on May 31, 2011 15:53:05 GMT -5
asm ;move.w #$8174, ($C00004) move.w #$8134, 4(a4) end asm My bad. It's $54, not $34.
|
|
|
Post by Mairtrus on May 31, 2011 8:41:37 GMT -5
That's because you are setting the Vertical Interrupt, but you haven't defined a section for it. Simply add a "On VBlank GoSub..." or just clear the bit 5 (it becomes $34).
|
|
|
Post by Mairtrus on Mar 11, 2011 15:52:35 GMT -5
Why not to use a FT245BL (despite the FT245BQ seems easier to solder)? It's cheap, small and seems easy to integrate with the LAKABAJO (with a new uploader, of course)...
|
|
|
Post by Mairtrus on Mar 4, 2011 16:57:02 GMT -5
Like one month ago, I was bored of test small useless code in my Genny with the LAKABAJO, so I remembered when some guy in the forums (like 1-2 years ago) asked if is possible to use a PS/2 keyboard in the real hardware... In the SpritesMind forums, some guys did it like 3-4 years ago, but no code was ever released, so I put my hands on it... and I got it!!
First, you will need a PS/2->DB-9 cable, which isn't too hard to make (if I could, anyone can) where the pins asignement is the next: Data->Pin 1 Clock->Pin 2 Vcc->Pin 5 Gnd->Pin 8
This is the code for getting a message (scancode of pressed/unpressed keys, errors, etc):
GetPS2Msg: move.l #$A10003,a0 move.b #0,6(a0) bsr.w HighLow ; Wait for bit 0 moveq #7,d7 moveq #0,d1 moveq #0,d2 @1: bsr.w HighLow move.b (a0),d0 andi.b #1,d0 or.b d0,d1 ror.b #1,d1 add.b d0,d2 dbra d7,@1 bsr.w HighLow ; Wait for parity move.b (a0),d3 andi.w #1,d3 bsr.w HighLow ; Wait for bit 1 not.b d2 andi.b #1,d2 move.b #2,6(a0) rts
HighLow: move.w #800,d4 @1: move.b (a0),d0 andi.b #2,d0 beq.s @2 subq.w #1,d4 beq.s @3 bra.s @1 @2: move.b (a0),d0 andi.b #2,d0 beq.s @2 rts @3: addq.l #4,a7 move.b #2,6(a0) rts I made it in asm only because the BEX code has no enough speed to get data when the clock reachs the falling edge. Also, I used the first joypad port only because I have the LAKABAJO cable plugged on the second joypad port, but if you want to use another port, change A10003(first joypad port) for A10005(second joypad port) or A10007 (exp port) However, that code doesn't gives you the ASCII code of the current pressed key, just it's scancode. Next, there is a complete BEX template which shows how to create a writing routine:
option TEXTSTART,1,2
Dim Key as Integer, Parity as Integer, KbParity as Integer, KbMsg as Integer
Init: ' KbMsg=&hEE ' gosub SendPS2Msg ' gosub GetPS2Msg ' print right$(hex$(Key),2) ' asm ' jsr joypad_checkreset ' end asm ' goto Init locate 0,0 Cursor=addsprite(1,1) propsprite Cursor,&hDB,0 MainLoop: Key=0 gosub GetPS2Msg if Key<&hF0 then if Key<&hE0 then if Key=&h5A then print "" elseif Key=&h12 then ShiftMode=1 elseif Key=&h14 then CtrlMode=1 elseif Key=&h11 then AltMode=1 elseif Key=&h76 then cls locate 0,0 elseif Key=&h66 then if PosX()>0 then Locate ,PosX()-1 else if PosY()>0 then Locate PosY()-1,37 end if end if Cx=PosX() Cy=PosY() print " "; Locate Cy,Cx elseif Key=&h05 then ink 0 elseif Key=&h06 then ink 1 elseif Key=&h04 then ink 2 elseif Key=&h0C then ink 3 else asm move.l #ScanCodes1,a0 tst.w (__INTEGER_ShiftMode) bne.s @1 move.l #ScanCodes2,a0 @1: move.w (__INTEGER_CtrlMode),d0 and.w (__INTEGER_AltMode),d0 beq.s @2 move.l #ScanCodes3,a0 @2: moveq #0,d0 move.w (__INTEGER_Key),d0 lsl.w #1,d0 move.w (a0,d0.w),d1 move.w d1,(__INTEGER_Key) end asm print chr$(Key); end if else gosub GetPS2Msg if Key>=&h6B then Select Case Key-&h6B Case 0: if PosX()>0 then Locate ,PosX()-1 else if PosY()>0 then Locate PosY()-1,37 end if end if Exit Select Case 7: if PosY()<25 then Locate PosY()+1, end if Exit Select Case 9: if PosX()<37 then Locate ,PosX()+1 else if PosY()<25 then Locate PosY()+1,0 end if end if Exit Select Case 10: if PosY()>0 then Locate PosY()-1, end if Case Else: Exit Select End Select else if Key=&h4A then print "/"; end if end if end if else gosub GetPS2Msg if Key>=&hE0 then gosub GetPS2Msg else if Key=&h12 then ShiftMode=0 elseif Key=&h14 then CtrlMode=0 elseif Key=&h11 then AltMode=0 end if end if end if movesprite Cursor,144+(PosX()<<3),136+(PosY()<<3) asm jsr joypad_checkreset end asm goto MainLoop
GetPS2Msg: asm move.l #$A10003,a0 move.b #0,6(a0) bsr.w HighLow ; Wait for bit 0 moveq #7,d7 moveq #0,d1 moveq #0,d2 @1: bsr.w HighLow move.b (a0),d0 andi.b #1,d0 or.b d0,d1 ror.b #1,d1 add.b d0,d2 dbra d7,@1 bsr.w HighLow ; Wait for parity move.b (a0),d3 andi.w #1,d3 bsr.w HighLow ; Wait for bit 1 move.w d1,(__INTEGER_Key) not.b d2 andi.b #1,d2 move.w d2,(__INTEGER_Parity) move.w d3,(__INTEGER_KBParity) move.b #2,6(a0) rts
HighLow: move.w #800,d4 @1: move.b (a0),d0 andi.b #2,d0 beq.s @2 subq.w #1,d4 beq.s @3 bra.s @1 @2: move.b (a0),d0 andi.b #2,d0 beq.s @2 rts @3: addq.l #4,a7 move.b #2,6(a0) rts end asm SendPS2Msg: asm move.l #$A10003,a0 move.b #2,6(a0) move.l #20,d0 dbra d0,* move.w (__INTEGER_KbMsg),d1 moveq #7,d7 moveq #0,d1 moveq #0,d2 moveq #0,d3 move.b #1,6(a0) move.b #0,(a0) bsr.w HighLow @1: move.b d1,d2 andi.b #1,d2 bsr.w HighLow move.b d2,(a0) ror.b #1,d1 add.b d2,d3 dbra d7,@1 not.b d3 andi.b #1,d3 move.b d3,(a0) bsr.w HighLow move.b #0,6(a0) bsr.w HighLow move.b (a0),d0 andi.b #2,d0 move.b #2,6(a0) rts end asm
asm ScanCodes1: dc.w 0 ; 00 dc.w 0 ; +1 dc.w 0 ; +2 dc.w 0 ; +3 dc.w 0 ; +4 dc.w 0 ; +5 dc.w 0 ; +6 dc.w 0 ; +7 dc.w 0 ; +8 dc.w 0 ; +9 dc.w 0 ; +A dc.w 0 ; +B dc.w 0 ; +C dc.w 0 ; +D dc.w $A6 ; +E dc.w 0 ; +F dc.w 0 ; 10 dc.w 0 ; +1 dc.w 0 ; +2 dc.w 0 ; +3 dc.w 0 ; +4 dc.w 'Q' ; +5 dc.w '!' ; +6 dc.w 0 ; +7 dc.w 0 ; +8 dc.w 0 ; +9 dc.w 'Z' ; +A dc.w 'S' ; +B dc.w 'A' ; +C dc.w 'W' ; +D dc.w '"' ; +E dc.w 0 ; +F dc.w 0 ; 20 dc.w 'C' ; +1 dc.w 'X' ; +2 dc.w 'D' ; +3 dc.w 'E' ; +4 dc.w '$' ; +5 dc.w '#' ; +6 dc.w 0 ; +7 dc.w 0 ; +8 dc.w ' ' ; +9 dc.w 'V' ; +A dc.w 'F' ; +B dc.w 'T' ; +C dc.w 'R' ; +D dc.w '%' ; +E dc.w 0 ; +F dc.w 0 ; 30 dc.w 'N' ; +1 dc.w 'B' ; +2 dc.w 'H' ; +3 dc.w 'G' ; +4 dc.w 'Y' ; +5 dc.w '&' ; +6 dc.w 0 ; +7 dc.w 0 ; +8 dc.w 0 ; +9 dc.w 'M' ; +A dc.w 'J' ; +B dc.w 'U' ; +C dc.w '/' ; +D dc.w '(' ; +E dc.w 0 ; +F dc.w 0 ; 40 dc.w ';' ; +1 dc.w 'K' ; +2 dc.w 'I' ; +3 dc.w 'O' ; +4 dc.w '=' ; +5 dc.w ')' ; +6 dc.w 0 ; +7 dc.w 0 ; +8 dc.w ':' ; +9 dc.w '_' ; +A dc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dc.w 'p' ; +D dc.w $27 ; +E dc.w 0 ; +F dc.w 0 ; 50 dc.w 0 ; +1 dc.w 0 ; +2 dc.w 0 ; +3 dc.w 0 ; +4 dc.w '¡' ; +5 dc.w 0 ; +6 dc.w 0 ; +7 dc.w 0 ; +8 dc.w 0 ; +9 dc.w 0 ; +A dc.w 0 ; +B dc.w 0 ; +C dc.w 'ç' ; +D dc.w 0 ; +E dc.w 0 ; +F dc.w 0 ; 60 dc.w '<' ; +1 dc.w 0 ; +2 dc.w 0 ; +3 dc.w 0 ; +4 dc.w 0 ; +5 dc.w 0 ; +6 dc.w 0 ; +7 dc.w 0 ; +8 dc.w '1' ; +9 dc.w 0 ; +A dc.w '4' ; +B dc.w '7' ; +C dc.w 0 ; +D dc.w 0 ; +E dc.w 0 ; +F dc.w '0' ; 70 dc.w '.' ; +1 dc.w '2' ; +2 dc.w '5' ; +3 dc.w '6' ; +4 dc.w '8' ; +5 dc.w 0 ; +6 dc.w 0 ; +7 dc.w 0 ; +8 dc.w '+' ; +9 dc.w '3' ; +A dc.w '-' ; +B dc.w '*' ; +C dc.w '9' ; +D dc.w 0 ; +E dc.w 0 ; +F end asm As you can see, those scancode are for a Spanish Keyboard (the ones who have the Ñ and Ç letters), so for whatever other keyboard configuration, you will need to complete it whit your own configuration (mostly simbols and shit like that, since the uppercase and lowercase letters seems to have always the scancodes in all the keyboards)... I added the extra functionality to the F1...4 functions to change the color of the text (command INK), and the arrows can be used for move around the text, but works weird for some reasons... If you follow the code, you will see that there is a function to send commands to keyboard, however it doesn't work correctly for some reason (keyboard always responds whit "RESEND"). I hope somebody can be able to fix it.
Well, I think that's all, enjoy...
|
|
|
Post by Mairtrus on Mar 2, 2011 17:33:13 GMT -5
You are using it as a User Defined subroutine? Because remember that BEX doesn't pass an offset as a parameter, unless you use VarPtr&, LblPtr&, etc... I don't remember right, but I think I too had problems trying to pass an offset directly to a An register (I had to move it to a Dn register, the to an An register) Aditionally, are you using the RAM viewer to check the status of the decompressed data? Because maybe this is what is confusing you: sometimes, when accesing a large amount of contiguous bytes, seems that KMod swap the odd and even bytes in a same word, but only in the RAM viewer, not in the real RAM (you can check this with a peek+print loop).
|
|
|
Post by Mairtrus on Feb 26, 2011 9:42:54 GMT -5
If you just need to move the car around the screen, you'll only need the ShiftSprite or MoveSprite commands. Just check the Up/Down button and add a certain value according to the angle of the car. Else, if you want to move the whole screen around the car (like Micromachines does 90% of the time), then you will also need the Scroll or Scroll2 commands, since you will need to move the background too...
For the second case, I modified a bit your code to make it able to scroll infinitely around the map:
Dim VAdder as Integer at AddVertical Dim HAdder as Integer at AddHorizontal ' 503 setgfxplane scroll_b setscrollplane scroll_b palettes stage_palette,0,0,2 ' Load stage palette loadtiles stage_tiles,1,1 ' Load stage tiles palettes car_palette,1,0,4 ' Load car palette loadtiles car_tiles,80,256 ' Load car tiles ' Main for x = 0 to 7 for y = 0 to 7 drawtiles stage_map,0,x<<3,y<<3,8,8 ' Draw ( very simple ) stage map next next car = addsprite(4,4) ' Create car sprite movesprite car,272,224 ' Move car to screen center do j = joypad(0) ' Get joypad input angle+= j.3-j.2 ' Increment car angle with horizontal d-pad input if angle = 64 then ' Wrap angle when passing maximum angle = 0 elseif angle = -1 then ' Wrap angle when passing minimum angle = 63 endif sprite = angle>>2 ' Shift bits ( reduce range from 64 to 16 ) select case sprite ' Select sprite address depending on angle case 0: index = sprite<<4 ' Normal sprite exit case case 5: index = (8-sprite)<<4+4096 ' Vertically flipped sprite exit case case 9: index = (sprite-8)<<4+6144 ' Vertically & horizontally flipped sprite exit case case 13: index = (16-sprite)<<4+2048 ' Horizontally flipped sprite exit case case 16: end select propsprite car,index+256,1 ' Set sprite address
if j.0 then scroll down,VAdder(sprite) scroll left,HAdder(sprite) end if
sleep 1 loop ' Data AddVertical: dataint 4,3,2,1,0,-1,-2,-3,-4,-3,-2,-1,0,1,2,3 AddHorizontal: dataint 0,1,2,3,4,3,2,1,0,-1,-2,-3,-4,-3,-2,-1
|
|
|
Post by Mairtrus on Feb 8, 2011 9:27:55 GMT -5
The problem is in your scrolling subs. When called, they substract the upper line to be scrolled to the maximun number of horizontal lines, right? Well, the maximun number of lines is 224, not 320. That causes that BEX is trying to scroll MORE than 224 lines, and since the Sprites info is stored inmediatly after the HScroll info (in VRAM), that is what is messing the sprites.
|
|
|
Post by Mairtrus on Feb 7, 2011 16:40:39 GMT -5
It's strange, but I have always the same problem when I plug for first time the cable (I unplug it from both PC and console if I will not use it for a long time), and after running the test mode, both good syncs and bad syncs increases really fast (the bad syncs like 10 times faster than the good syncs), and it says that the console is running at 452 fps, or like. But after unplug and plug it again (only from console, and without turning it off), it starts to works perfectly.
|
|
|
Post by Mairtrus on Feb 7, 2011 16:29:00 GMT -5
In fact, you are misunderstanding the value being loaded: $34 is 00110100 (since a byte is composed of 8 bits; always remember to fill with zeroes the left side of the number). Since only bits 7-2 are used, the 2 lower bits are always zeroes (can actually be anything).
|
|
|
Post by Mairtrus on Jan 22, 2011 11:38:36 GMT -5
I know it's a bit late now, but here is the proofs that the hot-swapping is possible(I delayed a lot because the Vcc cable is cut constantly and I have to resolder it again...) The program running is my buggybuggybuggy cart dumper, but is still usefull for check the cart's header(click in the images for enlarge): The Sonic 2's header is here, but then, power off the GG, unplug the cart WITHOUT the GG, insert the new cart, and voilà Powering off the GG is really important, since (when powered) the GG seems to check when a new cartridge is inserted, and resets the console. Anyway, you need to insert the cartridge at the first attempt, or else... (I ignore why this happens) @devster: Is possible to make the uploader be a bit more flexible with the timing errors? Because, like 2/5 of the times, it crashes inmediatly after the SEGA screen starts. Or is because I'm using Sonic 2?
|
|
|
Post by Mairtrus on Jan 20, 2011 16:58:58 GMT -5
mine is an HD74LS74A, if anyone cares I'm 99% sure that there's your problem. I had similar troubles when I used that flip-flop(HD74LS74AP, seems to be the same one), since the signals Clear and Preset are not inverted. Just bend (or cut) the pins 1,4,10 & 13.
|
|
|
Post by Mairtrus on Jan 16, 2011 16:48:21 GMT -5
Check this code. It's basically the method I use for access to SRAM. It's simple, fast, and more importar, works...
option EXTERNALSRAM, &h200000, 8192, EVEN Dim SRAM() as Integer at &h200000 print "Currently, the value ";SRAM(0);" is stored in the SRAM" randomize SRAM(0)+1 print "Hit (A) for change it" while 1 j=joypad() if j.6 then a=rnd(65535) print "The value now changes to ";a SRAM(0)=a end end if wend You will only be available to write 16 bit-data, and I'm not sure if it will works in real hardware, but in Kega works. If you are not using the interrupts, there is no need to disable them (DISABLE InterruptVBlank/InterruptHBlank).
|
|
|
Post by Mairtrus on Jan 14, 2011 8:50:17 GMT -5
Have you tried to upload something yet? Because, in the test utility, the buttons seems to work whenever they want, i.e: Run Sonic 2/3 (without the GG), with the cable in the first controller port, and try to spindash(the DOWN button is released after a two or three taps), or walk along the screen at constant speed (same behavior with RIGHT/LEFT buttons).
|
|