Hexload Error in 120

159 views
Skip to first unread message

G Kr

unread,
May 27, 2018, 6:07:26 AM5/27/18
to RC2014-Z80
Hi all... on sunday,
actually I wanted to test the joystick board with the snake game.
But I'm already failing on the hexload.

Small Computer Monitor - RC2014
*basic

Memory top? 35071
Z80 BASIC Ver 4.7b
Copyright (C) 1978 by Microsoft
1985 Bytes free
Ok
10 REM Created by Filippo Bergamasco,
11 REM and modified by DaveP for the RC2014
12 REM Adapted for z88dk by feilipu
20 REM Version 1.0
30 Print "Loading Data"
40 let mb=&H8900
50 print "Start Address: ";hex$(mb)
60 REM Go to READ Subroutine.
70 GOSUB 1000
80 print "End Address:   ";hex$(mb-1)

90 REM Change USR(0) Pointer for HexLoad
100 GOSUB 1100

110 REM RUN THE HEXLOAD CODE!
120 print usr(0)

130 REM Change USR(0) Pointer to 0x9000
140 GOSUB 1200

150 REM RUN THE PROGRAMME CODE!
160 print usr(0)
170 END

1000 REM Routine to load Data
1010 REM Needs var mb set to start location
1020 read a
1030 if a>255 then RETURN
1040 rem print HEX$(mb),a
1050 poke mb, a
1060 let mb=mb+1
1070 goto 1020

1100 REM Location of usr address &H8049
1110 print "USR(0) -> HexLoad"
1120 let mb=&H8049
1130 doke mb, &H8900
1140 RETURN

1200 REM Location of usr address &H8049
1210 print "USR(0) -> 0x9000, z88dk default"
1220 let mb=&H8049
1230 doke mb, &H9000
1240 RETURN

9010 data 33,116,137,205,109,137,215,254,58,32,251,14
9040 data 0,205,83,137,71,205,83,137,87,205,83,137
9070 data 95,205,83,137,254,1,40,23,254,0,32,33
9100 data 205,83,137,18,19,16,249,205,83,137,121,183
9130 data 32,26,62,35,207,24,207,205,83,137,121,183
9160 data 32,14,33,206,137,205,109,137,201,33,172,137
9190 data 205,109,137,201,33,189,137,205,109,137,201,205
9220 data 100,137,7,7,7,7,111,205,100,137,181,111
9250 data 129,79,125,201,215,214,48,254,10,216,214,7
9280 data 201,126,183,200,207,35,24,249,72,69,88,32
9310 data 76,79,65,68,69,82,32,98,121,32,70,105
9340 data 108,105,112,112,111,32,66,101,114,103,97,109
9370 data 97,115,99,111,32,38,32,102,101,105,108,105
9400 data 112,117,32,102,111,114,32,122,56,56,100,107
9430 data 10,13,58,0,10,13,73,110,118,97,108,105
9460 data 100,32,84,121,112,101,10,13,0,10,13,66
9490 data 97,100,32,67,104,101,99,107,115,117,109,10
9520 data 13,0,10,13,68,111,110,101,10,13,0,0
9550 data 999
9999 END
run
Loading Data
Start Address: 8900
End Address:   89D7
USR(0) -> HexLoad
?FC Error in 120
Ok

