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 - z80man
Pages: 1 ... 27 28 [29] 30 31 ... 62
421
« on: March 25, 2011, 11:21:35 pm »
Here was what I was thinking about the mnemonics. Because identifying the keys as 0020 and 0101 is the fastest way to work with the keys, internally that will stay the same. The keys though will be identified using numbers in which we have several options: Axe keys (Keep the key codes as close as possible to the original Axe ones), Casio BASIC keys (Use the exact same keys as Casio BASIC), TI BASIC keys(TI BASIC layout format, my personal favorite), or just a numerical index (1,2,3,...). There are no technical benefits to anyone because the translation will be done at compile time. It is just whichever layout the community would prefer. We can make a poll for this sometime.
Now to use mnemonics in your code. Yo won't be able to just refer to the keys as 45 or 12, but instead as k(45) or k(12). That way the compiler knows to translate the values. The k() part could really be anything, it will probably be replaced with an unused token. Now if you want to have multiple key presses you would say k(45+12). When saying this the compiler will not just add 45 and 12, but add their translated values instead. Also the k() translation would be smart enough to evaluate 0220 + 0210 as 0230 while 0520 + 0220 as 0740.
422
« on: March 25, 2011, 02:50:05 am »
Many of us out here are Axe programmers. Many of us also don't want to code in SH3 asm (not me of course, SH3 asm is the best ). Many of us do not want to go through all of the difficult steps to set up a C compiler. So there is a solution for this. Make Axe for the Prizm. Now this project hasn't even been started yet. I'm not even the one in charge of the language. But what I have here is an early development of the Getkey routine. So when the Axe port does come around someday, you will be able to interface with the keyboard. How this instruction works is that it returns the word length code through the stack. What is great about this routine is that the codes are easy to remember, it is extremely fast, and it supports multiple key presses. So how to use it? Well the answer is you can't right now. unless of course you integrate it with a program you wrote in C or asm. but anyways it will function just like your standard BASIC or AXE getkey routine where you can say GetKey ->A. Before I can teach you how to use multiple key presses, I have to teach you how the instruction works internally. what is great about the SH3 is that the keyboard is memory mapped. How that works is that there are 10 bytes representing the state of the keyboard starting at 0xA44B0000. Basically each row of keys has its own byte and each key has its own bit within that byte. (On key has its own byte; 0101) So for a single key press, the routine returns the byte index of the key pressed in the MSB and the value of that byte in the LSB. An example the EXE key. Because exe it located in the first byte 00xx is the first part evaluated then because pressing the the exe key toggles bit 2 in relative address 00, 4 is loaded into the lower byte. That then yields a result of 0004. So for multiple key presses everything works just about the same way. for this example say you are pushing the shift key 0940 and the up arrow 0902. Normally you would add the 2 MSB's together, but not when they are the same. So in this case they are both 9 so do not add them. But you always add the LSB's of all the keys being pushed. So 02 + 40 = 42. Then your result would be 0942. Sorry that this might be a bit vague. If you have a question on either the source or the routine usage, please ask. Getkey: MOVA @($07,PC),R0 ;$A44B0000 MOV $0A,R1 Loop: DT R1 BT/S $08 ;Exit MOV.B @(R0,R1),R2 CMP/PL R2 BF/S $FA ;Loop MOV R1,R4 SHLL8 R4 ADD R2,R3 BRA $F6 ;Loop ADD R4,R3 Exit: RTS MOV.L R3,@-R15 data.l $A44B0000
423
« on: March 24, 2011, 10:44:15 pm »
In an asm program the OS is only present when you run a bcall or an interrupt is toggled. When you try to execute code from a bad page, a hardware exception is enabled that resets the cpu. I believe there is a pin on the z80 that triggers a reset when it is set by an external device.
424
« on: March 24, 2011, 03:22:04 pm »
What I still want to do is treat libraries as separate files from the shell. That way an older shell can upload the libraries from a newer shell and use that to run newer programs. Think of it like MirageOS uploading the DoorsCS7 libraries that way it can run programs that make use of those libraries.
425
« on: March 24, 2011, 04:25:34 am »
Yes the only way to get machine code to run is to use the g3a format. That is what the shell itself is going to be formatted in. Then when you select a program to run from the menu, that program is loaded into ram and the execution jumps to the start of the prog. The reason for the shell is kind of like for the 83+ where you don't want to make all your programs in app format/8xk. The shell will be an app just like MirageOS or DoorsCS7 and will function in almost the exact same way. What we are still working on is how should we design the header for the shell. Because once we release the format you can't make major changes to it or else it will break compatibility with older programs. So basically we have to get it perfect the first time because there is no going back. Thats also why in my format I included expansion space where new features could be added later.
426
« on: March 24, 2011, 04:15:17 am »
I decided to make a timeline on how progress for the emulator will go. 1. incorporate about 20 instructions along with a memory model. include a simple debugging interface (testing phase) 2. incorporate somewhere between 50-80 instructions with an advanced debugging interface. include a simple screen mapped to the vram. include multi threading 3. incorporate all of the SH3 instructions. begin attaching important peripherals such as MMU, FRQCR, and ports. add support for rom memory 4. attach all standard peripherals used by the Prizm. Begin support for Prizm unique peripherals ie LCD driver, add support for the Prizm specific opcodes, incorporate full keyboard emulation 5. Include all peripherals used by the Prizm, begin support for serial port (including sound), usb port. Allow FAT32 communication between the emulator and the host computer. Advanced gui support now incorporated with a full suite of advanced debugging tools. Include real time disassembler and hex editor. First version of plug in scripting language to allow users to create and distribute their own apps that make use of the emulators resources to allow extended functionalities. 6. First stable release
And of course each release number includes sub-releases that patch bugs, add minor updates, and include optimizations. The next scheduled release is for this weekend and will include a new test program that uses all of the available instructions, linux executable, major optimizations, and documentation on how to create your own programs. Currently on the version that I'm using (not the release a few posts up) I'm getting speeds of twice the current release.
427
« on: March 24, 2011, 03:52:01 am »
With the whole talk of the asm shell for the Prizm going around recently, I had an idea to incorporate multiple run time libraries at a time. In the header a program would define which libraries it wanted to use and those would be loaded into memory before execution began. Perhaps some of the libraries would be attached to the shell itself, but I also liked the feature of allowing users to create their own run time libraries too. Now you can accomplish this without setting suggested standards, but this can give more difficulty for the coder if the libraries go around using random registers in various uses. On most other asm languages there are usually some guidelines that are recommended to be followed, but they still allow flexibility.
Just as an example say there are two different math libraries you are using for floats and the purpose of the program is to find the area of a circle. The first function takes R4 (radius) as an argument and squares it. The next function takes R1 as an argument and multiplies it by pi. The issue here is that not only are your registers becoming unorganized, but you also have to use precious clock cycles transferring data from R4 to R1. But if both routines took R1 as arguments then your code would be faster.
428
« on: March 24, 2011, 02:56:47 am »
Well... it's Texas Instruments we're talking about here, after all.
(Although if Casio tried to lock down the Prizm, then they failed even harder, since it got cracked a few weeks after its release)
A couple of weeks, I'm pretty sure we got our own apps on in under a week. In fact we were running apps before the announced release of the Prizm on January 15th. I never knew that Axe apps were deleted after 16 runs Probably because I've never ran one of my Axe apps more than 16 times before recompiling. but still it just sounds strange to see apps get deleted like that.
429
« on: March 24, 2011, 02:49:59 am »
What do you mean exactly by the FABS uses register Rn. According to the documentation it uses FRn. Now because no FRn exists I substituted that with a memory location when it was necessary to emulate the actual SH3E instruction. Otherwise I would just use a general purpose register. What I was wondering with the fpu interpreter idea you had a few days ago is if you intended to have an SH3E or SH4 emulator run on the calc or to just add floating point libraries. Because what I found to be the most effective was to use the fast routines in an interrupt state because it has little damage on the registers and is easy to use due to the RTE instruction and the second register bank. One thing I do want to optimize is determining which register is to be operated upon. So far my best choice has been to just use the stack, but I'm trying to find something faster for when the code is not inline.
Also I don't know if this already exists, but it might be a good idea to establish some "good programming suggestions" for coding on the SH3 or Prizm. Such as making all code location independent, R15 as stack pointer, R0 as an offset, maybe R7 bank 1 as an exception stack pointer, certain registers to be used in for loops, ones to be heavily worked upon by arithmetic instructions, ones to be pointers, ones to hold data, and so on.
Lastly I was just working on this routine to load the PC into R0. Can you tell me if it works. Seems important for location independent code.
Start: BSR PCtoR0 NOP blah...
PCtoR0: RTS STS PR,R0
430
« on: March 24, 2011, 01:39:34 am »
But if you used your own link protocol, could you send an app to another calculator without having to sign it correctly.
432
« on: March 24, 2011, 12:10:49 am »
I've now started work on creating an SH3E library for the the SH3. In case you don't know the SH3E is a version of the SH3 that incorporates an fpu. Later on I'll create libraries for the SH4 which incorporates double length double length data along with video acceleration hardware (except when emulated it will be more like video deceleration ). For the libraries I'm making three versions of each function. In each version there are three different sub-sets for a inline function, callable function, and an interrupt triggered function. On the inline version, the register numbers are labeled Ra, Rb, Rc and so on. When used in code the programmer should define these registers as they see fit. FR0-FR15 are memory locations along with the FPSCR and the FPUL. Fast version: The fastest possible version of each instruction. May destroy some registers during execution so care must be taken when using them. Is more of a floating point library than an fpu emulator as it ignores the system and control registers found in the emulated hardware. Safe version: Protects registers from being corrupted, and is only a little bit slower than the fast routines. Closely emulates the actual hardware, but still doesn't incorporate the fpu system and control registers. True version: Is an exact copy of the emulated hardware instruction. May be slow in some routines due to the system and control registers that must be managed. Also ensures that none of the general purpose registers are corrupted. FABS FRnFloating point absolute value of FRn;FABS FRn
;******************************* ;inline ;Ra is the register to be processed ;destroyed registers ;Ra, T bit
ROTR Ra ;shifts Ra 1 bit right. LSB is placed into the T bit ROTCL Ra ;shifts Ra 1 bit left. T bit placed into the LSB of Ra
;*******************************
;callable function ;@(R15) is the data to be processed ;data returned to @(R15) ;registers destroyed ;R1 and T bit
MOV.L @R15,R1 ;pops single argument off the stack. only one argument so no point in decrementing R15 ROTR R1 ;shifts R1 1 bit right. LSB is placed into the T bit ROTCL R1 ;shifts R1 1 bit left. T bit placed into the LSB of R1 RTS ;return to code. Delayed branch MOV.L R1,@R15 ;pushes single argument back on
;*******************************
;interrupt ;jumped to from the interrupt handler ;@(R15) is the data to be processed ;registers destroyed ;R1 (bank 1)
MOV.L @R15,R1 ;pops single argument off the stack. only one argument so no point in decrementing R15 ROTR R1 ;shifts R1 1 bit right. LSB is placed into the T bit ROTCL R1 ;shifts R1 1 bit left. T bit placed into the LSB of R1 RTE ;SSR/SPC -> SR/PC. returns to code. Delayed branch MOV.L R1,@R15 ;pushes single argument back on the stack
;FABS FRn
;******************************* ;inline ;Ra is the register to be processed ;cannot use R1 as Ra ;destroyed registers ;Ra
MOV.L R1,@-R15 ;pushes R1 onto the stack MOVT R1 ;moves the T bit into R1 MOV.L R1,@-R15 ;moves R1 onto the stack ROTR Ra ;shifts Ra 1 bit right. LSB is placed into the T bit ROTCL Ra ;shifts Ra 1 bit left. T bit placed into the LSB of Ra MOV.L @R15+,R1 ;pops R1 off the stack. T bit MOV.L R2,@-R15 ;pushes R2 onto the stack MOV $00,R2 ;moves 0 into R2 CMP/HI R1,R2 ;if the T bit was 1 then the T bit equals 1. Sounds retarded I know :P MOV.L @R15+,R2 ;pops R2 MOV.L @R15+,R1 ;pops R1
;***************************** ;callable ;NOT FINISHED
;***************************** ;interrupt ;jumped to from the interrupt handler ;@(R15+8) is the FR to be processed ;registers destroyed ;FRn
MOV.L R1,@R15+ ;pushes R1 onto the stack MOV.L R2,@R15+ ;pushes R2 onto the stack MOV.L @R15,R2 ;pops FR address off the stack. No decrement MOV.L @R2,R1 ;places contents of @R2 into R1 ROTR R1 ;shifts R1 1 bit right. LSB is placed into the T bit ROTCL R1 ;shifts R1 1 bit left. T bit placed into the LSB of R1 MOV.L R1,@R2 ;places result in FRn MOV.L @R15-,R2 ;pops R2 RTE ;SSR/SPC -> SR/PC. returns to code. Delayed branch MOV.L @R15-,R1 ;pops R1 So this was some of the hardest stack work I've ever done before. And it was only on the simplest of the floating point math operations. In fact I still haven't finished the safe version of the callable function or any of the true functions yet. May God save us all when we start working on the true version of the square root and the division functions. Just as a head up here is the C code for the fpu divide instruction. Now just imagine the SH3 asm version of that while preserving all of the registers. FDIV(float *FRm,*FRn) /* FDIV FRm,FRn */ { clear_cause_VZ(); if((data_type_of(FRm) = = sNaN) | | (data_type_of(FRn) = = sNaN)) invalid(FRn); else if((data_type_of(FRm) = = qNaN) | | (data_type_of(FRn) = = qNaN)) qnan(FRn); else case((data_type_of(FRm) { NORM : case(data_type_of(FRn)) { PINF : NINF : inf(FRn,sign_of(FRm)^sign_of(FRn)); break; default : *FRn =*FRn / *FRm; break; } break; PZERO : NZERO : case(data_type_of(FRn)) { PZERO : NZERO : invalid(FRn); break; PINF : NINF : inf(Fn,Sign_of(FRm)^sign_of(FRn)); break; default : dz(FRn,sign_of(FRm)^sign_of(FRn)); break; } break; PINF : NINF : case(data_type_of(FRn)) { PINF : NINF : invalid(FRn); break; default :zero (FRn,sign_of(FRm)^sign_of(FRn)); break break; } pc += 2; }
433
« on: March 23, 2011, 08:27:03 pm »
That looks really cool how you did an interlaced video format. I wonder if the quality would still be fine if the interlacing was done on every three lines instead of two.
434
« on: March 23, 2011, 02:16:28 pm »
Actually the Prizm does have a very long battery life. I've had my Prizm since Christmas now and I use it for at least one hour everyday. In that time I have not changed the batteries once.
435
« on: March 23, 2011, 04:51:40 am »
I use multi-threading to control the hardware other than the cpu itself. So primary execution is handled by the first thread, hardware and peripherals on the second thread, gui on the third thread, and the plug-in app scripting language on the fourth thread.
Pages: 1 ... 27 28 [29] 30 31 ... 62
|