Commodore64 VT100 Emulator
From
Project: Commodore64 VT100 Emulator | |
---|---|
360x360px | |
Name | Commodore64 VT100 Emulator |
Initiator | Peterbjornx |
Status | Active |
Skills | BASIC, 6502 Asm |
Summary | I'm writing a VT100 emulator for the C64. |
Current code (BasEdit preprocessor needed):
goto test asciiputchar: rem asciiputchar if c<5 then return if c=6 then return if c<>5 goto not5 if xc=1 then print# tf,ab$; if xc=0 then bc$=bc$+ab$ return not5: if c<>7 goto not7 gosub bell return not7: if c<>8 goto not8 gosub backspace return not8: if c<>9 goto not9 gosub horiztab return not9: if c<>10 goto not10 gosub linefeed return not10: if c<>11 goto not11 gosub linefeed return not11: if c<>12 goto not12 gosub linefeed return not12: if c<>13 goto not13 gosub carriagereturn return not13: if c<>14 goto not14 cs=g1 return not14: if c<>15 goto not15 cs=g0 return not15: if c=16 then return if c<>17 goto not17 xc=1 print# tf,bc$ bc$="" return not17: if c=18 then return if c<>19 goto not19 xc=0 bc$="" return not19: if c<32 then return if c<65 goto endfunc if c=91 goto endfunc if c<>92 goto not92 c=191 goto endfunc not92: if c=93 goto endfunc if c=94 goto endfunc if c<>95 goto not95 c=164 goto endfunc not95: if c<>96 goto not96 c=189 goto endfunc not96: if c<>123 goto not123 c=179 goto endfunc not123: if c<>124 goto not124 c=125 goto endfunc not124: if c<>125 goto not125 c=171 goto endfunc not125: if c<>126 goto not126 c=163 goto endfunc not126: if c=127 then return if c<91 goto uppercase if c<123 goto lowercase print# of,chr$(28)+chr$(94)+chr$(fc); gosub pollcursor return lowercase: c=c-32 goto endfunc uppercase: c=c+32 goto endfunc endfunc: print# of,chr$(c); gosub pollcursor return bell: rem bell poke 54276,17 for t=1 to 500: next poke 54276,16 return backspace: rem backspace cx=cx-1 if cx<0 then cx=0 gosub setcursor return horiztab: rem horizontal tab ox=cx cx=cx-(INT(cx/ts)*ts) if cx<ox then cx=cx+ts if cx>39 then cx=39 gosub setcursor return linefeed: rem line feed if nl=1 goto newline print# of, chr$(17) gosub pollcursor return newline: print# of, chr$(12) gosub pollcursor return carriagereturn: rem carriage return cx=0 gosub setcursor return pollcursor: rem pollcursor cx=peek(211) cy=peek(214) return setcursor: rem setcursor poke 211,cx poke 214,cy return initbell: rem initbell for l=54272 to 54296: poke l,0:next poke 54296,15 poke 54277,33 poke 54278,129 poke 54272,135 poke 54273,33 return initscreen: rem initscreen open of,3,0 print# of, chr$(9); print# of, chr$(147); return initout: rem initout xc=1 bc$="" fc=31 cx=0 cy=0 g0=0 g1=1 cs=g0 nl=1 ts=8 ab$="answerback" return init: rem init of=3 gosub initout gosub initbell gosub initscreen gosub initser return initser: rem initser tf=2 open tf,2,0,chr$(6) return test: rem test gosub init testloop: get# tf,c$ if len(c)=0 goto testloop c=asc(c$) gosub asciiputchar goto testloop