Jump to content
IGNORED

Graphics modes Basic and Assembler.


Recommended Posts

The Graphics modes avaible in Basic and Turbo Basic, can they be "turned on" in assembler also, Or do i have to replicate the entire dislpaylist for the mode i want to use in assembler ? any easy way of setting the atari graphics modes in assembler ?.

Link to comment
Share on other sites

Depends what you're doing. If you're just going to use E: or S: to output text or accept user input then generally it's best to use the OS.

 

If it's an arcade type game then you're better off using your own constructed DList. When you get the OS to open the screen it gets put at the top of what the OS sees as available memory. Generally in assembly you want screen related stuff to be at a fixed, known address which is good reason to do it all yourself.

Link to comment
Share on other sites

BASIC does all of its graphics through the OS exclusively, but you can use the OS to just to open the screen and write directly to screen memory afterward. The Atari OS Manual is the best reference for this.

 

To replicate the BASIC GRAPHICS statement, open an IOCB channel through CIOV to the S: device. BASIC uses IOCB #6. Set bits 2 and 3 of AUX1 for read/write mode, bit 4 if you want split screen (opposite of +16 in BASIC), and bit 5 if you want to skip the clear (+32 in BASIC). Set AUX2 to the desired mode (0-15). Once this is set up, S: will drive the main graphics screen and E: will drive the split screen if there is one.

 

Both the graphics and text screens will be laid out with linear addressing (lines back to back). The graphics screen memory is pointed to by SAVMSC ($58) and the text screen by TXTMSC ($0294). These are documented in the OS manual, so it's legal to access screen memory directly this way. The OS always reserves enough memory for both a full-size graphics screen and a split screen together, so the OS will always use a bit more memory than setting up the screen yourself.

 

The display list is pointed to by SDLSTL ($0230). However, if you need a custom display list, I don't recommend modifying the OS one -- the layout of the display list is not documented and it's can be both right below the screen and close to a 1K boundary, making it annoying to modify.

 

The OS doesn't reliably wait for the new screen to activate before returning from the open command. Most of the time this isn't an issue, except for the notable case of opening a screen and then immediately starting disk I/O. A few games have bugs with loading screens not consistently appearing due to this, and it's easier to hit this in assembly language due to the much faster speed than BASIC.

 

That having been said, you don't actually save much by having the OS set up the screen. It's a short piece of code to write/copy a display list and swap it into SDLSTL/SDLSTH. I don't recommend it unless you need to accept text input or print text the normal way through E:. S: is pretty useless for graphics due to the overhead and limited feature set.

  • Like 1
Link to comment
Share on other sites

Ok. so i was planning to make my first Atari Executable program, previous i have used Turbo Basic with assembler routines in "Speedway one". im using Atasm to compile. thats compitable with mac/65.

 

So if there som working assembler example in mac 65 for setting up a display list, that would be helpfull for me..

Link to comment
Share on other sites

Assembler it's easy. Usual storage format is little-endian which means the smaller portion is first.

 

Most assemblers it's just .WORD, e.g.

.WORD LABEL1,LABEL2

.WORD $12A0

.WORD $30,LABEL1,LABEL2

 

Just like instructions should be indented usually 2 spaces.

 

In Atari Basic there's not a function to split the low/high byte so you have to do it yourself.

 

1000 H=INT(W/256) : L=W-H*256 : POKE ADDR,L : POKE ADDR+1,H

Link to comment
Share on other sites

Heres my first try on the display list in assembler, just trying to create a gr.0 and put a few characters on screen. this doesnt work. Anyone see whats missing ?

 

 

*=12288

SDMCTL = 559 ; Can turn on and off Antic (needed when creating display list)
SDLSTL = 560 ; Shadow display list pointer low - Antic må vite hvor den nye display listen er
SDLSTH = 561 ; Shadow display list pointer high








LDA #0
STA SDMCTL ;TURN ANTIC OFF
LDA #0 ; LOW BYTE
STA SDLSTL ; store low byte of display list adress
LDA #144 ; HIGHBYTE
STA SDLSTH ;store high byte of display list adress
LDA #34
STA SDMCTL ; ... Turn on Antic again


LDX #12
STX 710
LDX #24
STX 708
LDX #34
STX 709
LDX #58
STX 711

LDX #40
STX 712 ; set color




LDX #66 ; try to put som characters on screen
STX 40000
STX 40010
LDX #68
STX 40025
LDX #70
STX 40190
HOLD


JMP HOLD








; The Display list for GR.0
*=39968
Mylist

.Byte 112,112,112 ; three blank lines
.byte 66,64,156 ; first is lms command two other is for screen adress (Adress off scrren memory) high byte,lowbyte = low byte,highbyte = 40000
.byte 2,2,2,2,2,2,2,2,2,2,2,2
.byte 2,2,2,2,2,2,2,2,2,2,2 ; 23 times antic mode 2 lines = Basic mode 0
.byte 65,144,0 ; first is jump on vertical blank instructions,2 other is the adress low byte first. the adress for the display list itself

Edited by Grevle
Link to comment
Share on other sites

I'm still learning assembly, so I can't tell you if you're right, but I can recommend to use hex instead of decimal numbers. It makes things a lot easier. For example 40000 is $9C40 so the low byte is $40 and the high byte is $9C. It also makes it easier to start on 1K boundaries, such as $9000.

 

 

Sent from my iPhone using Tapatalk

  • Like 1
Link to comment
Share on other sites

You've stored 32 ($20) in SDMCTL - that's no good. It enabled DList DMA but doesn't enable any display data DMA.

Standard value is 34 for normal screen, 33 for narrow, 35 for wide DMA.

 

And agreed, way easier using hex when doing assembler.

 

You can usually get away without changing SDMCTL, the danger is if a half-baked pointer is setup. Various ways you could avoid that.

One could be to use a STA WSYNC then immediately change the DList pointer following. The WSync store will ensure the VBlank NMI doesn't occur in the following 20 or so cycles.

 

 

 ldx #<dlist
 ldy #>dlist
 sta wsync
 stx sdlstl
 sty sdlsth
Link to comment
Share on other sites

I made the corrections 256 should ofcoarse be 156. Changed to 34 for SDMCTL. Its still not working. heres what it looks like. No characters on screen. I also changed the color registers to see if the colors was blending in.

 

Only a one color screen.

 

post-32232-0-17593200-1459701964_thumb.png

Link to comment
Share on other sites

Yes ! that was it. Its working now, so the concept of creating a display list and put something onscreen is understood. Thank you all. Heres the result. Just a simple result but its important to understand the concepts. Btw my first Atari Exe. All other programming on the Atari has been Basic and the Basic with Assembler routines.

 

post-32232-0-58496600-1459714409_thumb.png

Edited by Grevle
  • Like 2
Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...