[Coco] Assembler question
Robert Gault
robert.gault at att.net
Sun Aug 28 12:02:12 EDT 2011
Helio Emery Jr. wrote:
>
> 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
>
>
Well I tried a test with MESS and NitrOS-9 LevelI and Level2 using Coco2 and
Coco3 emulation.
The program was
ifp1
use /dd/defs/defsfile
endc
mod endprgm,name,langtype,attrev,start,edata
edata equ .
name fcs "screen"
langtype set Prgrm+Objct
attrev set ReEnt+1
start lda #1 stdout
leax cmd,pcr
ldy #3
os9 I$Write
loop bra loop
cmd fcb $f,0,0
emod
endgrgm equ *
end
The above on MESS Coco3 emulation running NitrOS-9 LevelII from a vdg screen
turned on the graphics mode. Run on a window screen, nothing happened.
The above run on MESS Coco2 emulation with NitrOS-9 LevelI did not work but
crashed NitrOS-9. The command display f 0 0 did start the graphics screen.
I don't know why the above failed with Coco2 emulation but I don't think it is a
problem with the program.
More information about the Coco
mailing list