All posts by estebon

Game boy Advance video playback

Pickup Line

Have you ever wish there were a better more convenient way to watch videos on the go in 2022? Is high resolution big screen phones with wireless audio headsets just not enough? Today is your lucky day because we will explore the world of video playback on the most advanced mobile platform ever. That is right, i am talking about the mighty Game Boy Advance .

Ways of Getting video on GBA are:

  • Game Boy Video
  • GBA Movie Player
  • Play Yan Micro

Game Boy Video

This is the easiest way, you just go to a videogame store in 2005 and by one of the available titles in this format.

This type of video format is very interesting because it uses new (for the time) storage technology. At the time, gba cartridges used to ship with 32 MB of ROM. However, moves like the one Above would not fit in such small storage. Bigger memories were always possible but prices would rise significantly.

At the time there was this memory startup called Matrix (CNET article here). That was experimenting with something they originally called Matrix 3D memory. that was basically build semiconductors in layers, the ability to increase the size of a memory chip in 3 dimensions rather that 2 help alleviate this problem thus cartridge’s using this technology could incorporate 256 MB of memory.

In the picture above we can see the internals of one of this cartridges, you can se they consist of two chips, the one marked (AGB-M2SE-5) on the leftis the actual 3D memory, it probably contains 256 MB with the Shrek 2 memory in it. The more square chip on the right is a memory controller. This presumably performs two duties, knows how to decode the memory mapping on the memory chip, assuming needs special instructions, and do bank switching for the gba.

lets remember the GBA memory address space is only 24 bits and the word length is 16 bits. Thus it can only directly address 32 MB of memory, making some sort of bank switching control necesary.

The other interesting aspect of this video is that the video format is either uncompressed or have a very light compression, since the chip does not seems to have special hardware for decoding, thus relying completely on the GBA cpu and hardware.

