Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MGOS

Pages: 1 ... 4 5 [6] 7 8 ... 23
76
Axe / Re: What I've done?! O.o
« on: February 11, 2013, 08:20:06 am »
Some time ago, I made my own raycaster, however I halted the project... :/ I need to finish it some day

Yours looks awesome so far :)
Looking at your code, I realized that it is quite slow. You only draw 1/4 segments of the screen, and it is running at 15 Mhz. I'm not an expert at raycasting, but I think you need to restructure parts of the code to really optimize it. Still, here are some minor optimization tricks you could use (but I don't think they really matter that much):

Code: [Select]
Pt-Off(0,,Pic0,L3)
If pxl-Test(V/8,W/8,L3)
Using a sprite is a cool idea to store the map, but the pixel-test function is incredible slow (and you're doing that a lot each frame!). Try directly accessing the data, e.g. in an 2d array/matrix etc.



The next optimization helps almost everywhere:
If size doesn't matter, use a bunch of /2 instead of dividing by a power of 2. For example:
A/2/2/2 is faster than /8
This trick works due to the fact that /2 is replaced by a shift operation, whereas every other division calls a routine to divide (which is kinda slow)

Code: [Select]
√(((abs(X-V)²)+(abs(Y-W)²)))→GHere you can leave out the abs(), because squaring gets rid of the sign. You don't even need the first parenthesis. So:
Code: [Select]
√(X-V²+(Y-W)²)→G


Code: [Select]
If r1<64 or (r1>192)Almost in every case you can substitute a logic "or" by an addition.
Code: [Select]
If r1<64 + (r1>192)


I think the slowest part of your code is this, I don't know how to optimize this though, because I don't understand what you want to do with that.
Code: [Select]
Lbl TH
abs(Y-W)*128//sin(r1-r2)*cos(r1-r2)//128→U
r1<128?U+X→V,X-U→V
Return

Lbl TV
abs(V-X)*128//cos(r1)*sin(r1)//128→U
Return
This code looks slow because of signed division and trigonometry. These functions are also called a lot each frame!



Also, if you need a function only once in the code, you can type it inline where you need it to save some bytes and cycles without the call.
If you want to keep readability, you can include them in another program.
Also, what helps reading the code is the C++ style function calling syntax:
Function(arguments) instead of sub(Function,arguments)
For example:
Code: [Select]
sub(TH,r1,128) becomes TH(r1,128)


I guess that's my part for now, maybe I take a closer look on it later. I hope it helps you a bit and good luck with your project.


77
TI Z80 / Re: zStart - an app that runs on ram clears
« on: January 24, 2013, 10:01:54 am »
I came across this "bug" multiple times now:
When you turn off the calculator while you're editing an archived program (the copy of one), and zStart wants to store the edited version and GarbageCollect appears, the LCD turns off and and it doesn't react on any key presses (calc behaves like turned off, but it isn't) before you can do a GarbageCollect. You need to remove the batteries and lose the current progress which is kinda annoying :/
Is there someway you can prevent the calc (or its peripherals) from turning off when the program isn't saved yet?

78
Other / Re: TI84+ soundchip - arduino SID emulator
« on: January 20, 2013, 09:52:20 am »
That's my piano roll music editor and player I made a while ago. It uses the Freq() function of axe, so the quality is pretty bad but it works quite well though.

http://ourl.ca/14703

79
Other / Re: Hooking up PIC µCs with accelerometer to TI-83+
« on: January 20, 2013, 08:43:28 am »
Yeah, I actually thought of making a racing game like Megacar (in case you remember that :) )

80
Other / Re: Hooking up PIC µCs with accelerometer to TI-83+
« on: January 20, 2013, 07:46:41 am »
The all examples with the accelerometer use the same program on the PIC, the programs on the calc are independent and made in axe. The Pic pretty much listens for a request by the TI (when data pin is set to HIGH) and makes a analog to digital conversion of the analog X and the Y values of the ADXL. Those raw values are sent as two bytes to the calc. The calculator subtracts a calibration value (stored at program start) off those bytes, so you get 0 when the board is hold horizontally. The new values function as the speed of the cursor.
But it is indeed a nice idea to write a hook and control the OS with the board.


And no, my last name isn't Gaye :P

81
Other / Hooking up PIC µCs with accelerometer to TI-83+
« on: January 20, 2013, 07:12:52 am »
Hey guys

You didn’t hear much from me for a while now, but don’t worry, I’m not gone. I just hadn’t a lot of time because of school. But that doesn’t mean I have nothing for you to show - especially for my b100000000th post :)

About half a year ago I came across the PIC microcontrollers by Microchip and since I was making a bunch of asm routines at that time, I decided to give them a try. I hooked up the PICkit3 demo board to my 83+ and programmed some routines for serial communication. With the accelerometer ADXL-335z at the AD inputs of the PIC it is even possible to control programs by moving the breadboard around. As power supply I’m using a Nokia BL-5C battery which lasts quite long (1020 mAh) and is relatively light in weight.



Code:

Spoiler For sender code (PIC asm):
Code: [Select]
; Byte to send in register “SerialData“

SerialBegin:
  MOVLF     0x8,Count
