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

Pages: 1 ... 70 71 [72] 73 74 ... 317
1066
Wow, this is interesting news, thank you for sharing this with us! I will need to see if I have the funds available to try out this model.

1067
TI Z80 / Re: Jade
« on: March 12, 2013, 02:38:35 pm »
I started the documentation and I am not sure if I have forgotten anything. About the header stuff, I thought that I would add an on-calc utility for adding a header to a file. I had issues with trying to get an assembler to work properly (because you need to do '.org 0' after the header). I still haven't added anything to Jade since the last update except code to let you press ON to turn Jade off.

A few other things that I was thinking about adding:
For the sprites, if you add 4 to the sprite method, then the first byte of the sprite data indicates the height of the sprite. In the Pong example, I currently use the same sprite twice for each paddle to make it 16 units long (so the same sprite is drawn 4 times to different locations). As well, the ball only needs to be 4 bytes instead of 8 (though it could be compressed to 2 bytes).

Type 8 can instead draw a string as opposed to a sprite. It feels like cheating, but haven't other systems done this?
Type 9 can draw a 16-bit signed number
Type 10 can draw an inverted rectangle
Type 11 can draw a filled rectangle
Type 12 can draw a white rectangle


I may not actually add these, but they are ideas.

1068
TI Z80 / Re: Jade
« on: March 11, 2013, 06:31:55 pm »
Yay, double posting. I found two bugs in Jade. The first made several commands work incorrectly:
cpa()
cpc()
suba()
subc()
sbca()
sbcc()

And the second one prevented the c flag from being set (I used rlc instead of rl). So I have those fixed, and I started Pong. Click the screenie for the download :)

The code for that is precisely 200 bytes and the code is:
Code: [Select]
#include     "ti83plus.inc"
#include     "Jade.inc"
.org 0
scratchmath  equ  252
scratchmath1 equ  253
ballxinc     equ  254
ballyinc     equ  255

Start:
     ldirc(sLSB0,25)
       .dw $100+ball \ .db 3,3,2  ;load the sprite data for Sprite0. The 2 is for XOR logic.
       .dw $100+paddle \ .db 0,24,2  ;load the sprite data for Sprite1. The 2 is for XOR logic.
       .dw $100+paddle \ .db 0,32,2  ;load the sprite data for Sprite2. The 2 is for XOR logic.
       .dw $100+paddle \ .db 94,24,2  ;load the sprite data for Sprite3. The 2 is for XOR logic.
       .dw $100+paddle \ .db 94,32,2  ;load the sprite data for Sprite4. The 2 is for XOR logic.
     ldirc(keyMask,2)
       .db %00010110,31              ;the second byte is for sMask (the sprite mask)
     ldc(ballxinc,1)
     ldc(ballyinc,1)
Loop:
     orc(status,2)      ;tell the status port to draw the sprites
     orc(status,3)      ;tell the status port to update the LCD, then draw the sprites
KeyLoop:
     bits(key1,40h)     ;check for the Clear key being pressed
     orcz(status,80h)   ;sets bit 7 of the status port if the z flag is set. This turns off Jade.
     bits(key2,2)       ;check if player 2 down key is being pressed
     togz()
     jrfz(TestP2Up)
     cpc(sY3,48)
     jrfz(TestP2Up)
     addc(sY3,2)
     addc(sY4,2)
TestP2Up:
     bits(key2,8)       ;check if player 2 down key is being pressed
     togz()
     jrfz(TestP1Down)
     cpc(sY3,0)
     jrfz(TestP1Down)
     subc(sY3,2)
     subc(sY4,2)
TestP1Down:
     bits(key4,2)       ;check if player 2 down key is being pressed
     togz()
     jrfz(TestP1Up)
     cpc(sY1,48)
     jrfz(TestP1Up)
     addc(sY1,2)
     addc(sY2,2)
TestP1Up:
     bits(key4,8)       ;check if player 2 down key is being pressed
     togz()
     jrfz(MoveBall)
     cpc(sY1,0)
     jrfz(MoveBall)
     subc(sY1,2)
     subc(sY2,2)