The vide seems to compress on a frame basis, have some artifacts that are very visible and have very low framerate, from what I was able to measure is between 7 to 8 frames. (demo at the end, see the green gameboy screen .

GBA Movie Player

This requires you to have a few things in order to make it work.

  • Compatible computer, mine at the time was a VIA C7 at 700 MHZ with widnows XP, which had the computing power of a toaster so. anything will do.
  • A CF card, this are the weird cards with an ISA interface
  • A CF reader
  • the converting software. Which you can get from here. http://www.sozoryoku.us/zip/CrystalEng.rar
See the source image

This little device I got it when I was probably 15, it was the first thing I ever bought online, and I ordered from the now defunct liksang.com. It seems was manufactured by a company named Movie Advance, probably from china.

This is how the cartridge looks, and curiously, that is the same memory brand and size that I originally acquired for mine.

See the source image

Internally this has a very similar structure to the GBA video, containing only two chips, the one with the sticker, that I think is the flash memory containing the GBA code, and the black square, which I think is either a memory controller or an FPGA that acts as a memory controller.

I think as a poor mans IP protection they shaved the marks on the square chip so it will require more work to figure out exactly what it was :P.

Memory controller /FPGA

On the other side there is only the interface for the CF card.

CF interface

This cartridge can handle very big memories. I tried 2 GB flash card and seems to work with no problems. the original site says it supports FAT32 format, this format can handle memory up to 8 TB in size and I would not be surprised if it could handle a at least 5% of that size. which is still a very respectable 200 GB, haven’t tested it tho. This of course, means it is also implementing some sort of bank switching. I doubt the memory controller has any video decoding capabilities to aid with the video decompression so for this sistem I also asume it is relying entirely on the GBA processor to do any video decompresion.

The Framerate for this device seems to be between 10 and 11 FPS, and the video in high quality has less artifacts although I can see the color pallete being reduced and I see the saturation a bit high. Overall still looks very good. See the demo on the blue gba .

Play Yan Micro

Now we will see the holy grail of portable video devices, the Nintendo Play Yan. This is a product officially released by nintendo.

See the source image

This is the one that I find the most interesting, it contains 3 ic inside and they shows us a completely different way of addressing the video playback problem.

Here some pictures of it.

See the source image

The first IC is the alphamosaic VC01PXX-ES2, this is a mpeg decoder from alphamosaic, it is more well known as VC01 (Video Core). This is the first version of Video Core, and the only one released by alphamosaic before being acquired by broadcom. this same chip was used by some samsung phones. seems it supports a resolution of CIF (352×288) and can decompress MP4 video up to 1.5 Mips. Also internally it features an ARM processor presumably over 100 Mhz and 3D capabilities way beyond what the GBA have.

The other two chips are a mystery to me, One may be a memory controller or flash memory, and the other named Epson something something may be a coprocessor to interface with the GBA, but that is just speculation. Also it has a strange limitation, the memory size limit seems to be hard on 1GB. It uses SD cards.

The video in this system is also very interesting, because it has an actual decoder, it supports any valid mp4 file compressed as mpeg4 presumably to resolutions up to 352×288 and then it will be downscaled somewhere.

I personally made test with 240×160 resolution and the lowest compression with is close to lossless mode, resulting in high bitrate, (around 1.2 mips) and big file sizes, (around 400 mb per hour of video). The system worked fine with that and seems to handle 30 fps very well.

Since we are using a decoder in this device, the memory mapping can be different and I guess the video decoding is as follows.

  • Decoder decodes frame
  • the coprocessor may crop and adjust the frame to gba specs and maps it to a set memory address
  • the GBA microcode just reads same memory address over and over again and just displays it.

Because of those possible steps, the GBA actually needs to process very little information, allowing it to potentially display higher framerates and color pallete, since it is no longer in charge of audio or video decompression.

Other point that I didn’t touch yet is audio quality, GBA only contains two 8 bit DAC, meaning the audio quality is effectively 8 bits, which means is very noisy.

the GBA Video and GBAMoviePlayer both rely solely on the GBA audio DAC. The playyan has an audio jack, with a standard 16 bit DAC, which gives CD quality audio. which is a world of difference.

The result is this mode has very visible frame rate, probably close to the 30 fps of my test video, no artifacts since my compression ratio is very low and an amazing color pallete. You can see the demo following the yellow GBA .

For this test, to make it the better possible one, I bought the play yan, got my GBAMoviePlayer from mexico, bought Shrek 2 as GBAVideo and in DVD. Ripped the dvd and convert it with mpeg2 to two different video formats.

For PlayYan

ffmpeg  -i VTS_01_1.VOB -ac 2 -c:v mpeg4 -s 240×160 -qscale:v 1 shrek2.mp4

For GBAMoviePlayer    

ffmpeg -i VTS_01_1.VOB -ac 2 -c:v libxvid  -s 480×320 -qscale:v 1 shrek2.avi    

followed by the best quality from the official GBAMoviePlayer converter.

This resulted in 3 files:

  • Shrek2.mp4 with a size of 533 MB that I placed in the PlayYan
  • Shrek2.GBM with a size of 251 MB containing the video for GBAMoviePlayer
  • Shrek2.GBS with a size of 60 MB containing the audio for GBAMoviePlayer

And finally, here are the results of this experiment. Enjoy this video.

Remember

  • Yellow (Top Left corner) is PlayYan
  • Blue (Top Right corner) is GBA Movie Player
  • Green (Bottom Right corner) is Shrek2 GBA Video

That is all, hopefully the video quality is so crappy that the youtube algorithm wont give me a strike. Fingers crossed.

Thanks.

IMSS, UN DERECHO QUE PUEDES PERDER.


En mi caso, y supongo en el caso de unos cuantos más de mis amigos paisanos, mi conocimiento de el sistema público de salud en México es escaso, y, hasta cierto punto, pensé que el IMSS, (Instituto Mexicano del Seguro Social), era un derecho al que cualquier Mexicano podia acceder.

En parte esta idea viene de la educación impartida en la escuela primaria cuando hablan del artículo 4 de la constitución mexicana. ( Art 4: Toda persona tiene derecho a la protección de la salud) (link constitución)

La realidad es que esto es una verdad a medias y en este artículo discutiré lo que he aprendido en los últimos días y mi consejo para otros compatriotas que quieran mantener su estado de derechohabiente.

Para muchos mexicanos, es bien conocido que el IMSS, junto con el ISSSTE, son los servicios de saludo de el estado para atender a la población, y estos a su vez es bien sabido que tienen problemas de solvencia que solo han crecido en los últimos años, impactando la calidad del servicio, deficiencias que se han visto aún más por la actual pandemia del COVID 19. No es raro escuchar bromas del tipo (Inútil Solicitar Servicio, Solo Tramitamos Entierros, ISSSTE).

Pequeño reality check

Algo que seguramente muchos mexicanos descubren muy tarde, es que, a diferencia de lo que el artículo 4 dice, no todos tienen derecho a usar los servicios del sistema de salud (IMSS). En este sentido el IMSS funciona más como una aseguradora que como un servicio de salud universal.

Para poder tener derecho a servicios de salud, uno tiene que estar dado de alta y con una póliza vigente. (La Constancia de Vigencia de Derechos). Puedes validar en cualquier momento el estado de tu póliza aquí. (tramites imss).

Éste es un ejemplo de mi póliza hace unos días, ahi se puede ver que no tenía derecho a servicis de salud.

Condiciones Preexistentes pueden prevenir tu incorporación voluntaria al IMSS.

Éste punto es muy importante y es algo que yo no sabía, si quieres voluntariamente inscribirte al IMSS, tienes que cumplir ciertos requerimientos, incluyendo no tener enfermedades preexistentes, como Tumores (cancer), Insuficiencia Renal, VIH entre otros. Puedes corroborar esto en este link del IMSS. (enfermedades preexistentes IMSS)

Esto al parecer se hace así, para prevenir que uno como mexicano, se inscriba solo cuando esta enfermo, ya que como cualquier seguro de salud, para funcionar correctamente, tiene que tener una cartera de clientes saludables que pague por los servicios de los clientes enfermos. Por desgracia, esta información es omitida de la educación y muchos mexicanos la desconocen.

Hoy en día muchas personas mayores que trabajaron en la informalidad, y que nunca fueron inscritas no pueden gozar de los servicios de salud, y solo se fueron enterando de esto cuando ya estaban enfermos. Más acerca de este problema en este link (Seguro voluntario del IMSS inaccesible para adultos mayores.)

En qué modos puedes inscribirte al IMSS

Por lo que entiendo hasta hoy, hay 4 maneras en las que puedes volverte derecho habiente del IMSS.

1-Alta Patronal: Esta me parece ha de ser la más común en México ya que no depende del individuo, sino de la institución para la que trabajas. Este es el modelo en el que tu empleador paga por tu prestación del IMSS. Este es el modo en el que yo obtuve la mía, en 2014, cuando trabajaba en Oracle. Para este modo no importan las condiciones preexistentes que tengas.

2-Incorporación al seguro de salud familiar: En este casi cualquier mexicano se puede inscribir, sin embargo, si tienes enfermedades preexistentes no lo puedes adquirir.

Ademas, este, a diferencia de el número 1 (Alta Patronal), no cuenta para tus semanas de cotización en IMSS (no cuenta para pensiones ni crédito de vivienda, solo servicios de salud). Más información en esta página del IMSS (Seguro de salud familiar).

3- Incorporación Voluntaria al Régimen Obligatorio: Este es equivalente al Alta patronal, si nunca has cotizado en el IMSS puedes aplicar para esta incorporación, esta, a diferencia del (Seguro de salud familiar) además te permite acumular semanas para pensión y crédito familiar. Dos grandes diferencias que tiene con la (Alta patronal) son.

a)Tu tienes que pagar mes con mes la quota, por que no tienes empleador que lo pague por tí.

