need a few POKES please,

Basic and Machine Language

Moderator: Moderators

User avatar
Aturnwald
Vic 20 Amateur
Posts: 47
Joined: Sat Feb 13, 2016 2:11 am
Location: Germany / Bavaria
Occupation: painter & decorator

Re: need a few POKES please,

Post by Aturnwald »

thank you, I've got the book already at paper form, and I understand a little of machine language.

with your answer i know a little more of it.
I know that the vic-20 can normally display only 21 chars per line, I was wondering that there is a software that can handle 40 chars per line
So I was thinking that it would be great to use this for a nice Game ect. So I will try work that schemata out and maybe I've get lucky, too.

bye bye Toni

PS: Sorry for my english
.....42, what else ???
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: need a few POKES please,

Post by Mike »

Those would be 22 chars per line of course.

The layout of the screen editor, 23 lines with 22 characters per line, is hardcoded into ROM. That cannot easily be altered, unless you replace more or less the entire editor code by an own, changed version. And truly, there also exist some programs, which do exactly that, and use the bitmapping technique to produce smaller chars.

However, these "soft-40-column" editors also tend to be quite slow. No wonders: instead of 506 bytes of text screen (and 506 nibbles of colour), they need to handle (at least) 3840 bytes of a bitmapped screen + a copy of the original text screen (960 bytes, or more), which is used as reference. Slightly more data to shuffle around, additionally hindered by a programming interface for the programmer, which only allows for outputting one single character at a time: PRINT (and the corresponding KERNAL routine BSOUT).

The routines in MG Browse dispense with those editor functions: today, most development doesn't happen anymore on the VIC-20 itself, but on the PC, and over there one doesn't need the 40-column emulation. Only the running program itself is supposed to use it. And there, the routines have been geared at fast output, one entire line of 40 characters at a time. There is no 'hidden' 'clear text' text screen, which would need to be updated and kept in sync with the bitmap. The scrolling routines consist of unrolled loops and are very fast: they can scroll any line range downwards or upwards in less than 1/30 second!

In principle, you can change the included char set as you wish. I chose it to be ASCII, not PETSCII, for a simple reason: for text applications, ASCII is the lowest common denominator nowadays, no further conversion is necessary, and as the text screen actually 'lives' on a bitmap, it's always possible to decorate the screen with other graphics alongside the text: the PETSCII 'graphic'-characters are simply not anymore necessary.

One point regarding colours: even though the underlying resolution is 160x192 pixels, this mode is built from double-height chars, and thus the foreground colour can only be changed for tiles of the size 8x16 pixels. That means 2 by 2 of those small characters always share the same colour. With careful positioning of text, that can still be used to produce colourful output (see MG Text Edit for an example), but it remains a restriction that needs to be kept in mind.

Finally, those half-sized 4x8 pixel characters wouldn't even necessarily need a big RAM expansion to be useful: I also put them into the loader menu of my 'Unexpanded type-in Collection'. :mrgreen:

Cheers,

Michael
User avatar
Aturnwald
Vic 20 Amateur
Posts: 47
Joined: Sat Feb 13, 2016 2:11 am
Location: Germany / Bavaria
Occupation: painter & decorator

Re: need a few POKES please,

Post by Aturnwald »

OK, I understand. If I'm right means that, the higher the resolution is, the lower are the colours.

But, when I was young I saw a VIC-Game, where some Text and Information ( Points, Highscore, Lives, Time and Level ) where displayed in the border.
Also the screen was pumped up in the vertically way form left to right, there was only a small border on each side. So, I was thinking, if I expand the screen from left to right and reduce the character to 2/3, then I'll get a lot of space and I can play with it.
Because you said, the double high is possible, so there should it be also possible to get a half or a quarter of it ?
If not, then I'll try to write it different.

I saw a few graphic demo with pictures in pixels. So I was thinking, all what you can see on the screen. ( Sorry, my English is to bad ) I mean for e.g. a ship is flying on the screen and I shot at that ship and the ship gets a hit. ( So I POKE a little, after that I use PEEK to determine the collision ) Is this also possible, when I use pixels to display anything? If this works than I don't need a real big screen, it would be enough when the screen is expand form left to right with a lot of colours.

So, I explain you my plan, hopefully it is OK by you ?

1st I want to write a machine-code for the joystick ( this one I've got already ) and start it with SYS xxx ( that runs in background )
2nd for all the moving stuff ( for e.g. balls, meteors, shooting, clouds etc. ) I like to use a machine routine and that that with SYS xx, too
3rd the reload process of the levels I'd like to use also a machine routine , starts and ends with SYS xx
4th the screen-pictures of each level that should be done by loading
5th the movement and the collision is done via machine-code also starts with SYS xx
6th the main program ( build up the screen, show points, determine where you are on the screen ect. ) is done by basic.

So, is that all possible, what I wrote down above ?

cheers Toni

PS: again, Sorry for my English
.....42, what else ???
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: need a few POKES please,

Post by Mike »

You're still sticking to the misconception, that the VIC-I chip has a border which could be "opened" to all sides, similar to what is done on the C64.

This is wrong, on the VIC-20 it is not possible to display anything in the border, you can only change the border colour.

However, it *is* possible to change the dimensions of the display window, and it can be put at another position. Of course that provision eventually allows to put text on screen where there was border visible on the monitor with the normal VIC register settings.

The BASIC editor however isn't aware of the changed VIC registers, it always assumes the 22x23 layout, which leads to sheared and/or unreachable parts of the display window. But a program, that changes the screen dimensions, can take this into account and can still use PRINT for the 'reachable' parts of the display, and POKEs or machine code for the 'unreachable' parts.

When it comes to available character sizes, only 8x8 and 8x16 are directly supported by the VIC-I chip. If you want to display characters with other sizes, you'll have to program it yourself. This most unevitably requires you to set up the screen as hires bitmap, and draw the characters from their pixels. In the bitmapped display, the colour resolution is still governed by the underlying character map. You can change the foreground colour only every 8x8 or 8x16 pixels.

...

As for your 6-points-plan you laid out, all these things are surely possible with the right code, but IMO this is already beyond the scope of this thread, i.e. not easily done with a few POKEs. If you take a look at my games collection, most of the games are written in BASIC, but you can still (re-)learn a lot from them by analysing their listings. For example, the title screen of "Dangerous Planet" uses an expanded display window to put the name of the game all over the horizontal width of the screen. :)

...

Finally, you don't need to excuse yourself repeatedly here for any bad English. Denial is a friendly forum, and not all fellows writing here have English as their first language.
User avatar
Aturnwald
Vic 20 Amateur
Posts: 47
Joined: Sat Feb 13, 2016 2:11 am
Location: Germany / Bavaria
Occupation: painter & decorator

Re: need a few POKES please,

Post by Aturnwald »

thank you for all your answers to my questions, right now I found a way, to expand the screen to a maximum, and that should be good for my planning,

I use this Poke POKE36864,8:POKE36865,21:POKE36866,26:POKE36867,64:POKE44,20:POKE5120,0:NEW

and for the other screens that POKE36864,8:POKE36865,38:POKE36866,26

that should be enough for my plan. Also many thanks to all of your explain, how I can use the extra space.
There is just a question left. I read in a few magazines that when I have a basic program, that can be changed via a small file into machine language, so is that true ? or is it only for e.g. small compiled so that it can be started via SYS xx ? Because, when it is the 2nd way it is useless for me.
Or should I write my Game in other languages, for e.g. Forthrun, or assembler with basic ? What do you mean is the better way. For me it's equal, because I must learn most of that language anyway, excepted Basic.

cheerio Toni
.....42, what else ???
Post Reply