WRx16 Revisited!

See all articles from CATS v6 n6
Author(s): Fred Nachbaur
Publication: CATS Newsletter
Pub Details: CATS v6 n6 (Volume 6, Issue 6)
Date: September 1988
Pages: 7

From ZX-Appeal, Vancouver SUG, April, 1988

Concluded from the July and August 1988 issues

and delete the demo portion (everything between and including lines 7 through 540). Leave line 5 in place. Enter line 4,

4 REM BIPLOT

Perform the following POKEs:

POKE 16645,4
POKE 16646,1
POKE 16419,4

Then delete line 5. This will “melt together” the REM lines 2 and 3, giving us enough room for the modified service routines. It also keeps us from getting stuck in the long REM lines at the beginning. Henceforth, you may replace line 4, but not delete it. If you do you’ll have to pull the plug to regain control. If you ever get in trouble after LIST, and the listing is stuck, LIST 4 and then POKE 16419,4. That’ll fix it.

FROM THE GROUND UP

If you start from scratch, enter a 1 REM line exactly 128 characters long. This is four full lines on the screen, looking like this:

  1 REM xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxx

Enter another REM line, numbered 2, long enough to hold at least our present operating system. To leave some elbow-room for any of your additions later, make it, say, 512 bytes long. (FAST mode will make this somewhat quicker.) Then enter the loader program of Listing 2. RUN this to input the values of Table 2 into the 1 REM, and the values from table 3 into the 2 REM.

THE BASIC

Now enter the BASIC program of listing 4. After saving with RUN 9990, the program will auto-run.

Have fun with this. As a final note, let us know if you want to see more reports of new developments. Some possible topics that already exist include: Using SHR-Extended BASIC from machine-code, to end up with a smooth, believable hi-res implementation of the classic SPACE INVADERS game. Using “QUICK” mode with WRx16, or with quasi-hi-res programs. PRINTing characters in high-res.

So once again it’s up to you; what do you want us to share with you?

THEORY

Listing 3 shows the disassembly of the modified core and service routines. To make the dual display work, we first have to make some changes to the WRx16 core. From 40BAh to 40C5, we have added a new routine which checks bit 0 of FRAMES. The subsequent commands cause HL to be loaded with 2000h (HRDF #1) or 3000h (HRDF #2), depending on the state of this bit.

When viewing only one display file, the command at 40BD is changed from AND 01 to either LD A,00 or LD A,01. These commands take the same time to execute, so this was just an easy way to insure that the loop will run the same regardless of whether we’ve viewing just one, or both of the display files.

Note that the command at 40AD was changed, and a NOP was added at 40C5 to compensate for the extra time it takes to run our new code. If you count T-states, you’ll see that the overall timing remains exactly the same.

Note also that we load B with only 80h at 40E2, since we are only displaying 128 hi-res lines.

The only other changes are at 40E3 and 40ED. These determine how many low-res rows are displayed. Since the hi-res portion takes 16 rows, we can display 8 lo-res rows for the same 24-row overall display size. However, one row is lost in returning from our hi-res system; this is why we have to kill some time at the start of DP-3, to wait for the start of the first line in the next available row.

The value loaded into DE at 40E3 represents 8000h plus the offset from the start of the normal display file, to the first byte of the starting low-res row to be displayed. The command at 40ED loads B with one more than the number of low-res rows, and C with 7 (always).

Just as our service routine modifies the command at 40BD to change viewing modes, the commands at 40E3 and 40ED could be changed to give a low-res “windowing” option, allowing you to scroll the entire low-res display up and down in the 7-row low-res portion of the display. Use a SYNC routine similar to ours here, to insure that both changes are made right after a vertical sync pulse, since you want to be sure that both changes will be in place by the start of the next field.

TABLE 1: WRX16-V2 CORE (DECIMAL)

START=16514     BYTES=128
237:079:000:000:000:000:000:000:
000:000:000:000:000:000:000:000:
000:000:000:000:000:000:000:000:
000:000:000:000:000:000:000:000:
000:000:221:233:243:062:007:071:
000:016:253:198:239:060:032:253:
006:176:017:032:000:033:000:032:
221:033:192:064:024:008:017:032:
000:005:202:207:064:025:124:237:
071:125:195:130:192:237:082:237:
082:035:042:012:064:017:247:130:
025:062:030:237:071:062:245:001:
007:002:205:181:002:205:146:002:
205:032:002:221:033:166:064:195:
164:002:221:033:166:064:201:062:
030:237:071:221:033:129:002:201:
TABLE 2: BI-PLOT WRX16 CORE

START=16514     BYTES=128
237:079:000:000:000:000:000:000:
000:000:000:000:000:000:000:000:
000:000:000:000:000:000:000:000:
000:000:000:000:000:000:000:000:
000:000:221:233:243:062:007:071:
000:016:253:198:242:060:032:253:
006:128:017:032:000:033:000:032:
058:052:064:230:001:023:023:023:
023:132:103:000:221:033:204:064:
024:008:017:032:000:005:202:219:
064:025:124:237:071:125:195:130:
192:237:082:237:082:035:042:012:
064:017:049:130:025:062:030:237:
071:062:245:001:007:008:205:181:
002:205:146:002:205:032:002:221:
033:166:064:195:164:002:000:000:
OPTIONAL SYNCHRONIZING ROUTINE
CALL THIS BEFORE CHANGING MODES
TO PREVENT SCREEN FLICKER.

E.G. CALL SYNC
JP HRES
OR
CALL SYNC
JP NRML

addr HEXCODE NAME MNEMONIC
----------------------------
4105 CD2B0F SYNC CALL SLOW
4108 FD4634 LD B,(FRMS)
410B 3A3440 NFM? LD A,(FRMS)
410E B8 CP B
410F 28FA JR Z NFM?
4111 C9 RET
TABLE 3: BIPLOT SERVICE ROUTINES

START=16640     BYTES=177
033:062:000:024:008:033:062:001:
024:003:033:230:001:034:189:064:
205:168:065:221:033:166:064:201:
205:168:065:221:033:129:002:201:
000:033:000:032:024:003:033:000:
048:001:000:016:054:000:011:084:
093:019:237:176:201:033:132:064:
001:032:000:126:198:128:119:024:
237:038:032:024:022:038:048:024:
018:205:073:065:024:247:038:032:
024:015:038:048:024:011:205:086:
065:024:247:253:203:059:214:024:
004:253:203:059:150:237:075:054:
064:062:128:061:144:218:173:014:
087:089:203:058:203:027:203:058:
203:027:203:058:203:027:046:000:
025:086:121:230:007:060:001:000:
008:203:002:203:017:061:032:012:
253:203:059:086:040:004:203:193:
024:002:203:129:016:235:113:201:
205:043:015:253:070:052:058:052:
064:184:040:250:062:030:237:071:
201:

WANTED

Uncle John Wants You!

HERE’S THE CHANCE TO DO SOMETHING FOR THE GROUP

John Riley, our Tape Librarian, is trying to assemble a tape of Astronomy programs. He needs a volunteer(s) to key in some of the programs. Contact him directly or through the CATS P.O. box.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.