mirror of
https://github.com/dschmenk/PLASMA.git
synced 2026-04-19 09:23:06 +00:00
Work out more VIDEX 80 column handling
This commit is contained in:
Binary file not shown.
+1
-1
@@ -82,4 +82,4 @@ import conio
|
||||
word tone
|
||||
word rnd
|
||||
end
|
||||
end
|
||||
end
|
||||
+53
-35
@@ -52,7 +52,7 @@ const ENV_REG = $FFDF
|
||||
//
|
||||
// Predefined functions.
|
||||
//
|
||||
predef a2keypressed,a2getkey,a2putchars(cnt,chrs), a2ctrl(code,param)
|
||||
predef a2keypressed,a2getkey,a2putuprchars(cnt,chrs), a2ctrl(code,param)
|
||||
predef a2clear(clr),a2gotoxy(x,y),a2viewport(left, top, width, height)
|
||||
predef a2textmode(cols),a2grmode(mix),a2grcolor(color),a2grplot(x,y)
|
||||
predef a2tone(duration, delay),a2rnd
|
||||
@@ -65,7 +65,7 @@ word conio[]
|
||||
//
|
||||
word = @a2keypressed
|
||||
word = @a2getkey
|
||||
word = @a2putchars
|
||||
word = @a2putuprchars
|
||||
word = @a2clear
|
||||
word = @a2gotoxy
|
||||
word = @a2viewport
|
||||
@@ -179,6 +179,22 @@ asm a2grplot(x, y)
|
||||
INX
|
||||
RTS
|
||||
end
|
||||
asm cout(chr)#0
|
||||
LCRDEN = $C080
|
||||
LCWTEN = $C081
|
||||
ROMEN = $C082
|
||||
LCRWEN = $C083
|
||||
LCBNK2 = $00
|
||||
LCBNK1 = $08
|
||||
COUT = $FDED
|
||||
LDA ESTKL,X
|
||||
ORA #$80
|
||||
BIT ROMEN
|
||||
JSR COUT
|
||||
BIT LCRDEN+LCBNK2
|
||||
INX
|
||||
RTS
|
||||
end
|
||||
//def a2putchars(cnt, chrs)
|
||||
// byte c
|
||||
//
|
||||
@@ -192,13 +208,6 @@ end
|
||||
// return ^CURSH
|
||||
//end
|
||||
asm a2putchars(cnt, chrs)
|
||||
LCRDEN = $C080
|
||||
LCWTEN = $C081
|
||||
ROMEN = $C082
|
||||
LCRWEN = $C083
|
||||
LCBNK2 = $00
|
||||
LCBNK1 = $08
|
||||
COUT = $FDED
|
||||
LDA ESTKL+1,X ; CNT
|
||||
BEQ EXA2PC
|
||||
BIT ROMEN
|
||||
@@ -250,9 +259,9 @@ TXTATTR = $32
|
||||
PHA
|
||||
LDA (SRC),Y
|
||||
ORA #$80
|
||||
CMP #'a'+$80
|
||||
CMP #'a'+128
|
||||
BCC +
|
||||
CMP #'z'+$81
|
||||
CMP #'z'+129
|
||||
BCS +
|
||||
SBC #$1F
|
||||
PHA
|
||||
@@ -269,9 +278,9 @@ TXTATTR = $32
|
||||
PHA
|
||||
LDA ESTKL,X ; CHR
|
||||
ORA #$80
|
||||
CMP #'a'+$80
|
||||
CMP #'a'+128
|
||||
BCC +
|
||||
CMP #'z'+$81
|
||||
CMP #'z'+129
|
||||
BCS +
|
||||
SBC #$1F
|
||||
PHA
|
||||
@@ -476,7 +485,7 @@ def a2getkey
|
||||
fin
|
||||
break
|
||||
otherwise
|
||||
if key >= $C0 and flags < shiftlock
|
||||
if key >= $C0 and flags & shiftlock
|
||||
if ^pushbttn3 < 128
|
||||
when key
|
||||
is $C0
|
||||
@@ -531,28 +540,27 @@ end
|
||||
def a2clear80e(clr)
|
||||
when clr
|
||||
is cleol // clear EOL
|
||||
putc(29) // GS
|
||||
cout(29) // GS
|
||||
break
|
||||
is cls // home
|
||||
putc(12) // FF
|
||||
cout(12) // FF
|
||||
break
|
||||
is cleos // clear OES
|
||||
putc(11) // VT
|
||||
cout(11) // VT
|
||||
break
|
||||
wend
|
||||
return 0
|
||||
putc(12) // Form Feed
|
||||
return 0
|
||||
end
|
||||
def a2clear80v(clr)
|
||||
when clr
|
||||
is cleol // clear EOL
|
||||
cout(29) // CLEOL
|
||||
break
|
||||
is cls
|
||||
putc(12) // FF
|
||||
cout(12) // FF
|
||||
break
|
||||
is cleos // clear OES
|
||||
putc(11) // VT
|
||||
cout(11) // VT
|
||||
break
|
||||
wend
|
||||
return 0
|
||||
@@ -566,7 +574,7 @@ def a2gotoxy80e(x, y)
|
||||
return call($FB5B, y + ^WNDTOP, 0, 0, 0) // TABV
|
||||
end
|
||||
def a2gotoxy80v(x, y)
|
||||
putc(30); putc(x + ' '); putc(y + ' ')
|
||||
cout(30); cout(x + ' '); cout(y + ' ')
|
||||
return 0
|
||||
end
|
||||
def a2viewport(left, top, width, height)
|
||||
@@ -622,10 +630,8 @@ def a2ctrl(code, param)#1
|
||||
break
|
||||
is ctrlcase
|
||||
if not (flags & txt80)
|
||||
flags = flags ^ uppercase
|
||||
if flags & uppercase
|
||||
conio:putchars = flags & uppercase ?? @a2putuprchars :: @a2putchars
|
||||
fin
|
||||
flags = flags ^ uppercase
|
||||
conio:putchars = flags & uppercase ?? @a2putuprchars :: @a2putchars
|
||||
fin
|
||||
handled = TRUE
|
||||
break
|
||||
@@ -702,12 +708,19 @@ def a2ctrl80v(code, param)#1
|
||||
handled = TRUE
|
||||
break
|
||||
is ctrlscroll
|
||||
if param == UP
|
||||
cout(30); cout(' '); cout(23 + ' '); cout(10)
|
||||
handled = TRUE
|
||||
fin
|
||||
break
|
||||
wend
|
||||
return handled
|
||||
end
|
||||
def a2textmode(columns)
|
||||
call($FB39, 0, 0, 0, 0) // textmode()
|
||||
if columns == 0
|
||||
columns = cmdsys:_sysflags_ & vid80col ?? 80 :: 40
|
||||
fin
|
||||
if columns > 40 and MACHID & MACHID_80COL
|
||||
cswsave = *CSW
|
||||
kswsave = *KSW
|
||||
@@ -716,19 +729,20 @@ def a2textmode(columns)
|
||||
conio:clear = @a2clear80e
|
||||
conio:gotoxy = @a2gotoxy80e
|
||||
conio:textctrl = @a2ctrl80e
|
||||
else
|
||||
else // MACHID_II
|
||||
^$C059 // 80 column output softswitch
|
||||
conio:clear = @a2clear80v
|
||||
conio:gotoxy = @a2gotoxy80v
|
||||
conio:textctrl = @a2ctrl80v
|
||||
conio:putchars = @a2putchars
|
||||
fin
|
||||
flags = flags | txt80
|
||||
flags = flags | txt80
|
||||
else
|
||||
if flags & txt80
|
||||
if MACHID & $C0 == MACHID_IIE
|
||||
puts(@disable80)
|
||||
cout(@disable80)
|
||||
else // Videx disable
|
||||
^$C058
|
||||
^$C058 // 80 column output softswitch
|
||||
*CSW = cswsave
|
||||
*KSW = kswsave
|
||||
a2viewport(0, 0, 40, 24)
|
||||
@@ -962,14 +976,17 @@ when MACHID & MACHID_MODEL
|
||||
conio:tone = @a3tone
|
||||
conio:rnd = @a13rnd
|
||||
break
|
||||
is MACHID_IIE
|
||||
conio:getkey = @a2egetkey
|
||||
break
|
||||
is MACHID_IIC
|
||||
conio:getkey = @a2cgetkey
|
||||
conio:putchars = @a2putchars
|
||||
break
|
||||
is MACHID_IIE
|
||||
conio:getkey = @a2egetkey
|
||||
conio:putchars = @a2putchars
|
||||
break
|
||||
is MACHID_IIPLUS
|
||||
is MACHID_II
|
||||
flags = flags | uppercase
|
||||
flags = flags | uppercase | shiftlock
|
||||
conio:putchars = @a2putuprchars
|
||||
break
|
||||
is MACHID_I
|
||||
@@ -986,8 +1003,9 @@ when MACHID & MACHID_MODEL
|
||||
conio:rnd = @a13rnd
|
||||
break
|
||||
wend
|
||||
if cmdsys:_sysflags_ & vid80col; conio:textmode(80); fin
|
||||
//
|
||||
// Keep module in memory
|
||||
//
|
||||
return modkeep
|
||||
done
|
||||
done
|
||||
@@ -10,7 +10,7 @@ word Name
|
||||
|
||||
// save text screen
|
||||
memcpy(@ScrSave, SCR_PTR, SCR_SIZE)
|
||||
conio:home()
|
||||
conio:clear(cls)
|
||||
for I=0 to 23
|
||||
conio:gotoxy(I,I)
|
||||
putc('A'+I)
|
||||
|
||||
@@ -842,7 +842,7 @@ end
|
||||
// Print title page
|
||||
//
|
||||
|
||||
conio:home()
|
||||
conio:clear(cls)
|
||||
while ^titlestr
|
||||
puts(titlestr)
|
||||
titlestr = titlestr + ^titlestr + 1
|
||||
@@ -850,4 +850,4 @@ loop
|
||||
for titlestr = 0 to scrnheight - 1
|
||||
screen[titlestr] = @screenbuffer + titlestr * scrnwidth
|
||||
next
|
||||
done
|
||||
done
|
||||
+25
-36
@@ -454,7 +454,7 @@ def drawstr(row, strptr)#0
|
||||
fin
|
||||
end
|
||||
def drawgutterrow(row)#0
|
||||
byte hilite, huns, tens, ones
|
||||
byte huns, tens, ones
|
||||
word scrnrow
|
||||
char gutterchars[4]
|
||||
|
||||
@@ -462,7 +462,6 @@ def drawgutterrow(row)#0
|
||||
// Draw line numbers and gutter hilites
|
||||
//
|
||||
if flags & gutter
|
||||
gutterchars[3] = viewleft ?? '<' :: ' '
|
||||
scrnrow = row + viewtop
|
||||
huns, tens = divmod(scrnrow + 1, 100)
|
||||
tens, ones = divmod(tens, 10)
|
||||
@@ -477,13 +476,15 @@ def drawgutterrow(row)#0
|
||||
fin
|
||||
huns, tens, ones = fillnum(huns, tens, ones, @gutterchars)
|
||||
conio:gotoxy(0, row)
|
||||
conio:putchars(4, @gutterchars)
|
||||
conio:putchars(3, @gutterchars)
|
||||
conio:textctrl(ctrlattr, INVERSE)
|
||||
putc(viewleft ?? '<' :: ' ')
|
||||
conio:textctrl(ctrlattr, NORMAL)
|
||||
fin
|
||||
fin
|
||||
end
|
||||
def drawgutter#0
|
||||
byte row, hilite, huns, tens, ones
|
||||
byte row, seperator, huns, tens, ones
|
||||
word scrnrow
|
||||
char gutterchars[4]
|
||||
|
||||
@@ -491,7 +492,7 @@ def drawgutter#0
|
||||
// Draw line numbers and gutter hilites
|
||||
//
|
||||
if flags & gutter
|
||||
gutterchars[3] = viewleft ?? '<' :: ' '
|
||||
seperator = viewleft ?? '<' :: ' '
|
||||
huns, tens = divmod(viewtop + 1, 100)
|
||||
tens, ones = divmod(tens, 10)
|
||||
for row = 0 to scrnheight-1
|
||||
@@ -509,21 +510,23 @@ def drawgutter#0
|
||||
fin
|
||||
huns, tens, ones = fillnum(huns, tens, ones, @gutterchars)
|
||||
conio:gotoxy(0, row)
|
||||
conio:putchars(4, @gutterchars)
|
||||
conio:putchars(3, @gutterchars)
|
||||
conio:textctrl(ctrlattr, INVERSE)
|
||||
putc(seperator)
|
||||
conio:textctrl(ctrlattr, NORMAL)
|
||||
fin
|
||||
next
|
||||
fin
|
||||
end
|
||||
def drawrows(toprow, bottomrow)#0
|
||||
byte row, hilite, huns, tens, ones, numchars
|
||||
byte row, seperator, huns, tens, ones, numchars
|
||||
word scrnrow, strptr
|
||||
char gutterchars[4]
|
||||
|
||||
//
|
||||
// Draw gutter and text
|
||||
//
|
||||
gutterchars[3] = viewleft ?? '<' :: ' '
|
||||
seperator = viewleft ?? '<' :: ' '
|
||||
huns, tens = divmod(viewtop + toprow + 1, 100)
|
||||
tens, ones = divmod(tens, 10)
|
||||
for row = toprow to bottomrow
|
||||
@@ -542,7 +545,9 @@ def drawrows(toprow, bottomrow)#0
|
||||
conio:textctrl(ctrlattr, INVERSE)
|
||||
fin
|
||||
huns, tens, ones = fillnum(huns, tens, ones, @gutterchars)
|
||||
conio:putchars(4, @gutterchars)
|
||||
conio:putchars(3, @gutterchars)
|
||||
conio:textctrl(ctrlattr, INVERSE)
|
||||
putc(seperator)
|
||||
conio:textctrl(ctrlattr, NORMAL)
|
||||
fin
|
||||
strptr = txtlinbuf=>[scrnrow]
|
||||
@@ -566,9 +571,9 @@ def curshpos(hpos)#1
|
||||
if hpos < 0; hpos = 0; fin
|
||||
if hpos > MAXLNLEN; hpos = MAXLNLEN; fin
|
||||
scrnleft = flags & gutter
|
||||
scrnright = scrnleft + viewwidth
|
||||
curscol = hpos
|
||||
cursx = curscol - viewleft + (flags & gutter)
|
||||
scrnright = scrnwidth - 2
|
||||
curscol = hpos
|
||||
cursx = curscol - viewleft + scrnleft
|
||||
if cursx > scrnright
|
||||
cursx = scrnright
|
||||
viewleft = curscol - viewwidth
|
||||
@@ -694,15 +699,7 @@ def pgdown#0
|
||||
fin
|
||||
end
|
||||
def cursleft#0
|
||||
if curscol > 0
|
||||
curscol--
|
||||
if cursx > flags & gutter
|
||||
cursx--
|
||||
else
|
||||
viewleft = curscol
|
||||
drawscrn
|
||||
fin
|
||||
fin
|
||||
if curshpos(curscol - 1); drawscrn; fin
|
||||
end
|
||||
def pgleft#0
|
||||
word i, strptr
|
||||
@@ -728,15 +725,7 @@ def pgleft#0
|
||||
fin
|
||||
end
|
||||
def cursright#0
|
||||
if curscol < MAXLNLEN
|
||||
curscol++
|
||||
if cursx < scrnwidth - 1
|
||||
cursx++
|
||||
else
|
||||
viewleft = curscol - scrnwidth - 1
|
||||
drawscrn
|
||||
fin
|
||||
fin
|
||||
if curshpos(curscol + 1); drawscrn; fin
|
||||
end
|
||||
def pgright#0
|
||||
word i, strptr
|
||||
@@ -1087,10 +1076,11 @@ def keyin
|
||||
conio:gotoxy(cursx, cursy)
|
||||
conio:textctrl(ctrlattr, INVERSE)
|
||||
conio:putchars(1, curschr)
|
||||
waitkey
|
||||
conio:gotoxy(cursx, cursy)
|
||||
waitkey
|
||||
conio:textctrl(ctrlattr, NORMAL)
|
||||
conio:putchars(1, underchr)
|
||||
conio:gotoxy(cursx, cursy)
|
||||
waitkey
|
||||
until conio:keypressed()
|
||||
key = conio:getkey()
|
||||
@@ -1542,14 +1532,13 @@ if ^arg
|
||||
cursrow = strtonum(arg)
|
||||
fin
|
||||
fin
|
||||
while statusVBL and cursflash
|
||||
cursflash--
|
||||
while statusVBL
|
||||
loop
|
||||
cursflash = 0
|
||||
while not statusVBL
|
||||
while not statusVBL and cursflash < 10000
|
||||
cursflash++
|
||||
loop
|
||||
if cursflash == 0; cursflash = 30; fin
|
||||
if cursflash == 10000 and not statusVBL; cursflash = 30; fin // Check if no VBL implemented
|
||||
cursflash = cursflash * 20 // Make it flash a little slower
|
||||
flags = flags | insmode | gutter
|
||||
scrnwidth = conio:textmode(scrnwidth)
|
||||
@@ -1562,5 +1551,5 @@ if cursrow
|
||||
fin
|
||||
drawscrn
|
||||
editmode
|
||||
conio:textmode(40)
|
||||
conio:textmode(0) // Set default mode
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user