Jump to content
paladina

BASIC PMG

Recommended Posts

My ..., what a wild post.

 

100 DATA 72,173,80,6,24,105,16,141,80,6,141,10,212,141

105 DATA 26,208,201,240,208,5,169,0,141,80,6,104,64

 

OK, this is easy one:

Disassemble with me.

Step  1: 72         = "PHA"                      
Step  2: 173,80,6   = "LDA (absolute) (80,6)"
Step  3: 24         = "CLC"
Step  4: 105,16     = "ADC (immediate) #16"
Step  5: 141,80,6   = "STA (absolute) (80,6)"
Step  6: 141,10,212 = "STA (absolute) (10,212)"
Step  7: 141,26,208 = "STA (absolute) (26,208)"
Step  8: 201,240    = "CMP (immediate) #240"
Step  9: 208,5      = "BNE 5"
Step 10: 169,0      = "LDA (immediate) #0"
Step 11: 141,80,6   = "STA (absolute) (80,6)"
Step 12: 104        = "PLA"
Step 13: 64         = "RTI"

 

Now, an explanation:

 

Realize: DLI is an interrupt. So, save contents of ACC (=accumulator) register onto stack. Thus:

 

Step 1: Is needed to save ACC to stack (PHA = "PusH Accumulator")

Step 2: Equivalent to basic: ACC=PEEK(80+256*6)

Step 3: CLC: CLear Carry flag: needed to prepare for 'add with carry procedure': Carry bit C=0 (part of status register).

Step 4: ADC #16: adds 16+C=16+0=16 to contents of ACC, stores result back in ACC.

Step 5: Equivalent to basic: POKE 80+256*6,ACC

Step 6: Equivalent to basic: POKE 10+256*212,ACC

...This is the MAGIC COMMAND: This is needed to synchronize the routine to 'end of mode-line'.

...The number of ACC does not really matter here.

Step 7: Equivalent to basic: POKE 26+256*208,ACC

Step 8: Compares value of ACC with value 240, the result of the comparison is stored in the CPU status register (called P)

Step 9: BNE 5 means: skip next 5 bytes if comparison was not equal.

Step 10: Equivalent to basic: ACC=0

Step 11: Equivalent to basic: POKE 80+256*6,ACC ((---this was the last action of the DLI: Now end it---))

Step 12: Is needed to get back the saved value of ACC from stack (PLA = "PuLl Accumulator")

Step 13: RTI = "ReTurn from Interrupt".

 

Memory Addresses used:

80+256*6=1616 = variable used by the code

26+256*208=53274 = Hardware register (related to shadow register 712): Background colour register

10+256*212=54282 = "WSYNC" (Wait for synchronization).

 

This programm is equivalent to the following in basic: Here Step 1 is ignored, and Step 12&13 are just END:

1000 ACC=PEEK(1616) 
1010 ACC=ACC+16
1020 POKE 1616,ACC
1030 POKE 54282,ACC
1040 POKE 53274,ACC
1050 IF ACC<>240 THEN GOTO 1080
1060 ACC=0
1070 POKE 1616,ACC
1080 END

 

Thus:

Line 1000 is equivalent to step 2

Line 1010 is equivalent to step 3&4

Line 1020 is equivalent to step 5

Line 1030 is equivalent to step 6

Line 1040 is equivalent to step 7

Line 1050 is equivalent to step 8,9

Line 1060 is equivalent to step 10

Line 1070 is equivalent to step 11

Share this post


Link to post
Share on other sites

...or, maybe another (basic) representation of the same code...

 

1536 REM STEP 1 = "PHA"
1537 ACC=PEEK(1616):REM STEP 2
1540 C=0:REM STEP 3
1541 ACC=ACC+16+C:REM STEP 4
1543 POKE 1616,ACC:REM STEP 5
1546 POKE 54282,ACC:REM STEP 6
1549 POKE 53274,ACC:REM STEP 7
1552 Z=(ACC=240):REM STEP 8
1554 IF Z=0 THEN GOTO 1561:REM STEP 9
1556 ACC=0:REM STEP 10
1558 POKE 1616,ACC:REM STEP 11
1561 REM STEP 12 : "PLA"
1562 REM STEP 13 : "RTI"
32767 END

Share this post


Link to post
Share on other sites

WAUU...HOLY S..STARGUNNER ;) foo..hard to learn...but I probe...ok,...question Stargunner...is it possible via any interrupt do more colors in one row? I think this.

1.draw picture GR15 with 3 colors + 1 background

2.DO INNTERUPT PROGRAM that change some of this 3 colors in one row, BUT from here to there...only any position of the row? ok...?

3.And finaly after this picture use PGM...but for other things...

 

Can you help me more STARGUNNER Please? you are relly good :D

 

thx. Paladina.

Share this post


Link to post
Share on other sites

Found an article on DLIs here Computes 2nd Book of Atari

 

I don't think excessive quantities of mead and learing to program DLIs is a good mix, on second thoughts, maybe I should try it ;)

 