b)No lo puedes obtener con enfermedades preexistentes.

De lo demás, funciona igual. Puedes leer las reglas originales en esta página del IMSS. (Incorporación voluntaria al Régimen Obligatorio)

4- Inscripción a la continuación voluntaria al régimen obligatorio: Este es equivalente al punto 3, con dos grandes diferencias.

a) Solo puedes aplicar para este si ya habías cotizado anteriormente en el modo (Alta patronal) y no han pasado mas de 5 años desde que te diste de baja (renunciaste o fuiste despedido) y cotizaste al menos 52 semanas en los 5 años anteriores a que fueras dado de baja por tu último empleador. (artículo de cotizar en IMSS si perdiste tu empleo)

b)Si cumples el puto a), puedes obtenerlo aun con enfermedades preexistentes, a diferencia del modo 3.

Esta 4ta modalidad es interesante por que parece ser la única opción para obtener IMSS si quieres trabajar independiente y tienes enfermedades preexistentes. Más información de esta modalidad del IMSS aquí. (Inscripción a la continuación voluntaria al régimen obligatorio)

Me puedo inscribir en linea o tengo que ir al IMSS?

Parece ser que para los modos 2,3 y 4, puedes hacerlo en linea a traves de este portal. (tramites imss).

Como hago los pagos

Una vez que estés inscrito te va a llegar una ficha de pago como esta. Esta se puede pagar en ventanilla de cualquier banco en México, o por medio de banca en linea de algunos bancos, por el momento se que la banca en linea de Banamex no permite pagarlos, pero la banca en linea de Bancomer sí. El problema es el tipo de ficha, SIPARE. Aquí info de SIPARE bancomer(SIPARE bancomer).

Si tengo Enfermedades preexistentes ya no puedo tener IMSS?

