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 - harold

Pages: 1 ... 10 11 [12] 13 14 ... 16
166
General Calculator Help / Re: TI 84 plus display mirror inverted
« on: October 14, 2012, 08:28:59 am »
Because TI is an idiot and they left the LCD auto-increment mode in the wrong setting?

167
How does it work? Markov chains?

168
Computer Programming / [x86] Hiding the Else in a NOP
« on: August 14, 2012, 01:46:39 pm »
I'm trying to implement 0x8000000000000000 >> nlz(x) well.

What I came up with might be a bit unorthodox:
Code: [Select]
 mov r11d, 1
  bsr rcx, rax
  jz _iszero
  shl r11, cl
  .db 0F, 1F, 80 ; nop [rax+sdword] with the sdword being the next shl
_iszero:
  shl r11, 63  ; 49 D3 E3 3F so 4 bytes
Because BSR is retarded and returns something useless when the argument is zero, I have to handle that case with a branch. But this gets rid of the branch I'd otherwise use to skip the second shl.
An other way to do this is shl-ing by 63 in all cases (or it could be a 64bit mov) and then shr back in the nonzero case. That means xor-ing the result of bsr with 63 though - not a disaster, but more instructions.

Is there any reason not to do it this way? (besides "maintainability", I'm the only person who's ever going to read it anyway and I certainly know what this means)
Any unexpected slowdowns on some micro-architectures? Are trace caches OK with this?
Is the other way I described better?

169
Huge update: tons of instructions added, mostly vector instructions. Also some bugs fixed, where sometimes you could use instructions with mmx operands when the instruction doesn't support that, and sometimes using 16bit operands would actually crash the assembler. 16bit and 8bit stuff still doesn't really work and I probably won't bother too much with it anyway unless someone asks.

170
General Calculator Help / Re: Detailed Modulus Discussion
« on: March 28, 2012, 01:58:00 pm »
Wowow wait. The modulus is not the remainder. It often is, but not when negative numbers are involved. The modulus has the sign of the divisor, the remainder has the sign of the dividend.

171
ASM / Binary Puzzle solving/generating
« on: March 26, 2012, 07:31:26 pm »
Binary puzzles.

I will update this post with the fastest ways to solve, count or generate them, and any sub-problems of those.

Detect duplicate columns (needed at the bottom of the search tree for a brute-force solver)

Jacobly:
Code: [Select]
    ; Returns NZ if there was a match
            ld hl,matrix
            ld d,$08
    outerloop:
            ld bc,$0801
    innerloop:
            rlc (hl)
            sbc a,a
            xor (hl)
            or c
            ld c,a
            inc l
            djnz innerloop
            ld l,matrix&$ff
            inc a
            jr nz,found
            dec d
            jr nz,outerloop
            ret
     
    found:
            ld c,8
            dec d
    foundouterloop:
            ld b,d
    foundinnerloop:
            rlc (hl)
            djnz foundinnerloop
            inc l
            dec c
            jr nz,foundouterloop
            scf
            ret

Detecting more than 4 zero's in a column or more than 4 one's.
(no entry)
I used this pseudocode:
Code: [Select]
int colc = 0x33333333;
int colcn = 0x33333333;

solve:
    int newcolc = colc + unzipToNibbles[row];
    int newcolcn = colcn + unzipToNibbles[row ^0xFF];
    if ((colc | colcn) & 0x88888888)
        more than 4 ones or zeroes
    else
        solve(newcolc, newcolcn)

more tomorrow, I have to go

172
Computer Programming / Re: Teach me how to Java
« on: February 28, 2012, 04:13:30 am »
Most tutorials aren't that good anyway. I recommend reading the language spec. Unlike tutorials it doesn't teach you how to use the language effectively, but also unlike tutorials, it actually teaches you about the entire language, not some small subset of it that a tutorial writer arbitrarily selected for you. After that, you can read any tutorial you like and it won't corrupt your knowledge of Java anymore.

