[Coco] Assembler question

Helio Emery Jr. helioemery at hotmail.com
Sun Aug 28 10:01:12 EDT 2011


Hi Robert, thanks for the response.
 
I used to have a Brasilian Coco2 clone, named Color 64.
While I don't manage to have one again in my hands, I'm using MESS as a Coco2 emulator to re-learn about Coco2 and OS-9 level 1 specifics.
Back in the 80's the Color 64 was my second computer, and the one with I learned much from it.
 
So, I started playing around using it to create some simple graphic programs in C and Assembler, just for fun.
I created in C a program to draw a line and a circle in graphics mode, in OS-9 environment.
And them I'm trying to create a program to do the same (draw a line and draw a circle) in Assembler.
I'm not trying to recreate the C program itself in Assembler (i.e a didn't take a look in the assembled code generated by the C compiler).
Just trying to get the line and the circle generated in graphics OS-9 environment.

Reading OS-9 Operating System User’s Guide, Appendix C. Display System Functions I understood that for switchng to OS-9 graphics environment using the standart OS-9 calls one have to send to the STDOUT 3 caracters, the $0F (DISPLAY GRAPHICS) followed by graphics mode ($00 in my case) and graphics color (again $00).
 
The problem is that only doing this is not enoght.
In C I had to call fflush() to make the graphics screen to apear.
In assembler I didn't know how to acomplish this.
 
You see, even in OS-9 shell these caracters behave as described.
If one uses the comand DISPLAY to send those characters to stdout, the system will change to graphics screen.
 
In assemby I just call I$Write to send those characters to the screen.
As you can see, I'm using this method to let OS-9 create the graphic screen for me, allocating the 6K screen area and using OS-9 GetStat to get the memory address.
After doing this I'll just store the bytes I want directly in the graphics memory area.
You do it in a different way?
This is the only way I know right now.
 
See bellow the assembler codes I'm using:
 
plota1 leax inigrf,u    *
          ldy #4            *
          lda #STDOUT * Inicializa tela gráfica
          OS9 I$Write   *
          bcs erroos9    *
plota2 lda #STDOUT
          leax devsta,u *
          ldb #DSTAT  * Obtem endereço da tela
          OS9 I$GetStt *
          bcs erroos9   *
 
 
Thanks for the help,
Helio
 

> Date: Sun, 28 Aug 2011 09:01:41 -0400
> From: robert.gault at att.net
> To: coco at maltedmedia.com
> Subject: Re: [Coco] Assembler question
> 
> Helio Emery Jr. wrote:
> >
> > Hey guys, me again.
> >
> > In the process of re-learning OS9 L1, I was abble to create some graphics programs in C that works quite well.
> > And them I moved to try recreating the same programs in Assembler, just for fun.
> >
> > While in C I learned that, to change OS9 to graphics screen is just a matter of sending some characters to the terminal screen (more preciselly the Hex codes 0F 00 00).
> > But there is a trick, the STDOUT is buffered, so one should call the function fflush() to actually change the screen to graphics mode.
> > In Assembler I don't know how to do this...
> > I've read all the technical manuals I could get my hands on, but none of them is of much help.
> > I've tryied to sent the characters to STDERR (path number 2) instead, but no go.
> >
> > Anyone knows how to flush the stdout in Assembly, or any other way to change to graphics in OS9?
> >
> > Thanks,
> > Helio 
> >
> 
> First, it is not necessary to use fflush in all cases. I've written graphic 
> routines in C that don't require that. It probably depends on the method used to 
> create, map, and write to the graphic screen.
> Second, assembly and C programs are very different animals. You probably will 
> not want to convert a C program to assembly if what you mean by that is an exact 
> duplicate. There are much more efficient ways to write assembly programs and you 
> can take complete control of the system. STDOUT could be buffered in C but when 
> using assembly, you don't need nor have a buffer unless you created one.
> 
> Actually you need to be more specific with your question. What is your Coco, a 
> 1, 2, or 3? What type of graphics screen do you want to use? Post the code you 
> are trying to use to mimic the OS-9 command
> display 0f 00 0f
> if that is the screen and color set you wanted.
> 
> Personally, I would just take direct control of the hardware after turning off 
> interrupts. You can restart OS-9 after you program is finished.
> 
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
 		 	   		  


More information about the Coco mailing list