Esto depende de algunos factores como he explicado en los puntos anteriores. Pero se resume así.

1- Si estas inscrito y activo en el IMSS no lo perderás mientras sigas trabajando con un empleador formal o mientras lo sigas pagando.

2- Si tienes enfermedades preexistentes pero cumples el punto a) del modo 4 (Inscripción a la continuación voluntaria al régimen obligatorio). puedes recuperar tu afiliación al IMSS de manera voluntaria.

3- Si consigues un trabajo formal, que te de prestación de IMSS seras automáticamente afiliado por las cuotas de tu patrón.

Por desgracia, si tienes enfermedades preexistentes y no caes en alguno de los tres casos anteriores, probablemente no podrás alistarte.

Más vale prevenIMSS

La moraleja de la historia es la misma que con cualquier seguro, vuélvete derecho habiente antes de que envejezcas y te enfermes. Incluso sin trabajo formal, te puedes inscribir si estas sano y pagar tus cuotas voluntariamente.

El CACAS aka (AMLO) dijo que con el INSABI todo va a ser gratis.

El INSABI y Seguro popular son instituciones separadas del IMSS pero las mencionaré brevemente.

Como habrás escuchado en las noticias, AMLO creo el INSABI (Instituto de Salud para el Bienestar).

El INSABI sustituye al Seguro popular, y algunas de las diferencias con el seguro popular son estas.

1- El seguro popular tenía cuotas anuales, basadas en tu estrato socioeconómico. el INSABI, no, es completamente gratuito.

2- El Seguro popular cubría los niveles 1 y 2 de salud, y algunas enfermedades de nivel 3 (especialidades). el INSABI no cubre nada de nivel 3. Esto significa el INSABI no cubrirá, por ejemplo, enfermedades (prenatales, neonatos, varios tipos de cancer, varias enfermedades respiratorias y de sangre entre otras), que sí cubría el Seguro Popular. Más información acerca de los( tres niveles de salud en México). Más información acerca de las (diferencias de cobertura de INSABI y Seguro popular.)

Página oficial INSABI

El INSABI es un instituto nuevo, no se mucho de como se vaya a comportar en el futuro, pero por ahora, a mí parecer, tiene un futuro incierto.

Vivo en otro país, que debo hacer con el IMSS?

Si planeas nunca jamás volver, puede que no te tengas que preocupar por lo que pase con tu IMSS, pues puede que nunca lo utilices. Pero si un día planeas regresar, entonces yo recomendaría que vieras si puedes habilitar tu estado de manera voluntaria y que pagaras las cuotas correspondientes. Los trámites de inscripción voluntaria son abiertos para cualquier Mexicano sin importar en qué parte del mundo estés.

Vale la pena el IMSS? todos dicen que es muy malo.

El IMSS, como toda institución en México, no es perfecta, y ha pasado por varias reformas para mejorar su servicio y estado financiero. A pesar de sus problemas, sigue siendo el único medio de saludo para muchos mexicanos (el IMSS atiende a 6 de cada 10 mexicanos), ya que sigue siendo más barato y más permisivo que las opciones privadas. Inscribirse al IMSS de manera voluntaria no solo te permitirá a ti gozar de sus servicios en un futuro, sino que también ayudará a que se pueda prestar mejor servicio a la gente que actualmente depende de él.

LINKS

http://www.diputados.gob.mx/servicios/datorele/cmprtvs/iniciativas/Inic/136/2.htm#:~:text=Toda%20persona%20tiene%20derecho%20a%20la%20protecci%C3%B3n%20de%20la%20salud.

https://serviciosdigitales.imss.gob.mx/portal-ciudadano-web-externo/home/validar

https://www.animalpolitico.com/2017/11/imss-seguro-voluntario-adultos/

http://www.imss.gob.mx/derechoH/enfermedad-seguros-familia

http://www.imss.gob.mx/tramites/imss02030c

http://www.imss.gob.mx/tramites/imss02007

https://www.bbva.mx/personas/servicios-digitales/pago-de-impuestos/sipare.html

https://www.paho.org/mex/index.php?option=com_content&view=article&id=218:respuesta-sector-salud&Itemid=387

https://www.lja.mx/2020/01/66-enfermedades-dejaran-de-ser-gratuitas-en-el-insabi

https://www.gob.mx/insabi

http://www.imss.gob.mx/prensa/archivo/201807/191#:~:text=El%20Director%20General%20del%20Instituto,aumento%20de%20estudiantes%20y%20familias

https://businessinsider.mx/cotizacion-imss-como-seguir-cotizando-imss-perdi-trabajo/



thanks and Rest in peace FLASh

In every story, there is a point in time that sets a path in your life. In mine was in my puberty, set by a middle school teacher and was very brief.

Since elementary school we would always have some computer class around, in my case they would teach us to use word and those things. and then we would play random games. So was in my first year in middle school, nothing too exiting. By my second year in middle school they changed the computing class teacher, I vaguely remember due to some scandal. The new teacher was probably around 28 or 30, and he did tried to show us more than just word. so we started second year with HTML. again nothing more exiting than <marquee> lololol </marquee> .

However by 3th semester he taught us to use macromedia flash MX. Simple things, make animations and setup buttons. I remember the intro class was he showing us the capabilities of flash, he showed us a 3D video of a singing monster that was in no way made in flash but that is what he said and I believe him. Other whole class was learning the 4 stages of buttons, (Up, Over, Down, Hit), that was a hard one . Good times.

The final project of the year was to make an animation and, I don’t remember exactly how, he mentioned we would get a copy of the software by the end of the year, that was, if we made a good work. So then I used to go to the computer lab at lunch time to work on my animation. which was just a pool table with marbles rolling. I know, very lame haha. Is not that I started with that. I wanted to do a story of something but turns out drawing was not my strong point.

So let be it. I finished my pool table animation, and I got a copy of the software. Don’t ask me about the legitimacy of it. I hope is enough to say that later when I had money I did got a legit one.

Back at home, I started playing with the software on my own, making more animations. I used to find the form transformation interpolation fascinating, and I realized you could put music into it so I tried to make music videos. Kind of karaoke ones that have the letters dancing and morphing and moving. they were very cool. However my computer was rather slow, so they would go out of sync very quickly. Oh well.

Then I entered High School, there there was also a computing class, and again first semester was office and boring stuff. However at that point I realized that many of the games that I played in middle school in the computer class were actually flash games. so I got fixated on trying to figure out how to make them. So I started learning AS2. I know so old. but hey, it was easy.

I would make small animations and have small pieces of code here and there to manage events. At the time you could put random code almost anywhere. It sounds horrifying to today’s me, but back then it was cool.

There I did learn to program, with bad coding practices. learned the basic elements, (if, else, for) and the main loop function. I made a pacman game with AI (rudimentary) ghost and everything with only those, no functions. It was a lot of duplicated code. but it worked….. and consumed the whole processing time of the core so you better have a dual core.

Then by the end of programing pacman I learned about functions and refactored some parts. performance didn’t improve but there was a slightly smaller piece of crappy code.

Then I entered colleague and of course decided to pursue a BS in computer science. We started learning java, and the first classes were kind of easy since they would teach us again, (if else for) and functions, all of whom I was already able to craft into poorly written blobs of code, so, no big deal there.

Also by that time I got my hands into Flash 8, which came with AS3. coming from AS2 it was whole different thing. No more duck typing… Or at least less duck typing.

In colleague I did improve my flash programming skills. and my programming in general. And I would use flash in a lot of projects for school. In Flash it was relatively easy to handle graphics and would always have this wow effect compared to projects running on console. I also made several games there. mostly ripofs of something else, made a galaxian, mine sweeper, pong, and attempted to do racing and RPG games. At that time I remember there were some very impressive 3D racing games in flash and some very beautiful art projects on the internet.

Also by the middle of my undergraduate studies I got a small job making flash games, It was awesome, I would make like 400 USD a moth but for me that was cool, didn’t last long tho. The owner of the company disappeared after two months.

By that time, Steve Jobs declare war against flash, saying HTML was the future. At the time I find it hard to believe since everything ran on flash.

After that I interviewed for an internship at MSFT, didn’t made it but a friend of mine did, so I felt a bit sad and started to look for a part time job for the summer. Interestingly I found it in the news paper( I know, old school ), there were looking for flash developer as freelancer.

With that company I made 3 flash projects. they where Interactive disks for kids that where shipped with books, like math and grammar kind of things. I really enjoyed making those things. They would pay me like 1600USD to 2200 USD per project and it would take me like 4 months to make each. For me that was very good money, at the time my father would give me a monthly allowance of 120 USD so you make the math. It was at that point when I finally was able to afford my license. so I got Flash CS5 for 700 USD and I was happy. After all those years I finally had a legit version of this thing and I was really grateful at that time.