Serialout:
  BTFSC     SerialData,0    
  BSF       SDATA    
  BTFSS     SerialData,0
  BCF       SDATA
  BCF       CLOCK
  SDelay    0x12        ; delays have to be adjusted depending on clock speed; in that case: 18*3+6=60 cycles @ 1 MHZ -> 60µs
  BSF       CLOCK
  SDelay    0x12
  RRF       SerialData
  DECFSZ    Count,1
  GOTO      Serialout
  Return

Spoiler For receiver code(z80 asm):
Code: [Select]
; GET()
; gets a byte from the port as a sequence of 0s and 1s on the ring
; (bit 1 of port 00h) on falling edge of the tip (bit 0 of port 00h)
; the sequence begins with least significant bit.

; (1) Read tip
; (2) Repeat (1) until tip low
; (3) Read ring
; (4) Put that at bit 0 of result
; (5) Rotate result right
; (6) Wait until tip back high
; (7) Repeat from (1) total 8 times

    ld bc,$0803
    ld hl,$0000
loop:
    in a,(00h)
    bit 0,a
    jr nz,loop
    and c
    sra a
    add a,l
    rrca
    ld l,a
wait:
    in a,(00h)
    bit 0,a
    jr z,wait
    djnz loop
 
Interrupts have to be disabled.

In later versions I used polling to keep sender and receiver in sync, but the delays between the bytes are fixed. Thus, there mustn't be too much code between each GET(). It works quite well for now, but the program might get stuck in more complicated applications. To prevent that, I'm planning to make a closed function for the whole communication process.

This project isn't finished, I showing just early prototypes.

Planned features:
  • General purpose functions for axe and pic programmers
  • Communication in both ways
  • Arbitrary packet length and check sum
  • Network applications


Let me know what you think :)

82
Axe / Re: Unobtainable Characters with AXE
« on: October 12, 2012, 01:20:48 pm »
Please, Hayleia, you disappointed me. The four bytes are the call of GetCalc :)

Code: [Select]
.AA
[]->GDB1
GetCalc("Str1",226)->A
[BB9ABB9BBB9CBB9DBB9EBB9FBBA0BBA1BBA2BBA3BBA4BBA5BBA6BBA7BBA8BBA9BBABBBACBBADBBAEBBCBBBCC7F8081BBD1BBD2BBD3BBD4BBD5BBD6BBD7BBD8BBD9BBDABBDBBBDCBBDDBBDEBBDFBBE0BBE1BBE2BBE3BBE4BBE5BBE6BBE7BBE8BBE9BBEABBEBBBECBBEDBBEEBBEFBBF0BBF1BBF2BBF3BBF4BBF5632B29BBCF83827170101108090607F02BBB71BB73BB74BB75BB6FBB70BB6EBB72BB7ABB7BBB7CBB76BB77BB78BB79BB7DBB81BB84BB85BBCDBB80BB7FBB83BB82BB8ABB8CBB86BB87BB88BB89BB8BBB8DBB91BB93BB95BB8FBB90BB92BB94BB8EBB98BB99BB96BB97]
Copy(GDB1+4,A,226)

Because GBD1 is in the program code, all your commands will be part of the memory. You have to put the []->GBD1 after the GetCalc, otherwise your data starts with "Getcalc" instead of that chunk of Hex!

83
TI Z80 / Re: ORG: online Z80 IDE and assembler
« on: October 06, 2012, 02:38:29 pm »
Oh, I forgot about that, say it was DE instead.

84
TI Z80 / Re: ORG: online Z80 IDE and assembler
« on: October 06, 2012, 02:17:27 pm »
Yeah, for example is
Code: [Select]
ld ixh,d
ld ixl,e
6 cycles faster than
Code: [Select]
push de
pop ix

Edit: with hl it doesn't work
:)

85
TI Z80 / Re: ORG: online Z80 IDE and assembler
« on: October 06, 2012, 02:09:10 pm »
What about the undocumented instructions?

86
Axe / Re: raycasting texture
« on: October 05, 2012, 11:32:46 am »
Ah, that makes sense now. Have you tested the version with Rect(?

87
Axe / Re: raycasting texture
« on: October 05, 2012, 10:37:47 am »
Drawing the text on the right side every frame is very slow. You should draw it once before the game and then only clear the 64x64 px area. You could use Copy(, Fill( and/or a for( loop to achieve that.

88
TI Z80 / Re: ORG: online Z80 IDE and assembler
« on: October 05, 2012, 10:14:13 am »
it seems like it would be simpler and more intuitive to have the calculations be in the same column as the code is already. the cycle count could just be displayed to the right of the line number and the total calculations over on the right side where all the rest of the system messages are.

Yeah, also great idea.

89
TI Z80 / Re: ORG: online Z80 IDE and assembler
« on: October 05, 2012, 08:22:30 am »
Maybe. I would have to change how the programs are parsed in order for that to work dynamically. I have all the data for size and cycles, though.

It doesn't need to be dynamically. Maybe just a button to show/refresh the cycle calculator and one to hide it. When you click the show button, another column will appear next to the text field for the code (parallel scrolling) and you can select the loops to multiply. At the bottom the total sum is displayed.

EDIT something like this:

I used the average number of cycles.

90
Axe / Re: raycasting texture
« on: October 04, 2012, 05:28:36 pm »
To test if whether a pixel is set you could make a simple routine that shifts the byte right by one and checks for carry.

Pages: 1 ... 4 5 [6] 7 8 ... 23