Shop OBEX P1 Docs P2 Docs Learn Events
Assembly: Can bad programming damage hardware? — Parallax Forums

Assembly: Can bad programming damage hardware?

RedNifreRedNifre Posts: 84
edited 2009-01-19 01:27 in Propeller 1
Hello there!

I plan to learn propeller assembly language so I can write a video driver for my Hydra console. The thing is this: I'm a software-guy. I never did any low level stuff or anything hardware-related. So I guess I have a lot of superstitions about low level programming.

1. How hard is it to learn assembly language, if you already know high level languages?
2. Is it possible to damage the Hydra or my TV with bad programming/signal generation etc.? (My TV is relatively new)
3. Lets say I want to fill the entire screen yellow (just for practice). How hard would it be to write an assembly program that does this?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Unterwelt (My first game for the HYDRA):
http://forums.parallax.com/showthread.php?p=696204

Hydra in a LEGO NES:
http://forums.parallax.com/showthread.php?p=654788

Comments

  • Parallel UniverseParallel Universe Posts: 46
    edited 2008-10-27 22:51
    1. I·don't think it's·too hard,·it just takes more step to get some things done, and you have to think about timing of code execution (which is really easy on the propeller).·Be warned that the Prop can't multiply or divide natively in assembly.
    2. I don't know, but I don't think it's likely. My old CRT was just fine with a bunch of random signals
    3. Check out the 50-line grapics driver: http://forums.parallax.com/showthread.php?p=735672. I didn't understand NTSC until I started playing around with it. The HYDRA book really helps too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·</Parallel Universe>
  • epmoyerepmoyer Posts: 314
    edited 2008-10-31 05:38
    Don't worry; there's no way to damage an NTSC monitor or TV by anything you can make the Hydra do on the NTSC output in software. In general, any NTSC signal which stays withing the normal NTSC voltage range can do no physical damage.

    If you were driving a vector display (the kind of display where you have direct control over the electron beam) you can do potential damage by directing the beam at one location for an extended period of time and burning the phosphor in a small area. An NTSC monitor/tv doesn't give you direct control of the beam, so you can't make it do anything damaging. All you do with bad code is make ugly video, so fire away!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The World's First Open Source Guitar Pedal:··http://www.OpenStomp.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-10-31 19:00
    The only way I can think of to damage your system due to improper programming is if you have external components which are sending a signal to the Propeller and you program the Propeller so it is driving the line as well. This conflict can cause a large amount of current to flow through·the chips damaging one or both of them. But doing things such as placing a resistance in line will prevent such programming mistakes from damaging components.

    LCDs can be really finicky about the timing of thier signals and the Prop's output·will look horrible, but I've never seen any situation where anything was damaged.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Parallel UniverseParallel Universe Posts: 46
    edited 2008-11-01 01:35
    If the edges of your graphics look shaky on an LCD, sometimes it helps to decrease the sharpness control if their is one.

    Also, from my experience with programming video, most new TV's (LCD and CRT)·don't care what you do during the vertial sync period.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·</Parallel Universe>
  • potatoheadpotatohead Posts: 10,261
    edited 2008-11-07 18:17
    When doing some driver re-writing for KABOOM! this weekend, I ended up using an older CRT TV. (My capture device crapped out [noparse]:)[/noparse] I'm pretty sure I did some damage to the flyback transformer! What happened was I had sent the wrong sync. Frame rate was a bit fast as well, because of that. Heard a hissing and a nice *POP*, *POP*, *CRACKLE* and I just hit the off switch, waited, turned it back on with a known good signal, and now the TV has a low hiss always! I came close to letting the magic smoke out.

    I suspect an electrical path has been created from a spark jump across dust or some other thing. That was probably from transient higher voltages, or somebody here who knows way more than I do can tell us, that exceeded the conductivity barrier normally good enough to prevent things like this from happening.

    Probably time to whip out the silicone and try to close that path down, or just let the older CRT go die a peaceful death. I've used the silicone back a number of years ago, on older TV's to get a few more years out of what was otherwise a good set, but got too dusty...

    So, I think stuff can happen through programming, but only for those devices where touchy analog elements are present. A newer LCD, or CRT very likely has these danger conditions filtered out before they do damage. Older gear was just trusting and really, there was little potential for bad signals anyway.

    Plus an LCD just doesn't have those conditions inherent in it's design in the first place. Agreed on no harm done with poor / out of spec signals.

    Edit: I kind of like older analog display devices, because they will just display what you send them, and they do it quick! That helps see problems and such, and that is a help when no scope is available. (One is on my xmas list, trust me! Video things are so much better with one, than without.) This experience was kind of a bummer...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!

    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net

    Post Edited (potatohead) : 11/7/2008 6:22:41 PM GMT
  • RedNifreRedNifre Posts: 84
    edited 2008-11-09 11:42
    Thanks for all the info!

    As soon as I have time I'll learn how to write a graphics driver in assembly.
    If you never hear from me again I probably made a programming mistake that made my Hydra create a black hole.

    Wish me luck! [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Unterwelt (My first game for the HYDRA):
    http://forums.parallax.com/showthread.php?p=696204

    Hydra in a LEGO NES:
    http://forums.parallax.com/showthread.php?p=654788
  • BaggersBaggers Posts: 3,019
    edited 2008-11-09 12:22
    good luck RedNifre, and have fun [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • OwenSOwenS Posts: 173
    edited 2008-11-09 18:06
    Must have been an old set you damaged Potatohead.

    Modern CRTs (And LCDs) are bomb proof; in fact the only things that aren't any more are raw LCD panels, which bad timing can cause to boil
  • potatoheadpotatohead Posts: 10,261
    edited 2008-11-09 19:47
    Yeah, it was. Thought I would post it up though. Never know what people are hacking on / with!

    It's an 80's era Zenith. Silicone worked and the thing is quiet again. I'll just be a bit nicer to it going forward. Don't know about others here, but I'll often go scrounging through the thrifties looking for stuff I can cannibalize, or just use. The Zenith is a little 7" CRT and it's got great color and a very nicely converged tube. I kind of liked it, and it was only $5. I did take it apart and modify the yoke position some to get a 5" square, full NTSC frame for testing. Don't think that was the cause, but it's why I snagged it in the first place. Many CRT's from that era are just easy to modify in that fashion.

    That took a day of move the yoke, fiddle with the little inductive adjustments, then converge with patterns from the propeller to get done, but now I've got a nice little full-frame monitor that lets me see what is happening in the overscan.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!

    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
  • potatoheadpotatohead Posts: 10,261
    edited 2008-11-09 21:11
    If it were me, I would use a capture device for initial driver development. I've had good luck with the little, cheap USB ones. Be sure and get one with s-video capability. They will accept a lot of goofy and outta spec signals, and that let's you debug with a bit more freedom than I think you get with just a display device.

    A scope is golden, get one of those if you can. They are not all that hard to learn to use. I think you can use a sound card software scope for video stuff too. Been wanting to try that actually.

    Anyway, the capture devices do have a latency and do some processing on the image. That's tough for moving objects and such, but for the core driver dev, it's no biggie. Recording short movies can let you see frame glitches and other wierdnesses, and seeing the full overscan is nice too. The s-video option is good for seeing the video minus the color. It's possible to see the actual color sub-pixels and to tell if interlacing and such is working properly.

    On my first driver project, I used a very tolerant SONY TV, and it worked well. It was a PITA to see transient effects though. When I started with a capture device, things progressed much faster, and I'm sure it came down to being able to just step through the frames to see what happened exactly, and when.

    I like to use a real CRT for fine tuning. One example of this is keying motion to the vertical blank. My capture card never does show a solid moving object. There always seems to be some signal processing between me and the graphics. Not sure what that is. Probably de-interlacing and poor sync between the computer display and such. I find working with a nice, simple CRT to be clean and clear in this respect. Some newer LCD displays won't always display things too. One example seems to be non-vertically interlaced NTSC signals. The standard calls for a half-line to be displayed so that the vertical timing puts the scan lines of even frames in a different place on the display, compared to the odd frames. Most early computer gear used this kind of display to cut flicker and to make good use of limited RAM and overall graphics throughput.

    Some of the LCD devices I own, have trouble with these displays. [noparse]:([/noparse] Others do it just fine.

    I'm lucky enough to own a newer plasma set. (was an early Xmas gift) That thing does a lot of processing on analog NTSC signals, and it acts a whole lot like the capture card. I don't like it all that much, unless it's getting a digital display (HDMI, encryped to the max, closed $(*^&#@$(%*^$%!), making it somewhat lousy for this kind of thing. I've noted between frame pixel artifacts on what should be clean and clear images. Haven't had time yet to send it a bunch of test signals, but I'm going to someday. An example of this would be some text changing. Say it's the letter A on one frame, and the letter H, on another. What I end up seeing is the A, then A plus some of H, then H over maybe three frames. With DVD movies, this works ok, because the frame rate is only 24 frames / second. Don't notice it at all. On 60Hz non-interlaced displays, I see it clearly.

    Dang, this post is getting long. Sorry!

    To sum it up, I think there is a difference between the core driver functionality, which is sync, color, pixel size, etc... And what happens with that driver, which is the actual graphics over time. Better to use a CRT for the moving stuff, and the capture / LCD for the core signal, IMHO. I would add to that using a baseband (composite) input, not a rf-modulator. Those things can introduce artifacts at both the core signal level and the pixel level.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!

    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
  • JimPishloJimPishlo Posts: 6
    edited 2009-01-19 01:27
    I once had a teacher tell us, "Nothing you enter through the keyboard can cause permanent damage to your hardware." I soon proved him wrong when I spilled lemonaide on my keyboard... lol.gif
Sign In or Register to comment.