Author Topic: RSX infos  (Read 2002 times)

0 Members and 1 Guest are viewing this topic.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2280
  • Likes Given: 3478
RSX infos
« on: 13:41, 02 June 09 »
It is possible to redefine RSX commands using more than one call to KL LOG EXT.
 
Code: [Select]
;
;; firmware functions we use in this example
kl_log_ext: equ &bcd1
txt_output: equ &bb5a
org &4000
start:
LD HL,BufferRsx1
LD BC,RsxTable1
call kl_log_ext
LD HL,BufferRsx2
LD BC,RsxTable2
call kl_log_ext
ret


RsxTable1:
DW RsxCmdTable1
JP FunctionA

BufferRsx1:
defs 4
RsxCmdTable1:
DB "A"+&80
DB 0
RsxTable2:
DW RsxCmdTable2
JP FunctionB

BufferRsx2:
defs 4

RsxCmdTable2:
DB "B"+&80
DB 0
FunctionA:
ld a,"A"
call txt_output
ret

FunctionB:
ld a,"B"
call txt_output
ret
;;end start

Any call to MC START PROGRAM or MC BOOT PROGRAM will clear RSXs you have defined.
This means running a Binary program from BASIC.
 
I remember one other way that RSXs are removed, but I don't remember it at the moment.
 
Another thing, RSXs you defined are checked first.
so in theory (not tested yet), you can define a RSX with the same name as an existing RSX in ROM (or even RSXs that were loaded before yours).
 
If you want to also call the other RSX you would need to find it and store the details of it before you initialise your RSX command.
 
e.g.
find existing command and store infos (address and rom select).
Setup your RSX.
In your RSX, call the existing one.
 
So for example, you could implement your own |DRIVE command to accept your own parameter, but if the parameter was not one for you, pass it to the existing DRIVE command.
 
Just some things I found while I looked at CPC6128 OS rom one day.
 
 
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource