Skip to content

Commit

Permalink
Native ARM Co Pro: *PIVDU 2 OSWRCH Redirector copied from wrong addre…
Browse files Browse the repository at this point in the history
…ss (#170)

Change-Id: Icc881b8c1c3f280b43b4b79c77cacad3bd916672
  • Loading branch information
hoglet67 committed Jun 10, 2023
1 parent 4590ace commit 353e101
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 59 deletions.
34 changes: 18 additions & 16 deletions src/programs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2852,27 +2852,27 @@ static const unsigned char dormann_d65c02[] = {
// Careful, this now starts at &280

static const unsigned char osword_driver[] = {
0xad, 0x0a, 0x02, 0x8d, 0x1e, 0x03, 0xad, 0x0b, 0x02, 0x8d, 0x1f, 0x03,
0xa9, 0x11, 0x8d, 0x0a, 0x02, 0xa9, 0x03, 0x8d, 0x0b, 0x02, 0xad, 0x0c,
0x02, 0x8d, 0x74, 0x03, 0xad, 0x0d, 0x02, 0x8d, 0x75, 0x03, 0xa9, 0x6f,
0x8d, 0x0c, 0x02, 0xa9, 0x03, 0x8d, 0x0d, 0x02, 0xa9, 0x6b, 0x8d, 0x0e,
0xad, 0x0a, 0x02, 0x8d, 0x55, 0x03, 0xad, 0x0b, 0x02, 0x8d, 0x56, 0x03,
0xa9, 0x48, 0x8d, 0x0a, 0x02, 0xa9, 0x03, 0x8d, 0x0b, 0x02, 0xad, 0x0c,
0x02, 0x8d, 0x38, 0x03, 0xad, 0x0d, 0x02, 0x8d, 0x39, 0x03, 0xa9, 0x33,
0x8d, 0x0c, 0x02, 0xa9, 0x03, 0x8d, 0x0d, 0x02, 0xa9, 0x2f, 0x8d, 0x0e,
0x02, 0xa9, 0x03, 0x8d, 0x0f, 0x02, 0xa9, 0x09, 0x85, 0x81, 0xa0, 0x2b,
0x84, 0x80, 0xb9, 0x3f, 0x03, 0x5a, 0x20, 0x03, 0x03, 0x7a, 0x88, 0x10,
0x84, 0x80, 0xb9, 0x03, 0x03, 0x5a, 0x20, 0x3a, 0x03, 0x7a, 0x88, 0x10,
0xf3, 0xc8, 0xa9, 0x04, 0xa2, 0x01, 0x20, 0xf4, 0xff, 0xa9, 0x02, 0x85,
0x81, 0xa9, 0x0e, 0x85, 0x80, 0xa9, 0x00, 0x20, 0x03, 0x03, 0xa9, 0x09,
0x20, 0x03, 0x03, 0xa9, 0x03, 0x85, 0x81, 0xa9, 0x08, 0x85, 0x80, 0xa9,
0x00, 0x20, 0x03, 0x03, 0xe6, 0x80, 0xa9, 0x4f, 0xd0, 0x0d, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x80, 0x02, 0x85,
0x84, 0xa9, 0x06, 0xa2, 0x80, 0xa0, 0x00, 0x20, 0xf1, 0xff, 0xe6, 0x80,
0x60, 0xc9, 0x86, 0xf0, 0x0b, 0xc9, 0x87, 0xf0, 0x0e, 0xc9, 0xa0, 0xf0,
0x13, 0x4c, 0xea, 0xea, 0xae, 0xf1, 0xfe, 0xac, 0xf2, 0xfe, 0x60, 0xa2,
0x54, 0x20, 0x30, 0x03, 0xae, 0xf3, 0xfe, 0x60, 0xe8, 0x8e, 0xf4, 0xfe,
0xac, 0xf4, 0xfe, 0xca, 0x8e, 0xf4, 0xfe, 0xae, 0xf4, 0xfe, 0x60, 0x48,
0x81, 0xa9, 0x0e, 0x85, 0x80, 0xa9, 0x00, 0x20, 0x3a, 0x03, 0xa9, 0x09,
0x20, 0x3a, 0x03, 0xa9, 0x03, 0x85, 0x81, 0xa9, 0x08, 0x85, 0x80, 0xa9,
0x00, 0x20, 0x3a, 0x03, 0xe6, 0x80, 0xa9, 0x4f, 0xd0, 0x44, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x80, 0x02, 0x48,
0xc9, 0x0c, 0xf0, 0x17, 0xc9, 0x0d, 0xf0, 0x13, 0xc9, 0x1e, 0xf0, 0x0f,
0xc9, 0x20, 0x90, 0x11, 0xee, 0x18, 0x03, 0xad, 0x0a, 0x03, 0xcd, 0x18,
0x03, 0xb0, 0x06, 0xad, 0x08, 0x03, 0x8d, 0x18, 0x03, 0xa9, 0x03, 0x8d,
0xe2, 0xfe, 0x68, 0x8d, 0xe4, 0xfe, 0x60, 0x8d, 0xf8, 0xfe, 0x60, 0xc9,
0x00, 0xf0, 0x03, 0x4c, 0xea, 0xea, 0x86, 0xf0, 0x84, 0xf1, 0xa0, 0x04,
0x00, 0xf0, 0x3f, 0x4c, 0xea, 0xea, 0x85, 0x84, 0xa9, 0x06, 0xa2, 0x80,
0xa0, 0x00, 0x20, 0xf1, 0xff, 0xe6, 0x80, 0x60, 0xc9, 0x86, 0xf0, 0x0b,
0xc9, 0x87, 0xf0, 0x0e, 0xc9, 0xa0, 0xf0, 0x13, 0x4c, 0xea, 0xea, 0xae,
0xf1, 0xfe, 0xac, 0xf2, 0xfe, 0x60, 0xa2, 0x54, 0x20, 0x67, 0x03, 0xae,
0xf3, 0xfe, 0x60, 0xe8, 0x8e, 0xf4, 0xfe, 0xac, 0xf4, 0xfe, 0xca, 0x8e,
0xf4, 0xfe, 0xae, 0xf4, 0xfe, 0x60, 0x86, 0xf0, 0x84, 0xf1, 0xa0, 0x04,
0xb1, 0xf0, 0x99, 0xf6, 0x02, 0x88, 0xc0, 0x02, 0xb0, 0xf6, 0xb1, 0xf0,
0x85, 0xe9, 0x88, 0xb1, 0xf0, 0x85, 0xe8, 0x90, 0x07, 0xa9, 0x07, 0x88,
0xc8, 0x20, 0xee, 0xff, 0x20, 0xe0, 0xff, 0xb0, 0x5c, 0xc9, 0x7f, 0xd0,
Expand All @@ -2886,7 +2886,9 @@ static const unsigned char osword_driver[] = {
0xb0, 0x9d, 0x20, 0xe7, 0xff, 0xa5, 0xff, 0x2a, 0xa9, 0x00, 0x60
};

const unsigned char *host_oswrch_redirector = osword_driver;
// The osword driver is assembed at 0x280, and the host oswrch code is
// fixes to start at 0x303, hence the 0x83 offset.
const unsigned char *host_oswrch_redirector = osword_driver + 0x83;

int search_bin(const uint8_t *pattern, unsigned int psize, const uint8_t *data, unsigned int dsize) {
const uint8_t *dptr = data;
Expand Down
89 changes: 46 additions & 43 deletions tools/frame_buffer/osword.asm
Original file line number Diff line number Diff line change
Expand Up @@ -119,54 +119,14 @@ clear &300, &3FF

JMP init

.osword6
STA osword6_data
LDA #6
LDX #LO(osword6_param)
LDY #HI(osword6_param)
JSR osword
INC osword6_addr_lo
RTS

.newosbyte
CMP #&86
BEQ osbyte86
CMP #&87
BEQ osbyte87
CMP #&A0
BEQ osbyteA0

EQUB &4C ; JMP

.oldosbyte
NOP
NOP

.osbyte86
LDX char_cursor_x
LDY char_cursor_y
RTS

.osbyte87
LDX #&55-1
JSR osbyteA0
LDX char_at_cursor
RTS

.osbyteA0
INX
STX vdu_var_addr
LDY vdu_var_data
DEX
STX vdu_var_addr
LDX vdu_var_data
RTS

;; Host-side OSWRCH Redirector
;;
;; This redirects OSWRCH calls on the host back over to the Pi VDU driver
;;
;; It's used for the output of MOS command (like *CAT, *HELP, etc)
;;
;; IMPORTANT: This must start at &303 and be position independant
;; as it's used by the Native Arm Co Pro in *PIVDU 2

.host_oswrch_start
;; Stack the character to be printed
Expand Down Expand Up @@ -216,6 +176,49 @@ clear &300, &3FF
NOP
NOP

.osword6
STA osword6_data
LDA #6
LDX #LO(osword6_param)
LDY #HI(osword6_param)
JSR osword
INC osword6_addr_lo
RTS

.newosbyte
CMP #&86
BEQ osbyte86
CMP #&87
BEQ osbyte87
CMP #&A0
BEQ osbyteA0

EQUB &4C ; JMP

.oldosbyte
NOP
NOP

.osbyte86
LDX char_cursor_x
LDY char_cursor_y
RTS

.osbyte87
LDX #&55-1
JSR osbyteA0
LDX char_at_cursor
RTS

.osbyteA0
INX
STX vdu_var_addr
LDY vdu_var_data
DEX
STX vdu_var_addr
LDX vdu_var_data
RTS

;; X/Y Param Block points to
;;
;; Buffer LSB
Expand Down

0 comments on commit 353e101

Please sign in to comment.