That actually looks pretty good ... except for the Error in 120 :- (
What am I doing wrong?
Regards
Gerd

phillip.stevens

unread,
May 27, 2018, 6:17:00 AM5/27/18
to RC2014-Z80


On Sunday, 27 May 2018 20:07:26 UTC+10, G Kr wrote:
Hi all... on sunday,
actually I wanted to test the joystick board with the snake game.
But I'm already failing on the hexload.

Small Computer Monitor - RC2014
*basic

snip

9999 END
run
Loading Data
Start Address: 8900
End Address:   89D7
USR(0) -> HexLoad
?FC Error in 120
Ok

That actually looks pretty good ... except for the Error in 120 :- (
What am I doing wrong?
Regards
Gerd

The problem starts right at the top.
This program is designed for the standard ROM provided with the Classic and Mini RC2014.
It won't work with the SCM, because locations (particularly that of the HexLoad program) will be wrong.

The issue is with these two lines:

1120 let mb=&H8049
1130 doke mb, &H8900

The location of the USR variable for the Basic loaded with the SCM is different from the standard load, so the standard ?FC Errror is being displayed.

If you've already been able to load a ROM, then you don't need this program. Either use the hexload capability from within the SCM, or load the HexLoadr ROM, and follow its instructions.

Cheers, Phillip


Steve Cousins

unread,
May 27, 2018, 6:33:35 AM5/27/18
to RC2014-Z80
HI Gerd

It is failing when making the call to your code because the USR function pointer is not set correctly in the routine below.

1100 REM Location of usr address &H8049
1110 print "USR(0) -> HexLoad"
1120 let mb=&H8049
1130 doke mb, &H8900
1140 RETURN

The correct value for mb (in the routine above) depends on the build of BASIC in use. The version in SCMonitor is different from the one assumed in the routine above.

There are two variants of BASIC included in the SCMonitor ROM, depending on the monitor configuration (R1, R2, R3, etc). Each of these has a different location for BASIC's workspace as they are built for different memory sizes, and thus have different locations for the USR pointer (mb).

The possible values of mb are &H4004 for the 47k BASIC in configuration R2, or &H8004 for the 31k BASIC in configuration R3.

If you load the BASIC interpreter into RAM from the supplied HEX file, then the value of mb would be &HA004. 

See page 40 of the Small Computer Monitor User Guide v1.0 for more details.

So I think this will work:

1100 REM Location of usr address &H8049
1110 print "USR(0) -> HexLoad"
1120 let mb=&H4004

1130 doke mb, &H8900
1140 RETURN

If the above does not work, try:

1100 REM Location of usr address &H8049
1110 print "USR(0) -> HexLoad"
1120 let mb=&H8004

1130 doke mb, &H8900
1140 RETURN

Steve

G Kr

unread,
May 27, 2018, 7:02:52 AM5/27/18
to RC2014-Z80
Thanks Steve and Phillip, these were quick answers.
I tried Steve's version ... the second went well.

1100 REM Location of usr address &H8049
1110 print "USR(0) -> HexLoad"
1120 let mb=&H8004

1130 doke mb, &H8900
1140 RETURN
 
...

run
Loading Data
Start Address: 8900
End Address:   89D7
USR(0) -> HexLoad
HEX LOADER by Filippo Bergamasco & feilipu for z88dk
:##############################################################################################################################################################################
Done
 0

USR(0) -> 0x9000, z88dk default
HEX LOADER by Filippo Bergamasco & feilipu for z88dk
:
... and then comes the next stupid question: What's next?
I have loaded the snake hex file from https://github.com/RC2014Z80/RC2014/tree/master/ROMs/snake
Would I have to recompile that?

Steve Cousins

unread,
May 27, 2018, 7:10:14 AM5/27/18
to RC2014-Z80
Hi Gerd

Looks like you would need to recompile as the code appears to be assembled to start at location &H0000.

It appears to be written as a stand alone ROM, so you could just program it into ROM and turn your '14 into a dedicated games machine!

Steve

phillip.stevens

unread,
May 27, 2018, 7:11:44 AM5/27/18
to RC2014-Z80
1100 REM Location of usr address &H8049
1110 print "USR(0) -> HexLoad"
1120 let mb=&H8004
1130 doke mb, &H8900
1140 RETURN
 
...

run
Loading Data
Start Address: 8900
End Address:   89D7
USR(0) -> HexLoad
HEX LOADER by Filippo Bergamasco & feilipu for z88dk
:##############################################################################################################################################################################
Done
 0
USR(0) -> 0x9000, z88dk default
HEX LOADER by Filippo Bergamasco & feilipu for z88dk
:
... and then comes the next stupid question: What's next?
I have loaded the snake hex file from https://github.com/RC2014Z80/RC2014/tree/master/ROMs/snake
Would I have to recompile that?

The idea behind the hexload program is to support users of the Classic RC2014 and Mini 2014, with the standard ROM and no ability to program their own ROM, into the world of assembly and C programming.
If you can write your own ROMs, have access to a CP/M version, or the Steve's SCM (see page 31), then you don't need to use hexload.

If you're interested in writing a mixture of C and assembly programs, then I can recommend the Z88DK.
The default RC2014 target for the Z88DK assumes that you are loading code at 0x9000, with a BASIC providing the RST serial interfaces.
But, you can also compile to a raw RC2014 target, for either ACIA or SIO serial interfaces.

Cheers, Phillip

Steve Cousins

unread,
May 27, 2018, 7:19:51 AM5/27/18
to RC2014-Z80
Hi Phillip

SCM also provides RST serial interface support, so code written to execute at 0x9000 and only using RST 0x08, 0x10 and 0x18 for serial I/O should run.

So as you say, with SCM and the HEX file it should be just a simple download and run. No need to go through BASIC.

Steve

phillip.stevens

unread,
May 27, 2018, 7:21:17 AM5/27/18
to RC2014-Z80
... and then comes the next stupid question: What's next?
I have loaded the snake hex file from https://github.com/RC2014Z80/RC2014/tree/master/ROMs/snake
Would I have to recompile that?

The idea behind the hexload program is to support users of the Classic RC2014 and Mini 2014, with the standard ROM and no ability to program their own ROM, into the world of assembly and C programming.
If you can write your own ROMs, have access to a CP/M version, or the Steve's SCM (see page 31), then you don't need to use hexload.

If you're interested in writing a mixture of C and assembly programs, then I can recommend the Z88DK.
The default RC2014 target for the Z88DK assumes that you are loading code at 0x9000, with a BASIC providing the RST serial interfaces.
But, you can also compile to a raw RC2014 target, for either ACIA or SIO serial interfaces.

To actually answer your question. The snake program is written for an interface to the pi graphics board, so it is likely that it won't work for you at all.

If you want to try some games that are text based, I suggest using the EXAMPLES folder from Z88dk.
The general command line for these is something like:

zcc +rc2014 -subtype=basic -v -m --list -SO3 -clib=sdcc_iy --max-allocs-per-node100000 --opt-code-size startrek.c -o startrek -lm -create-app

-v verbose
-m map file
--list list files

other subtypes

-subtype=acia is for ROM burning and ACIA serial
-subtype=sio is for ROM burining and SIO serial

Phillip

G Kr

unread,
May 27, 2018, 7:51:37 AM5/27/18
to RC2014-Z80
Ui, there's a lot of things that I obviously have to think about ... and try ...
I have a Pi in use.
Only alone, the snake game but probably not in ROM on 0x0000 run (???)
Anyway, it did not do it in a first test ... not even with the Pi graphics.
I'll try some of what you've suggested ... if I can understand it at all.
That's going to take time...

G Kr

unread,
May 28, 2018, 7:16:37 AM5/28/18
to RC2014-Z80
Hi Steve and Phillip,
stand alone should snake well ... but I assume it is not compiled for the SIO/2 card in conjunction with the PI.
So I just see "... Waiting for UART data (115200.8, N, 1)". Could I be right with my guess?

Unfortunately, the z88dk on Windows does not work for me yet. Otherwise I would have liked to follow Phillip's advice.
In z88dk config file for rc2014 I find synonymous only

SUBTYPE acia -startup = 0 -Cz "+ rom --ihex"
SUBTYPE basic -startup = 16 -Cz "+ rom --ihex"
SUBTYPE none -startup = 256 -Cz "+ rom --ihex"

  and no sio type. How should the entry look like? And would a textual supplement suffice?

Regards
Gerd

phillip.stevens

unread,
May 28, 2018, 7:29:32 AM5/28/18
to RC2014-Z80
stand alone should snake well ... but I assume it is not compiled for the SIO/2 card in conjunction with the PI.
 
The Pi has to be loaded with the specific naked machine code for PiGFX (not the normal operating system). I'm not sure how to do that.
 
So I just see "... Waiting for UART data (115200.8, N, 1)". Could I be right with my guess?

Unfortunately, the z88dk on Windows does not work for me yet. Otherwise I would have liked to follow Phillip's advice.
In z88dk config file for rc2014 I find synonymous only

SUBTYPE acia -startup = 0 -Cz "+ rom --ihex"
SUBTYPE basic -startup = 16 -Cz "+ rom --ihex"
SUBTYPE none -startup = 256 -Cz "+ rom --ihex"
and no sio type. How should the entry look like? And would a textual supplement suffice?

The current z88dk subtypes available for the RC2014 are found here.
SUBTYPE   acia        -startup=0   -Cz"+rom --ihex"
SUBTYPE   sio        
-startup=4   -Cz"+rom --ihex"
SUBTYPE   basic      
-startup=16  -Cz"+hex --ihex"
SUBTYPE   none        
-startup=256 -Cz"+rom --ihex"

Of course if you're using CP/M, then the CP/M target +cpm will also work on the RC2014.
It may be easier in the first instance to use the CP/M target for z88dk to get things running on RC2014.

z88dk is quite fast moving. Contributions come in daily across the classic targets, and both compilers and the assembler are improved on a weekly basis. Currently there is a lot of drive for support for the SpecNext or z80-zxn target, which is demanding paged memory and extended op code support.

Point being, it is worth the effort to clone and build it, so you can stay up to date with the most recent code.
I've never seen it build broken, as continuous integration usually flags issues before they are committed.

Cheers, Phillip


G Kr

unread,
May 28, 2018, 7:43:10 AM5/28/18
to RC2014-Z80
Oh, I saw, the config file was added...

G Kr

unread,
May 28, 2018, 8:47:51 AM5/28/18
to RC2014-Z80
Thank you Phillip.
I have to download the finished win32 zip files because the build is not working for me. But that's okay.
And after all, I've had the compiler running for the first time .... with the startrek as a test ... but I have never seen so many warnings :-) A bin file has also been created ;-)
Well, I try to move forward.

The PiGFX proves somehow not very useful ... How to install a keyboard driver for alternative keyboards (for example, German), I have not found yet. That is annoying.
But maybe it just lacks more experience. ;-)
Gerd
Reply all
Reply to author
Forward
0 new messages