Authors
Publication
Pub Details
Date
Pages
BASIC Terms
Amongst the differences between the Spectrum and the 2068, there are the 2068’s video modes. These modes are not directly reached by BASIC. To use them, we must write some routines in machine language. This machine code toolkit is for the mode called “extended color”. If we type in normal mode:
CIRCLE 125,87,50:PLOT 0,87:DRAW 1,0,255
we will see the flash attribute on eight bytes. In the extended color mode, each display file byte has its own attribute byte. The color resolution is multiplied by eight.
There is no use of POKEs with the toolkit. When we need to pass some information to the machine code routine, we use the form:
INPUT USR add,x,y
where add is the routine entry point, and x & y are the information needed by the routine.
First type in the HEXLOADER program and SAVE it to tape. RUN the program and wait. If an error is detected, the line number will be printed. If there are no errors in the DATA statements, an error report “OUT OF DATA” will occur. Then RUN 550 to save the toolkit code.
RANDOMIZE USR 62000 switches the extended color mode on and a welcome message should be printed at the top of the screen. If not, type PRINT USR 0 and LOAD the HEXLOADER to check the DATA lines for any errors. Remember, its very important to CLEAR 61999 before switching into extended mode.
Here is a summary of the toolkit’s routines:
RANDOMIZE USR 62000 | enables D_FILE2 |
RANDOMIZE USR 62048 | clears D_FILE1 and D_FILE2. CLS will only clear D_FILE1. If we have something on the screen and we want to change the ink color without erasing the screen, INK x:RAND USR 62051 will do it. This entry point erases only D_FILE2, i.e. the attribute file. |
INPUT USR 62069,X,Y | attributes on PLOT. X=(8*PAPER)+INK. If we want a plot with yellow ink on blue paper, then X=(8*1)+6=14, Y=FLASH/BRIGHT — if Y=1 then BRIGHT 1, Y=2 then FLASH 1, Y=3 then BRIGHT 1 and FLASH 1, Y=0 then BRIGHT 1 and FLASH 1. These two arguments are not optional. |
INPUT USR 62105,X,Y | fills a zone with the attribute X and Y. X=(8*PAPER)+INK, Y=FLASH/BRIGHT. For example, enter CIRCLE 125,87,80 and PLOT INVERSE 1,125,87 to determine the filling starting point. If the screen PAPER is black and INK is yellow (if not, use PAPER 0:INK 6:RAND USR 62051), type INPUT USR 62105,14,0 to fill the circle with green INK because X=(8*0)+6=14 |
PRINT AT X,Y;INK/PAPER/FLASH/BRIGHT;CHR$ USR 62220 | prints the variable s$ with the different attributes than the current screen attributes. For example:10 LET s$="This is a test..."20 PAPER 1:INK 0:RAND USR 62048: REM CLS30 PRINT AT 10,5; FLASH 1; PAPER 0, INK 6; CHR$ USR 62220. If you don’t let s$ equal somethiNG, an error report is given. |
RANDOMIZE USR 62292 | scrolls D_FILE1 & 2 one character up. RAND USR 62295 will scroll up D_FILE2 only. |
RANDOMIZE USR 62346 | scrolls D_FILE1 & 2 one character down. RAND USR 62360 will scroll down D_FILE2 only. |
RANDOMIZE USR 62446 | scrolls D_FILE1 & 2 one character left. RAND USR 62461 for D_FILE2 only. |
RANDOMIZE USR 62500 | scrolls D_FILE1 & 2 one character right. RAND USR 62515 for D_FILE2 only. |
Technical Notes
Don’t forget to always CLEAR 61999. When D_FILE2 is in use and the toolkit is in memory, there are 28268 bytes free to BASIC.
The UDG area now begins at 63256. The BASIC program begins at 31510. For a line 0, POKE 31511,0. To put machine code in REM statements, poke at 31514 upward. To SAVE a screen to tape, use:
SAVE "D_FILE1" CODE 16384,6143 SAVE "D_FILE2" CODE 24576,6143
At anytime, you can return to normal mode using OUT 255,0 and return to extended mode with OUT 255,2. When using the fill routine (INPUT USR 62105,x,y), if we reach the top or the bottom of the screen, an error report “Integer out of range” will occur. To overcome this situation, use ON ERR GOTO and ON ERROR RESET in your BASIC programs.
The DRAW command works but we don’t have any control over the attribute. Same thing for CIRCLE. In extended color mode, attribute file2 is opened but not used. If you want you can use it to put machine code there. ATT_FILE2 is between 30720 and 31487 (767 bytes long). (Ed. note, only use RAND USR 62000 once.)
Program Listing — HEXLOADER TOOLKIT ULTRA RES 2068
1 REM HEXLOADER TOOLKIT ULTRA RES 2068 GAG-o85
5 CLEAR 61999: LET a=10: LET b=11: LET c=12: LET d=13: LET e=14: LET f=15
10 LET line=100: LET add=62000
15 READ s$,sum: LET tot=0
20 LET byte=16*VAL s$(1)+VAL s$(2): LET tot=tot+byte: POKE add,byte
25 LET s$=s$(3 TO ): LET add=add+1: IF s$<>"" THEN GO TO 20
30 POKE 23692,255: IF sum=tot THEN PRINT "Line ";line;" OK": LET line=line+1: GO TO 15
40 BEEP .1,1: PRINT "Error at line ";line: STOP
100 DATA "01FEFECD99643E02CD8E0E01FF00CD59FCCD60F2215AF406407ED72310FB212067CD57F221006006203E87772310FCC9CDE4083A8D5C32006021006011016001",6628
101 DATA "0018EDB0C9CDDC1BCD602678FE002808CB18CB18CB18E6C0C5ED4B7D5CCD032601002009C1788177C9CDDC1BCD6026CDF9F2ED5B7D5CCDC0F22006CDDFF21418",8153
102 DATA "F5ED5B7D5C15CDC0F2C0CDDFF21518F6424BCD03264704487E0710FDCB47C0CBC7410F10FD77010020093AF8F277C91CCDC0F2200218F83A7D5C5F1DCDC0F220",7828
103 DATA "0218F83A7D5C5FC90078FE002808CB18CB18CB18E6C0788132F8F2C92A4B53ED4B595CE5ED422809E17EFE5328052318F2CF0123237EFE0028052318E6CF012B",6911
104 DATA "462323C5CD41F3C17ED710F63E08D74EC9E52A845C3A8F5C110020190608772410FCE1C9CD390921006011E05BD5E53E03012000C5E5EDB0D10EE0EDB0060709",6928
105 DATA "3DC120F0413A8D5C121310FCE1D1247CFE6838D9EB732C20FCC921FF5711FF5B3E0001EDF302180D21FF7711FF5B3A8D5C01EDF302D5E53E03012000C5E5EDB8",7542
106 DATA "D10EE0EDB806F909C13D20F0413AEDF3121B10FCE1D1257CF53AEDF3FE00200EF1FE5030D0AF0620121B10FC18BAF1FE7030C2AF0620121B10FCC90000002101",7429
107 DATA "401100403E0001EDF302CD0AF42101601100603A8D5C01EDF30201C000ED43EBF3011F00EDB03AEDF3121323ED4BEBF30D20EAC921FE5711FF573E0001EDF302",6744
108 DATA "CD40F421FE7711FF773A8D5C01EDF30201C000ED43EBF3011F00EDB83AEDF3121B2BED4BEBF30D20EAC9554C545241204849474820434F4C4F52205245534F4C",6956
109 DATA "5554494F4E2032303638544F4F4C4B495420202020204741472D6F2020202076657273696F6E20332E3500000000000000000000000000000000000000000000",2796
500 REM Save Hexloader
510 SAVE "ultra_1": PRINT " Verify ";: VERIFY "": PRINT "OK": STOP
550 REM Save Machine Code
560 SAVE "ultra_c" CODE 62000,620: PRINT " Verify ";: VERIFY "" CODE : PRINT "OK": STOP
Program Listing — DEMO1
1 REM DEMO1 GAG-o85
5 PAPER 0: INK 0: RANDOMIZE USR 62048
10 LET r=35: LET s=35: LET t=87
20 FOR n=0 TO 2*PI STEP PI/55
30 LET x=r*COS n: LET y=r*SIN n
35 LET papink=(8*0)+((RND*6)+1)
40 PLOT x+s,y+t
45 INPUT USR 62069,papink,0
50 NEXT n
55 BEEP .1,-1: LET s$="....PRESS A KEY................"
60 PRINT AT 20,0; BRIGHT 1; INK 4;CHR$ USR 62220: REM print s$
70 PAUSE 0: FOR i=0 TO 31
80 RANDOMIZE USR 62500: REM scroll right
90 NEXT i
Program Listing — DEMO2
1 REM DEMO2 GAG-o85
5 PAPER 0: INK 1: BORDER 0: RANDOMIZE USR 62048
9 REM house
10 PLOT 8,10
20 DRAW 48,0: DRAW 0,48: DRAW -48,0: DRAW 0,-48
30 PLOT 56,10: DRAW 70,20: DRAW 0,48: DRAW -70,-20
40 PLOT 8,58: DRAW 24,30: DRAW 24,-30
50 DRAW 70,20: DRAW -24,30: DRAW -70,-20
60 PLOT 0,130: DRAW 175,-10: DRAW 80,10: DRAW 0,45: DRAW -255,0: DRAW 0,-45: REM sky
70 PLOT 0,80: DRAW 30,30: DRAW 135,-5: DRAW 90,-25: REM grass
300 PLOT INVERSE 1,15,15: INPUT USR 62105,5,0: REM fill house
310 PLOT INVERSE 1,57,20: INPUT USR 62105,6,0: PLOT INVERSE 1,122,59: INPUT USR 62105,6,0
320 PLOT INVERSE 1,32,71: INPUT USR 62105,2,0
330 PLOT INVERSE 1,175,150: INPUT USR 62105,1,0: REM fill sky
340 PLOT INVERSE 1,0,116: INPUT USR 62105,4,0: REM fill grass
700 CIRCLE INVERSE 1,180,150,10
Products
Media
Image Gallery
Source Code
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.