Sample BASIC-09 code for Change Working Area

This area is for discussing OS-9/NitrOS-9 operating system(s).

Sample BASIC-09 code for Change Working Area

Postby curtisboyle » Sat Nov 04, 2017 2:27 pm

Originally done for Rick Adams and D. Bruce Moore as a quick demo program showing Change working area (I did it through Syscall I$Write call, but did some other things with PRINT, just to show some alternative methods). I do remember that one or two control characters OS-9/NitrOS-9 will filter out of print (LF or CR, maybe?), so I always defaulted to using the System call to eliminate any other possible "bugs" to worry about.

PROCEDURE AreaTest
TYPE registers=cc,a,b,dp:BYTE; x,y,u:INTEGER
DIM regs:registers
DIM areanum:INTEGER
DIM type7(14):BYTE
TYPE displayparms=prm(6):BYTE
DIM cwarea(6):displayparms
DIM areacolors(6):displayparms
DIM ctr:INTEGER
type7(1)=$1b
type7(2)=$24
type7(3)=$1b
type7(4)=$20
type7(5)=$7
type7(6)=0
type7(7)=0
type7(8)=$50
type7(9)=$19
type7(10)=0
type7(11)=2
type7(12)=2
type7(13)=$1b
type7(14)=$21
regs.a=1
regs.x=ADDR(type7)
regs.y=14
RUN syscall($8c,regs)
PRINT CHR$(12);
FOR ctr=1 TO 6
cwarea(ctr).prm(1)=$1B
cwarea(ctr).prm(2)=$25
areacolors(ctr).prm(1)=$1B
areacolors(ctr).prm(2)=$32
areacolors(ctr).prm(4)=$1B
areacolors(ctr).prm(5)=$33
NEXT ctr
(* upper left
cwarea(1).prm(3)=0
cwarea(1).prm(4)=0
cwarea(1).prm(5)=40
cwarea(1).prm(6)=12
(* White on black
areacolors(1).prm(3)=0
areacolors(1).prm(6)=2
(* upper right
cwarea(2).prm(3)=40
cwarea(2).prm(4)=0
cwarea(2).prm(5)=40
cwarea(2).prm(6)=12
(* White on blue
areacolors(2).prm(3)=0
areacolors(2).prm(6)=1
(* middle
cwarea(3).prm(3)=0
cwarea(3).prm(4)=12
cwarea(3).prm(5)=80
cwarea(3).prm(6)=10
(* Blue on black
areacolors(3).prm(3)=1
areacolors(3).prm(6)=2
(* bottom left
cwarea(4).prm(3)=0
cwarea(4).prm(4)=22
cwarea(4).prm(5)=40
cwarea(4).prm(6)=3
(* Blue on white
areacolors(4).prm(3)=1
areacolors(4).prm(6)=0
(* bottom right
cwarea(5).prm(3)=40
cwarea(5).prm(4)=22
cwarea(5).prm(5)=40
cwarea(5).prm(6)=3
(* Black on white
areacolors(5).prm(3)=2
areacolors(5).prm(6)=0
(* Full screen default
cwarea(6).prm(3)=0
cwarea(6).prm(4)=0
cwarea(6).prm(5)=80
cwarea(6).prm(6)=25
(* White on black
areacolors(6).prm(3)=0
areacolors(6).prm(6)=2
regs.a=1
FOR areanum=1 TO 5
regs.x=ADDR(cwarea(areanum))
regs.y=6
RUN Syscall($8C,regs)
regs.x=ADDR(areacolors(areanum))
regs.y=6
RUN Syscall($8C,regs)
FOR ctr=1 TO 15
PRINT "Area #";areanum;" ";ctr
NEXT ctr
NEXT areanum
regs.x=ADDR(cwarea(6))
regs.y=6
RUN syscall($8c,regs)
regs.x=ADDR(areacolors(6))
regs.y=6
RUN syscall($8c,regs)
PRINT CHR$(2);CHR$($20);CHR$($24);
END
curtisboyle
 
Posts: 5
Joined: Fri Sep 29, 2017 6:02 am

Return to OS-9 / NitrOS-9

Who is online

Users browsing this forum: No registered users and 2 guests

cron