MoveBall:
     adda(sX0,ballxinc)
     callfz(TestP1Collision)
     cpc(sX0,89)
     callfz(TestP2Collision)
     adda(sY0,ballyinc)
     jrfz(NegYinc)
     cpc(sY0,60)
     togz()
     jrbz(Loop)
NegYinc:
     inv(ballyinc)
     inc(ballyinc)
     jrb(loop)

TestP1Collision:
     lda(scratchmath,sY1)
     jrf(CheckBounds)
TestP2Collision:
     lda(scratchmath,sY3)
CheckBounds:
     lda(scratchmath1,scratchmath)
     subc(scratchmath,3)
     ldcc(scratchmath,0)
     suba(scratchmath,sY0)
     jrfc(CheckOtherBound)
LoseCode:
     ldc(status,80h)
CheckOtherBound:
     addc(scratchmath1,15)
     suba(scratchmath1,sY0)
     jrbc(LoseCode)
NegXinc:
     inv(ballxinc)
     inc(ballxinc)     
     ret()
     
ball:
     .db 18h
     .db 24h
     .db 24h
     .db 18h
     .db 0,0,0,0
paddle:
     .db $C0
     .db $C0
     .db $C0
     .db $C0
     .db $C0
     .db $C0
     .db $C0
     .db $C0
Use [3] and [9] to move the paddle of player 2 and [1] and [7] for Player 1. [Clear] exits.
EDIT: I was trying to write an oncalc compiler thing for Jade earlier when I remembered about this project: ASMDREAM
So after an hour of working on a compiler I decided to instead incorporate ASMDream's system using macros and it works! All of the instructions and equates have been made except for one area-- the header. What sort of header should I use for Jade files? I was thinking there could be several types of files:
ROMs
ROM packs (multiple ROMs in one file)
Save states
So I thought headers might consist of:
Code: [Select]
1 byte for the file info and type
   bit 0:1 for the type
   bit 2 for the save state size (128 bytes or 256)
   bit 3 set if there is a description
   bit 4 set if there is an icon
1 bytes for the name length
n bytes for the name
2 bytes for the miscellaneous data size
n bytes for miscellaneous data such as description and icon
2 bytes for the ROM size
n bytes for ROM data

Hopefully this is will make it easier for people to code for Jade :)

1069
TI Z80 / Re: Jade
« on: March 11, 2013, 12:00:14 pm »
I totally rewrote the sprite drawing routine and now there are only three methods of drawing sprites :/ On the other hand, I fixed clipping and made it faster. Currently Jade has the instruction set working (or it appears to be working), but I cannot figure out why the LCD is being updated when it shouldn't be, so I am probably going to make Jade update all sprites at once, if bit 1 of the status port is set. That will just make it easier and smaller to code with sprites. As it is, here is a current screenshot :)

EDIT: Well that was quick o.o I have it working now the way it was supposed to. Compare the first screenshot to the second XD And now here is a download. The code in the new screenshot is:
Spoiler For Jade.inc:
;ports
sLSB0     equ 00h
sMSB0     equ 01h
sX0       equ 02h
sY0       equ 03h
sMethod0  equ 04h
sLSB1     equ 05h
sMSB1     equ 06h
sX1       equ 07h
sY1       equ 08h
sMethod1  equ 09h
sLSB2     equ 0Ah
sMSB2     equ 0Bh
sX2       equ 0Ch
sY2       equ 0Dh
sMethod2  equ 0Eh
sLSB3     equ 0Fh
sMSB3     equ 10h
sX3       equ 11h
sY3       equ 12h
sMethod3  equ 13h
sLSB4     equ 14h
sMSB4     equ 15h
sX4       equ 16h
sY4       equ 17h
sMethod4  equ 18h
sLSB5     equ 19h
sMSB5     equ 1Ah
sX5       equ 1Bh
sY5       equ 1Ch
sMethod5  equ 1Dh
sLSB6     equ 1Eh
sMSB6     equ 1Fh
sX6       equ 20h
sY6       equ 21h
sMethod6  equ 22h
sLSB7     equ 23h
sMSB7     equ 24h
sX7       equ 25h
sY7       equ 26h
sMethod7  equ 27h
key0      equ 28h
key1      equ 29h
key2      equ 2Ah
key3      equ 2Bh
key4      equ 2Ch
key5      equ 2Dh
key6      equ 2Eh
keyMask   equ 2Fh
sMask     equ 30h
status    equ 31h     ;bit 7 set means turn the system off, bit 0 = LCD update

