A Daewoo DPC-100 white in picture !
Does anyone have an idea to replace the lines 110 to 180 by something shorter in the Basic program to draw a dot with VPOKE?
https://www.msx.org/wiki/Screen_Modes_Description#SCREEN_2_....
Does anyone have an idea to replace the lines 110 to 180 by something shorter in the Basic program to draw a dot with VPOKE?
Here's my suggestion, embedded in a little test program that shows that my code produces the same results as the original.
10 FOR X = 0 to 9 20 GOSUB 100 : PRINT " old=";HEX$(B); 30 GOSUB 200 : PRINT " new=";HEX$(B); 40 PRINT 50 NEXT X 90 END 100 ' Old code 110 IF X MOD 8=0 THEN B=&h80 120 IF X MOD 8=1 THEN B=&h40 130 IF X MOD 8=2 THEN B=&h20 140 IF X MOD 8=3 THEN B=&h10 150 IF X MOD 8=4 THEN B=&h8 160 IF X MOD 8=5 THEN B=&h4 170 IF X MOD 8=6 THEN B=&h2 180 IF X MOD 8=7 THEN B=&h1 190 RETURN 200 ' New code 210 B=2^(7 - (X AND &h07)) 290 RETURN
Formatting will probably only be possible on 80 track so called 4DD drives, but reading disks should work (I will try if I can find some external drive unit probably for Fujitsu FM-7 as they use the standard Shugart connector).
Be careful. All of the FM-7 drive kits I've managed to get my hands on (Epson TF-10 units) do not use a Shugart interface, though it looks similar. The card in the I/O slot just extends the system bus out to the external drive case, which contains the FDC and one or two drives. From looking at pictures of the I/O boards, Fujitsu and Logitec units work the same. (Note that they all have just a bit of 7400 logic on the board for buffering; there's no FDC on any of them.)
If you're considering a NEC PC-8001 or PC-8801 drive kit instead, those are even weirder: there's a parallel interface between the computer and the external drive box that sends commands such as "read sector"; there's no direct interaction with the FDC at all. (Well, PC-8001/8801 8" drive boards do actually have a controller on the board, and a Shugart interface to the 8" drive box.)
I believe that the FM77 series external drive connectors are the Shugart interface, however, since the FDC in those units is on the motherboard.
Thanks cjs, It works fine. "AND &H07" is even not necessary.
Thanks cjs, It works fine. "AND &H07" is even not necessary.
Yes it is. Take a ook at the last two lines (X=8 and X=9) when you leave it out:
old=80 new=0 old=40 new=0
Without the AND &h07
you end up calculating 2^(7-9) = 2(-2) = 0.125 which rounds to 0 for an integer. The AND &h07
is performing the X MOD 8
function.
Thanks cjs, It works fine. "AND &H07" is even not necessary.
Yes it is. Take a ook at the last two lines (X=8 and X=9) when you leave it out:
old=80 new=0 old=40 new=0
Without the AND &h07
you end up calculating 2^(7-9) = 2(-2) = 0.125 which rounds to 0 for an integer. The AND &h07
is performing the X MOD 8
function.
In the example program for the wiki, X always goes from 0 to 7.
In the example program for the wiki, X always goes from 0 to 7.
The way I read it, X is always 127 in the example program and doesn't change. Further, the text below suggests that you can change X to anything you like.
At any rate, I think it's best to incude the AND &h07
both because without it it's not doing the same thing as the lines it replaces and, more importantly, if someone re-uses that bit of code elsewhere it will do the correct thing. It's not good to have code floating around that does the wrong thing with reasonable inputs when it's nearly trivial to make it work for all reasonable inputs.
I tried to edit the page to fix what you added, but I don't have permission to do that, apparently. But if you really insist that it be there without the AND &h07
, I'd prefer you take my name off it, since that's not code that I would suggest using.
I just consed up a little example program that demonstrates the problem of dropping the AND &h07
:
10 COLOR 15,4,1 : SCREEN 2 20 Y=95 : C=7 30 FOR X=0 to 250 60 PGT=(VDP(4)AND&HFC)*&H2000 ' PGT = Pattern generator table 70 PCT=((VDP(3)\128))*&H2000 ' PCT = Pattern color table 80 AD=(Y\8)*256+(Y MOD 8)+(X\8)*8 ' Pixel address calculation 90 PGT=PGT+AD : PCT=PCT+AD 100 VPOKE PCT,(VPEEK(PCT) AND &HF)+C*16 ' Set C as forground color 110 VPOKE PGT,VPEEK(PGT) OR 2^(7 - (X AND &h07)) 120 'VPOKE PGT,VPEEK(PGT) OR 2^(7 - X) 150 NEXT X 200 GOTO 200
As is, it draws a line right across the middle of the screen. Comment out or delete line 110 and uncomment line 120 to see the version without the AND &h07
and notice how it breaks: it correctly draws the line for the first eight pixels and then stops; at that point it's repeatedly setting pixel 0 on that row, regardless of the value of X.