Skip to content

Commit

Permalink
Release 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
envenomator committed Apr 4, 2023
1 parent 06163f3 commit 2735f8e
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 687 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This utility provides two options:
![A single transfer over the VDP serial](https://github.com/envenomator/agon-hexload/blob/master/media/vdptransfer.png?raw=true)

## Installation
Copy 'hexload.bin' to the \mos\ directory on the microSD card. If no such directory exists, create it first. This allows the usage of arguments to the utility and loading it using it's base name.
Copy 'hexload.bin' and 'hexload.dll' to the \mos\ directory on the microSD card. If no such directory exists, create it first. This allows the usage of arguments to the utility and loading it using it's base name.

The utility requires at least MOS version 1.02

Expand Down
Binary file removed binaries/MOS 1.02/hexload.bin
Binary file not shown.
Binary file removed binaries/MOS 1.03rc3/hexload.bin
Binary file not shown.
Binary file removed binaries/MOS 1.03rc3/hexload.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion send.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
sys.exit(f'Error: file \'{sys.argv[1]}\' not found')

if len(sys.argv) == 2:
serialport = 'COM3'
serialport = 'COM11'

if len(sys.argv) >= 3:
serialport = sys.argv[2]
Expand Down
1 change: 0 additions & 1 deletion src/Hexload.linkcmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ DEFINE __len_bss = length of BSS
".\main.obj", \
".\mos-interface.obj", \
".\hxload.obj", \
".\vdp.obj", \
".\serial.obj", \
".\uart.obj", \
"C:\ZiLOG\ZDSII_eZ80Acclaim!_5.3.5\lib\std\chelpD.lib", \
Expand Down
32 changes: 10 additions & 22 deletions src/Hexload.wsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ptn_Child5=Document-4
ptn_Child6=Document-5
ptn_Child7=Document-6
ptn_Child8=Document-7
ptn_Child9=Document-8

[WorkState_v1_2.Frames.ChildFrames.Document-0]
ptn_Child1=ViewFrame-0
Expand Down Expand Up @@ -41,72 +40,61 @@ WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPIPPPPPPPBOPPPPPPOEAAAAAA
ptn_Child1=ViewFrame-0

[WorkState_v1_2.Frames.ChildFrames.Document-2.ViewFrame-0]
DocPathName=.\vdp.c
DocTemplateIndex=0
DocumentString=IDE.Document
IsActiveChildFrame=False
IsFrameVisible=True
WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPIPPPPPPPBOPPPPPPKBAAAAAAKBAAAAAAFIEAAAAACDBAAAAA

[WorkState_v1_2.Frames.ChildFrames.Document-3]
ptn_Child1=ViewFrame-0

[WorkState_v1_2.Frames.ChildFrames.Document-3.ViewFrame-0]
DocPathName=.\Hexload.linkcmd
DocTemplateIndex=0
DocumentString=IDE.Document
IsActiveChildFrame=True
IsFrameVisible=True
WindowPlacement=MCAAAAAACAAAAAAADAAAAAAAPPPPPPPPPPPPPPPPIPPPPPPPBOPPPPPPOEAAAAAAOEAAAAAAOFEAAAAAGACAAAAA

[WorkState_v1_2.Frames.ChildFrames.Document-4]
[WorkState_v1_2.Frames.ChildFrames.Document-3]
ptn_Child1=ViewFrame-0

[WorkState_v1_2.Frames.ChildFrames.Document-4.ViewFrame-0]
[WorkState_v1_2.Frames.ChildFrames.Document-3.ViewFrame-0]
DocPathName=.\mos_api.inc
DocTemplateIndex=0
DocumentString=IDE.Document
IsActiveChildFrame=False
IsFrameVisible=True
WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPIPPPPPPPBOPPPPPPCIAAAAAACIAAAAAACJEAAAAAKDCAAAAA

[WorkState_v1_2.Frames.ChildFrames.Document-5]
[WorkState_v1_2.Frames.ChildFrames.Document-4]
ptn_Child1=ViewFrame-0

[WorkState_v1_2.Frames.ChildFrames.Document-5.ViewFrame-0]
[WorkState_v1_2.Frames.ChildFrames.Document-4.ViewFrame-0]
DocPathName=.\mos-interface.h
DocTemplateIndex=0
DocumentString=IDE.Document
IsActiveChildFrame=False
IsFrameVisible=True
WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPIPPPPPPPBOPPPPPPMJAAAAAAMJAAAAAAMKEAAAAAEFCAAAAA

[WorkState_v1_2.Frames.ChildFrames.Document-6]
[WorkState_v1_2.Frames.ChildFrames.Document-5]
ptn_Child1=ViewFrame-0

[WorkState_v1_2.Frames.ChildFrames.Document-6.ViewFrame-0]
[WorkState_v1_2.Frames.ChildFrames.Document-5.ViewFrame-0]
DocPathName=.\mos-interface.asm
DocTemplateIndex=0
DocumentString=IDE.Document
IsActiveChildFrame=False
IsFrameVisible=True
WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPIPPPPPPPBOPPPPPPIGAAAAAAIGAAAAAAKFEAAAAACIBAAAAA

[WorkState_v1_2.Frames.ChildFrames.Document-7]
[WorkState_v1_2.Frames.ChildFrames.Document-6]
ptn_Child1=ViewFrame-0

[WorkState_v1_2.Frames.ChildFrames.Document-7.ViewFrame-0]
[WorkState_v1_2.Frames.ChildFrames.Document-6.ViewFrame-0]
DocPathName=.\uart.h
DocTemplateIndex=0
DocumentString=IDE.Document
IsActiveChildFrame=False
IsFrameVisible=True
WindowPlacement=MCAAAAAAAAAAAAAABAAAAAAAPPPPPPPPPPPPPPPPIPPPPPPPBOPPPPPPEDAAAAAAEDAAAAAAGCEAAAAAOEBAAAAA

[WorkState_v1_2.Frames.ChildFrames.Document-8]
[WorkState_v1_2.Frames.ChildFrames.Document-7]
ptn_Child1=ViewFrame-0

[WorkState_v1_2.Frames.ChildFrames.Document-8.ViewFrame-0]
[WorkState_v1_2.Frames.ChildFrames.Document-7.ViewFrame-0]
DocPathName=.\uart.c
DocTemplateIndex=0
DocumentString=IDE.Document
Expand Down
1 change: 0 additions & 1 deletion src/Hexload.zdsproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<file filter-key="">.\mos-interface.asm</file>
<file filter-key="">.\Hexload.linkcmd</file>
<file filter-key="">.\hxload.asm</file>
<file filter-key="">.\vdp.c</file>
<file filter-key="">.\serial.asm</file>
<file filter-key="">.\uart.c</file>
</files>
Expand Down
28 changes: 1 addition & 27 deletions src/hexload.mak
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,6 @@ clean:
$(RM) "$(WORKDIR)\hxload.lis"
@if exist "$(WORKDIR)\hxload.lst" \
$(RM) "$(WORKDIR)\hxload.lst"
@if exist "$(WORKDIR)\vdp.obj" \
$(RM) "$(WORKDIR)\vdp.obj"
@if exist "$(WORKDIR)\vdp.lis" \
$(RM) "$(WORKDIR)\vdp.lis"
@if exist "$(WORKDIR)\vdp.lst" \
$(RM) "$(WORKDIR)\vdp.lst"
@if exist "$(WORKDIR)\vdp.src" \
$(RM) "$(WORKDIR)\vdp.src"
@if exist "$(WORKDIR)\serial.obj" \
$(RM) "$(WORKDIR)\serial.obj"
@if exist "$(WORKDIR)\serial.lis" \
Expand All @@ -142,8 +134,6 @@ relist:
C:\source\agon-hexload\src\mos-interface.asm
$(AS) $(ASFLAGS) -relist:"C:\source\agon-hexload\src\Debug\hexload.map" \
C:\source\agon-hexload\src\hxload.asm
$(AS) $(ASFLAGS) -relist:"C:\source\agon-hexload\src\Debug\hexload.map" \
C:\source\agon-hexload\src\Debug\vdp.src
$(AS) $(ASFLAGS) -relist:"C:\source\agon-hexload\src\Debug\hexload.map" \
C:\source\agon-hexload\src\serial.asm
$(AS) $(ASFLAGS) -relist:"C:\source\agon-hexload\src\Debug\hexload.map" \
Expand All @@ -159,7 +149,6 @@ OBJS = \
$(WORKDIR_ESCSPACE)\main.obj \
$(WORKDIR_ESCSPACE)\mos-interface.obj \
$(WORKDIR_ESCSPACE)\hxload.obj \
$(WORKDIR_ESCSPACE)\vdp.obj \
$(WORKDIR_ESCSPACE)\serial.obj \
$(WORKDIR_ESCSPACE)\uart.obj

Expand Down Expand Up @@ -190,9 +179,7 @@ $(WORKDIR_ESCSPACE)\main.obj : \
$(INCLUDE_ESCSPACE)\zilog\uart.h \
$(INCLUDE_ESCSPACE)\zilog\uartdefs.h \
$(PRJDIR_ESCSPACE)\mos-interface.h \
$(PRJDIR_ESCSPACE)\stdint.h \
$(PRJDIR_ESCSPACE)\uart.h \
$(PRJDIR_ESCSPACE)\vdp.h
$(PRJDIR_ESCSPACE)\uart.h
$(CC) $(CFLAGS) "$(PRJDIR)\main.c"

$(WORKDIR_ESCSPACE)\mos-interface.obj : \
Expand All @@ -205,26 +192,13 @@ $(WORKDIR_ESCSPACE)\hxload.obj : \
$(PRJDIR_ESCSPACE)\mos_api.inc
$(AS) $(ASFLAGS) "$(PRJDIR)\hxload.asm"

$(WORKDIR_ESCSPACE)\vdp.obj : \
$(PRJDIR_ESCSPACE)\vdp.c \
$(INCLUDE_ESCSPACE)\zilog\defines.h \
$(PRJDIR_ESCSPACE)\mos-interface.h \
$(PRJDIR_ESCSPACE)\stdint.h \
$(PRJDIR_ESCSPACE)\vdp.h
$(CC) $(CFLAGS) "$(PRJDIR)\vdp.c"

$(WORKDIR_ESCSPACE)\serial.obj : \
$(PRJDIR_ESCSPACE)\serial.asm
$(AS) $(ASFLAGS) "$(PRJDIR)\serial.asm"

$(WORKDIR_ESCSPACE)\uart.obj : \
$(PRJDIR_ESCSPACE)\uart.c \
$(INCLUDE_ESCSPACE)\std\Format.h \
$(INCLUDE_ESCSPACE)\std\Stdarg.h \
$(INCLUDE_ESCSPACE)\std\Stddef.h \
$(INCLUDE_ESCSPACE)\std\Stdio.h \
$(INCLUDE_ESCSPACE)\zilog\cio.h \
$(INCLUDE_ESCSPACE)\zilog\defines.h \
$(INCLUDE_ESCSPACE)\zilog\eZ80190.h \
$(INCLUDE_ESCSPACE)\zilog\eZ80F91.h \
$(INCLUDE_ESCSPACE)\zilog\eZ80F92.h \
Expand Down
48 changes: 26 additions & 22 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Title: AGON Hexload code
* Author: Jeroen Venema
* Created: 22/10/2022
* Last Updated: 07/01/2023
* Last Updated: 04/04/2023
*
* Modinfo:
* 22/10/2022: Initial version MOS patch
Expand All @@ -13,6 +13,7 @@
* 23/02/2023: Bugfix - DEFB used, should have been DS at end of hxload.asm
* Option to save as file to SD card
* 30/03/2023: Preparation for MOS 1.03
* 04/04/2023: Making use of mos_setintvector, kept own UART1 handler for speed
*/

#define DEFAULT_BAUDRATE 384000
Expand All @@ -22,11 +23,8 @@
#include <string.h>
#include <stdlib.h>
#include "mos-interface.h"
#include "vdp.h"
#include "uart.h"

#define MOS103_SETVECTOR 0x000B1A

// external assembly routines
extern VOID hxload_vdp(void);
extern CHAR hxload_uart1(void);
Expand All @@ -36,6 +34,9 @@ extern VOID uart1_handler(void);
extern volatile UINT24 startaddress;
extern volatile UINT24 endaddress;

// single VDP function needed
UINT8 vdp_cursorGetXpos(void);

int errno; // needed by stdlib

typedef void * rom_set_vector(unsigned int vector, void(*handler)(void));
Expand Down Expand Up @@ -75,32 +76,27 @@ void handle_hexload_uart1(UINT24 baudrate)
{
CHAR c;
void *oldvector;

rom_set_vector *set_vector = (rom_set_vector *)MOS103_SETVECTOR;
UART pUART;

pUART.baudRate = baudrate;
pUART.dataBits = 8;
pUART.stopBits = 1;
pUART.parity = PAR_NOPARITY;
pUART.flowcontrol = 0;
pUART.eir = UART_IER_RECEIVEINT;
pUART.interrupts = UART_IER_RECEIVEINT;

oldvector = mos_setintvector(UART1_IVECT, uart1_handler);

//init_UART1(); // set the Rx/Tx port pins
//open_UART1(&pUART); // Open the UART, set interrupt
mos_uopen(&pUART);
init_UART1();
open_UART1(&pUART);
// Only feedback during transfer - we have no time to output to VDP or even UART1 between received bytes
printf("Receiving Intel HEX records - UART1:%d 8N1\r\n",baudrate);
c = hxload_uart1();

if(c == 0) printf("OK\r\n");
else printf("%d error(s)\r\n",c);

// close UART1, so no more interrupts and default port pins Rx/Tx
// close UART1, so no more interrupts will trigger before removal of handler
close_UART1();
//mos_uclose();
// disable UART1 interrupt, set previous vector (__default_mi_handler in MOS ROM, might change on every revision)
mos_setintvector(UART1_IVECT, oldvector);
}
Expand All @@ -109,14 +105,8 @@ int main(int argc, char * argv[]) {
UINT24 baudrate = 0;
char *end;
char *filename = NULL;

if(argc == 1)
{
printf("Usage: hexload <uart1 [baudrate]| vdp> [filename]\r\n");
return 0;
}

if(strcmp("uart1",argv[1]) == 0)
if((argc >= 2) && (strcmp("uart1",argv[1]) == 0))
{
if(argc >= 3) {
baudrate = strtol(argv[2], &end, 10);
Expand All @@ -139,8 +129,7 @@ int main(int argc, char * argv[]) {
return 0;
}

if(strcmp("vdp",argv[1]) == 0)
{
if((argc >= 2) && (strcmp("vdp",argv[1]) == 0)) {
if(argc > 3) {
printf("Too many arguments\r\n");
return 0;
Expand All @@ -150,5 +139,20 @@ int main(int argc, char * argv[]) {
write_file(filename);
return 0;
}
printf("Usage: hexload <uart1 [baudrate]| vdp> [filename]\r\n");
return 0;
}

UINT8 vdp_cursorGetXpos(void)
{
unsigned int delay;

putch(23); // VDP command
putch(0); // VDP command
putch(0x82); // Request cursor position

delay = 255;
while(delay--);
return(getsysvar_cursorX());

}
24 changes: 2 additions & 22 deletions src/mos-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define MOS_H

#include <defines.h>
#include "uart.h"

// File access modes - from mos_api.inc
#define fa_read 0x01
Expand Down Expand Up @@ -58,27 +59,6 @@
#define vdp_pflag_mode 0x10
#define vdp_pflag_rtc 0x20

// UART settings for open_UART1
//
typedef struct {
INT24 baudRate ; //!< The baudrate to be used.
BYTE dataBits ; //!< The number of databits per character to be used.
BYTE stopBits ; //!< The number of stopbits to be used.
BYTE parity ; //!< The parity bit option to be used.
BYTE flowcontrol ;
BYTE eir ;
} UART ;

// UART settings structure
//typedef struct {
// INT24 baudRate ; // The baudrate to be used.
// BYTE dataBits ; // The number of databits per character to be used.
// BYTE stopBits ; // The number of stopbits to be used.
// BYTE parity ; // The parity bit option to be used.
// BYTE flowcontrol ; // Flowcontrol 0/1
// BYTE ier ; // Interrupt enable register bits
//} uartsettings ;

// Generic IO
extern int putch(int a);
extern char getch(void);
Expand Down Expand Up @@ -130,7 +110,7 @@ extern UINT8 mos_oscli(char *command, char **argv, UINT24 argc);
extern UINT8 mos_getrtc(char *buffer);
extern void mos_setrtc(UINT8 *timedata);
//extern void* mos_setintvector(UINT8 vector, void(*handler)(void));
extern void* mos_setintvector(UINT8 vector, void*);
extern void* mos_setintvector(UINT8 vector, void(*handler)(void));
extern UINT8 mos_uopen(UART *settings);
extern void mos_uclose(void);
extern int mos_ugetc(void); // 0-255 valid character - >255 error
Expand Down
Loading

0 comments on commit 2735f8e

Please sign in to comment.