Scrolltext
- Posted by Tor Bernhard Gausen <tor.gausen at C2I.NET> Jan 19, 1999
- 495 views
All I wanted to do was to make a txt viewer in mode 18 which would allow people to read text files and scroll up and down smoothly and with some sort of accelerating speed control. Sounds very simple, right? Well, I ran into three problems; a trivial problem, a depressing problem and a mysterious problem. The trivial problem: I don't know how the mode18 bit planes are organized (where in memory, and which bit planes are most and least significant). Could anyone please help me, and/or direct me to a place on the web where I can find such information without bothering the EU list? The depressing problem is that my routine is incredibly slow. I'm clearly doing something REALLY wrong, but what? The program is slow in mode 19, how slow would it not be in mode 18? A smoother, faster, full screen 320x200 mode scroller was programmed on the 1MHz C64 by the 1001 Crew 15 years ago... It should be possible to do something at least as good on my P233, even in an interpreted language. The mysterious problem is that at one point on the screen, it seems like the raster is skipping one line ...!?! Consequently the text seems to be 'sucked' through a narrow horizontal portion of the screen. Is there something wrong with CHARN's wait_retrace routine? Or could the problem be my cheap video card ? With my card ("expert color s3" or something) I can't use modes 261 etc, but I can use modes 256 and 257. This means it's SVGA, right? Not right ? Well, here's an example of what I'm trying to do: --------------------------------------------------------------------------------- include graphics.e include machine.e global constant wait_retrace = allocate(20) -- thanks to CHARN for this routine poke(wait_retrace, { #50, -- PUSH EAX #52, -- PUSH EDX #BA,#DA,3,0,0, -- MOV EDX, 0x03DA #EC, -- IN AL, DX #24,#08, -- AND AL, 0x08 #75,#FB, -- JNZ -5 #EC, -- IN AL, DX #24,#08, -- AND AL, 0x08 #74,#FB, -- JZ -5 #5A, -- POP EDX #58, -- POP EAX #C3 } ) -- RET integer char, key, speed, screen_mem, mem_size object junk, text screen_mem=#A0000 mem_size= 320 * 200 speed=1 char=0 text = " *** Man, this is slooowww... ***" junk=graphics_mode(19) while char < length(text) do char +=1 if char=length(text) then char=1 end if key=get_key() if key=27 then abort(1) end if if key='+' and speed < 4 then speed *= 2 end if if key='-' and speed > 1 then speed /= 2 end if if key=' ' then key=-1 while key !=' ' do key=get_key() end while end if position(25,1) puts (1,text) for m=1 to 8/speed do call (wait_retrace) mem_copy (screen_mem, screen_mem+320*speed, mem_size) end for end while ----------------------------------------------------------------------------------------- You can regulate speed with +/- and freeze with space. The text does not glide smoothly the way I wanted it to. Instead it seems to 'shake' so that it all becomes a blur. This gets worse with higher speeds, but is also visible at the slowest speed. A similar routine with a horizontal scroller is very nice and smooth, but is just as slow. Would things go faster with a virtual screen? How do I write text to a virtual screen, (not to mention drawing lines, circles etc. ?) And if the answer is: "there's no easy way, you have to copy characters to the virtual screen one by one (and code your own graphics routines (yeah, right!))" then: Where in memory can I find the standard character set? (Another trivial question I guess). Thanks, Tor Bernhard Gausen