;RAM equates
stackptr  equ 32h
PClow     equ 33h+saveSScreen
PChigh    equ 34h+saveSScreen
stackbase equ 80h+saveSScreen


_FlashToRam2        equ 8054h
#define    lda(addr1  , addr2)     .db 0,addr1,addr2
#define    adda(addr1 , addr2)     .db 1,addr1,addr2
#define    adca(addr1 , addr2)     .db 2,addr1,addr2
#define    suba(addr1 , addr2)     .db 3,addr1,addr2
#define    sbca(addr1 , addr2)     .db 4,addr1,addr2
#define    xora(addr1 , addr2)     .db 5,addr1,addr2
#define    ora(addr1  , addr2)     .db 6,addr1,addr2
#define    anda(addr1 , addr2)     .db 7,addr1,addr2
#define    cpa(addr1  , addr2)     .db 8,addr1,addr2
#define    inc(addr)               .db 9,addr
#define    rotl(addr)              .db 10,addr
#define    shftl(addr)             .db 11,addr
#define    pusha(addr)             .db 12,addr
#define    pop(addr)               .db 13,addr
#define    inv(addr)               .db 14,addr
#define    ldira(addr,size)        .db 15,addr,size

#define    ldc(addr  , const)      .db 16,addr,const
#define    addc(addr , const)      .db 17,addr,const
#define    adcc(addr , const)      .db 18,addr,const
#define    subc(addr , const)      .db 19,addr,const
#define    sbcc(addr , const)      .db 20,addr,const
#define    xorc(addr , const)      .db 21,addr,const
#define    orc(addr  , const)      .db 22,addr,const
#define    andc(addr , const)      .db 23,addr,const
#define    cpc(addr  , const)      .db 24,addr,const
#define    dec(addr)               .db 25,addr
#define    rotr(addr)              .db 26,addr
#define    shftr(addr)             .db 27,addr
#define    pushc(const)            .db 28,const
#define    ex(addr1,addr2)         .db 29,addr1,addr2
#define    bits(addr,const         .db 30,addr,const
#define    ldirc(addr,size)        .db 31,addr,size

#define    ret()                   .db 32
#define    setz()                  .db 33
#define    setc()                  .db 34
#define    togz()                  .db 35
#define    togc()                  .db 36
#define    jp1(Addr)               .db 37,Addr
#define    jp2(Addr)               .db 38,Addr
#define    jrf(offset)             .db 39,offset-1-$
#define    jrb(offset)             .db 40,1-offset+$
#define    call1(Addr)             .db 41,Addr
#define    call2(Addr)             .db 42,Addr
#define    callf(offset)           .db 43,offset-1-$
#define    callb(offset)           .db 44,1-offset+$

#define    ldcz(addr1  , const)    .db 16+128,addr1,const
#define    jrbz(offset)            .db 40+128,1-offset+$
#define    incz(addr)              .db 9+128,addr
#define    decz(addr)              .db 25+128,addr
#define    retz()                  .db 32+128

jkDown     equ %11111110
jkRight    equ %11111101
jkLeft     equ %11111011
jkUp       equ %11110111
jkClear    equ %10111111

lcdupdatebit       equ 0
spriteupdatebit    equ 1

Code: [Select]
#include 'Jade.inc'
.org $00
 jrf(start)
sprite:
.db %00111100
.db %01100110
.db %11000011
.db %11100111
.db $FF
.db $FF
.db $FF
.db $FF
start:
 ldirc(sLSB0,5)
  .dw $100+sprite \ .db 0,0,2
 ldirc(keyMask,2)
  .db 3,1             ;
Loop:
 orc(status,2)        ;set bit 1 of the status port to draw the sprites
 orc(status,3)        ;set bit 0 and 1 of the status port to update the LCD, then redraw the sprites
