Join us on Discord!
You can help CodeWalrus stay online by donating here.
Menu

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.

Show posts Menu

Messages - unregistered

#16
Other / Re: I can give you a cheap vintage computer
July 12, 2016, 08:17:08 AM
Oh ! I remember this computer, it was rather expensive !! (my familly could not afford it)
There's a z80 microprocessor inside  oops  9_9
#17
I started programming in 1983 (I was 10) , on a Thomson TO7, at school. I was so happy to discover BASIC !

(see http://www.old-computers.com/museum/computer.asp?c=11 for more details)

I was eager to get my own computer, but in these days, a computer was expensive !..At last, 2 years later, my parents offered my brother and I an Amstrad CPC 464 (included a tape recorder, and colour monitor) Such a great day !!!
#18
Better method, again  ;D

Yesterday I discussed with PT_ another method :

its aim is to clear while create coding !!

"Push de" is coded $d5
with "ld de,$d5d5d5",  a "push de" will create 3 "push de" !!..That's the trick :)

In 8bpp mode, whe have to clear 76800 bytes , using PUSHs we need 76800/3=25600 PUSHs
As a PUSH creates 3 PUSHs, we just need to clear/create 1/4 of 25600 = 6400 PUSHs :)
Then we will go inside this huge group of 19200 bytes $d5 to complete the 3/4 remaining to clear !!
Of course, we will write at the very end "ld sp,hl \ ei \ ret" to be able to quit the routine ;)

Here's the routine:
        ld      bc,$c9fbf9      ; pour écrire "ld sp,hl \ ei \ ret"
        ld      de,$d5d5d5      ; $d5=code de "push de"
        or      a               ; en PUSHant $d5d5d5, on crée du code
        sbc     hl, hl          ; (des PUSHs qui créent des PUSHs !!)
        di
        add     hl, sp          ; mémorise SP dans HL
        ld      sp,$D52C03
        push    bc
        ld      b,52
