Welcome to Schneider / Amstrad CPC Forum. Please login or sign up.

29. March 2024, 13:30:37

Login with username, password and session length

Shoutbox

TFM

2024-01-15, 17:06:57
Momentan billige Farbbänder auf Ebay für PCW

Devilmarkus

2023-07-09, 10:37:40
Zweiter 👋😂🤣

TFM

2023-06-13, 14:21:49
Sommerloch!

TFM

2023-05-30, 17:00:20
Erster ;-)

Recent

Members
Stats
  • Total Posts: 11,655
  • Total Topics: 1,329
  • Online today: 188
  • Online ever: 1,724
  • (16. January 2020, 00:18:45)
Users Online
Users: 1
Guests: 150
Total: 151

150 Guests, 1 User
xesrjb

Übergabe von Parametern bei dem RSX-Befehl.

Started by cpcman, 09. March 2016, 11:39:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cpcman

Hallo, guten Tag.
Wie kann man hier bitte mit dem RSX-Befehl Daten übernehmen in die Routine, einmal Byte und einmal String?
Zb: |command1,45,254 und |command2,"test",test1"

Kann man bitte mir mal eine kleine Routine für das Byte und den String reinbringen ?

Danke.
Gruss


org &8000

;;-------------------------------------------------------------------------------
;; install RSX

ld hl,work_space ;;address of a 4 byte workspace useable by Kernel
ld bc,jump_table ;;address of command name table and routine handlers
jp kl_log_ext ;;Install RSX's

.work_space                ;Space for kernel to use
defs 4

;;-------------------------------------------------------------------------------
;; RSX definition

.jump_table
defw name_table            ;address pointing to RSX commands

                           ;list of jump commands associated with each command
                           
                           ;The name (in the name_table) and jump instruction
                           ;(in the jump_table), must be in the same
                           ;order.

                           ;i.e. the first name in the name_table refers to the
                           ;first jump in the jump_table, and vice versa.

jp RSX_1_routine           ;routine for COMMAND1 RSX
jp RSX_2_routine           ;routine for COMMAND2 RSX

;; the table of RSX function names
;; the names must be in capitals.

.name_table
defb "COMMAND","1"+&80     ;the last letter of each RSX name must have bit 7 set to 1.
defb "COMMAND","2"+&80     ;This is used by the Kernel to identify the end of the name. 

defb 0                     ;end of name table marker

; Code for the example RSXs

.RSX_1_routine
ret

.RSX_2_routine
ret


cpcman

Hier möchte ich bitte einen Sinuswert von 0-360 übergeben und den Endwert der in HL ist in Basic übernehmen.
Wie geht das bitte?

a%=|sin1,345


.kl_log_ext equ &bcd1

;; this can be any address in the range &0040-&a7ff.
org &8000

;;-------------------------------------------------------------------------------
;; install RSX

ld hl,work_space ;;address of a 4 byte workspace useable by Kernel
ld bc,jump_table ;;address of command name table and routine handlers
jp kl_log_ext ;;Install RSX's

.work_space         ;;Space for kernel to use
defs 4

;;-------------------------------------------------------------------------------
;; RSX definition

.jump_table
defw name_table            ;address pointing to RSX commands

                      ;list of jump commands associated with each command
                           
                           ;The name (in the name_table) and jump instruction
                           ;(in the jump_table), must be in the same
                           ;order.

                           ;i.e. the first name in the name_table refers to the
                           ;first jump in the jump_table, and vice versa.

jp SIN1_routine           ;routine for COMMAND1 RSX

;; the table of RSX function names
;; the names must be in capitals.

.name_table
defb "SIN","1"+&80     ;the last letter of each RSX name must have bit 7 set to 1.

defb 0                     ;end of name table marker

; Code for the example RSXs

.SIN1_routine
INTSIN: LD BC, 360
LOOP1: BIT 7, H ;angle positive?
JR Z, LOOP2 ;-> yes, ok
ADD HL, BC ;else add 360
JR LOOP1 ;repeat until H>0

LOOP2: OR A ;reset carry
SBC HL, BC ;angle - 360
JR NC, LOOP2 ;->ok if >=0
ADD HL, BC ;else correct value

LD E, L ;angle to DE
LD D, H
LD BC, 90
XOR A ;sign flag = 0
SBC HL, BC ;angle < 90?
JR NC, TEST2 ;-> no
EX DE, HL ;else HL = angle
JR GETTAB ;get table value

TEST2: SBC HL, BC ;angle < 180?
JR NC, TEST3 ;-> no
LD HL, 180 ;else HL =
OR A ;180 - angle
SBC HL, DE
JR GETTAB ;get table value

TEST3: DEC A ;sign flag &FF
SBC HL, BC ;angle < 270?
JR NC, TEST4 ;-> no
EX DE, HL ;else HL =
OR A ;clear carry
SBC HL, BC ;angle - 180
SBC HL, BC
JR GETTAB ;get table value

TEST4: LD HL, 360 ;if angle >=270
SBC HL, DE ;HL = 360 - angle

GETTAB: ADD HL, HL ;angle * 2
LD DE, SINTAB ;+ start table
ADD HL, DE ;= tableaddress
LD E, (HL) ;lowbyte to E
INC HL
LD D, (HL) ;highbyte to D
EX DE, HL ;result to HL
     ret

SINTAB:
DW 0,572,1144,1715,2286
DW 2856,3425,3993,4560,5126
DW 5690,6252,6813,7371,7927
DW 8481,9032,9580,10126,10668
DW 11207,11743,12275,12803,13328
DW 13848,14364,14876,15383,15886
DW 16384,16876,17364,17846,18323
DW 18794,19260,19720,20173,20621
DW 21062,21497,21925,22347,22762
DW 23170,23571,23964,24351,24730
DW 25101,25465,25821,26169,26509
DW 26841,27165,27481,27788,28087
DW 28377,28659,28932,29196,29451
DW 29697,29934,30162,30381,30591
DW 30791,30982,31163,31335,31498
DW 31650,31794,31927,32051,32165
DW 32269,32364,32448,32523,32587
DW 32642,32687,32722,32747,32762
DW 32767


almasys

Das alles wird hervorragend von Günther Woick im Schneider CPC Systembuch erklärt, im Kapitel Basic und Maschinencode.

Viel Spaß bei der Lektüre,
Mr. AMS

cpcman


TFM

Hi Amsi, guter Link. Erklärt schön wie es gemacht wird. (Erklärt auch warum ich ganz nach MC ausgewandert bin  ;D).

Hab auch nach so etwas gesucht, leider ist aber mein PC gerade futsch, also dauert bei mir jetzt alles länger. Ausser es findet am CPC statt.  :-X
TFM of FutureSoft
http://www.futureos.de --> Das Betriebssystem FutureOS (Update: 20.12.2023)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> RSX ROM für LambdaSpeak (Update: 26.12.2021)