KeyLoop:
 cpc(key1,jkClear)    ;Check if clear is pressed
 ldcz(status,$80)     ;Turn off Jade if the z flag is set by writing 80h to the status port
 cpc(key0,-1)         ;test if no keys are being pressed
 jrbz(KeyLoop)


 cpc(key0,jkDown)
 incz(sY0)
 cpc(key0,jkUp)
 decz(sY0)
 cpc(key0,jkLeft)
 incz(sX0)
 cpc(key0,jkRight)
 decz(sX0)
 jrb(Loop)
Now I need to try to document everything .__.


1070
Miscellaneous / Re: What Does Your Voice Sound Like? (New Collection)
« on: March 09, 2013, 08:55:08 pm »
>.> I sound weird. Also, I didn't follow the format because I recorded it before looking at the format. <.<

I may or may not have pronounced Omnimaga and Cemetech incorrectly.

EDIT: I use the word "so" a lot.

1071
TI-BASIC / Re: Pi Day
« on: March 09, 2013, 02:20:47 pm »
I only worked my way up to 194 digis. On the other hand, I can commit strings of numbers to memory in a few minutes. I haven't reached my limit yet, but when I was trying to memorise more digits of pi, it took me a few minutes (about 5) to commit a 48 digit chunk to memory and then I went to the next chunk :D If you do the math, you will see that that amounts to 4 chunks plus a few digits. Only the first three chunks have stuck, though, and it has been a few months since I have tried to memorise it. My goal was to have 10000 memorised by now, but school got in the way .__. I made a program to quiz me and it has 1000 digits :D

1072
It is fine :P Also, be careful as a TI-83 Program is a little different from a TI-83 Plus program. The former is stored as .83p and the latter as .8xp. If it was programmed on a TI-83, then you want .83p and if it was programmed on a TI-83+ or 84+, you will want it saved as .8xp.

1073
SourceCoder lets you edit programs and whatnot on the computer and then save them as .8xp files, among other things. You don't need to download anything to use it.

Also, we encourage editing posts as opposed to double posting (unless of course it has been a while since the last post).

1074
I am not sure if there will be a problem with it. I don't think Source Coder will be able to open it. If it could, I would say you could open it with Source Coder and then resave it as .8xp. I don't know if simply changing the extension will work.

1075
Oh, check the properties of it to see what its extension is. .txt files are "Text Document" and likewise, .8xp files are "TI Program"

1076
I don't know, that is the format it is in automatically on Windows, maybe Matrefeytontias knows?

1077
.8xp is the most conventional type, yes.

1078
ASM / Re: ASM Optimized routines
« on: March 07, 2013, 04:14:15 pm »
EDIT3: (continued below) Smaller, faster version below.
I wanted to optimise an old routine in Grammer to compute the GCD of two 16-bit numbers. I came up with this:
Code: [Select]
GCDDE_HL:
;Inputs:
;     HL,DE are the two values
;Outputs:
;     B is 0
;     DE is 0
;     HL is the GCD
;     C is not changed
;Destroys:
;     A
     xor a              ;AF     4
     ld b,a             ;47     4
CheckMax:               ;
     sbc hl,de          ;ED52   15n
     jr z,AdjustGCD     ;28**   12n-5
     jr nc,ParityCheck  ;30**   12n-5
    xor a              ;AF     4(n-a)
     sub l              ;95     4(n-a)
     ld l,a             ;6F     4(n-a)
     sbc a,a            ;9F     4(n-a)
     sub h              ;94     4(n-a)
     ld h,a             ;67     4(n-a)
     ex de,hl
     jp CheckMax        ;C3**** 10(n-a)
ParityCheck:            ;
     bit 0,e            ;CB**   8a
     jr nz,DE_Odd       ;20**   12a-5b
     bit 0,l            ;CB**   8b
     jr z,BothEven      ;28**   12b-5c
     rr d               ;CB**   8(n-a-b-c)
     rr e               ;CB**   8(n-a-b-c)
     jp CheckMax        ;C3**** 10(n-a-b-c)
BothEven:               ;
     inc b              ;04     4c
     rr d \ rr e        ;       16c
     rr h \ rr l        ;       16c
     jp CheckMax        ;       10c