By the end of colleague I did got an internship at MSFT which was ok, I got to know Redmond and Seattle which was very cool, however I did not get the FT offer. I guess that is why was it just ok and not great, anyway. Back in Mexico I finally graduated and started to interview for full time jobs. Also, this was 2012, and the war against flash was heating up. I think was in that year that the fate of flash was finally wrote down. even tho it would take several years for it to go away.

In the meantime I started making the FABLE tool. Which was a box2d level editor, this time it was made in Adobe air and flex. Which really means, more flash and AS3. I spent 1 year solely making that tool and then I got hired at Oracle in Mexico. While at oracle I kept working on this tool and even got to used to make some OS books for kids.

That FABLE tool was probably my biggest project in flash and the last one, containing 60k lines of AS3. Then in 2016 I got a hired as FTE at MSFT in Redmond and stop development of the tool. I always intended to take it back and improve and implement a lot of cool features I had in mind but time passed and came January first 2020. Flash is dead, and adobe air and flex on life support. my project is pretty much obsolete, and yet , is hard to say good bye.

For me was probably a 17 years ride, along flash, learning, dreaming, and enjoying programing. I will miss their out of the box approach, that had everything working from start and the fact that you could mix and match animation, code and images in such a seamless way. Its reduced set of graphic capabilities with its reduced set of coding capabilities made it a nice playground for teenage me, and its evolution thru AS3, OOP, Air and FLEX made it a great tutor as I grew up. I have the feeling of flash being and old friend that grew with me and now has to say good bye. And is a bit sad to see him leave.

For excercises

TIK TOK CHINA exercise.

Create a JS program that gets a number from the user and then print the numbers from 0 to the number provided by the user and do the following calcuations.

1- if the number is divisible by 3 it should print TIK instead of the number.

2- If the number is divisible by 5 it should print TOK instead of the number.

3- If the number is divisible by 3 and 5 it should print CHINA instead of the number.

4- Use prompt to get the value from the user.

5- Use console.log to print the output to the console.

Examples of when user inputs 20

1
2
TIK
4
TOK
TIK
7
8
TIK
TOK
11
TIK
13
14
CHINA
16
17
TIK
19
TOK

2 cristmas tree

Write a program that receives a value from a user using prompt and draw a christmas tree using * and spaces with the same level of lines as the number inserted by the user.

Example when user inputs 5

    *
   ***
  *****
 *******
*********

3 Enigma machine

Create a program that can encrypt messages using the following rules

1-The program should ask if it needs to encrypt or decrypt

2- the program will receive a phrase in english in lower case

