Saturday, February 28, 2009

Here is some old code for you...

The Apple ][ computer didn't have super fancy graphics.  They had a portion of memory mapped to the graphic screen.  Since I don't really feel like trying to explain it here because others have done it far better than I could read this: http://en.wikipedia.org/wiki/Apple_II_graphics   Specifically the Hires Graphics section.

Now, I had a need to be able to scroll the Hires Screen left or right.  Thanks to a series of articles by David Lubar in Creative Computing called The Graph Paper (October 1982 -> March 1983) and an article called Lookup Tables (March 1982) I had a very good understanding of how each byte in memory made up the picture that was displayed so I wrote the following code using the SC Macro Assembler.  This version of the code did the scroll left.

The 'Lookup Table' allowed me to access each line of the hires screen directly and in order (since the screen was 'interlaced').

BTW, comments are for losers. :)

1000        .OR $6000
1010        .TF SCROLLLEFT
1020        .LIST OFF
1030        JMP HERE
1040 TABLHI .HS 2024282C3034383C
1050        .HS 2024282C3034383C
1060        .HS 2125292D3135393D 
1070        .HS 2125292D3135393D
1080        .HS 22262A2E32363A3E
1090        .HS 22262A2E32363A3E
1100        .HS 23272B2F33373B3F
1110        .HS 23272B2F33373B3F
1120        .HS 2024282C3034383C 
1130        .HS 2024282C3034383C
1140        .HS 2125292D3135393D 
1150        .HS 2125292D3135393D
1160        .HS 22262A2E32363A3E
1170        .HS 22262A2E32363A3E 
1180        .HS 23272B2F33373B3F
1190        .HS 23272B2F33373B3F
1200        .HS 2024282C3034383C 
1210        .HS 2024282C3034383C
1220        .HS 2125292D3135393D
1230        .HS 2125292D3135393D
1240        .HS 22262A2E32363A3E 
1250        .HS 22262A2E32363A3E
1260        .HS 23272B2F33373B3F
1270        .HS 23272B2F33373B3F
1280 TABLLO .HS 0000000000000000
1290        .HS 8080808080808080
1300        .HS 0000000000000000
1310        .HS 8080808080808080
1320        .HS 0000000000000000 
1330        .HS 8080808080808080 
1340        .HS 0000000000000000
1350        .HS 8080808080808080
1360        .HS 2828282828282828
1370        .HS A8A8A8A8A8A8A8A8
1380        .HS 2828282828282828
1390        .HS A8A8A8A8A8A8A8A8 
1400        .HS 2828282828282828 
1410        .HS A8A8A8A8A8A8A8A8 
1420        .HS 2828282828282828 
1430        .HS A8A8A8A8A8A8A8A8 
1440        .HS 5050505050505050
1450        .HS D0D0D0D0D0D0D0D0
1460        .HS 5050505050505050 
1470        .HS D0D0D0D0D0D0D0D0 
1480        .HS 5050505050505050 
1490        .HS D0D0D0D0D0D0D0D0
1500        .HS 5050505050505050 
1510        .HS D0D0D0D0D0D0D0D0 
1520 HERE   STA $C050 
1530        STA $C057
1540        STA $C054
1550        STA $C052
1560        LDX #$00
1570 A7     LDA TABLLO,X  
1580        STA $F0
1590        LDA TABLHI,X
1600        STA $F1
1610        CLC
1620        LDY #$27
1630 A6     LDA ($F0),Y
1640        ROL
1650        BCC A1
1660        ROR
1670        BCC A2
1680        SEC
1690        ROR
1710        JMP A3
1720 A2     ROL
1730        CLC
1740        ROR
1750        SEC
1760        ROR
1770        JMPA3
1780 A1     ROR
1790        BCC A4
1800        ROL
1810        SEC
1820        ROR
1830 A4     ROR
1840 A3     STA ($F0),Y
1850        ROR
1860        DEY
1870        BMI A5
1880        ROL
1890        JMP A6
1900 A5     INX
1910        CPX #$C0
1920        BNE A7
1930        RTS

And the code to scroll right looks like this:

1000        .OR $6000
1010        .TF SCROLLRGHT
1020        .LIST OFF
1030        JMP HERE
1040 TABLHI .HS 2024282C3034383C
1050        .HS 2024282C3034383C
1060        .HS 2125292D3135393D 
1070        .HS 2125292D3135393D
1080        .HS 22262A2E32363A3E
1090        .HS 22262A2E32363A3E
1100        .HS 23272B2F33373B3F
1110        .HS 23272B2F33373B3F
1120        .HS 2024282C3034383C 
1130        .HS 2024282C3034383C
1140        .HS 2125292D3135393D 
1150        .HS 2125292D3135393D
1160        .HS 22262A2E32363A3E
1170        .HS 22262A2E32363A3E 
1180        .HS 23272B2F33373B3F
1190        .HS 23272B2F33373B3F
1200        .HS 2024282C3034383C 
1210        .HS 2024282C3034383C
1220        .HS 2125292D3135393D
1230        .HS 2125292D3135393D
1240        .HS 22262A2E32363A3E 
1250        .HS 22262A2E32363A3E
1260        .HS 23272B2F33373B3F
1270        .HS 23272B2F33373B3F
1280 TABLLO .HS 0000000000000000
1290        .HS 8080808080808080
1300        .HS 0000000000000000
1310        .HS 8080808080808080
1320        .HS 0000000000000000 
1330        .HS 8080808080808080 
1340        .HS 0000000000000000
1350        .HS 8080808080808080
1360        .HS 2828282828282828
1370        .HS A8A8A8A8A8A8A8A8
1380        .HS 2828282828282828
1390        .HS A8A8A8A8A8A8A8A8 
1400        .HS 2828282828282828 
1410        .HS A8A8A8A8A8A8A8A8 
1420        .HS 2828282828282828 
1430        .HS A8A8A8A8A8A8A8A8 
1440        .HS 5050505050505050
1450        .HS D0D0D0D0D0D0D0D0
1460        .HS 5050505050505050 
1470        .HS D0D0D0D0D0D0D0D0 
1480        .HS 5050505050505050 
1490        .HS D0D0D0D0D0D0D0D0
1500        .HS 5050505050505050 
1510        .HS D0D0D0D0D0D0D0D0 
1520 HERE   STA $C050 
1530        STA $C057
1540        STA $C054
1550        STA $C052
1560        LDX #$00
1570 A7     LDA TABLLO,X  
1580        STA $F0
1590        LDA TABLHI,X
1600        STA $F1
1610        CLC
1620        LDY #$00
1630 A6     LDA ($F0),Y
1640        ROL
1650        BCC A1
1660        ROL
1670        BCC A2
1680        SEC
1690        ROR
1700        SEC
1710        BCS A3
1720 A2     SEC
1730        ROR
1740        CLC
1750        BCC A3
1760 A1     ROL
1770        BCC A4
1780        CLC
1790        ROR
1800        SEC
1810        BCS A3
1820 A4     CLC
1830        ROR
1840        CLC
1850 A3     STA ($F0),Y
1860        ROR
1870        INY
1880        CPY #$28
1890        BEQ A5
1900        ROL
1910        JMP A6
1920 A5     INX
1930        CPX #$C0
1940        BNE A7
1950        RTS

The code is very close but there are some important differences (like line 1620, 00 starts on the left of the line and #27 starts on the right of the line).

Now, you may ask, Why did I bother posting this?  Because I could and I felt like sharing.  I do have some old notebook pages I found with some hand written code on them that I'm going to scan in and post here at some point in the near future.

A Definition? Maybe later...

So, a number of years ago, I was in this writing class and the assignment was to pick a word and write a creative definition for it. Below is what I submitted (which got me a "Clever! 4.0" out of a possible 4.0 points)


A definition? Maybe later...
By Me

Possibly the most destructive activity in the U.S.A today.

Requires little to no effort to be effective.

One can do it any time of the day or night.

Creative methods can be used to justify the results.

Rarely can one escape once the habit is formed.

Always easier to allow it to continue than to reverse it effects.

Students learn it in school from their classmates.

Teachers despise it for they are aware of its destructiveness.

Into the blackness time is cast.

No reason is too small to allow its propagation.

Anyone may be its slave.

Tomorrow will be different but that can wait.

I am caught in its eternal web.

One has only to do nothing to participate.

Not until I become the master will its grip be broke.

Procrastination, the act, tendency or habit of postponing.

Ah, the old days...

So, long ago I was deep into Apple ][ computers. I could hand code assembly directly into the monitor (until I got my hands on SC Macro Assembler).. A time when Boot Code tracing was the best way to get into the guts of a game and when windows were things you looked out of.

My buddy and I would figure out some cool piece of code and then share it. Each of us trying to be better than the other.

Once I figure out an easy way to link to some of the stuff we wrote, I'll post links to .bin files that will run in any Apple ][ emulator. Sure, its not up to today's standards but for the time it was pretty cool (20+ years ago!).

I miss the simplicity of the code & operating systems. Today's OSes just have way too much bloat.
Ah well... everything must pass to dust eventually

Thursday, February 26, 2009

I'm not the man you think I am...

So, this isn't something that I really enjoy. I've never been one to write my thoughts down, mostly because I thought it was a bit on the 'fruity' side but also because I don't like to leave a paper trail ;)

I've never had alot to say in the public as I've always been a private guy. When I do share my thoughts its with my friends and family.

So, now you ask, why the heck am I here doing it now? Why should you listen to me? What could I possibly have to say?

The short answer: Nothing so go away.

The not short but not long answer: I don't feel that I have anything really important to say. I just needed a place to vent, but also a place to write down some of the ideas I have so that when someone comes out with a product that uses my idea I can say SEE! I thought of that YEARS ago... :)

What You'll find here: From time to time I will post my frustrations. I'll post ideas that I think are cool. I might even post some code here and there (new, old, moldy, in any language I find amusing).

If you don't like what I have to say, too bad, deal with it, or just go somewhere else. I don't want to hear your thoughts on my thoughts. If I want your opinion, I'll give it to you.

Why that title and description?

"Pentium Prime"

This title came from the old days when I had a Dual P90 running Windows NT. I was on IRC and I saw alot of people that had a message display when they left. So I thought to myself, what the heck could I say that sounded cool? I came up with "And the sun sets on Pentium Prime, hopefully to rise again...". Pentium Prime referring to the Dual P90, which at the time, was an awesome box. I guess I just always liked the sound of it.

"From our minds to your brain, whether you like it or not."

If you haven't figured it out, I'm being condescending to you, the reader. :) I'm implying that while we the authors have Minds (implying that we are highly intelligent, which of course we are), you the reader just have a brain (which allows you to breath but not think very well). If you don't like the implication, we don't really care. Hey, its all in fun right? If you can't have fun, then there is no point in existing.
Copyright Realm Laboratories, LLC