DE_Odd:                 ;
     bit 0,l            ;       8b
     jr nz,BothOdd      ;       12b-5d
     rr h \ rr l        ;       16(n-a-b-d)
     jp CheckMax        ;       10(n-a-b-d)
BothOdd:                ;
     sbc hl,de          ;       15d
     rr h \ rr l        ;       16d
     jp CheckMax        ;       10d
AdjustGCD:              ;
     ex de,hl           ;       4
     inc b              ;       4
     dec b              ;       4
     ret z              ;       11+4(k>0)
     add hl,hl          ;       11k
     djnz $-1           ;       13k-5
     ret                ;       --
It is a lot faster than my other version which used division to compute the mod of two 16-bit numbers x.x The JP instructions can be changed to JR for better portability and to save a byte each time.

EDIT: And if I didn't make a mistake, the 8-bit version:
Code: [Select]
GCD_A_C:
;Outputs:
;    A is the GCD
;    C should be the smallest odd number that divides both inputs
;    B is 0
;Destroys:
;    D
     ld b,1
CheckMax:
     sub c
     jr z,AdjustGCD
     jr nc,ParityCheck
     neg
     ld d,a
     ld a,c
     ld c,a
     jr CheckMax
ParityCheck:
     rrc c
     jr c,c_Odd
     inc b
     rrca
     jr nc,CheckMax
     rlca
     djnz CheckMax
c_Odd:
     rlc c
     rrca
     jr nc,CheckMax
     rlca
     jr CheckMax
AdjustGCD:
     ld a,c
     dec b
     ret z
     add a,a
     djnz $-1
     ret
EDIT2: I think I computed a massive overestimate of the slowest speed of the first routine to be a little over 4000 cycles. My old routine used about 1500 cycles at the fastest for a non-trivial result. 1500 is likely close to the slowest that the new routine will run at :)
EDIT3: 14 bytes saved, runs faster?
Code: [Select]
GCDDE_HL:
;Inputs:
;     HL,DE are the two values
;Outputs:
;     B is 0
;     DE is 0
;     HL is the GCD
;     C is not changed
;     A is not changed
     ld b,1
     or a
CheckMax:               ;
     sbc hl,de          ;ED52   15n
     jr z,AdjustGCD     ;28**   12n-5
     jr nc,ParityCheck  ;30**   12n-5
     add hl,de
     or a
     ex de,hl
ParityCheck:            ;
     bit 0,e            ;CB**   8a
     jr nz,DE_Odd       ;20**   12a-5b
     bit 0,l            ;CB**   8b
     jr z,BothEven      ;28**   12b-5c
     rr d               ;CB**   8(n-a-b-c)
     rr e               ;CB**   8(n-a-b-c)
     jp CheckMax        ;C3**** 10(n-a-b-c)
BothEven:               ;
     inc b              ;04     4c
     rr d \ rr e        ;       16c
HL_Even:
     rr h \ rr l        ;       16c
     jp CheckMax        ;       10c
DE_Odd:                 ;
     bit 0,l            ;       8b
     jr z,HL_Even       ;       12b-5d
     sbc hl,de          ;       15d
     rr h \ rr l        ;       16d
     jp nz,CheckMax        ;       10d
AdjustGCD:              ;
     ex de,hl           ;       4
     dec b              ;       4
     ret z              ;       11+4(k>0)
     add hl,hl          ;       11k
     djnz $-1           ;       13k-5
     ret                ;       --

1079
News / Re: Release of TilEm2
« on: March 07, 2013, 07:22:10 am »
Wow, this seems awesome o.o I have a question because I think i misunderstood something. Is there an issue with pressing multiple keypresses at once? I have made programs that could take >4 simultaneous keypresses, so that could be a problem. This also made me wonder if your macros were able to support multiple key presses at once, because that could be useful.

1080
Other Calculators / Re: TI-Concours - last days to subscribe !
« on: March 06, 2013, 07:46:24 am »
yeah, this should be fun o.o I should also email my BASIC z80 entry later >.>

Pages: 1 ... 70 71 [72] 73 74 ... 317