An important point to remember that almost everyone gets wrong due to confusing terminology, is that there is no pass by reference in Java. There is "pass A reference" of course, but that reference is passed by value. It may help to think of references as pointers in that case (which isn't too inaccurate anyway).

173
Computer Projects and Ideas / Re: Rainbow Dash: The Game
« on: February 06, 2012, 07:29:30 pm »
If you ship the two main XNA dlls it'll probably work without having XNA 4 as a prerequisite. Used to work with XNA 1 through 3 anyway, I stopped using it and all of DirectX after that and switched to OpenGL so I'm not sure about 4.
Btw, .NET 4 Full or Client Profile?

174
Miscellaneous / Re: So what did you get for christmas?
« on: December 26, 2011, 11:06:34 am »
Nothing at all.

175
TI-BASIC / Re: 100 TI-BASIC Optimizing Tips
« on: December 14, 2011, 01:08:52 pm »
1. Disp X   to X  (only as the last command in a program, and messes up Ans)
2. seq(2^X,X,1,8 to 2^cumSum(binomcdf(7,0

176
News / Re: Rules and positions update
« on: December 09, 2011, 04:05:36 am »
Ok thanks for clarifying so far, but I still have some questions..
How about linking to a torrent? A site where you can download that torrent? The SHA1 describing the contents of the torrent? A magnet url?
What if the work is copyrighted, but known not to be enforced by the copyright holder?
Does "just google it" constitute "discussing how to pirate software"? What if you use the name of a popular torrent site instead of google?

177
News / Re: Rules and positions update
« on: December 09, 2011, 03:50:50 am »
Not clear enough yet - I assume "illegal content" refers to "content illegal in Canada"?
Probably better to explicitly state that.
But even if that's what it means, I (and I assume many others) have no clue what's illegal in Canada.

- is direct linking to copyrighted material allowed?
- is indirect linking to copyrighted material allowed?
- is describing how to find a specific piece of copyrighted material allowed?
- are movies & music exempt from those rules?
- will there be a black unmarked van parked in my street if I do it anyway?

178
ASM / Re: BIT n,(HL) flags
« on: December 07, 2011, 05:53:48 am »
Thanks, that will help.
I have read that, but there's not that much information about WZ in it.

edit: I found a document that contains some information about WZ, though they call it MEMPTR. It includes CPI/D(R) bahaviour.

Spoiler For Spoiler:
MEMPTR, esoteric register of the ZiLOG Z80 CPU.
by Boo-boo (first and draft English translation by Vladimir Kladov)

  As it is known, after the instruction BIT n,(HL) execution, bits 3 and 5 of the flag register become containing values that is not documented in the official documentation at all. Actually these bits are copied from the bits 11 and 13 of the internal register pair of Z80 CPU, which is used for 16-bit operations, and in most cases to handle addresses. This is usual practice for processors having 8-bits data bus working with 16-bits data.
  It is not known why and how these bits of the internal buffer register are copied to the flags register though. At least Sean Young in the "Undocumented Z80 Documented" refers to that phenomenon (http://www.myquest.nl/z80undocumented/) and a bit more info can be found in the Z80 description of another "nocash" project (http://www.work.de/nocash/zxdocs.htm) where such register pair is called as MEMPTR. Unfortunately until now attemts to crack the algorithm setting the value of the MEMPTR by different processor instructions on base of knowning only two bits of those 16-bits register were not successful.
  But miraculously in result of many experiments (based on the hyposesis that index addressing instructions initialize the MEMPTR always the same way) and also after the deep meditations under the results of these samples we have found that CPI instruction increments the MEMPTR by 1 whereas CPD instruction decrements it. Hence, decrementing the MEMPTR in the loop and monitoring borrow from the high bits having two known bits in the flag register, it is possible to determine unambigously 14 low bits of the MEMPTR and having these in our hands to say for sure on which rule MEMPTR is set after each instruction.
  A list of instructions changing the MEMPTR is follow, together with the formula for new MEMPTR value. Here "rp" means register pair (16 bits register BC, DE, HL or SP - ?), and "INDEX" means register pair IX or IY. Instructions not listed below do not affect MEMPTR as it is found. All the CPU chips tested give the same results except KP1858BM1 and T34BM1 slices noted as "BM1" in the text.
====================================================================================

LD A,(addr)
   MEMPTR = addr + 1

LD (addr),A
   MEMPTR_low = (addr + 1) & #FF,  MEMPTR_hi = A
   Note for *BM1: MEMPTR_low = (addr + 1) & #FF,  MEMPTR_hi = 0

LD A,(rp)  where rp -- BC or DE
   MEMPTR = rp + 1

LD (rp),A  where rp -- BC or DE
   MEMPTR_low = (rp + 1) & #FF,  MEMPTR_hi = A
   Note for *BM1: MEMPTR_low = (rp + 1) & #FF,  MEMPTR_hi = 0

LD (addr), rp
LD rp,(addr)
   MEMPTR = addr + 1

EX (SP),rp
   MEMPTR = rp value after the operation

ADD/ADC/SBC rp1,rp2
   MEMPTR = rp1_before_operation + 1

RLD/RRD
   MEMPTR = HL + 1

JR/DJNZ/RET/RETI/RST (jumping to addr)
   MEMPTR = addr

JP(except JP rp)/CALL addr (even in case of conditional call/jp, independantly on condition satisfied or not)
   MEMPTR = addr

IN A,(port)
   MEMPTR = (A_before_operation << 8) + port + 1

IN A,(C)
   MEMPTR = BC + 1

OUT (port),A
   MEMPTR_low = (port + 1) & #FF,  MEMPTR_hi = A
   Note for *BM1: MEMPTR_low = (port + 1) & #FF,  MEMPTR_hi = 0

OUT (C),A
   MEMPTR = BC + 1

LDIR/LDDR
   when BC == 1: MEMPTR is not changed
   when BC <> 1: MEMPTR = PC + 1, where PC = instruction address

CPI
   MEMPTR = MEMPTR + 1

CPD
   MEMPTR = MEMPTR - 1

CPIR
   when BC=1 or A=(HL): exactly as CPI
   In other cases MEMPTR = PC + 1 on each step, where PC = instruction address.
   Note* since at the last execution BC=1 or A=(HL), resulting MEMPTR = PC + 1 + 1
     (if there were not interrupts during the execution)

CPDR
   when BC=1 or A=(HL): exactly as CPD
   In other cases MEMPTR = PC + 1 on each step, where PC = instruction address.
   Note* since at the last execution BC=1 or A=(HL), resulting MEMPTR = PC + 1 - 1
     (if there were not interrupts during the execution)

INI
   MEMPTR = BC_before_decrementing_B + 1

IND
   MEMPTR = BC_before_decrementing_B - 1

INIR
   exactly as INI on each execution.
   I.e. resulting MEMPTR = ((1 << 8) + C) + 1

INDR
   exactly as IND on each execution.
   I.e. resulting MEMPTR = ((1 << 8) + C) - 1

OUTI
   MEMPTR = BC_after_decrementing_B + 1

OUTD
   MEMPTR = BC_after_decrementing_B - 1

OTIR
   exactly as OUTI on each execution. I.e. resulting MEMPTR = C + 1

OTDR
   exactly as OUTD on each execution. I.e. resulting MEMPTR = C - 1

Any instruction with (INDEX+d):
   MEMPTR = INDEX+d

Interrupt call to addr:
   As usual CALL. I.e. MEMPTR = addr

====================================================================================
  What is the profit of which secret knowledge? First of all, it is possible now to program Z80 emulators supporting _all_ the undocumented pecularities of the CPU. In the second place the fact that on some Z80 clones MEMPTR register behaves a bit another adds a method of model checking. Seems very enough!
(c)2006, zx.pk.ru
Theoretical part: boo_boo, Vladimir Kladov
Testing real Z80 chips: Wlodek, CHRV, icebear, molodcov_alex, goodboy


179
Computer Usage and Setup Help / Re: I lost XP Home Premium
« on: December 04, 2011, 02:29:50 pm »
You'll probably get better results asking Microsoft for a new key. They usually just give you one no questions asked. Be sure to get exactly the right version of key/windows, if they mismatch it won't work.

edit: if that somehow doesn't work, ask a student to get one for free from their university. It might be semi-illegal/gray-area to give such a key to someone else, but nothing serious..

180
ASM / Re: BIT n,(HL) flags
« on: November 28, 2011, 11:42:07 am »
Ok, well I'm interested in the precise behaviour of the z80 that's in the TI 83+ (black). For emulation, so it had better be exactly right, undocumented behaviour and all.
Later I might potentially do the SE/84 versions as well but this one isn't even near usable yet.

Pages: 1 ... 10 11 [12] 13 14 ... 16