3. the program should replace the letters as follows table, (depending if is encrypting or decrypting.

4 any other character should remain unchanged.

q — aw — be — cr — dt — ey — f
u — g i — ho — ip — ja — ks — l
d — mf — ng — oh — pj — qk — r
l — sz — tx — uc — vv — wb — x
n — ym — z

example, if the program receives the string “cat” it should return “vke“. when encrypting

In the same way, if the program gets the string ‘vke’, it should return ‘cat’ if decrypting

NOTES:

if you have a variable string

var str = “hello”

you can get characters at specific part of the string with

str.charAt(2)

you can get the length of the string with

str.length

4 Roman Nightmare

Make a program that translates a number provided by the user between 1 and 399 and translates it to roman numbers.

Example when inserting 7 output should be VII

Example when inserting 399 output should be CCCXCIX

Example when inserting 159 output should be CLIX

Notes:, in roman numbers the following equivalences hold true

I = 1

V = 5

X = 10

L = 50

C = 100

III = 3

XXX = 30

III = 300

for loop basics

A for loop allows to execute a piece of code several times.

Example 1.0

for(var i =0; i<10; i++)
{
    console.log("I am printing this message 10 times");
}

If the previous code where to run in chrome we could see the following output in the console.

Basic structure of for loop

for(    INITIALIZATION     ;     CONDITION     ;    INCREMENT    )
{
           CODE
}

We have 4 main parts that build the for

  • INITIALIZATION: Executed only one time at all.
  • CONDITION: Executed before the code is executed. (executed several times)
  • CODE: Executed only if CONDITION is meet (executed several times)
  • INCREMENT: Executed after the code is executed. (executed several times)

The following diagram shows how the flow of a for is performed.

so in our original example 1.0 we could spread the parts of the for as follows.

for(var i =0; i<10; i++)
{
    console.log("I am printing this message 10 times");
}

NOTE THAT

  • INITIALIZATION executes only once.
  • the CONDITION will be executed as long as it is meet.
  • Every time the CONDITION is meet, the CODE and the INCREMENT will execute once.

Divoom Tivoo IC components (part 1)

Here we will discuss the electronic components that compose the circuit board of the Tivoo, in this first part we will just find what the components are and what they do.

Lets start with the screen

Tivoo screen back

Here we can see three main IC of the board

ICN2053 – 16-channel PWM

CHIPONE ICN2053BPA13115BB

Here you can see a link to this IC
http://www.xlix.ru/datasheet/ICN2053.pdf

ICN2012

CHIPONE ICN2012A9092EBF

Here you can see a link to this IC
http://wiki.amperka.ru/_media/%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D1%8B:rgb-led-matrix-64×32:icn2012_datasheet.pdf

This is basically a merge between TTL 74HC138 and 8 powermosftets.

F130G4 0 Microcontroller

F130G4CE80879AJ1746

Here you can see a link to what I think this IC is.
https://datasheetspdf.com/parts/GD32F130G4U6.pdf?id=976678

This IC is aparently from a company called GigaDevice, the IC have diferent naming, so may be a clone, Seems this IC was originally a GD32F130G4 from GigaDevice, the Die match at least in the shape. Also the logo looks like GigaDevice, I may be wrong tho.

Now lets jump to the Main board.

main board front Tivoo
main board front 2 Tivoo

Main board back Tivoo

This board have 5 major IC

XB8608A 8u1 – Lithium Battery Protection IC

XB8606A8u1

Here you can see a link of what I think is this IC
https://datasheet4u.com/datasheet-parts/XB8686E-datasheet.php?id=1243989

This IC seems to be a Once Cell Lithium-ion Protection circuit. The original IC seems to have been XB8686E from Sysemi I presume is similar to that link since the numbers kind of match and the way it is installed relates to the pdf. you can see the top 4 legs are unused, or in this case, maybe connected to the negative part of the battery altogether.

25Q127CSIG – Flash memory

AJ183025Q127CSIGU8A252

Here you can see a link to what I think is this IC
https://www.digikey.com/product-detail/en/gigadevice-semiconductor-hk-limited/GD25Q127CSIGR/1970-1027-1-ND/9484777

This IC seems to be Flash memory, the original IC seems to be GD25Q127CSIG

CS8326S B144 – Audio Amplifier

CS8326SB144

Here you can see a link of what I think this IC is
https://datasheetspdf.com/datasheet/CS8326S.html

FP8102 SAe-00L Li-Ion Battery Charger

FP8102Sae-00L

Here you can see a link to this IC
https://datasheetspdf.com/datasheet/FP8102.html

ANYKA AK1052DN048 GZSH04I18 Microcontroler/DSP

ANYKA AK1052DN048GZSH04I18

Here you can see a link to this IC
https://datasheet.lcsc.com/szlcsc/1904091402_NYKA-AK1052D_C383433.pdf

We will discuss the function of each of this ics in future post.

DIVOOM tIVO dISASEMBLY (teardown)

This Post will show my disassembly process as well as screenshot of main components and tips and tricks.

The main structure of the Tivoo is not glued, it consist of some snap locks and screws.

The first step is to remove the knobs, there are two knobs in the unit, those you just need to pull with a bit of force and they will slide of, they are held in place only by pressure and friction so very safe to remove.

Second step is to remove the plastic faceplate. This is the trickiest part, as the face plate is attached with latches.

In the next picture I highlighted the latches.

Tivoo Latches

To start disassembling the device, I started from the knob corner moving up using a guittar pick.

Using guitar pick to remove faceplate.

Once the faceplate is removed, the tivoo looks like this.

Tivoo without faceplate

After that the tivo screen is composed of 4 components.

*Glass
*Diffuser panel
*ligth mask
*led array

The following images is the device after removing the Glass

Tivoo without Glass

The following image is the device after removing the diffuser

Tivoo without deffuser

The following image is the device without the grid mask.

Tivoo without grid mask.

Here are the images of all the 4 components of the screen.

Tivoo glass, diffuser, mask and led display.

Here is other shot of the LED display turned off.

Tivoo LED display

To continue the disassembly process, we need to remove some 6 screws pointed in the next screenshot.

from this point the screen is just held in place by friction against some panne like material. to extract the screen I used one screw driver in one of the holes and pulled as follows.

removing led screen from Tivoo

After that you can just unplug the two wires, the big one is power and data, the small one is the microphone.

screen connected to Tivoo

Here is another picture of the main board of the screen. (The following picture is highRes so you can see the components.

In the case you can see the main battery (a lithium 18650 w 3000mah), the speaker and another board behind the battery (hard to see). You will also see other two screws that need to be removed to continue with the disassembly.

Screws inside assembly.

After that you can remove the inner assembly from the outer case.

Tivoo inner assembly and outer case.

Now to open the inner assembly you need to remove itehr 4 screws.

Inner assembly Tivoo screws

After that you will need to remove other three screws that attach the circuit boar to the assembly and unglue the battery.

To Remove the battery I just gently moved until the glue broke. Also note that the board itself have some of the same glue, so you will need to pull it gently until the glue gives up after removing the 3 screws from the picture.

Tivoo main board srews

Here you can see the board separated from the assembly.

main board Tivoo apart.

Next Here I add some high resolutions from the front and back of the circuit board.

Front side of board
back side of board.

That will be all in this entry, thanks

Note: to see high res in your phone you may need to switch to desktop site mode.

Divoom Tivoo Retro Non Destructive INSIGHTS

For Black Friday I ordered a Divoom Tivo, since I think the pixel art on it looks so cool. And also to learn about the workings of this little neat device.

Divoom Tivo Inside box

The device itself is very nice.

Tivo showing Mario Pixel Art

The grid of the screen is a 16×16 pixels, and the whole screen measures 579×509. you can see a mock of the configuration in the following sketch.

Mock of Tivo

The values in the above image are my measures with caliper and may be a bit of and the may not even add, but they give a nice approximation. (good enough for me at least).

GAL16V8 :3- 4 bit counter using macrocell

We will construct a 4 bit counter using the GAL16V8, but instead of constructing the latch like in the previous post, LATCHES, SR LATCH. we will use the builtin flip flop of the MACROCELL.

As a quick reference, a D type flip flop is a device that can store one value, like the SR LATCH, however the value will only be stored on the rising edge of the clock. In reality it does the change using both the rising and falling edge of the clock. You can have a deeper insight of its works with this video from Ben Eater. https://www.youtube.com/watch?v=rXHSB5w7CyE

When configuring a macrocell you need to describe the equations which based in the current state, will change the next state.

When configuring the D-Latch you need to think on how the next state will be reached based on the current state. We can think of it as current state, Q and next state QNext.

In a 1 bit binary counter, when Q is 0, the next state is 1. and when Q is 1, we overflow and the next state is 0. Making it effectively that QNext is !Q, such equation would look like this.

QNext = !Q;

Lets see what would be the truth table for this 1 bit counter.

QQ Next
01
10

Now, the second less significant bit, Q2, will have its next state based on two values, the value of Q and the value of Q2. For the rest of the examples we will call Q as Q1.

The first condition of Q2 is that it will change every time Q1 transitions from 1 to 0, or effectively, every time !Q1.

We can see that in the following truth table.

Q2Q1Q2NextQ1Next
0001
0110
1011
1100

Q2Next = (Q2 and !Q1) or (!Q2 and Q1)

In colloquial language this could be expressed as the following quote.

If Q1 is true, Q2Next will be complement of Q2, if Q1 is false, Q2 don’t change.

Now, the way to write this code in CUPL, to be able to progaram with our gal will be very similar, however CUPL does not have a QNext, instead it have a Q.d where d stands for DLatch. So our equation in CUPL will be like this for Q1 and Q2.

Q2.d = (!Q1 & Q0) # (Q1 & !Q0);
Q1.d = !Q0; 

We can follow the same analysis for the other 2 bits. If we decide to do so we could get a CUPL code similar to this one. This code also includes a clr input, to reset the counter to 0 at any time.

Name  CCCCCC;
 Partno XXXXXX;
 Date XX/XX/XX;
 Revision XX;
 Designer XXXXXX;
 Company XXXXXX;
 Assembly XXXXXX;
 Location XXXXXX;
 Device g16v8ms
 PIN 1 = clk;
 PIN 2 = clr;
 PIN 15 = Q0;
 PIN 14 = Q1;
 PIN 13 = Q2;
 PIN 12 = Q3;
 Q3.d = !clr & ((!Q3 & Q2 & Q1 & Q0) # (Q3 & !(Q2 & Q1 & Q0)));
 Q2.d = !clr & ((!Q2 & Q1 & Q0) # (Q2 & !(Q1 & Q0)));
 Q1.d = !clr & (!Q1 & Q0 # Q1 & !Q0);
 Q0.d = !clr & !Q0;

This would be the wiring diagram.

4 bit counter from aruduino

The clock is being generated by an arduino, but it could be generated by any means, including a 555 timer as long as is a square wave between 0 and 5 volts. (for this circuit that is being powered by 5V).

Also here we can see the the circuit assembled in action, I added a small yellow led to see the state of the clock.