PushLp: .fill 123,$d5           ; 6400 = 52*123+4
        djnz    PushLp          ; là, on "PUSH DE" 6400 fois ( = 1/4 de l'effaçage écran)
        push    de              ; pour ensuite aller dedans!! (car c'est aussi du code!)
        push    de              ; (afin de de poursuivre l'effaçage des 3/4 restants de l'écran)
        push    de
        push    de
        jp      $d52C00-(6400*3)

length = 153 bytes only !

16+16+4+8+4+4+16+10+8+(123*10+13)*52-5+10+10+10+10+17+19200*10+4+4+21= 256803 states !!!

The constraint is we must clear using byte $d5
But that may not be a problem as , in 8bpp mode, we can modify the palette ;)
#19
 9_9 Oh, please forget v3.31 : this sort of getkey added to PALETTE was rather slow  :-[ (in fact, you had to put the token of getKey, perhaps it was not ok for you because of that ;) )
I just downgraded to v3.3  :P
To be fast, we could add this "getkeyS" function but as another new ASM program (yes , one more!)
#20
Sprites v3.31 available ! ( https://tiplanet.org/forum/archives_voir.php?id=539203 )

! NEW !.. "getKey":Asm(prgmPALETTE

Allows you to know if 1 or more "arrow" keys  are pressed, then store result into theta variable

(down)=1 , (left)=2 , (right) =4 , (up) = 8

Also allows you to know if 1 or more of the keys (2nd) =1 , (mode) = 4 , (del) = 8 are pressed,
then store result into Ans.

It's possible to read several keys together !

EG : when (up) and (left) are pressed, theta will contains value 8+2 = 10 :)

#21
Quote from: TheMachine02 on June 10, 2016, 01:05:08 PM
Yeah <_<. This is about 76800 bytes to clear at 7 TStates/bytes. (Actually it is more 540000TStates)
I recommend you the "Push" method  ! only 258 832 States :thumbsup:
( https://codewalr.us/index.php?topic=1395.msg40164#msg40164 )
#22
This morning, I've just manually measured both methods : "LDIR" and "PUSH"
I used http://online-stopwatch.chronme.com/ , my TI83PCE (freshly "Ram cleared", unplugged)

Here are the 2 programs to clear screen during 10 000 times !

First, the classic method "LDIR"...

        ld              a,$27
        ld              ($e30018),a

        ld              bc,10000
BigLp:  push    bc
;----------------------------------------------------------------
        ( di )
        ld              hl,$d40000
        ld              de,$d40001
        ld              (hl),85
        ld              bc,76799
        ldir
        ( ei )
;-----------------------------------------------------------------
        pop     bc
        dec     bc
        ld              a,b
        or              c
        jp              nz,BigLp

        ld              a,$2d
        ld              ($e30018),a
        ret


which takes (with or without interrupts!)  1 minute and 59 seconds



Then, the method "PUSH" ...

        ld              a,$27
        ld              ($e30018),a
       
        ld              bc,10000
BigLp:  push    bc
;-----------------------------------------------------------------------
        ld      de,$555555      ; will write byte 85 (= blue color)
        or      a
        sbc     hl,hl
        ld      b,213
        di
        add     hl,sp           ; saves SP in HL
        ld      sp,vram+76800   ; begin at end of 8bpp mode physical screen
ClrLp:  .fill 120,$d5           ;       = 120 * "PUSH DE"
        djnz    ClrLp           ; during 213 times
        .fill 40,$d5            ; 40 * "PUSH DE"
        ld      sp,hl           ; restore SP
        ei
;------------------------------------------------------------------------
        pop     bc
        dec     bc
        ld              a,b
        or              c
        jp              nz,BigLp

        ld              a,$2d
        ld              ($e30018),a
        ret


which takes ... 58 seconds !!!   ;D

And if we relocate the main routine in $e30800, time will decrease to 51 seconds !!!
#23
Ah yes, Push does not take 12 but only 10 !! (I've checked)
Thanks, Adriweb...and Runer ;)

I also modified "PUSH IX/IY" which takes 14 states (not 16)
#24
Hello there!!

While on CodeWalr.us chat, PT_ and I thought about a way to clear screen of a TI83PCE/TI84+CE as fast as possible! (in 8bpp mode)

Here's the result :

FastClr:
        ld      de,$555555      ; will write byte 85 (= blue color)
        or      a
        sbc     hl,hl
        ld      b,217
        di
        add     hl,sp           ; saves SP in HL
        ld      sp,vram+76818   ; for best optimisation , we'll write 18 extra bytes
ClrLp:  .fill 118,$d5           ;       = 118 * "PUSH DE"
        djnz    ClrLp           ; during 217 times
        ld      sp,hl           ; restore SP
        ei


16+4+8+8+4+4+16+217*(118*10+13)-5+4+4=258944 States !!!  ;D
(the classic LDIR takes about 537600 states)

Imagine this routine relocated in the faster memory-area $e30800 !!! (faster again !!)


** EDIT **


A little faster !

FastClr:
        ld      de,$555555      ; will write byte 85 (= blue color)
        or      a
        sbc     hl,hl
        ld      b,213
        di
        add     hl,sp           ; saves SP in HL
        ld      sp,vram+76800   ; as a PUSH is decreasing SP, begin at end of 8bpp mode physical screen
ClrLp:  .fill 120,$d5           ;       = 120 * "PUSH DE"
        djnz    ClrLp           ; during 213 times
        .fill 40,$d5            ; 40 * "PUSH DE"
        ld      sp,hl           ; restore SP
        ei


16+4+8+8+4+4+16+213*(120*10+13)-5+40*10+4+4 = 258832 States =D
#25
I wanted SETTINGS to make a black screen (because going into 8bpp mode) and as fast as possible :

ld hl,$e40000
ld de,$d40000
ld bc,153600/2

$e40000 is a memory-area where we can't write, only read...And it only read zeros (with less Wait-States than usual)
#26
nice, DJ Omnimaga :)

One detail : SETTINGS also clear screen in black (faster way than CLSCREEN) ;)

I optimised a bit GALACACE (just for help ;) ), You can take a look at it (renamed GALAGAC to avoid confusion)
#27
Perhaps I found why there was a bug !
In this program, when you start to define sprites, you ommit sprite #0 !
Please don't forget that we must start from 0, because meanwhile this allows the routine to (re)set sprites :)