I think if you need a lot of scanline changes every scanline, better to go for a kernel and do other stuff in it. Otherwise, you waste a lot of time doing 141,10,212 (STA WSYNC) every scanline.

Share this post


Link to post
Share on other sites

Hello all.

 

I was just thinking and seeing this picture before I went here.

I saw this right now on Fandal's site:post-6517-12594202792_thumb.png

 

The nº2, 3Graphic modes/GTIA bug several times explained in many places, but the top one, if no PMs. what metod is there? I don't see any flicker so I think it's not use of more than 1charset (like super IRG), so what is this?

Share this post


Link to post
Share on other sites

not easy to find a threasure...but mayby I find anything...but who can this? Ok...GR15 has 3 colors (708,709,710) + backround (712)...the QUESTION...where is the 711??? I think its as invert color or soo..ok..who can help me now to do in basic or turbobasic little example how to use this 711... to next color in my pictures?

 

Ok, there is program from Poland,you know GRAP2FONT and it USE the 5th COLOR - 711...but how I use it in simple basic or turbobasic programs?

 

10 GR.15

20 POKE 710,30:COLOR 3

30 PLOT 10,10:DRAWTO 20,20

40 POKE 711,60: COLOR ???

50 PLOT 20,20:DRAWTO 30,30

100 GOTO 100

 

OK...how do this example correct for color 711 ??

 

Thx.

post-24943-125951908703_thumb.jpg

Share this post


Link to post
Share on other sites

I don't think that color register is available in bitmap mode - that's another one of the advantages to the char mode. Besides lower mem usage, you get the 5th color.

 

Stephen Anderson

Share this post


Link to post
Share on other sites

not easy to find a threasure...but mayby I find anything...but who can this? Ok...GR15 has 3 colors (708,709,710) + backround (712)...the QUESTION...where is the 711??? I think its as invert color or soo..ok..who can help me now to do in basic or turbobasic little example how to use this 711...

G2F uses basic mode 12 which is a character mode rather than the bitmap mode Graphics 15. The pictures are made up from multiple fonts hence the name graph2font. Graphics 12 mode enables the use of the 5th colour (register 711) by adding the value of $80 to any char which contains colour 710 or in simpler terms, an inversed character. This means that the 4th and 5th colour of course cannot be together in the same character so the colour usage must be carefully thought out.

Share this post


Link to post
Share on other sites

I don't think that color register is available in bitmap mode - that's another one of the advantages to the char mode. Besides lower mem usage, you get the 5th color.

 

Stephen Anderson

 

If you set bit 4 of 53275 then the missiles use that color register (711). Also, if you switch GTIA to non-gtia in graphics 8, then 708..711 are used for the 4 colors and the border uses the 5th color (712).

Share this post


Link to post
Share on other sites

A very simple basic program to see the 5 colour in Graphics mode 12...

 

10 GR.12+16

20 ? #6;CHR$(69)

30 ? #6;CHR$(197)

40 GOTO 40

 

Character 69 is the capital letter E

Adding $80 (or 128 in decimal) to the 69 is an inversed capital letter E.

 

You will see the capital E character printed top left and below this the capital E character inverted showing the 5th colour

Edited by Tezz

Share this post


Link to post
Share on other sites

Vau...that super...ok... lets next...G2Font has 2x1 - Graphics 15 Basic mode, max. 192x240, 4 colors + 5th color with chars (inverse). Ok..for this little example other... how can I combine GR 15 + 12 to become ploting and do 5 colors? thx.

Share this post


Link to post
Share on other sites

But how can I change..please any exaple...its better. thx.

 

Hey guy!

 

I tried to explain you many things for hours but you still don't listen to me.

 

So once again: if you want more colors or more sprites you must use DLI. And if you want to use DLI, you must be able to program in ML. Moreover, you must understand how Atari works.

 

F.

Share this post


Link to post
Share on other sites

Hello all.

 

I was just thinking and seeing this picture before I went here.

I saw this right now on Fandal's site:post-6517-12594202792_thumb.png

 

The nº2, 3Graphic modes/GTIA bug several times explained in many places, but the top one, if no PMs. what metod is there? I don't see any flicker so I think it's not use of more than 1charset (like super IRG), so what is this?

 

Probably an accurate cycle timed routine which can change colours/modes at the same X position on each line. You just need to ensure each scanline uses the same number of cycles and if you're in a mode (character modes) that uses more DMA every 8 lines, take that into account as well. (yes there are other ways apart from counting cycles every line)

 

 

Pete

Share this post


Link to post
Share on other sites

