TempleOSTS_130707.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:45 +02:00
1 parent 17b71f1a2d
commit 1343005a29
617 files changed
+14399 -25130

No files matched your search

+2 -5
View File
@@ -45,17 +45,14 @@ I64 AsmAndC()
Beeps(i);
asm {
//You can clobber RAX,RBX,RCX,RDX, but preserve the rest for code in a C+ routine.
//You can clobber RAX,RBX,RCX,RDX, but preserve the rest for code in a Holy C routine.
USE64 //Defaults to 64, but this is a good habit.
IMPORT Snd;
MOV RCX,&i[RBP] //You can clobber RAX,RBX,RCX,RDX.
//You better preserve the rest.
@@05: PUSH RCX
//U0 Snd(F64 freq,I64 waveform=WF_SQUARE,F64 amp=1.0);
MOV RAX,1.0 //amplitude
PUSH RAX
PUSH WF_SQUARE
//U0 Snd(F64 freq);
MOV RAX,RCX //freq=loop*100.0+100.0
IMUL2 RAX,100 //TempleOS uses nonstandard opcodes
+3 -6
View File
@@ -38,7 +38,7 @@ _BEEPS2::
POP RCX
LOOP @@05
PUSH RSI //we must preserve this register.
PUSH RSI //See $LK,"CREG_VARS_MASK","MN:CREG_VARS_MASK"$ & $LK,"CREG_NON_PTR_MASK","MN:CREG_NON_PTR_MASK"$
MOV RSI,JIFFIES_MSG
CALL PUT_STR
POP RSI
@@ -67,15 +67,12 @@ U0 AsmAndC2()
asm {
LIST
//You can clobber RAX,RBX,RCX,RDX, but preserve the rest for code in a C+ routine.
//You can clobber RAX,RBX,RCX,RDX, but preserve the rest for code in a Holy C routine.
USE64 //Defaults to 64, but this is a good habit.
MOV RCX,R15 //You can clobber RAX,RBX,RCX,RDX.
//You better preserve the rest.
@@05: PUSH RCX
//U0 Snd(F64 freq,I64 waveform=WF_SQUARE,F64 amp=1.0);
MOV RAX,1.0 //amplitude
PUSH RAX
PUSH WF_SQUARE
//U0 Snd(F64 freq);
MOV RAX,RCX //freq=loop*100.0+100.0
IMUL2 RAX,glbl_hz_step //evaluated at compile ttime
+8 -3
View File
@@ -28,24 +28,29 @@ USE64 //Defaults to 64, but this is a good habit.
IMPORT PUT_HEX_U8,PUT_CHAR;
MY_MSG:
MY_WORLD_MSG:
//Define U8 does not put terminating zeros
//on strings.
DU8 "Hello World\n",0;
DU8 "World\n",0;
//My convention is to put an underscore
//on C callable routines.
_HELLO_WORLD::
PUSH RSI //See $LK,"CREG_VARS_MASK","MN:CREG_VARS_MASK"$ & $LK,"CREG_NON_PTR_MASK","MN:CREG_NON_PTR_MASK"$
MOV RCX,10
@@05: MOV RAX,RCX
CALL PUT_HEX_U8
MOV RAX,CH_SPACE
CALL PUT_CHAR
MOV RSI,MY_MSG
MOV RAX,'Hello ' //Supports multi-byte char constants
CALL PUT_CHAR
//We broke it in two pieces to show different ways.
MOV RSI,MY_WORLD_MSG
//Alternatively, if you use an '&', you don't need
//to import a SYS_SYM. This only works for JIT asm.
CALL &PUT_STR
LOOP @@05
POP RSI
RET
};
+1 -1
View File
@@ -12,7 +12,7 @@ MSG_NEW_LINE: DU8 "\n\0";
_BUZZ_FIZZ::
ENTER 0 //Always use Enter/Leave
PUSH RSI //RSI must be preserved.
PUSH RSI //See $LK,"CREG_VARS_MASK","MN:CREG_VARS_MASK"$ & $LK,"CREG_NON_PTR_MASK","MN:CREG_NON_PTR_MASK"$
MOV RAX,RANGE_START
MOV DX,(FIZZ_SPAN-RANGE_START%FIZZ_SPAN+1)<<8+
(BUZZ_SPAN-RANGE_START%BUZZ_SPAN+1)
+6 -2
View File
@@ -3,8 +3,12 @@ PUT_DEC_U64::
//RAX is number to print in decimal.
//Preserves all regs.
ENTER 24 //24 char buffer on stack
PUSH_C_REGS //$LK,"Save regs","FF:::/TempleOS/Kernel/Adam1a.HPP,PUSH_C_REGS"$ which C code is free to clobber
PUSH RSI //This reg is not saved.
//$LK,"Save regs","FF:::/TempleOS/Kernel/Adam1a.HPP,PUSH_C_REGS"$ which C code is free to clobber. We don't have to for C callers,
//but this function will be nice for ASM callers if it saves all regs.
PUSH_C_REGS
PUSH RSI //See $LK,"CREG_VARS_MASK","MN:CREG_VARS_MASK"$ & $LK,"CREG_NON_PTR_MASK","MN:CREG_NON_PTR_MASK"$
LEA RSI,-1[RBP] //Load addr of end of buffer.
//We picked RSI because of PUT_STR
//We'll move backward