Asm(prgmSETTINGS
0:Asm(prgmCLSCREEN
{20,25,255,148,224,227,0,12,4,34,231,129
Asm(prgmPALETTE
1→dim(ʟWALRS
{129,224,227,231,129,224→L₁
For(Z,7,39
randInt(0,1→L₁(Z
End
"001,75,410011101011121111111110111111001110
Asm(prgmSPRITE
"002,75,450000004555000444455544440004000000
Asm(prgmSPRITE
"003,75,400606006006006066466060060060060600
Asm(prgmSPRITE
"004,C5,7000099990000099988889999988877778888877700007777700000000000
Asm(prgmSPRITE
"005,88,40330330012212210112112103333333332323333323233333333333330330330
Asm(prgmSPRITE
"006,55,70000000000000000000000000
Asm(prgmSPRITE
"007,88,3A33A33AA1221221A1121121A333333333232333332323333333333333A33A33A
Asm(prgmSPRITE
"668,Y5,4BBB666BBB6666BBBBBB6BBB66666BBBBBB44466644464446664446444666664446665556665556555666555655565556555555AAAAAAAAA6AAA666AAA6AAA66666AAA6662226662226666222222622266666222666
Asm(prgmSPRITE
"669,Y5,46666BBB666BBB6BBBBBB6BBB6666666BBB44464446664446444666644466666664446666555666555655555565555556666555AAA6AAA666AAA6666AAA6AAA666AAA66662226666222666622222262226662226222
Asm(prgmSPRITE
"616,75,4BBB6BBB46664665666555A666A662226222
Asm(prgmSPRITE
{0,0,320,80,0,0,77,320,8,16,0,78,320,1,0,0,85,320,8,25,0,86,320,1,16,0,93,320,8,29,0,94,320,1,25,0,101,320,8,14,0,102,320,1,29,0,109,320,61,231,0,110,320,1,14,0,170,320,71,5,2,41,316,4,129
Asm(prgmCLSCREEN
{6,146,111,7,2,17,8,138,17,9,290,17
Asm(prgmSPRITE
For(A,0,288,24
{10+A,168,1,4,16,18+A,170,4,1,231,26+A,169,4,4,14
Asm(prgmCLSCREEN
End
{89,52,14,0,1,2
Asm(prgmPRINT
"A GAME OF WALRUSES
Asm(prgmPRINT
{12,179,0,5
Asm(prgmPRINT
"PC a\nd Atari 2600 game by JWinslow23
Asm(prgmPRINT
{20,199
Asm(prgmPRINT
"TI-84 Plus CE remake by DJ Omnimaga
Asm(prgmPRINT
{48,219
Asm(prgmPRINT
"(C)2016, https://codewalr.us
Asm(prgmPRINT
{114,146,0,231
Asm(prgmPRINT
"Highscore:
Asm(prgmPRINT
{202,146
Asm(prgmPRINT
ʟWALRS(1
Asm(prgmPRINT
0getKey
Repeat Z
getKey→Z
End
If Z=45:Then
Asm(prgmBACKHOME
ClrHome
DelVar L₁Return
End
While 1
1→A
0→B
0→I
288→C
288→D
1→E
100→R
120→O
0→P
288→F
0→G
1→M
{0,0,320,220,20,0,220,320,20,0
Asm(prgmCLSCREEN
{146,222,255,0
Asm(prgmPRINT
0
Asm(prgmPRINT
While B<190 and Z≠45 and (O≠C or (B+20<R or B+10>R
While B<190 and O≤300 and (O≠C or (B+20<R or B+10>R
{5,F,G,5,D,I,3,12A,96,3,12A+80,96,3,12A+160,96,3,12A+240,96,4,C,B,M,O,R
Asm(prgmSPRITE
C→D
B→I
O→F
R→G
A+1→A
If A>13:1→A
getKey→Z
If Z=21:⁻40→E
E+10+10(E=⁻10→E
C-24(Z=24)+24(Z=26→C
If C<0:0→C
If C>288:288→C
If E>30:30→E
B+E→B
If B<0:0→B
O+24→O
R+20(M=2)((R<B)-(R>B→R
If Z=45:200→B
End
If (B+20≥R and B+10≤R) and O=C and not(M:Then
P+10→P:300→O
End
If O>288:Then
0→O
P+1→P
{146,222
Asm(prgmPRINT
P
Asm(prgmPRINT
20randInt(0,9→R
not(randInt(0,3))+(150<randInt(P,200→M
End
End
If Z≠45:Then
If B>189:189→B
For(Z,1,2
For(M,1,4
{33,12,1,6,27,L₁(M+1),33,5,1,5,27,L₁(M),33,4,1,1,27,L₁(M),33,4,A,52,6,L₁(M+1),33,4,A+13,52,6,L₁(M+1),33,B+L₁(M+4Z+2),C+L₁(M+4Z+18),39,1,L₁(M+2
"Asm(prgmTEXTLIB
End
End
{17,L₁(M),16,12
"Asm(prgmTEXTLIB

{126,40,0,129
Asm(prgmPRINT
"Game Over
Asm(prgmPRINT
If P>ʟWALRS(1:Then
{112,60
Asm(prgmPRINT
"NEW HIGHSCORE
Asm(prgmPRINT
P→ʟWALRS(1
End
0getKey
Repeat getKey
End
Else
Asm(prgmBACKHOME
ClrHome
DelVar L₁Return
End
End
#28
Yes , the asm routine accepts up to 255 elements ;)
(more would be useful?)
and concerning minuscules, make sure you re not using tokens (which are not welcome!)

I found a bug : the caracter ^ gives a space
#29
I use a TI-83 Premium CE, OS 5.1.5.0019.

And about the "44 sprites cap bug", maybe the TI-OS fault
I displayed about 55 times at coordinates (1,1) the sprite #1, and coord. (9,9) for the last sprite: it works!
So I think it may be a length of Basic List too long (for TI-OS !) which could make trouble ..?
#30
I have the blue fish :) (never saw green squares)



I'll search more about this "44 sprites cap bug" ;)
Powered by EzPortal