Yeah I listen...but I am begginer...and I will find any easy way to do more colors or somebody who do easy library that can use every one....understand? If you can programmed DLI and ML you can help me..hm? whats ate the way of ATARI? can do any vertical interrupt that I become more colors in one line? without using PMG...that can I use for other things...for next colors...hm..but how can I copy on one line one player..hm.. easy mathematic... line Gr15 160 pixels, in this come 3 basic colors and backgrounds, next is the combination of the 5th color as charaters invers (G2Font example), next colors are from the PLAYERS 0-3 and MISSLES (Grapf2Font)...ok...its one pixel line or row...for next I can via display list interrups do on NEXT LINE others color for eye moment...ok...and finali I can du VERTICAL inteerupt to become other grafic mode with next colors... ( example of the king ). dont say this or this...help us with examples... its better any example as listen..I see many sites and read some books...but not find anything that I can understand...or do this grafic projeckt library... uf..ok...I listen and wait for your examples..you know the Atari better as I, but I need help..much more...ok..then PLEASE HELP with OWN EXAMPLES thx. Atari fun from childhood :P

Share this post


Link to post
Share on other sites

In each character you define in Graphics 12 mode, 2 bits are used to select the colour registers for each pixel which is why the characters are 4 low res pixels wide by eight pixels high.

 

So those posible bit combinations are as follows..

 

00 colbak 712

01 color0 708

10 color1 709

11 color2 710

11(inv) color3 711

 

so for example...

 

00000000 would be a line four pixels across of colbak (or in other words, a blank line)

01010101 would make a solid line four pixels across of colour0

10101010 would make a solid line four pixels across of colour1

11111111 would make a solid line four pixels across of colour2

11111111 inverted would make a solid line four pixels across of colour3

Share this post


Link to post
Share on other sites

Hello all.

 

I was just thinking and seeing this picture before I went here.

I saw this right now on Fandal's site:post-6517-12594202792_thumb.png

 

The nº2, 3Graphic modes/GTIA bug several times explained in many places, but the top one, if no PMs. what metod is there? I don't see any flicker so I think it's not use of more than 1charset (like super IRG), so what is this?

It is possible to change the colour registers mid scanline with cycle exact timing. This is not possible (to any great degree) in a game environment however as there is too little cpu time left to use it freely. Another issue with this is in character modes where it will produce a "badline" on the first scanline of each character row that it is applied to which occurs when Antic fetches the address of chbase in the dli so the colour change does not take place on the first scanline. In static pictures such as title screens/loading pics, you can overcome this issue using player underlays and/or altering the dli with a lot of careful forethought. For other examples, I used mid scan line changes in the Boulderdash II intro animation and also the BombJake title screen amongst others. Edited by Tezz

Share this post


Link to post
Share on other sites

Ok boys... thinks this is the atari MAXIMUM... 16 COLORS in ONE LINE! Its about the inverse technic with interrups and other...Idont understand how...but you see its possible.. well... in grafic 12.. 40 x 24 - 160 * 192 as gr12..but in this grafik is no line..then...whats now...I have only 128 characters...is possible to do on screen one place for graphics of characters with pic and via interrupt change to basic character bank to draw standart text? or so.. hm..Idea.. one set bank in GR12 for playerscreen and second for text..possible?

post-24943-125952555965_thumb.jpg

post-24943-125952556646_thumb.jpg

XEX16.zip

Share this post


Link to post
Share on other sites

Ok boys... thinks this is the atari MAXIMUM... 16 COLORS in ONE LINE! Its about the inverse technic with interrups and other...Idont understand how...but you see its possible.. well... in grafic 12.. 40 x 24 - 160 * 192 as gr12..but in this grafik is no line..then...whats now...I have only 128 characters...is possible to do on screen one place for graphics of characters with pic and via interrupt change to basic character bank to draw standart text? or so.. hm..Idea.. one set bank in GR12 for playerscreen and second for text..possible?

 

No, maximum is every pixel can be different color in GTIA modes but if you are looking at 160*240 mode, then maximum (without doing interlace) is more than 40 colors/scanline using GPRIOR mode 0.

Share this post


Link to post
Share on other sites
...but if you are looking at 160*240 mode, then maximum (without doing interlace) is more than 40 colors/scanline using GPRIOR mode 0.

In theory, but not in practice.

 

Without mid-scanline register changes, the maximum with GPRIOR 0 is 23 colours.

However, we could change some palette values on the fly,

but then you'd also need to reposition ALL the PMs on the fly,

just to be sure you have maximal usage of the GPRIOR features.

That's slightly too much for poor little Atari I'm afraid.

 

...but, the idea is still interesting.

We could come close to 40 colours per scanline I think. Maybe 32 or 35. (first guess)

 

(or do you have some example pic?)

Edited by analmux

Share this post


Link to post
Share on other sites

At start of this TOPIC a give file DOC.ZIP, look STARGUNNER for his please... the maximum of colors I need in one line is 16 the minimum is 6, it will be good I dont use to do pictures the PMG gtafik, but if there is no other way I will ask you Stargunner if you can help me build the library ( little universal program ) to do any pictures with 6 or more colors..max 16. Ok? The library be good in use in turbobasic. Or do you simple program for 6 or 16 colors in one line please, you have the experience of programming...I only have the Idea and wish to do my games or remakes...but not only I...but many others beginner programmers... thx.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...