1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-26 19:30:00 +00:00

Updated all stdlib files to use standard C types.

This commit is contained in:
jespergravgaard 2020-04-13 20:00:13 +02:00
parent a877da3c7d
commit d12daf874d
300 changed files with 30852 additions and 30852 deletions

View File

@ -4,9 +4,9 @@
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
// Finding the angle requires a binary search using CORDIC_ITERATIONS_16
// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI)
word atan2_16(signed word x, signed word y);
unsigned int atan2_16(signed int x, signed int y);
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
// Finding the angle requires a binary search using CORDIC_ITERATIONS_8
// Returns the angle in hex-degrees (0=0, 0x80=PI, 0x100=2*PI)
byte atan2_8(signed byte x, signed byte y);
char atan2_8(signed char x, signed char y);

View File

@ -5,12 +5,12 @@
// Prepare MEM pointers for operations using MEM
inline void prepareMEM(unsigned int mem);
// FAC = word
// Set the FAC (floating point accumulator) to the integer value of a 16bit word
// FAC = unsigned int
// Set the FAC (floating point accumulator) to the integer value of a 16bit unsigned int
void setFAC(unsigned int w);
// word = FAC
// Get the value of the FAC (floating point accumulator) as an integer 16bit word
// unsigned int = FAC
// Get the value of the FAC (floating point accumulator) as an integer 16bit unsigned int
// Destroys the value in the FAC in the process
unsigned int getFAC();
@ -24,32 +24,32 @@ void setFACtoARG();
// MEM = FAC
// Stores the value of the FAC to memory
// Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};)
// Stores 5 chars (means it is necessary to allocate 5 chars to avoid clobbering other data using eg. char[] mem = {0, 0, 0, 0, 0};)
void setMEMtoFAC(char* mem);
// FAC = MEM
// Set the FAC to value from MEM (float saved in memory)
// Reads 5 bytes
// Reads 5 chars
void setFACtoMEM(char* mem);
// FAC = PI/2
// Set the FAC to PI/2
// Reads 5 bytes from the BASIC ROM
// Reads 5 chars from the BASIC ROM
void setFACtoPIhalf();
// FAC = 2*PI
// Set the FAC to 2*PI
// Reads 5 bytes from the BASIC ROM
// Reads 5 chars from the BASIC ROM
void setFACto2PI();
// ARG = MEM
// Load the ARG from memory
// Reads 5 bytes
// Reads 5 chars
void setARGtoMEM(char* mem);
// FAC = MEM+FAC
// Set FAC to MEM (float saved in memory) plus FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void addMEMtoFAC(char* mem);
// FAC = ARG+FAC
@ -58,7 +58,7 @@ void addARGtoFAC();
// FAC = MEM-FAC
// Set FAC to MEM (float saved in memory) minus FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void subFACfromMEM(char* mem);
// FAC = ARG-FAC
@ -67,17 +67,17 @@ void subFACfromARG();
// FAC = MEM/FAC
// Set FAC to MEM (float saved in memory) divided by FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void divMEMbyFAC(char* mem);
// FAC = MEM*FAC
// Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void mulFACbyMEM(char* mem);
// FAC = MEM^FAC
// Set FAC to MEM (float saved in memory) raised to power of FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void pwrMEMbyFAC(char* mem);
// FAC = int(FAC)

View File

@ -2,12 +2,12 @@
// Currently it can only plot on the first 256 x-positions.
// Initialize the bitmap plotter tables for a specific bitmap
void bitmap_init(byte* bitmap);
void bitmap_init(char* bitmap);
// Clear all graphics on the bitmap
void bitmap_clear();
void bitmap_plot(byte x, byte y);
void bitmap_plot(char x, char y);
// Draw a line on the bitmap
void bitmap_line(byte x0, byte x1, byte y0, byte y1);
void bitmap_line(char x0, char x1, char y0, char y1);

View File

@ -2,22 +2,22 @@
#include <string.h>
// Initialize bitmap plotting tables
void bitmap_init(byte* gfx, byte* screen);
void bitmap_init(char* gfx, char* screen);
// Clear all graphics on the bitmap
// bgcol - the background color to fill the screen with
// fgcol - the foreground color to fill the screen with
void bitmap_clear(byte bgcol, byte fgcol);
void bitmap_clear(char bgcol, char fgcol);
// Plot a single dot in the bitmap
void bitmap_plot(word x, byte y);
void bitmap_plot(unsigned int x, char y);
// Draw a line on the bitmap using bresenhams algorithm
void bitmap_line(word x1, word y1, word x2, word y2);
void bitmap_line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2);
// Get the absolute value of a 16-bit unsigned number treated as a signed number.
word abs_u16(word w);
unsigned int abs_u16(unsigned int w);
// Get the sign of a 16-bit unsigned number treated as a signed number.
// Returns unsigned -1 if the number is
word sgn_u16(word w);
unsigned int sgn_u16(unsigned int w);

View File

@ -8,166 +8,166 @@
#include <c64.h>
// Feature enables or disables the extra C64 DTV features
byte* const DTV_FEATURE = $d03f;
const byte DTV_FEATURE_ENABLE = 1;
const byte DTV_FEATURE_DISABLE_TIL_RESET = 2;
char* const DTV_FEATURE = $d03f;
const char DTV_FEATURE_ENABLE = 1;
const char DTV_FEATURE_DISABLE_TIL_RESET = 2;
// Controls the graphics modes of the C64 DTV
byte* const DTV_CONTROL = $d03c;
const byte DTV_LINEAR = $01;
const byte DTV_BORDER_OFF = $02;
const byte DTV_HIGHCOLOR = $04;
const byte DTV_OVERSCAN = $08;
const byte DTV_COLORRAM_OFF = $10;
const byte DTV_BADLINE_OFF = $20;
const byte DTV_CHUNKY = $40;
char* const DTV_CONTROL = $d03c;
const char DTV_LINEAR = $01;
const char DTV_BORDER_OFF = $02;
const char DTV_HIGHCOLOR = $04;
const char DTV_OVERSCAN = $08;
const char DTV_COLORRAM_OFF = $10;
const char DTV_BADLINE_OFF = $20;
const char DTV_CHUNKY = $40;
// Defines colors for the 16 first colors ($00-$0f)
byte* const DTV_PALETTE = $d200;
char* const DTV_PALETTE = $d200;
// Default vallues for the palette
byte DTV_PALETTE_DEFAULT[16] = { $00, $0f, $36, $be, $58, $db, $86, $ff, $29, $26, $3b, $05, $07, $df, $9a, $0a };
char DTV_PALETTE_DEFAULT[16] = { $00, $0f, $36, $be, $58, $db, $86, $ff, $29, $26, $3b, $05, $07, $df, $9a, $0a };
// Linear Graphics Plane A Counter Control
byte* const DTV_PLANEA_START_LO = $d03a;
byte* const DTV_PLANEA_START_MI = $d03b;
byte* const DTV_PLANEA_START_HI = $d045;
byte* const DTV_PLANEA_STEP = $d046;
byte* const DTV_PLANEA_MODULO_LO = $d038;
byte* const DTV_PLANEA_MODULO_HI = $d039;
char* const DTV_PLANEA_START_LO = $d03a;
char* const DTV_PLANEA_START_MI = $d03b;
char* const DTV_PLANEA_START_HI = $d045;
char* const DTV_PLANEA_STEP = $d046;
char* const DTV_PLANEA_MODULO_LO = $d038;
char* const DTV_PLANEA_MODULO_HI = $d039;
// Linear Graphics Plane B Counter Control
byte* const DTV_PLANEB_START_LO = $d049;
byte* const DTV_PLANEB_START_MI = $d04a;
byte* const DTV_PLANEB_START_HI = $d04b;
byte* const DTV_PLANEB_STEP = $d04c;
byte* const DTV_PLANEB_MODULO_LO = $d047;
byte* const DTV_PLANEB_MODULO_HI = $d048;
char* const DTV_PLANEB_START_LO = $d049;
char* const DTV_PLANEB_START_MI = $d04a;
char* const DTV_PLANEB_START_HI = $d04b;
char* const DTV_PLANEB_STEP = $d04c;
char* const DTV_PLANEB_MODULO_LO = $d047;
char* const DTV_PLANEB_MODULO_HI = $d048;
// Select memory bank where sprite data is fetched from (bits 5:0) - source only (J)
// Memory address of Sprite RAM is SpriteBank*$10000
byte* const DTV_SPRITE_BANK = $d04d;
char* const DTV_SPRITE_BANK = $d04d;
// Select memory bank where color data is fetched from (bits 11:0)
// Memory address of Color RAM is ColorBank*$400
byte* const DTV_COLOR_BANK_LO = $d036;
byte* const DTV_COLOR_BANK_HI = $d037;
char* const DTV_COLOR_BANK_LO = $d036;
char* const DTV_COLOR_BANK_HI = $d037;
const dword DTV_COLOR_BANK_DEFAULT = $1d800;
const unsigned long DTV_COLOR_BANK_DEFAULT = $1d800;
// Selects memory bank for normal VIC color mode and lower data for high color modes. (bits 5:0)
// Memory address of VIC Graphics is GraphicsBank*$10000
byte* const DTV_GRAPHICS_VIC_BANK = $d03d;
char* const DTV_GRAPHICS_VIC_BANK = $d03d;
// Selects memory bank for upper data for high color modes. (bits 5:0) - source only (H)
byte* const DTV_GRAPHICS_HICOL_BANK = $d03e;
char* const DTV_GRAPHICS_HICOL_BANK = $d03e;
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
// The actual memory addressed will be $4000*cpuSegmentIdx
void dtvSetCpuBankSegment1(byte cpuBankIdx);
void dtvSetCpuBankSegment1(char cpuBankIdx);
// Blitter Source A Start
byte* const DTV_BLITTER_SRCA_LO = $d320;
byte* const DTV_BLITTER_SRCA_MI = $d321;
byte* const DTV_BLITTER_SRCA_HI = $d322;
char* const DTV_BLITTER_SRCA_LO = $d320;
char* const DTV_BLITTER_SRCA_MI = $d321;
char* const DTV_BLITTER_SRCA_HI = $d322;
// Blitter Source A Modulo
byte* const DTV_BLITTER_SRCA_MOD_LO = $d323;
byte* const DTV_BLITTER_SRCA_MOD_HI = $d324;
char* const DTV_BLITTER_SRCA_MOD_LO = $d323;
char* const DTV_BLITTER_SRCA_MOD_HI = $d324;
// Blitter Source A Line Length
byte* const DTV_BLITTER_SRCA_LIN_LO = $d325;
byte* const DTV_BLITTER_SRCA_LIN_HI = $d326;
char* const DTV_BLITTER_SRCA_LIN_LO = $d325;
char* const DTV_BLITTER_SRCA_LIN_HI = $d326;
// Blitter Source A Step ([7:4] integral part, [3:0] fractional part)
byte* const DTV_BLITTER_SRCA_STEP = $d327;
char* const DTV_BLITTER_SRCA_STEP = $d327;
// Blitter Source B Start
byte* const DTV_BLITTER_SRCB_LO = $d328;
byte* const DTV_BLITTER_SRCB_MI = $d329;
byte* const DTV_BLITTER_SRCB_HI = $d32a;
char* const DTV_BLITTER_SRCB_LO = $d328;
char* const DTV_BLITTER_SRCB_MI = $d329;
char* const DTV_BLITTER_SRCB_HI = $d32a;
// Blitter Source B Modulo
byte* const DTV_BLITTER_SRCB_MOD_LO = $d32b;
byte* const DTV_BLITTER_SRCB_MOD_HI = $d32c;
char* const DTV_BLITTER_SRCB_MOD_LO = $d32b;
char* const DTV_BLITTER_SRCB_MOD_HI = $d32c;
// Blitter Source B Line Length
byte* const DTV_BLITTER_SRCB_LIN_LO = $d32d;
byte* const DTV_BLITTER_SRCB_LIN_HI = $d32e;
char* const DTV_BLITTER_SRCB_LIN_LO = $d32d;
char* const DTV_BLITTER_SRCB_LIN_HI = $d32e;
// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
byte* const DTV_BLITTER_SRCB_STEP = $d32f;
char* const DTV_BLITTER_SRCB_STEP = $d32f;
// Blitter Destination Start
byte* const DTV_BLITTER_DEST_LO = $d330;
byte* const DTV_BLITTER_DEST_MI = $d331;
byte* const DTV_BLITTER_DEST_HI = $d332;
char* const DTV_BLITTER_DEST_LO = $d330;
char* const DTV_BLITTER_DEST_MI = $d331;
char* const DTV_BLITTER_DEST_HI = $d332;
// Blitter Source B Modulo
byte* const DTV_BLITTER_DEST_MOD_LO = $d333;
byte* const DTV_BLITTER_DEST_MOD_HI = $d334;
char* const DTV_BLITTER_DEST_MOD_LO = $d333;
char* const DTV_BLITTER_DEST_MOD_HI = $d334;
// Blitter Source B Line Length
byte* const DTV_BLITTER_DEST_LIN_LO = $d335;
byte* const DTV_BLITTER_DEST_LIN_HI = $d336;
char* const DTV_BLITTER_DEST_LIN_LO = $d335;
char* const DTV_BLITTER_DEST_LIN_HI = $d336;
// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
byte* const DTV_BLITTER_DEST_STEP = $d337;
char* const DTV_BLITTER_DEST_STEP = $d337;
// Blitter Blit Length
byte* const DTV_BLITTER_LEN_LO = $d338;
byte* const DTV_BLITTER_LEN_HI = $d339;
char* const DTV_BLITTER_LEN_LO = $d338;
char* const DTV_BLITTER_LEN_HI = $d339;
// Blitter Control
byte* const DTV_BLITTER_CONTROL = $d33a;
char* const DTV_BLITTER_CONTROL = $d33a;
// Bit[0] Force Start Strobe when set
const byte DTV_BLIT_FORCE_START = %00000001;
const char DTV_BLIT_FORCE_START = %00000001;
// Bit[1] Source A Direction Positive when set
const byte DTV_BLIT_SRCA_FWD = %00000010;
const char DTV_BLIT_SRCA_FWD = %00000010;
// Bit[2] Source B Direction Positive when set
const byte DTV_BLIT_SRCB_FWD = %00000100;
const char DTV_BLIT_SRCB_FWD = %00000100;
// Bit[3] Destination Direction Positive when set
const byte DTV_BLIT_DEST_FWD = %00001000;
const char DTV_BLIT_DEST_FWD = %00001000;
// Bit[4] VIC IRQ Start when set
const byte DTV_BLIT_VIC_IRQ = %00010000;
const char DTV_BLIT_VIC_IRQ = %00010000;
// Bit[5] CIA IRQ Start when set($DCXX CIA)
const byte DTV_BLIT_CIA_IRQ = %00100000;
const char DTV_BLIT_CIA_IRQ = %00100000;
// Bit[6] V Blank Start when set
const byte DTV_BLIT_VBLANK = %01000000;
const char DTV_BLIT_VBLANK = %01000000;
// Bit[7] Blitter IRQ Enable when set
const byte DTV_BLIT_IRQ_EN = %10000000;
const char DTV_BLIT_IRQ_EN = %10000000;
// Blitter Transparency
byte* const DTV_BLITTER_TRANSPARANCY = $d33b;
char* const DTV_BLITTER_TRANSPARANCY = $d33b;
// Bit[0] Disable Channel B.
// (data into b port of ALU is forced to %00000000. ALU functions as normal)
const byte DTV_BLIT_DISABLE_B = %00000001;
const char DTV_BLIT_DISABLE_B = %00000001;
// Bit[1] Write Transparent Data when set
//(Data will be written if source a data *IS* %00000000. This can be used with channel b and ALU set to OR to write Data masked by source A.) Cycles will be saved if No writes.
const byte DTV_BLIT_WRITE_TRANSPARENT = %00000010;
const char DTV_BLIT_WRITE_TRANSPARENT = %00000010;
// Bit[2] Write Non Transparent
// when set (Data will be written if SourceA fetched data is *NOT* %00000000. This may be used combined with channel b data and/or ALU) Cycles will be Saved if no write. Bit[2]==Bit[1]==0: write in any case
const byte DTV_BLIT_WRITE_NONTRANSPARENT = %00000100;
const char DTV_BLIT_WRITE_NONTRANSPARENT = %00000100;
// No transparancy
// Bit[2]==Bit[1]==0: write in any case
const byte DTV_BLIT_TRANSPARANCY_NONE = %00000000;
const char DTV_BLIT_TRANSPARANCY_NONE = %00000000;
// Controls the ALU operation
byte* DTV_BLITTER_ALU = $d33e;
char* DTV_BLITTER_ALU = $d33e;
// Bit[2:0] Source A right Shift: 000 SourceA Data, 001 LastA[0],SourceA[7:1], ..., 111 LastA[6:0],SourceA[7]
const byte DTV_BLIT_SHIFT0 = %00000000;
const byte DTV_BLIT_SHIFT1 = %00000001;
const byte DTV_BLIT_SHIFT2 = %00000010;
const byte DTV_BLIT_SHIFT3 = %00000011;
const byte DTV_BLIT_SHIFT4 = %00000100;
const byte DTV_BLIT_SHIFT5 = %00000101;
const byte DTV_BLIT_SHIFT6 = %00000110;
const byte DTV_BLIT_SHIFT7 = %00000111;
const char DTV_BLIT_SHIFT0 = %00000000;
const char DTV_BLIT_SHIFT1 = %00000001;
const char DTV_BLIT_SHIFT2 = %00000010;
const char DTV_BLIT_SHIFT3 = %00000011;
const char DTV_BLIT_SHIFT4 = %00000100;
const char DTV_BLIT_SHIFT5 = %00000101;
const char DTV_BLIT_SHIFT6 = %00000110;
const char DTV_BLIT_SHIFT7 = %00000111;
// Bit[5:3] Minterms/ALU
const byte DTV_BLIT_AND = %00000000;
const byte DTV_BLIT_NAND = %00001000;
const byte DTV_BLIT_NOR = %00010000;
const byte DTV_BLIT_OR = %00011000;
const byte DTV_BLIT_XOR = %00100000;
const byte DTV_BLIT_XNOR = %00101000;
const byte DTV_BLIT_ADD = %00110000;
const byte DTV_BLIT_SUB = %00111000;
const char DTV_BLIT_AND = %00000000;
const char DTV_BLIT_NAND = %00001000;
const char DTV_BLIT_NOR = %00010000;
const char DTV_BLIT_OR = %00011000;
const char DTV_BLIT_XOR = %00100000;
const char DTV_BLIT_XNOR = %00101000;
const char DTV_BLIT_ADD = %00110000;
const char DTV_BLIT_SUB = %00111000;
// Blitter Control 2
byte* const DTV_BLITTER_CONTROL2 = $d33f;
char* const DTV_BLITTER_CONTROL2 = $d33f;
// Bit[0] Clear Blitter IRQ
const byte DTV_BLIT_CLEAR_IRQ = %00000001;
const char DTV_BLIT_CLEAR_IRQ = %00000001;
// Bit[1] Source A Continue
const byte DTV_BLIT_SRCA_CONT = %00000010;
const char DTV_BLIT_SRCA_CONT = %00000010;
// Bit[2] Source B Continue
const byte DTV_BLIT_SRCB_CONT = %00000100;
const char DTV_BLIT_SRCB_CONT = %00000100;
// Bit[3] Destination Continue
const byte DTV_BLIT_DEST_CONT = %00001000;
const char DTV_BLIT_DEST_CONT = %00001000;
// Bit[0] Busy when set (When reading)
const byte DTV_BLIT_STATUS_BUSY = %00000001;
const char DTV_BLIT_STATUS_BUSY = %00000001;
// Bit[1] IRQ when set (When reading)
const byte DTV_BLIT_STATUS_IRQ = %00000010;
const char DTV_BLIT_STATUS_IRQ = %00000010;

View File

@ -5,13 +5,13 @@
// Remainder after signed 8 bit division
extern char rem8u;
// Performs division on two 8 bit unsigned bytes
// Performs division on two 8 bit unsigned chars
// Returns dividend/divisor.
// The remainder will be set into the global variable rem8u
// Implemented using simple binary division
char div8u(char dividend, char divisor);
// Performs division on two 8 bit unsigned bytes and an initial remainder
// Performs division on two 8 bit unsigned chars and an initial remainder
// Returns dividend/divisor.
// The final remainder will be set into the global variable rem8u
// Implemented using simple binary division
@ -20,20 +20,20 @@ char divr8u(char dividend, char divisor, char rem);
// Remainder after unsigned 16-bit division
extern unsigned int rem16u;
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
unsigned int divr16u(unsigned int dividend, unsigned int divisor, unsigned int rem);
// Performs division on two 16 bit unsigned words
// Performs division on two 16 bit unsigned ints
// Returns the quotient dividend/divisor.
// The remainder will be set into the global variable rem16u
// Implemented using simple binary division
unsigned int div16u(unsigned int dividend, unsigned int divisor);
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
unsigned long div32u16u(unsigned long dividend, unsigned int divisor);
// Remainder after signed 8 bit division

View File

@ -5,30 +5,30 @@
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
void mulf_init();
// Prepare for fast multiply with an unsigned byte to a word result
void mulf8u_prepare(byte a);
// Prepare for fast multiply with an unsigned char to a unsigned int result
void mulf8u_prepare(char a);
// Calculate fast multiply with a prepared unsigned byte to a word result
// The prepared number is set by calling mulf8u_prepare(byte a)
word mulf8u_prepared(byte b);
// Calculate fast multiply with a prepared unsigned char to a unsigned int result
// The prepared number is set by calling mulf8u_prepare(char a)
unsigned int mulf8u_prepared(char b);
// Fast multiply two unsigned bytes to a word result
word mulf8u(byte a, byte b);
// Fast multiply two unsigned chars to a unsigned int result
unsigned int mulf8u(char a, char b);
// Prepare for fast multiply with an signed byte to a word result
inline void mulf8s_prepare(signed byte a);
// Prepare for fast multiply with an signed char to a unsigned int result
inline void mulf8s_prepare(signed char a);
// Calculate fast multiply with a prepared unsigned byte to a word result
// The prepared number is set by calling mulf8s_prepare(byte a)
signed word mulf8s_prepared(signed byte b);
// Calculate fast multiply with a prepared unsigned char to a unsigned int result
// The prepared number is set by calling mulf8s_prepare(char a)
signed int mulf8s_prepared(signed char b);
// Fast multiply two signed bytes to a word result
signed word mulf8s(signed byte a, signed byte b);
// Fast multiply two signed chars to a unsigned int result
signed int mulf8s(signed char a, signed char b);
// Fast multiply two unsigned words to a double word result
// Fast multiply two unsigned ints to a double unsigned int result
// Done in assembler to utilize fast addition A+X
dword mulf16u(word a, word b);
unsigned long mulf16u(unsigned int a, unsigned int b);
// Fast multiply two signed words to a signed double word result
// Fast multiply two signed ints to a signed double unsigned int result
// Fixes offsets introduced by using unsigned multiplication
signed dword mulf16s(signed word a, signed word b);
signed long mulf16s(signed int a, signed int b);

View File

@ -19,109 +19,109 @@
// Keyboard Codes for all 63 keys.
// Keyboard Codes are %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7).
// See C64 Keyboard Matrix Reference http://codebase64.org/doku.php?id=base:reading_the_keyboard
const byte KEY_DEL = $00;
const byte KEY_RETURN = $01;
const byte KEY_CRSR_RIGHT = $02;
const byte KEY_F7 = $03;
const byte KEY_F1 = $04;
const byte KEY_F3 = $05;
const byte KEY_F5 = $06;
const byte KEY_CRSR_DOWN = $07;
const byte KEY_3 = $08;
const byte KEY_W = $09;
const byte KEY_A = $0a;
const byte KEY_4 = $0b;
const byte KEY_Z = $0c;
const byte KEY_S = $0d;
const byte KEY_E = $0e;
const byte KEY_LSHIFT = $0f;
const byte KEY_5 = $10;
const byte KEY_R = $11;
const byte KEY_D = $12;
const byte KEY_6 = $13;
const byte KEY_C = $14;
const byte KEY_F = $15;
const byte KEY_T = $16;
const byte KEY_X = $17;
const byte KEY_7 = $18;
const byte KEY_Y = $19;
const byte KEY_G = $1a;
const byte KEY_8 = $1b;
const byte KEY_B = $1c;
const byte KEY_H = $1d;
const byte KEY_U = $1e;
const byte KEY_V = $1f;
const byte KEY_9 = $20;
const byte KEY_I = $21;
const byte KEY_J = $22;
const byte KEY_0 = $23;
const byte KEY_M = $24;
const byte KEY_K = $25;
const byte KEY_O = $26;
const byte KEY_N = $27;
const byte KEY_PLUS = $28;
const byte KEY_P = $29;
const byte KEY_L = $2a;
const byte KEY_MINUS = $2b;
const byte KEY_DOT = $2c;
const byte KEY_COLON = $2d;
const byte KEY_AT = $2e;
const byte KEY_COMMA = $2f;
const byte KEY_POUND = $30;
const byte KEY_ASTERISK = $31;
const byte KEY_SEMICOLON = $32;
const byte KEY_HOME = $33;
const byte KEY_RSHIFT = $34;
const byte KEY_EQUALS = $35;
const byte KEY_ARROW_UP = $36;
const byte KEY_SLASH = $37;
const byte KEY_1 = $38;
const byte KEY_ARROW_LEFT = $39;
const byte KEY_CTRL = $3a;
const byte KEY_2 = $3b;
const byte KEY_SPACE = $3c;
const byte KEY_COMMODORE = $3d;
const byte KEY_Q = $3e;
const byte KEY_RUNSTOP = $3f;
const char KEY_DEL = $00;
const char KEY_RETURN = $01;
const char KEY_CRSR_RIGHT = $02;
const char KEY_F7 = $03;
const char KEY_F1 = $04;
const char KEY_F3 = $05;
const char KEY_F5 = $06;
const char KEY_CRSR_DOWN = $07;
const char KEY_3 = $08;
const char KEY_W = $09;
const char KEY_A = $0a;
const char KEY_4 = $0b;
const char KEY_Z = $0c;
const char KEY_S = $0d;
const char KEY_E = $0e;
const char KEY_LSHIFT = $0f;
const char KEY_5 = $10;
const char KEY_R = $11;
const char KEY_D = $12;
const char KEY_6 = $13;
const char KEY_C = $14;
const char KEY_F = $15;
const char KEY_T = $16;
const char KEY_X = $17;
const char KEY_7 = $18;
const char KEY_Y = $19;
const char KEY_G = $1a;
const char KEY_8 = $1b;
const char KEY_B = $1c;
const char KEY_H = $1d;
const char KEY_U = $1e;
const char KEY_V = $1f;
const char KEY_9 = $20;
const char KEY_I = $21;
const char KEY_J = $22;
const char KEY_0 = $23;
const char KEY_M = $24;
const char KEY_K = $25;
const char KEY_O = $26;
const char KEY_N = $27;
const char KEY_PLUS = $28;
const char KEY_P = $29;
const char KEY_L = $2a;
const char KEY_MINUS = $2b;
const char KEY_DOT = $2c;
const char KEY_COLON = $2d;
const char KEY_AT = $2e;
const char KEY_COMMA = $2f;
const char KEY_POUND = $30;
const char KEY_ASTERISK = $31;
const char KEY_SEMICOLON = $32;
const char KEY_HOME = $33;
const char KEY_RSHIFT = $34;
const char KEY_EQUALS = $35;
const char KEY_ARROW_UP = $36;
const char KEY_SLASH = $37;
const char KEY_1 = $38;
const char KEY_ARROW_LEFT = $39;
const char KEY_CTRL = $3a;
const char KEY_2 = $3b;
const char KEY_SPACE = $3c;
const char KEY_COMMODORE = $3d;
const char KEY_Q = $3e;
const char KEY_RUNSTOP = $3f;
// Initialize keyboard reading by setting CIA#$ Data Direction Registers
void keyboard_init();
// Check if any key is currently pressed on the keyboard matrix
// Return 0 if no key is pressed and not 0 if any key is pressed
byte keyboard_matrix_any(void);
char keyboard_matrix_any(void);
// Read a single row of the keyboard matrix
// The row ID (0-7) of the keyboard matrix row to read. See the C64 key matrix for row IDs.
// Returns the keys pressed on the row as bits according to the C64 key matrix.
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
byte keyboard_matrix_read(byte rowid);
char keyboard_matrix_read(char rowid);
// Determines whether a specific key is currently pressed by accessing the matrix directly
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
// All keys exist as as KEY_XXX constants.
// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed
byte keyboard_key_pressed(byte key);
char keyboard_key_pressed(char key);
// Get the keycode corresponding to a specific screen code character
// ch is the character to get the key code for ($00-$3f)
// Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled.
// If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) .
byte keyboard_get_keycode(byte ch);
char keyboard_get_keycode(char ch);
// Current keyboard modifiers (left shift, right shift, ctrl, commodore)
extern byte keyboard_modifiers;
extern char keyboard_modifiers;
// Left shift is pressed
extern const byte KEY_MODIFIER_LSHIFT;
extern const char KEY_MODIFIER_LSHIFT;
// Right shift is pressed
extern const byte KEY_MODIFIER_RSHIFT;
extern const char KEY_MODIFIER_RSHIFT;
// CTRL is pressed
extern const byte KEY_MODIFIER_CTRL;
extern const char KEY_MODIFIER_CTRL;
// Commodore is pressed
extern const byte KEY_MODIFIER_COMMODORE;
extern const char KEY_MODIFIER_COMMODORE;
// Any shift is pressed
extern const byte KEY_MODIFIER_SHIFT;
extern const char KEY_MODIFIER_SHIFT;
// Scans the entire matrix to determine which keys have been pressed/depressed.
// Generates keyboard events into the event buffer. Events can be read using keyboard_event_get().
@ -131,10 +131,10 @@ void keyboard_event_scan();
// Determine if a specific key is currently pressed based on the last keyboard_event_scan()
// Returns 0 is not pressed and non-0 if pressed
byte keyboard_event_pressed(byte keycode);
char keyboard_event_pressed(char keycode);
// Get the next event from the keyboard event buffer.
// Returns $ff if there is no event waiting. As all events are <$7f it is enough to examine bit 7 when determining if there is any event to process.
// The buffer is filled by keyboard_event_scan()
byte keyboard_event_get();
char keyboard_event_get();

View File

@ -1,19 +1,19 @@
// Simple binary multiplication implementation
// Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word
// Perform binary multiplication of two unsigned 8-bit chars into a 16-bit unsigned int
unsigned int mul8u(char a, char b);
// Multiply of two signed bytes to a signed word
// Multiply of two signed chars to a signed int
// Fixes offsets introduced by using unsigned multiplication
int mul8s(signed char a, signed char b);
// Multiply a signed byte and an unsigned byte (into a signed word)
// Multiply a signed char and an unsigned char (into a signed int)
// Fixes offsets introduced by using unsigned multiplication
int mul8su(signed char a, char b);
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned double unsigned int
unsigned long mul16u(unsigned int a, unsigned int b);
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed double unsigned int
// Fixes offsets introduced by using unsigned multiplication
signed long mul16s(int a, int b);

View File

@ -2,75 +2,75 @@
// Print a number of zero-terminated strings, each followed by a newline.
// The sequence of lines is terminated by another zero.
void print_str_lines(byte* str);
void print_str_lines(char* str);
// Print a zero-terminated string followed by a newline
void print_str_ln(byte* str);
void print_str_ln(char* str);
// Print a zero-terminated string
void print_str(byte* str);
void print_str(char* str);
// Print a string at a specific screen position
void print_str_at(byte* str, byte* at);
void print_str_at(char* str, char* at);
// Print a newline
void print_ln();
// Print a int as HEX
void print_sword(signed word w);
void print_sint(signed int w);
// Print a signed byte as HEX
void print_sbyte(signed byte b);
// Print a signed char as HEX
void print_s8(signed char b);
// Prints a signed byte as HEX at a specific position on the screen
// Prints a signed char as HEX at a specific position on the screen
// row and col are 0-based indices
inline void print_sbyte_pos(signed byte sb, byte row, byte col);
inline void print_s8_pos(signed char sb, char row, char col);
// Print a signed byte as hex at a specific screen position
void print_sbyte_at(signed byte b, byte* at);
// Print a signed char as hex at a specific screen position
void print_s8_at(signed char b, char* at);
// Print a word as HEX
void print_word(word w);
// Print a unsigned int as HEX
void print_uint(unsigned int w);
// Print a byte as DECIMAL
void print_byte_decimal(byte b);
// Print a char as DECIMAL
void print_u8_decimal(char b);
// Print a word as DECIMAL
void print_word_decimal(word w);
// Print a unsigned int as DECIMAL
void print_uint_decimal(unsigned int w);
// Print a word as HEX at a specific position
void print_word_at(word w, byte* at);
// Print a unsigned int as HEX at a specific position
void print_uint_at(unsigned int w, char* at);
// Print a dword as HEX
void print_dword(unsigned dword dw);
// Print a unsigned long as HEX
void print_ulong(unsigned long dw);
// Print a unsigned long as DECIMAL
void print_dword_decimal(unsigned dword w);
void print_ulong_decimal(unsigned long w);
// Print a unsigned long as HEX at a specific position
void print_dword_at(unsigned dword dw, byte* at);
void print_ulong_at(unsigned long dw, char* at);
// Print a signed long as HEX
void print_sdword(signed dword dw);
void print_slong(signed long dw);
// Print a byte as HEX
void print_byte(byte b);
// Print a char as HEX
void print_u8(char b);
// Prints a byte as HEX at a specific position on the screen
// Prints a char as HEX at a specific position on the screen
// row and col are 0-based indices
void print_byte_pos(byte b, byte row, byte col);
void print_u8_pos(char b, char row, char col);
// Print a byte as HEX at a specific position
void print_byte_at(byte b, byte* at);
// Print a char as HEX at a specific position
void print_u8_at(char b, char* at);
// Print a single char
void print_char(byte ch);
void print_char(char ch);
// Print a single char
void print_char_at(byte ch, byte* at);
void print_char_at(char ch, char* at);
// Clear the screen. Also resets current line/char cursor.
void print_cls();
// Set the screen to print on. Also resets current line/char cursor.
void print_set_screen(byte* screen);
void print_set_screen(char* screen);

View File

@ -18,35 +18,35 @@ extern const unsigned int PI_u4f12;
// PI/2 in u[4.12] format
extern const unsigned int PI_HALF_u4f12;
// Generate signed (large) word sinus table - on the full -$7fff - $7fff range
// Generate signed (large) unsigned int sinus table - on the full -$7fff - $7fff range
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
void sin16s_gen(int* sintab, unsigned int wavelength);
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
void sin16s_gen2(int* sintab, unsigned int wavelength, int min, int max);
// Generate signed byte sinus table - on the full -$7f - $7f range
// Generate signed char sinus table - on the full -$7f - $7f range
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
void sin8s_gen(signed char* sintab, unsigned int wavelength);
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
int sin16s(unsigned long x);
// Calculate signed byte sinus sin(x)
// x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12
// result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f
// Calculate signed char sinus sin(x)
// x: unsigned int input u[4.12] in the interval $0000 - PI2_u4f12
// result: signed char sin(x) s[0.7] - using the full range -$7f - $7f
signed char sin8s(unsigned int x);
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
unsigned int mulu16_sel(unsigned int v1, unsigned int v2, char select);
// Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result.
// Calculate val*val for two unsigned char values - the result is 8 selected bits of the 16-bit result.
// The select parameter indicates how many of the highest bits of the 16-bit result to skip
char mulu8_sel(char v1, char v2, char select);

View File

@ -4,11 +4,11 @@
// Uses iterative formula (x+1)^2 = x^2 + 2*x + 1
void init_squares();
// Find the square of a byte value
// Find the square of a char value
// Uses a table of squares that must be initialized by calling init_squares()
word sqr(byte val);
unsigned int sqr(char val);
// Find the (integer) square root of a word value
// Find the (integer) square root of a unsigned int value
// If the square is not an integer then it returns the largest integer N where N*N <= val
// Uses a table of squares that must be initialized by calling init_squares()
byte sqrt(word val);
char sqrt(unsigned int val);

View File

@ -2,7 +2,7 @@
// Implementation of functions found int C stdlib.h / stdlib.c
#include <string.h>
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// Allocates a block of size chars of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
void* malloc(unsigned int size);
@ -15,7 +15,7 @@ void free(void* ptr);
// - size This is the size of elements.
void *calloc(size_t nitems, size_t size);
// Searches an array of nitems unsigned words, the initial member of which is pointed to by base, for a member that matches the value key.
// Searches an array of nitems unsigned ints, the initial member of which is pointed to by base, for a member that matches the value key.
// - key - The value to look for
// - items - Pointer to the start of the array to search in
// - num - The number of items in the array

View File

@ -4,11 +4,11 @@
typedef unsigned int size_t ;
// Copy block of memory (forwards)
// Copies the values of num bytes from the location pointed to by source directly to the memory block pointed to by destination.
// Copies the values of num chars from the location pointed to by source directly to the memory block pointed to by destination.
void* memcpy( void* destination, void* source, size_t num );
// Move block of memory
// Copies the values of num bytes from the location pointed by source to the memory block pointed by destination. Copying takes place as if an intermediate buffer were used, allowing the destination and source to overlap.
// Copies the values of num chars from the location pointed by source to the memory block pointed by destination. Copying takes place as if an intermediate buffer were used, allowing the destination and source to overlap.
void* memmove( void* destination, void* source, size_t num );
// Copies the character c (an unsigned char) to the first num characters of the object pointed to by the argument str.

View File

@ -4,10 +4,10 @@
#include <atan2.h>
// The number of iterations performed during 16-bit CORDIC atan2 calculation
const byte CORDIC_ITERATIONS_16 = 15;
const char CORDIC_ITERATIONS_16 = 15;
// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ...
word CORDIC_ATAN2_ANGLES_16[CORDIC_ITERATIONS_16] = kickasm {{
unsigned int CORDIC_ATAN2_ANGLES_16[CORDIC_ITERATIONS_16] = kickasm {{
.for (var i=0; i<CORDIC_ITERATIONS_16; i++)
.word 256*2*256*atan(1/pow(2,i))/PI/2
}};
@ -15,19 +15,19 @@ word CORDIC_ATAN2_ANGLES_16[CORDIC_ITERATIONS_16] = kickasm {{
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
// Finding the angle requires a binary search using CORDIC_ITERATIONS_16
// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI)
word atan2_16(signed word x, signed word y) {
signed word yi = (y>=0)?y:-y;
signed word xi = (x>=0)?x:-x;
word angle = 0;
for( byte i: 0..CORDIC_ITERATIONS_16-1) {
unsigned int atan2_16(signed int x, signed int y) {
signed int yi = (y>=0)?y:-y;
signed int xi = (x>=0)?x:-x;
unsigned int angle = 0;
for( char i: 0..CORDIC_ITERATIONS_16-1) {
if(yi==0) {
// We found the correct angle!
break;
}
// Optimized shift of 2 values: xd=xi>>i; yd=yi>>i
signed word xd = xi;
signed word yd = yi;
byte shift = i;
signed int xd = xi;
signed int yd = yi;
char shift = i;
while(shift>=2) {
xd >>= 2;
yd >>= 2;
@ -55,27 +55,27 @@ word atan2_16(signed word x, signed word y) {
}
// The number of iterations performed during 8-bit CORDIC atan2 calculation
const byte CORDIC_ITERATIONS_8 = 8;
const char CORDIC_ITERATIONS_8 = 8;
// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ...
byte CORDIC_ATAN2_ANGLES_8[CORDIC_ITERATIONS_8] = kickasm {{
char CORDIC_ATAN2_ANGLES_8[CORDIC_ITERATIONS_8] = kickasm {{
.fill CORDIC_ITERATIONS_8, 2*256*atan(1/pow(2,i))/PI/2
}};
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
// Finding the angle requires a binary search using CORDIC_ITERATIONS_8
// Returns the angle in hex-degrees (0=0, 0x80=PI, 0x100=2*PI)
byte atan2_8(signed byte x, signed byte y) {
signed byte yi = (y>0)?y:-y;
signed byte xi = (x>0)?x:-x;
byte angle = 0;
for( byte i: 0..CORDIC_ITERATIONS_8-1) {
char atan2_8(signed char x, signed char y) {
signed char yi = (y>0)?y:-y;
signed char xi = (x>0)?x:-x;
char angle = 0;
for( char i: 0..CORDIC_ITERATIONS_8-1) {
if(yi==0) {
// We found the correct angle!
break;
}
signed byte xd = xi>>i;
signed byte yd = yi>>i;
signed char xd = xi>>i;
signed char yd = yi>>i;
if(yi>0) {
xi += yd;
yi -= xd;

View File

@ -14,11 +14,11 @@ inline void prepareMEM(unsigned int mem) {
*memHi = >mem;
}
// FAC = word
// Set the FAC (floating point accumulator) to the integer value of a 16bit word
// FAC = unsigned int
// Set the FAC (floating point accumulator) to the integer value of a 16bit unsigned int
void setFAC(unsigned int w) {
prepareMEM(w);
// Load word register Y,A into FAC (floating point accumulator)
// Load unsigned int register Y,A into FAC (floating point accumulator)
asm {
ldy memLo
lda memHi
@ -26,11 +26,11 @@ void setFAC(unsigned int w) {
}
}
// word = FAC
// Get the value of the FAC (floating point accumulator) as an integer 16bit word
// unsigned int = FAC
// Get the value of the FAC (floating point accumulator) as an integer 16bit unsigned int
// Destroys the value in the FAC in the process
unsigned int getFAC() {
// Load FAC (floating point accumulator) integer part into word register Y,A
// Load FAC (floating point accumulator) integer part into unsigned int register Y,A
asm {
jsr $b1aa
sty memLo
@ -58,7 +58,7 @@ void setFACtoARG() {
// MEM = FAC
// Stores the value of the FAC to memory
// Stores 5 bytes (means it is necessary to allocate 5 bytes to avoid clobbering other data using eg. byte[] mem = {0, 0, 0, 0, 0};)
// Stores 5 chars (means it is necessary to allocate 5 chars to avoid clobbering other data using eg. char[] mem = {0, 0, 0, 0, 0};)
void setMEMtoFAC(char* mem) {
prepareMEM((unsigned int)mem);
asm {
@ -70,7 +70,7 @@ void setMEMtoFAC(char* mem) {
// FAC = MEM
// Set the FAC to value from MEM (float saved in memory)
// Reads 5 bytes
// Reads 5 chars
void setFACtoMEM(char* mem) {
prepareMEM((unsigned int)mem);
asm(clobbers "AY") {
@ -82,7 +82,7 @@ void setFACtoMEM(char* mem) {
// FAC = PI/2
// Set the FAC to PI/2
// Reads 5 bytes from the BASIC ROM
// Reads 5 chars from the BASIC ROM
void setFACtoPIhalf() {
asm(clobbers "AY") {
lda #$e0
@ -93,7 +93,7 @@ void setFACtoPIhalf() {
// FAC = 2*PI
// Set the FAC to 2*PI
// Reads 5 bytes from the BASIC ROM
// Reads 5 chars from the BASIC ROM
void setFACto2PI() {
asm(clobbers "AY"){
lda #$e5
@ -104,7 +104,7 @@ void setFACto2PI() {
// ARG = MEM
// Load the ARG from memory
// Reads 5 bytes
// Reads 5 chars
void setARGtoMEM(char* mem) {
prepareMEM((unsigned int)mem);
asm(clobbers "AY") {
@ -116,7 +116,7 @@ void setARGtoMEM(char* mem) {
// FAC = MEM+FAC
// Set FAC to MEM (float saved in memory) plus FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void addMEMtoFAC(char* mem) {
prepareMEM((unsigned int)mem);
asm {
@ -136,7 +136,7 @@ void addARGtoFAC() {
// FAC = MEM-FAC
// Set FAC to MEM (float saved in memory) minus FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void subFACfromMEM(char* mem) {
prepareMEM((unsigned int)mem);
asm {
@ -156,7 +156,7 @@ void subFACfromARG() {
// FAC = MEM/FAC
// Set FAC to MEM (float saved in memory) divided by FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void divMEMbyFAC(char* mem) {
prepareMEM((unsigned int)mem);
asm {
@ -168,7 +168,7 @@ void divMEMbyFAC(char* mem) {
// FAC = MEM*FAC
// Set FAC to MEM (float saved in memory) multiplied by FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void mulFACbyMEM(char* mem) {
prepareMEM((unsigned int)mem);
asm {
@ -180,7 +180,7 @@ void mulFACbyMEM(char* mem) {
// FAC = MEM^FAC
// Set FAC to MEM (float saved in memory) raised to power of FAC (float accumulator)
// Reads 5 bytes from memory
// Reads 5 chars from memory
void pwrMEMbyFAC(char* mem) {
prepareMEM((unsigned int)mem);
asm {

View File

@ -4,16 +4,16 @@
#include <bitmap-draw.h>
// Tables for the plotter - initialized by calling bitmap_draw_init();
const byte bitmap_plot_xlo[256];
const byte bitmap_plot_xhi[256];
const byte bitmap_plot_ylo[256];
const byte bitmap_plot_yhi[256];
const byte bitmap_plot_bit[256];
const char bitmap_plot_xlo[256];
const char bitmap_plot_xhi[256];
const char bitmap_plot_ylo[256];
const char bitmap_plot_yhi[256];
const char bitmap_plot_bit[256];
// Initialize the bitmap plotter tables for a specific bitmap
void bitmap_init(byte* bitmap) {
byte bits = $80;
for(byte x : 0..255) {
void bitmap_init(char* bitmap) {
char bits = $80;
for(char x : 0..255) {
bitmap_plot_xlo[x] = x&$f8;
bitmap_plot_xhi[x] = >bitmap;
bitmap_plot_bit[x] = bits;
@ -22,8 +22,8 @@ void bitmap_init(byte* bitmap) {
bits = $80;
}
}
byte* yoffs = $0;
for(byte y : 0..255) {
char* yoffs = $0;
for(char y : 0..255) {
bitmap_plot_ylo[y] = y&$7 | <yoffs;
bitmap_plot_yhi[y] = >yoffs;
if((y&$7)==7) {
@ -34,27 +34,27 @@ void bitmap_init(byte* bitmap) {
// Clear all graphics on the bitmap
void bitmap_clear() {
byte* bitmap = (byte*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] };
for( byte y: 0..39 ) {
for( byte x: 0..199 ) {
char* bitmap = (char*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] };
for( char y: 0..39 ) {
for( char x: 0..199 ) {
*bitmap++ = 0;
}
}
}
void bitmap_plot(byte x, byte y) {
// Needs word arrays arranged as two underlying byte arrays to allow byte* plotter_x = plot_x[x]; - and eventually - byte* plotter = plot_x[x] + plot_y[y];
word plotter_x = { bitmap_plot_xhi[x], bitmap_plot_xlo[x] };
word plotter_y = { bitmap_plot_yhi[y], bitmap_plot_ylo[y] };
byte* plotter = plotter_x+plotter_y;
void bitmap_plot(char x, char y) {
// Needs unsigned int arrays arranged as two underlying char arrays to allow char* plotter_x = plot_x[x]; - and eventually - char* plotter = plot_x[x] + plot_y[y];
unsigned int plotter_x = { bitmap_plot_xhi[x], bitmap_plot_xlo[x] };
unsigned int plotter_y = { bitmap_plot_yhi[y], bitmap_plot_ylo[y] };
char* plotter = plotter_x+plotter_y;
*plotter = *plotter | bitmap_plot_bit[x];
}
// Draw a line on the bitmap
void bitmap_line(byte x0, byte x1, byte y0, byte y1) {
byte xd;
byte yd;
void bitmap_line(char x0, char x1, char y0, char y1) {
char xd;
char yd;
if(x0<x1) {
xd = x1-x0;
if(y0<y1) {
@ -92,8 +92,8 @@ void bitmap_line(byte x0, byte x1, byte y0, byte y1) {
}
}
void bitmap_line_xdyi(byte x, byte y, byte x1, byte xd, byte yd) {
byte e = yd>>1;
void bitmap_line_xdyi(char x, char y, char x1, char xd, char yd) {
char e = yd>>1;
do {
bitmap_plot(x,y);
x++;
@ -105,8 +105,8 @@ void bitmap_line_xdyi(byte x, byte y, byte x1, byte xd, byte yd) {
} while (x!=(x1+1));
}
void bitmap_line_xdyd(byte x, byte y, byte x1, byte xd, byte yd) {
byte e = yd>>1;
void bitmap_line_xdyd(char x, char y, char x1, char xd, char yd) {
char e = yd>>1;
do {
bitmap_plot(x,y);
x++;
@ -118,8 +118,8 @@ void bitmap_line_xdyd(byte x, byte y, byte x1, byte xd, byte yd) {
} while (x!=(x1+1));
}
void bitmap_line_ydxi(byte y, byte x, byte y1, byte yd, byte xd) {
byte e = xd>>1;
void bitmap_line_ydxi(char y, char x, char y1, char yd, char xd) {
char e = xd>>1;
do {
bitmap_plot(x,y);
y++;
@ -131,8 +131,8 @@ void bitmap_line_ydxi(byte y, byte x, byte y1, byte yd, byte xd) {
} while (y!=(y1+1));
}
void bitmap_line_ydxd(byte y, byte x, byte y1, byte yd, byte xd) {
byte e = xd>>1;
void bitmap_line_ydxd(char y, char x, char y1, char yd, char xd) {
char e = xd>>1;
do {
bitmap_plot(x,y);
y = y++;

View File

@ -3,29 +3,29 @@
#include <string.h>
// The adddress of the bitmap screen (used for colors)
byte* bitmap_screen;
char* bitmap_screen;
// The adddress of the bitmap graphics (used for pixels)
byte* bitmap_gfx;
char* bitmap_gfx;
// Tables for the plotter - initialized by calling bitmap_init();
const byte bitmap_plot_ylo[256];
const byte bitmap_plot_yhi[256];
const byte bitmap_plot_bit[256];
const char bitmap_plot_ylo[256];
const char bitmap_plot_yhi[256];
const char bitmap_plot_bit[256];
// Initialize bitmap plotting tables
void bitmap_init(byte* gfx, byte* screen) {
void bitmap_init(char* gfx, char* screen) {
bitmap_gfx = gfx;
bitmap_screen = screen;
byte bits = $80;
for(byte x : 0..255) {
char bits = $80;
for(char x : 0..255) {
bitmap_plot_bit[x] = bits;
bits >>= 1;
if(bits==0) {
bits = $80;
}
}
byte* yoffs = gfx;
for(byte y : 0..255) {
char* yoffs = gfx;
for(char y : 0..255) {
bitmap_plot_ylo[y] = y&$7 | <yoffs;
bitmap_plot_yhi[y] = >yoffs;
if((y&$7)==7) {
@ -37,36 +37,36 @@ void bitmap_init(byte* gfx, byte* screen) {
// Clear all graphics on the bitmap
// bgcol - the background color to fill the screen with
// fgcol - the foreground color to fill the screen with
void bitmap_clear(byte bgcol, byte fgcol) {
byte col = fgcol*0x10 + bgcol;
void bitmap_clear(char bgcol, char fgcol) {
char col = fgcol*0x10 + bgcol;
memset(bitmap_screen, col, 1000uw);
memset(bitmap_gfx, 0, 8000uw);
}
// Plot a single dot in the bitmap
void bitmap_plot(word x, byte y) {
byte* plotter = (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] };
void bitmap_plot(unsigned int x, char y) {
char* plotter = (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] };
plotter += ( x & $fff8 );
*plotter |= bitmap_plot_bit[<x];
}
// Draw a line on the bitmap using bresenhams algorithm
void bitmap_line(word x1, word y1, word x2, word y2) {
word x = x1;
word y = y1;
word dx = abs_u16(x2-x1);
word dy = abs_u16(y2-y1);
void bitmap_line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2) {
unsigned int x = x1;
unsigned int y = y1;
unsigned int dx = abs_u16(x2-x1);
unsigned int dy = abs_u16(y2-y1);
if(dx==0 && dy==0) {
bitmap_plot(x,(byte)y);
bitmap_plot(x,(char)y);
return;
}
word sx = sgn_u16(x2-x1);
word sy = sgn_u16(y2-y1);
unsigned int sx = sgn_u16(x2-x1);
unsigned int sy = sgn_u16(y2-y1);
if(dx > dy) {
// X is the driver
word e = dy/2;
unsigned int e = dy/2;
do {
bitmap_plot(x,(byte)y);
bitmap_plot(x,(char)y);
x += sx;
e += dy;
if(dx < e) {
@ -76,9 +76,9 @@ void bitmap_line(word x1, word y1, word x2, word y2) {
} while (x != x2);
} else {
// Y is the driver
word e = dx/2;
unsigned int e = dx/2;
do {
bitmap_plot(x,(byte)y);
bitmap_plot(x,(char)y);
y += sy;
e += dx;
if(dy<e) {
@ -87,11 +87,11 @@ void bitmap_line(word x1, word y1, word x2, word y2) {
}
} while (y != y2);
}
bitmap_plot(x,(byte)y);
bitmap_plot(x,(char)y);
}
// Get the absolute value of a 16-bit unsigned number treated as a signed number.
word abs_u16(word w) {
unsigned int abs_u16(unsigned int w) {
if(>w&0x80) {
return -w;
} else {
@ -101,7 +101,7 @@ word abs_u16(word w) {
// Get the sign of a 16-bit unsigned number treated as a signed number.
// Returns unsigned -1 if the number is
word sgn_u16(word w) {
unsigned int sgn_u16(unsigned int w) {
if(>w&0x80) {
return -1;
} else {

View File

@ -2,19 +2,19 @@
#include <c64.h>
// Get the value to store into D018 to display a specific screen and charset/bitmap
// Optimized for ASM from (byte)((((word)screen&$3fff)/$40)|(((word)charset&$3fff)/$400));
// Optimized for ASM from (char)((((unsigned int)screen&$3fff)/$40)|(((unsigned int)charset&$3fff)/$400));
inline char toD018(char* screen, char* gfx) {
return (>((((unsigned int)screen&$3fff)*4)))|(((>((unsigned int)gfx))/4)&$f);
}
// Get the value to store into DD00 (CIA 2 port A) to choose a specific VIC bank
// Optimized for ASM from %00000011 ^ (byte)((word)gfx/$4000)
// Optimized for ASM from %00000011 ^ (char)((unsigned int)gfx/$4000)
inline char toDd00(char* gfx) {
return %00000011 ^ (>((unsigned int)gfx))/$40;
}
// Get the sprite pointer for a sprite.
// The sprite pointer is the index of the sprite within the graphics bank and equal to the sprite (byte)(sprite_addr/64)
// The sprite pointer is the index of the sprite within the graphics bank and equal to the sprite (char)(sprite_addr/64)
// The sprite pointers are stored SCREEN+$3f8+sprite_id to set the pointer of each sprite
inline char toSpritePtr(char* sprite) {
return (char)(((unsigned int)sprite)/$40);

View File

@ -9,9 +9,9 @@
// Set the memory pointed to by CPU BANK 1 SEGMENT ($4000-$7fff)
// This sets which actual memory is addressed when the CPU reads/writes to $4000-$7fff
// The actual memory addressed will be $4000*cpuSegmentIdx
void dtvSetCpuBankSegment1(byte cpuBankIdx) {
void dtvSetCpuBankSegment1(char cpuBankIdx) {
// Move CPU BANK 1 SEGMENT ($4000-$7fff)
byte* cpuBank = $ff;
char* cpuBank = $ff;
*cpuBank = cpuBankIdx;
asm {
// SAC $dd - A register points to 13 BANK 1 segment

View File

@ -5,23 +5,23 @@
#include <division.h>
// Remainder after signed 8 bit division
byte rem8u =0;
char rem8u =0;
// Performs division on two 8 bit unsigned bytes
// Performs division on two 8 bit unsigned chars
// Returns dividend/divisor.
// The remainder will be set into the global variable rem8u
// Implemented using simple binary division
byte div8u(byte dividend, byte divisor) {
char div8u(char dividend, char divisor) {
return divr8u(dividend, divisor, 0);
}
// Performs division on two 8 bit unsigned bytes and an initial remainder
// Performs division on two 8 bit unsigned chars and an initial remainder
// Returns dividend/divisor.
// The final remainder will be set into the global variable rem8u
// Implemented using simple binary division
byte divr8u(byte dividend, byte divisor, byte rem) {
byte quotient = 0;
for( byte i : 0..7) {
char divr8u(char dividend, char divisor, char rem) {
char quotient = 0;
for( char i : 0..7) {
rem = rem << 1;
if( (dividend & $80) != 0 ) {
rem = rem | 1;
@ -38,15 +38,15 @@ byte divr8u(byte dividend, byte divisor, byte rem) {
}
// Remainder after unsigned 16-bit division
word rem16u = 0;
unsigned int rem16u = 0;
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
word divr16u(word dividend, word divisor, word rem) {
word quotient = 0;
for( byte i : 0..15) {
unsigned int divr16u(unsigned int dividend, unsigned int divisor, unsigned int rem) {
unsigned int quotient = 0;
for( char i : 0..15) {
rem = rem << 1;
if( (>dividend & $80) != 0 ) {
rem = rem | 1;
@ -62,25 +62,25 @@ word divr16u(word dividend, word divisor, word rem) {
return quotient;
}
// Performs division on two 16 bit unsigned words
// Performs division on two 16 bit unsigned ints
// Returns the quotient dividend/divisor.
// The remainder will be set into the global variable rem16u
// Implemented using simple binary division
word div16u(word dividend, word divisor) {
unsigned int div16u(unsigned int dividend, unsigned int divisor) {
return divr16u(dividend, divisor, 0);
}
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
dword div32u16u(dword dividend, word divisor) {
word quotient_hi = divr16u(>dividend, divisor, 0);
word quotient_lo = divr16u(<dividend, divisor, rem16u);
dword quotient = { quotient_hi, quotient_lo};
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
unsigned long div32u16u(unsigned long dividend, unsigned int divisor) {
unsigned int quotient_hi = divr16u(>dividend, divisor, 0);
unsigned int quotient_lo = divr16u(<dividend, divisor, rem16u);
unsigned long quotient = { quotient_hi, quotient_lo};
return quotient;
}
// Remainder after signed 8 bit division
signed byte rem8s = 0;
signed char rem8s = 0;
// Perform division on two signed 8-bit numbers
// Returns dividend/divisor.
@ -88,66 +88,66 @@ signed byte rem8s = 0;
// Implemented using simple binary division
// Follows the C99 standard by truncating toward zero on negative results.
// See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5
signed byte div8s(signed byte dividend, signed byte divisor) {
byte neg = 0;
byte dividendu = 0;
signed char div8s(signed char dividend, signed char divisor) {
char neg = 0;
char dividendu = 0;
if(dividend<0) {
dividendu = (byte)-dividend;
dividendu = (char)-dividend;
neg = 1;
} else {
dividendu = (byte)dividend;
dividendu = (char)dividend;
}
byte divisoru = 0;
char divisoru = 0;
if(divisor<0) {
divisoru = (byte)-divisor;
divisoru = (char)-divisor;
neg = neg ^ 1;
} else {
divisoru = (byte)divisor;
divisoru = (char)divisor;
}
byte resultu = div8u(dividendu, divisoru);
char resultu = div8u(dividendu, divisoru);
if(neg==0) {
rem8s = (signed byte)rem8u;
return (signed byte)resultu;
rem8s = (signed char)rem8u;
return (signed char)resultu;
} else {
rem8s = -(signed byte)rem8u;
return -(signed byte)resultu;
rem8s = -(signed char)rem8u;
return -(signed char)resultu;
}
}
// Remainder after signed 16 bit division
signed word rem16s = 0;
signed int rem16s = 0;
// Perform division on two signed 16-bit numbers with an initial remainder.
// Returns dividend/divisor. The remainder will be set into the global variable rem16s.
// Implemented using simple binary division
// Follows the C99 standard by truncating toward zero on negative results.
// See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5
signed word divr16s(signed word dividend, signed word divisor, signed word rem) {
byte neg = 0;
word dividendu = 0;
word remu = 0;
signed int divr16s(signed int dividend, signed int divisor, signed int rem) {
char neg = 0;
unsigned int dividendu = 0;
unsigned int remu = 0;
if(dividend<0 || rem<0) {
dividendu = (word)-dividend;
remu = (word)-rem;
dividendu = (unsigned int)-dividend;
remu = (unsigned int)-rem;
neg = 1;
} else {
dividendu = (word)dividend;
remu = (word)rem;
dividendu = (unsigned int)dividend;
remu = (unsigned int)rem;
}
word divisoru = 0;
unsigned int divisoru = 0;
if(divisor<0) {
divisoru = (word)-divisor;
divisoru = (unsigned int)-divisor;
neg = neg ^ 1;
} else {
divisoru = (word)divisor;
divisoru = (unsigned int)divisor;
}
word resultu = divr16u(dividendu, divisoru, remu);
unsigned int resultu = divr16u(dividendu, divisoru, remu);
if(neg==0) {
rem16s = (signed word)rem16u;
return (signed word)resultu;
rem16s = (signed int)rem16u;
return (signed int)resultu;
} else {
rem16s = -(signed word)rem16u;
return -(signed word)resultu;
rem16s = -(signed int)rem16u;
return -(signed int)resultu;
}
}
@ -157,6 +157,6 @@ signed word divr16s(signed word dividend, signed word divisor, signed word rem)
// Implemented using simple binary division
// Follows the C99 standard by truncating toward zero on negative results.
// See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf section 6.5.5
signed word div16s(signed word dividend, signed word divisor) {
signed int div16s(signed int dividend, signed int divisor) {
return divr16s(dividend, divisor, 0);
}

View File

@ -6,22 +6,22 @@
// mulf_sqr tables will contain f(x)=int(x*x/4) and g(x) = f(x-255).
// <f(x) = <(( x * x )/4)
byte align($100) mulf_sqr1_lo[512];
char align($100) mulf_sqr1_lo[512];
// >f(x) = >(( x * x )/4)
byte align($100) mulf_sqr1_hi[512];
char align($100) mulf_sqr1_hi[512];
// <g(x) = <((( x - 255) * ( x - 255 ))/4)
byte align($100) mulf_sqr2_lo[512];
char align($100) mulf_sqr2_lo[512];
// >g(x) = >((( x - 255) * ( x - 255 ))/4)
byte align($100) mulf_sqr2_hi[512];
char align($100) mulf_sqr2_hi[512];
// Initialize the mulf_sqr multiplication tables with f(x)=int(x*x/4)
void mulf_init() {
// Fill mulf_sqr1 = f(x) = int(x*x/4): If f(x) = x*x/4 then f(x+1) = f(x) + x/2 + 1/4
word sqr = 0; // sqr = (x*x)/4
byte x_2 = 0; // x/2
byte c = 0; // Counter used for determining x%2==0
byte* sqr1_hi = mulf_sqr1_hi+1;
for(byte* sqr1_lo = mulf_sqr1_lo+1; sqr1_lo!=mulf_sqr1_lo+512; sqr1_lo++) {
unsigned int sqr = 0; // sqr = (x*x)/4
char x_2 = 0; // x/2
char c = 0; // Counter used for determining x%2==0
char* sqr1_hi = mulf_sqr1_hi+1;
for(char* sqr1_lo = mulf_sqr1_lo+1; sqr1_lo!=mulf_sqr1_lo+512; sqr1_lo++) {
if((++c&1)==0) {
x_2++; // increase i/2 on even numbers
sqr++; // sqr++ on even numbers because 1 = 2*1/4 (from the two previous numbers) + 1/2 (half of the previous uneven number)
@ -32,10 +32,10 @@ void mulf_init() {
}
// Fill mulf_sqr2 = g(x) = f(x-255) : If x-255<0 then g(x)=f(255-x) (because x*x = -x*-x)
// g(0) = f(255), g(1) = f(254), ..., g(254) = f(1), g(255) = f(0), g(256) = f(1), ..., g(510) = f(255), g(511) = f(256)
byte x_255 = (byte)-1; //Start with g(0)=f(255)
byte dir = $ff; // Decrease or increase x_255 - initially we decrease
byte* sqr2_hi = mulf_sqr2_hi;
for(byte* sqr2_lo = mulf_sqr2_lo; sqr2_lo!=mulf_sqr2_lo+511; sqr2_lo++) {
char x_255 = (char)-1; //Start with g(0)=f(255)
char dir = $ff; // Decrease or increase x_255 - initially we decrease
char* sqr2_hi = mulf_sqr2_hi;
for(char* sqr2_lo = mulf_sqr2_lo; sqr2_lo!=mulf_sqr2_lo+511; sqr2_lo++) {
*sqr2_lo = mulf_sqr1_lo[x_255];
*sqr2_hi++ = mulf_sqr1_hi[x_255];
x_255 = x_255 + dir;
@ -48,9 +48,9 @@ void mulf_init() {
*(mulf_sqr2_hi+511) = *(mulf_sqr1_hi+256);
}
// Prepare for fast multiply with an unsigned byte to a word result
void mulf8u_prepare(byte a) {
byte* const memA = $fd;
// Prepare for fast multiply with an unsigned char to a unsigned int result
void mulf8u_prepare(char a) {
char* const memA = $fd;
*memA = a;
asm {
lda memA
@ -62,11 +62,11 @@ void mulf8u_prepare(byte a) {
}
}
// Calculate fast multiply with a prepared unsigned byte to a word result
// The prepared number is set by calling mulf8u_prepare(byte a)
word mulf8u_prepared(byte b) {
byte* const resL = $fe;
byte* const memB = $ff;
// Calculate fast multiply with a prepared unsigned char to a unsigned int result
// The prepared number is set by calling mulf8u_prepare(char a)
unsigned int mulf8u_prepared(char b) {
char* const resL = $fe;
char* const memB = $ff;
*memB = b;
asm {
ldx memB
@ -85,43 +85,43 @@ word mulf8u_prepared(byte b) {
return { *memB, *resL };
}
// Fast multiply two unsigned bytes to a word result
word mulf8u(byte a, byte b) {
// Fast multiply two unsigned chars to a unsigned int result
unsigned int mulf8u(char a, char b) {
mulf8u_prepare(a);
return mulf8u_prepared(b);
}
// Prepare for fast multiply with an signed byte to a word result
inline void mulf8s_prepare(signed byte a) {
mulf8u_prepare((byte)a);
// Prepare for fast multiply with an signed char to a unsigned int result
inline void mulf8s_prepare(signed char a) {
mulf8u_prepare((char)a);
}
// Calculate fast multiply with a prepared unsigned byte to a word result
// The prepared number is set by calling mulf8s_prepare(byte a)
signed word mulf8s_prepared(signed byte b) {
signed byte* const memA = $fd;
word m = mulf8u_prepared((byte) b);
// Calculate fast multiply with a prepared unsigned char to a unsigned int result
// The prepared number is set by calling mulf8s_prepare(char a)
signed int mulf8s_prepared(signed char b) {
signed char* const memA = $fd;
unsigned int m = mulf8u_prepared((char) b);
if(*memA<0) {
>m = (>m)-(byte)b;
>m = (>m)-(char)b;
}
if(b<0) {
>m = (>m)-(byte)*memA;
>m = (>m)-(char)*memA;
}
return (signed word)m;
return (signed int)m;
}
// Fast multiply two signed bytes to a word result
signed word mulf8s(signed byte a, signed byte b) {
// Fast multiply two signed chars to a unsigned int result
signed int mulf8s(signed char a, signed char b) {
mulf8s_prepare(a);
return mulf8s_prepared(b);
}
// Fast multiply two unsigned words to a double word result
// Fast multiply two unsigned ints to a double unsigned int result
// Done in assembler to utilize fast addition A+X
dword mulf16u(word a, word b) {
word* const memA = $f8;
word* const memB = $fa;
dword* const memR = $fc;
unsigned long mulf16u(unsigned int a, unsigned int b) {
unsigned int* const memA = $f8;
unsigned int* const memB = $fa;
unsigned long* const memR = $fc;
*memA = a;
*memB = b;
asm {
@ -199,15 +199,15 @@ _dd: lda #0
return *memR;
}
// Fast multiply two signed words to a signed double word result
// Fast multiply two signed ints to a signed double unsigned int result
// Fixes offsets introduced by using unsigned multiplication
signed dword mulf16s(signed word a, signed word b) {
dword m = mulf16u((word)a, (word)b);
signed long mulf16s(signed int a, signed int b) {
unsigned long m = mulf16u((unsigned int)a, (unsigned int)b);
if(a<0) {
>m = (>m)-(word)b;
>m = (>m)-(unsigned int)b;
}
if(b<0) {
>m = (>m)-(word)a;
>m = (>m)-(unsigned int)a;
}
return (signed dword)m;
return (signed long)m;
}

View File

@ -21,7 +21,7 @@
// Keycodes for each screen code character from $00-$3f.
// Chars that do not have an unmodified keycode return $3f (representing RUN/STOP).
const byte keyboard_char_keycodes[] = {
const char keyboard_char_keycodes[] = {
/*@*/KEY_AT, /*a*/KEY_A, /*b*/KEY_B, /*c*/KEY_C, /*d*/KEY_D, /*e*/KEY_E, /*f*/KEY_F, /*g*/KEY_G,
/*h*/KEY_H, /*i*/KEY_I, /*j*/KEY_J, /*k*/KEY_K, /*l*/KEY_L, /*m*/KEY_M, /*n*/KEY_N, /*o*/KEY_O,
/*p*/KEY_P, /*q*/KEY_Q, /*r*/KEY_R, /*s*/KEY_S, /*t*/KEY_T, /*u*/KEY_U, /*v*/KEY_V, /*w*/KEY_W,
@ -33,10 +33,10 @@ const byte keyboard_char_keycodes[] = {
};
// Keyboard row bitmask as expected by CIA#1 Port A when reading a specific keyboard matrix row (rows are numbered 0-7)
byte keyboard_matrix_row_bitmask[8] = { %11111110, %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111 };
char keyboard_matrix_row_bitmask[8] = { %11111110, %11111101, %11111011, %11110111, %11101111, %11011111, %10111111, %01111111 };
// Keyboard matrix column bitmasks for a specific keybooard matrix column when reading the keyboard. (columns are numbered 0-7)
byte keyboard_matrix_col_bitmask[8] = { %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 };
char keyboard_matrix_col_bitmask[8] = { %00000001, %00000010, %00000100, %00001000, %00010000, %00100000, %01000000, %10000000 };
// Initialize keyboard reading by setting CIA#$ Data Direction Registers
void keyboard_init() {
@ -48,7 +48,7 @@ void keyboard_init() {
// Check if any key is currently pressed on the keyboard matrix
// Return 0 if no key is pressed and not 0 if any key is pressed
byte keyboard_matrix_any(void) {
char keyboard_matrix_any(void) {
*CIA1_PORT_A = 0;
return ~*CIA1_PORT_B;
}
@ -58,9 +58,9 @@ byte keyboard_matrix_any(void) {
// Returns the keys pressed on the row as bits according to the C64 key matrix.
// Notice: If the C64 normal interrupt is still running it will occasionally interrupt right between the read & write
// leading to erroneous readings. You must disable kill the normal interrupt or sei/cli around calls to the keyboard matrix reader.
byte keyboard_matrix_read(byte rowid) {
char keyboard_matrix_read(char rowid) {
*CIA1_PORT_A = keyboard_matrix_row_bitmask[rowid];
byte row_pressed_bits = ~*CIA1_PORT_B;
char row_pressed_bits = ~*CIA1_PORT_B;
return row_pressed_bits;
}
@ -68,9 +68,9 @@ byte keyboard_matrix_read(byte rowid) {
// The key is a keyboard code defined from the keyboard matrix by %00rrrccc, where rrr is the row ID (0-7) and ccc is the column ID (0-7)
// All keys exist as as KEY_XXX constants.
// Returns zero if the key is not pressed and a non-zero value if the key is currently pressed
byte keyboard_key_pressed(byte key) {
byte colidx = key&7;
byte rowidx = key>>3;
char keyboard_key_pressed(char key) {
char colidx = key&7;
char rowidx = key>>3;
return keyboard_matrix_read(rowidx) & keyboard_matrix_col_bitmask[colidx];
}
@ -78,47 +78,47 @@ byte keyboard_key_pressed(byte key) {
// ch is the character to get the key code for ($00-$3f)
// Returns the key code corresponding to the passed character. Only characters with a non-shifted key are handled.
// If there is no non-shifted key representing the char $3f is returned (representing RUN/STOP) .
byte keyboard_get_keycode(byte ch) {
char keyboard_get_keycode(char ch) {
return keyboard_char_keycodes[ch];
}
// Keyboard event buffer. Contains keycodes for key presses/releases. Presses are represented by the keycode. Releases by keycode | $40. The buffer is filled by keyboard_scan()
byte keyboard_events[8];
char keyboard_events[8];
// Keyboard event buffer size. The number of events currently in the event buffer
byte keyboard_events_size = 0;
char keyboard_events_size = 0;
// Current keyboard modifiers (left shift, right shift, ctrl, commodore)
byte keyboard_modifiers = 0;
char keyboard_modifiers = 0;
// Left shift is pressed
const byte KEY_MODIFIER_LSHIFT = 1;
const char KEY_MODIFIER_LSHIFT = 1;
// Right shift is pressed
const byte KEY_MODIFIER_RSHIFT = 2;
const char KEY_MODIFIER_RSHIFT = 2;
// CTRL is pressed
const byte KEY_MODIFIER_CTRL = 4;
const char KEY_MODIFIER_CTRL = 4;
// Commodore is pressed
const byte KEY_MODIFIER_COMMODORE = 8;
const char KEY_MODIFIER_COMMODORE = 8;
// Any shift is pressed
const byte KEY_MODIFIER_SHIFT = KEY_MODIFIER_LSHIFT|KEY_MODIFIER_RSHIFT;
const char KEY_MODIFIER_SHIFT = KEY_MODIFIER_LSHIFT|KEY_MODIFIER_RSHIFT;
// The values scanned values for each row. Set by keyboard_scan() and used by keyboard_get_event()
byte keyboard_scan_values[8];
char keyboard_scan_values[8];
// Scans the entire matrix to determine which keys have been pressed/depressed.
// Generates keyboard events into the event buffer. Events can be read using keyboard_event_get().
// Handles debounce and only generates events when the status of a key changes.
// Also stores current status of modifiers in keyboard_modifiers.
void keyboard_event_scan() {
byte keycode = 0;
for(byte row : 0..7) {
byte row_scan = keyboard_matrix_read(row);
char keycode = 0;
for(char row : 0..7) {
char row_scan = keyboard_matrix_read(row);
if(row_scan!=keyboard_scan_values[row]) {
// Something has changed on the keyboard row - check each column
for(byte col : 0..7){
for(char col : 0..7){
// XOR of row scan with the last seen row scan AND'ed with the col bitmask will be non-0 if the key status is changed
if(((row_scan^keyboard_scan_values[row])&keyboard_matrix_col_bitmask[col])!=0) {
// Key(row, col) status has changed. We have an event.
// Only process event if there is still room in the buffer
if(keyboard_events_size!=8) {
// AND of row scan and bit mask determines if key is pressed or released
byte event_type = row_scan&keyboard_matrix_col_bitmask[col];
char event_type = row_scan&keyboard_matrix_col_bitmask[col];
if(event_type==0) {
// Key released
keyboard_events[keyboard_events_size++] = keycode|$40;
@ -155,15 +155,15 @@ void keyboard_event_scan() {
// Determine if a specific key is currently pressed based on the last keyboard_event_scan()
// Returns 0 is not pressed and non-0 if pressed
byte keyboard_event_pressed(byte keycode) {
byte row_bits = keyboard_scan_values[keycode>>3];
char keyboard_event_pressed(char keycode) {
char row_bits = keyboard_scan_values[keycode>>3];
return row_bits & keyboard_matrix_col_bitmask[keycode&7];
}
// Get the next event from the keyboard event buffer.
// Returns $ff if there is no event waiting. As all events are <$7f it is enough to examine bit 7 when determining if there is any event to process.
// The buffer is filled by keyboard_event_scan()
byte keyboard_event_get() {
char keyboard_event_get() {
if(keyboard_events_size==0) {
return $ff;
} else {

View File

@ -2,7 +2,7 @@
//TODO: Convert all limits to macros
// Number of bits in a char object (byte)
// Number of bits in a char object
const char CHAR_BIT = 8;
// Minimum value of char type
const char CHAR_MIN = 0;

View File

@ -2,10 +2,10 @@
#include <multiply.h>
// Perform binary multiplication of two unsigned 8-bit bytes into a 16-bit unsigned word
word mul8u(byte a, byte b) {
word res = 0;
word mb = b;
// Perform binary multiplication of two unsigned 8-bit chars into a 16-bit unsigned int
unsigned int mul8u(char a, char b) {
unsigned int res = 0;
unsigned int mb = b;
while(a!=0) {
if( (a&1) != 0) {
res = res + mb;
@ -16,33 +16,33 @@ word mul8u(byte a, byte b) {
return res;
}
// Multiply of two signed bytes to a signed word
// Multiply of two signed chars to a signed int
// Fixes offsets introduced by using unsigned multiplication
signed word mul8s(signed byte a, signed byte b) {
word m = mul8u((byte)a, (byte) b);
signed int mul8s(signed char a, signed char b) {
unsigned int m = mul8u((char)a, (char) b);
if(a<0) {
>m = (>m)-(byte)b;
>m = (>m)-(char)b;
}
if(b<0) {
>m = (>m)-(byte)a;
>m = (>m)-(char)a;
}
return (signed word)m;
return (signed int)m;
}
// Multiply a signed byte and an unsigned byte (into a signed word)
// Multiply a signed char and an unsigned char (into a signed int)
// Fixes offsets introduced by using unsigned multiplication
signed word mul8su(signed byte a, byte b) {
word m = mul8u((byte)a, (byte) b);
signed int mul8su(signed char a, char b) {
unsigned int m = mul8u((char)a, (char) b);
if(a<0) {
>m = (>m)-(byte)b;
>m = (>m)-(char)b;
}
return (signed word)m;
return (signed int)m;
}
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
dword mul16u(word a, word b) {
dword res = 0;
dword mb = b;
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
unsigned long mul16u(unsigned int a, unsigned int b) {
unsigned long res = 0;
unsigned long mb = b;
while(a!=0) {
if( (a&1) != 0) {
res = res + mb;
@ -53,15 +53,15 @@ dword mul16u(word a, word b) {
return res;
}
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
signed dword mul16s(signed word a, signed word b) {
dword m = mul16u((word)a, (word) b);
signed long mul16s(signed int a, signed int b) {
unsigned long m = mul16u((unsigned int)a, (unsigned int) b);
if(a<0) {
>m = (>m)-(word)b;
>m = (>m)-(unsigned int)b;
}
if(b<0) {
>m = (>m)-(word)a;
>m = (>m)-(unsigned int)a;
}
return (signed dword)m;
return (signed long)m;
}

View File

@ -1,16 +1,16 @@
#include <stdlib.h>
#include <string.h>
byte* print_screen = $0400;
byte* print_line_cursor = print_screen;
byte* print_char_cursor = print_line_cursor;
char* print_screen = $0400;
char* print_line_cursor = print_screen;
char* print_char_cursor = print_line_cursor;
// Print a number of zero-terminated strings, each followed by a newline.
// The sequence of lines is terminated by another zero.
void print_str_lines(byte* str) {
void print_str_lines(char* str) {
while(*str) {
do {
byte ch = *(str++);
char ch = *(str++);
if(ch) {
*(print_char_cursor++) = ch;
}
@ -20,20 +20,20 @@ void print_str_lines(byte* str) {
}
// Print a zero-terminated string followed by a newline
void print_str_ln(byte* str) {
void print_str_ln(char* str) {
print_str(str);
print_ln();
}
// Print a zero-terminated string
void print_str(byte* str) {
void print_str(char* str) {
while(*str) {
*(print_char_cursor++) = *(str++);
}
}
// Print a string at a specific screen position
void print_str_at(byte* str, byte* at) {
void print_str_at(char* str, char* at) {
while(*str) {
*(at++) = *(str++);
}
@ -47,133 +47,133 @@ void print_ln() {
print_char_cursor = print_line_cursor;
}
// Print a signed word as HEX
void print_sword(signed word w) {
// Print a signed int as HEX
void print_sint(signed int w) {
if(w<0) {
print_char('-');
w = -w;
} else {
print_char(' ');
}
print_word((word)w);
print_uint((unsigned int)w);
}
// Print a signed byte as HEX
void print_sbyte(signed byte b) {
// Print a signed char as HEX
void print_s8(signed char b) {
if(b<0) {
print_char('-');
b = -b;
} else {
print_char(' ');
}
print_byte((byte)b);
print_u8((char)b);
}
// Prints a signed byte as HEX at a specific position on the screen
// Prints a signed char as HEX at a specific position on the screen
// row and col are 0-based indices
inline void print_sbyte_pos(signed byte sb, byte row, byte col) {
print_sbyte_at(sb, print_screen+row*40+col);
inline void print_s8_pos(signed char sb, char row, char col) {
print_s8_at(sb, print_screen+row*40+col);
}
// Print a signed byte as hex at a specific screen position
void print_sbyte_at(signed byte b, byte* at) {
// Print a signed char as hex at a specific screen position
void print_s8_at(signed char b, char* at) {
if(b<0) {
print_char_at('-', at);
b = -b;
} else {
print_char_at(' ', at);
}
print_byte_at((byte)b, at+1);
print_u8_at((char)b, at+1);
}
// Print a word as HEX
void print_word(word w) {
print_byte(>w);
print_byte(<w);
// Print a unsigned int as HEX
void print_uint(unsigned int w) {
print_u8(>w);
print_u8(<w);
}
// Digits used for storing the decimal word
// Digits used for storing the decimal unsigned int
char decimal_digits[6];
// Print a byte as DECIMAL
void print_byte_decimal(byte b) {
utoa((word)b, decimal_digits, DECIMAL);
// Print a char as DECIMAL
void print_u8_decimal(char b) {
utoa((unsigned int)b, decimal_digits, DECIMAL);
print_str(decimal_digits);
}
// Print a word as DECIMAL
void print_word_decimal(word w) {
// Print a unsigned int as DECIMAL
void print_uint_decimal(unsigned int w) {
utoa(w, decimal_digits, DECIMAL);
print_str(decimal_digits);
}
// Print a word as HEX at a specific position
void print_word_at(word w, byte* at) {
print_byte_at(>w, at);
print_byte_at(<w, at+2);
// Print a unsigned int as HEX at a specific position
void print_uint_at(unsigned int w, char* at) {
print_u8_at(>w, at);
print_u8_at(<w, at+2);
}
// Print a dword as HEX
void print_dword(dword dw) {
print_word(>dw);
print_word(<dw);
// Print a unsigned long as HEX
void print_ulong(unsigned long dw) {
print_uint(>dw);
print_uint(<dw);
}
// Digits used for storing the decimal word
// Digits used for storing the decimal unsigned int
char decimal_digits_long[11];
// Print a dword as DECIMAL
void print_dword_decimal(dword w) {
// Print a unsigned long as DECIMAL
void print_ulong_decimal(unsigned long w) {
ultoa(w, decimal_digits_long, DECIMAL);
print_str(decimal_digits_long);
}
// Print a dword as HEX at a specific position
void print_dword_at(dword dw, byte* at) {
print_word_at(>dw, at);
print_word_at(<dw, at+4);
// Print a unsigned long as HEX at a specific position
void print_ulong_at(unsigned long dw, char* at) {
print_uint_at(>dw, at);
print_uint_at(<dw, at+4);
}
// Print a signed dword as HEX
void print_sdword(signed dword dw) {
// Print a signed long as HEX
void print_slong(signed long dw) {
if(dw<0) {
print_char('-');
dw = -dw;
} else {
print_char(' ');
}
print_dword((dword)dw);
print_ulong((unsigned long)dw);
}
const byte print_hextab[] = "0123456789abcdef"z;
const char print_hextab[] = "0123456789abcdef"z;
// Print a byte as HEX
void print_byte(byte b) {
// Print a char as HEX
void print_u8(char b) {
// Table of hexadecimal digits
print_char(print_hextab[b>>4]);
print_char(print_hextab[b&$f]);
}
// Prints a byte as HEX at a specific position on the screen
// Prints a char as HEX at a specific position on the screen
// row and col are 0-based indices
inline void print_byte_pos(byte b, byte row, byte col) {
print_byte_at(b, print_screen+row*40+col);
inline void print_u8_pos(char b, char row, char col) {
print_u8_at(b, print_screen+row*40+col);
}
// Print a byte as HEX at a specific position
void print_byte_at(byte b, byte* at) {
// Print a char as HEX at a specific position
void print_u8_at(char b, char* at) {
// Table of hexadecimal digits
print_char_at(print_hextab[b>>4], at);
print_char_at(print_hextab[b&$f], at+1);
}
// Print a single char
void print_char(byte ch) {
void print_char(char ch) {
*(print_char_cursor++) = ch;
}
// Print a single char
void print_char_at(byte ch, byte* at) {
void print_char_at(char ch, char* at) {
*(at) = ch;
}
@ -185,7 +185,7 @@ void print_cls() {
}
// Set the screen to print on. Also resets current line/char cursor.
void print_set_screen(byte* screen) {
void print_set_screen(char* screen) {
print_screen = screen;
print_line_cursor = print_screen;
print_char_cursor = print_line_cursor;

View File

@ -9,69 +9,69 @@
#include <multiply.h>
// PI*2 in u[4.28] format
const dword PI2_u4f28 = $6487ed51;
const unsigned long PI2_u4f28 = $6487ed51;
// PI in u[4.28] format
const dword PI_u4f28 = $3243f6a9;
const unsigned long PI_u4f28 = $3243f6a9;
// PI/2 in u[4.28] format
const dword PI_HALF_u4f28 = $1921FB54;
const unsigned long PI_HALF_u4f28 = $1921FB54;
// PI*2 in u[4.12] format
const word PI2_u4f12 = $6488;
const unsigned int PI2_u4f12 = $6488;
// PI in u[4.12] format
const word PI_u4f12 = $3244;
const unsigned int PI_u4f12 = $3244;
// PI/2 in u[4.12] format
const word PI_HALF_u4f12 = $1922;
const unsigned int PI_HALF_u4f12 = $1922;
// Generate signed (large) word sinus table - on the full -$7fff - $7fff range
// Generate signed (large) unsigned int sinus table - on the full -$7fff - $7fff range
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
void sin16s_gen(signed word* sintab, word wavelength) {
void sin16s_gen(signed int* sintab, unsigned int wavelength) {
// u[4.28] step = PI*2/wavelength
dword step = div32u16u(PI2_u4f28, wavelength); // u[4.28]
unsigned long step = div32u16u(PI2_u4f28, wavelength); // u[4.28]
// Iterate over the table
dword x = 0; // u[4.28]
for( word i=0; i<wavelength; i++) {
unsigned long x = 0; // u[4.28]
for( unsigned int i=0; i<wavelength; i++) {
*sintab++ = sin16s(x);
x = x + step;
}
}
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
void sin16s_gen2(signed word* sintab, word wavelength, signed word min, signed word max) {
signed word ampl = max-min;
signed word offs = min + ampl>>1; // ampl is always positive so shifting left does not alter the sign
void sin16s_gen2(signed int* sintab, unsigned int wavelength, signed int min, signed int max) {
signed int ampl = max-min;
signed int offs = min + ampl>>1; // ampl is always positive so shifting left does not alter the sign
// u[4.28] step = PI*2/wavelength
dword step = div32u16u(PI2_u4f28, wavelength); // u[4.28]
unsigned long step = div32u16u(PI2_u4f28, wavelength); // u[4.28]
// Iterate over the table
dword x = 0; // u[4.28]
for( word i=0; i<wavelength; i++) {
*sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl); // The signed sin() has values [-7fff;7fff] = [-1/2 ; 1/2], so ampl*sin has the right amplitude
unsigned long x = 0; // u[4.28]
for( unsigned int i=0; i<wavelength; i++) {
*sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl); // The signed sin() has values [-7fff;7fff] = [-1/2 ; 1/2], so ampl*sin has the right amplitude
x = x + step;
}
}
// Generate signed byte sinus table - on the full -$7f - $7f range
// Generate signed char sinus table - on the full -$7f - $7f range
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
void sin8s_gen(signed byte* sintab, word wavelength) {
void sin8s_gen(signed char* sintab, unsigned int wavelength) {
// u[4.28] step = PI*2/wavelength
word step = div16u(PI2_u4f12, wavelength); // u[4.12]
unsigned int step = div16u(PI2_u4f12, wavelength); // u[4.12]
// Iterate over the table
word x = 0; // u[4.12]
for( word i=0; i<wavelength; i++) {
unsigned int x = 0; // u[4.12]
for( unsigned int i=0; i<wavelength; i++) {
*sintab++ = sin8s(x);
x = x + step;
}
}
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
signed word sin16s(dword x) {
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
signed int sin16s(unsigned long x) {
// Move x1 into the range 0-PI/2 using sinus mirror symmetries
byte isUpper = 0;
char isUpper = 0;
if(x >= PI_u4f28 ) {
x = x - PI_u4f28;
isUpper = 1;
@ -80,28 +80,28 @@ signed word sin16s(dword x) {
x = PI_u4f28 - x;
}
// sinx = x - x^3/6 + x5/128;
word x1 = >x<<3; // u[1.15]
word x2 = mulu16_sel(x1, x1, 0); // u[2.14] x^2
word x3 = mulu16_sel(x2, x1, 1); // u[2.14] x^3
word x3_6 = mulu16_sel(x3, $10000/6, 1); // u[1.15] x^3/6;
word usinx = x1 - x3_6; // u[1.15] x - x^3/6
word x4 = mulu16_sel(x3, x1, 0); // u[3.13] x^4
word x5 = mulu16_sel(x4, x1, 0); // u[4.12] x^5
word x5_128 = x5>>4; // // u[1.15] x^5/128 -- much more efficient than mul_u16_sel(x5, $10000/128, 3);
unsigned int x1 = >x<<3; // u[1.15]
unsigned int x2 = mulu16_sel(x1, x1, 0); // u[2.14] x^2
unsigned int x3 = mulu16_sel(x2, x1, 1); // u[2.14] x^3
unsigned int x3_6 = mulu16_sel(x3, $10000/6, 1); // u[1.15] x^3/6;
unsigned int usinx = x1 - x3_6; // u[1.15] x - x^3/6
unsigned int x4 = mulu16_sel(x3, x1, 0); // u[3.13] x^4
unsigned int x5 = mulu16_sel(x4, x1, 0); // u[4.12] x^5
unsigned int x5_128 = x5>>4; // // u[1.15] x^5/128 -- much more efficient than mul_u16_sel(x5, $10000/128, 3);
usinx = usinx + x5_128; // u[1.15] (first bit is always zero)
signed word sinx = (signed word)usinx; // s[0.15]
signed int sinx = (signed int)usinx; // s[0.15]
if(isUpper!=0) {
sinx = -(signed word)usinx; // s[0.15];
sinx = -(signed int)usinx; // s[0.15];
}
return sinx;
}
// Calculate signed byte sinus sin(x)
// x: unsigned word input u[4.12] in the interval $0000 - PI2_u4f12
// result: signed byte sin(x) s[0.7] - using the full range -$7f - $7f
signed byte sin8s(word x) {
// Calculate signed char sinus sin(x)
// x: unsigned int input u[4.12] in the interval $0000 - PI2_u4f12
// result: signed char sin(x) s[0.7] - using the full range -$7f - $7f
signed char sin8s(unsigned int x) {
// Move x1 into the range 0-PI/2 using sinus mirror symmetries
byte isUpper = 0;
char isUpper = 0;
if(x >= PI_u4f12 ) {
x = x - PI_u4f12;
isUpper = 1;
@ -110,32 +110,32 @@ signed byte sin8s(word x) {
x = PI_u4f12 - x;
}
// sinx = x - x^3/6 + x5/128;
byte x1 = >x<<3; // u[1.7]
byte x2 = mulu8_sel(x1, x1, 0); // u[2.6] x^2
byte x3 = mulu8_sel(x2, x1, 1); // u[2.6] x^3
const byte DIV_6 = $2b; // u[0.7] - $2a.aa rounded to $2b
byte x3_6 = mulu8_sel(x3, DIV_6, 1); // u[1.7] x^3/6;
byte usinx = x1 - x3_6; // u[1.7] x - x^3/6
byte x4 = mulu8_sel(x3, x1, 0); // u[3.5] x^4
byte x5 = mulu8_sel(x4, x1, 0); // u[4.4] x^5
byte x5_128 = x5>>4; // // u[1.7] x^5/128 -- much more efficient than mul_u16_sel(x5, $10000/128, 3);
char x1 = >x<<3; // u[1.7]
char x2 = mulu8_sel(x1, x1, 0); // u[2.6] x^2
char x3 = mulu8_sel(x2, x1, 1); // u[2.6] x^3
const char DIV_6 = $2b; // u[0.7] - $2a.aa rounded to $2b
char x3_6 = mulu8_sel(x3, DIV_6, 1); // u[1.7] x^3/6;
char usinx = x1 - x3_6; // u[1.7] x - x^3/6
char x4 = mulu8_sel(x3, x1, 0); // u[3.5] x^4
char x5 = mulu8_sel(x4, x1, 0); // u[4.4] x^5
char x5_128 = x5>>4; // // u[1.7] x^5/128 -- much more efficient than mul_u16_sel(x5, $10000/128, 3);
usinx = usinx + x5_128; // u[1.7] (first bit is always zero)
if(usinx>=128) { usinx--; } // rounding may occasionally result in $80 - lower into range ($00-$7f)
signed byte sinx = (signed byte)usinx; // s[0.7]
signed char sinx = (signed char)usinx; // s[0.7]
if(isUpper!=0) {
sinx = -(signed byte)usinx; // s[0.7];
sinx = -(signed char)usinx; // s[0.7];
}
return sinx;
}
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
word mulu16_sel(word v1, word v2, byte select) {
unsigned int mulu16_sel(unsigned int v1, unsigned int v2, char select) {
return >mul16u(v1, v2)<<select;
}
// Calculate val*val for two unsigned byte values - the result is 8 selected bits of the 16-bit result.
// Calculate val*val for two unsigned char values - the result is 8 selected bits of the 16-bit result.
// The select parameter indicates how many of the highest bits of the 16-bit result to skip
byte mulu8_sel(byte v1, byte v2, byte select) {
char mulu8_sel(char v1, char v2, char select) {
return >mul8u(v1, v2)<<select;
}

View File

@ -4,35 +4,35 @@
#include <stdlib.h>
// The number of squares to pre-calculate. Limits what values sqr() can calculate and the result of sqrt()
byte NUM_SQUARES = 0xff;
char NUM_SQUARES = 0xff;
// Squares for each byte value SQUARES[i] = i*i
// Squares for each char value SQUARES[i] = i*i
// Initialized by init_squares()
word* SQUARES;
unsigned int* SQUARES;
// Initialize squares table
// Uses iterative formula (x+1)^2 = x^2 + 2*x + 1
void init_squares() {
SQUARES = malloc(NUM_SQUARES*sizeof(word));
word* squares = SQUARES;
word sqr = 0;
for(byte i=0;i<NUM_SQUARES;i++) {
SQUARES = malloc(NUM_SQUARES*sizeof(unsigned int));
unsigned int* squares = SQUARES;
unsigned int sqr = 0;
for(char i=0;i<NUM_SQUARES;i++) {
*squares++ = sqr;
sqr += i*2+1;
}
}
// Find the square of a byte value
// Find the square of a char value
// Uses a table of squares that must be initialized by calling init_squares()
word sqr(byte val) {
unsigned int sqr(char val) {
return SQUARES[val];
}
// Find the (integer) square root of a word value
// Find the (integer) square root of a unsigned int value
// If the square is not an integer then it returns the largest integer N where N*N <= val
// Uses a table of squares that must be initialized by calling init_squares()
byte sqrt(word val) {
word* found = bsearch16u(val, SQUARES, NUM_SQUARES);
byte sq = (byte)(found-SQUARES);
char sqrt(unsigned int val) {
unsigned int* found = bsearch16u(val, SQUARES, NUM_SQUARES);
char sq = (char)(found-SQUARES);
return sq;
}

View File

@ -9,7 +9,7 @@ unsigned char* HEAP_TOP = 0xa000;
// Head of the heap. Moved backward each malloc()
unsigned char* heap_head = HEAP_TOP;
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// Allocates a block of size chars of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
void* malloc(unsigned int size) {
unsigned char* mem = heap_head-size;
@ -32,14 +32,14 @@ void *calloc(size_t nitems, size_t size) {
return mem;
}
// Searches an array of nitems unsigned words, the initial member of which is pointed to by base, for a member that matches the value key.
// Searches an array of nitems unsigned ints, the initial member of which is pointed to by base, for a member that matches the value key.
// - key - The value to look for
// - items - Pointer to the start of the array to search in
// - num - The number of items in the array
// Returns pointer to an entry in the array that matches the search key
unsigned int* bsearch16u(unsigned int key, unsigned int* items, char num) {
while (num > 0) {
word* pivot = items + (num >> 1);
unsigned int* pivot = items + (num >> 1);
signed int result = (signed int)key-(signed int)*pivot;
if (result == 0)
return pivot;
@ -93,7 +93,7 @@ void utoa(unsigned int value, char* buffer, enum RADIX radix){
*buffer = 0;
return;
}
byte started = 0;
char started = 0;
for( char digit=0; digit<max_digits-1; digit++ ) {
unsigned int digit_value = digit_values[digit];
if (started || value >= digit_value){
@ -157,7 +157,7 @@ void ultoa(unsigned long value, char* buffer, enum RADIX radix){
*buffer = 0;
return;
}
byte started = 0;
char started = 0;
for( char digit=0; digit<max_digits-1; digit++ ) {
unsigned long digit_value = digit_values[digit];
if (started || value >= digit_value){

View File

@ -15,7 +15,7 @@ void* memcpy( void* destination, void* source, size_t num ) {
// Move block of memory
// Copies the values of num bytes from the location pointed by source to the memory block pointed by destination. Copying takes place as if an intermediate buffer were used, allowing the destination and source to overlap.
void* memmove( void* destination, void* source, size_t num ) {
if((word)destination<(word)source) {
if((unsigned int)destination<(unsigned int)source) {
memcpy(destination, source, num);
} else {
// copy backwards
@ -37,7 +37,7 @@ void *memset(void *str, char c, size_t num) {
}
// Copies the C string pointed by source into the array pointed by destination, including the terminating null character (and stopping at that point).
char* strcpy( char* destination, byte* source ) {
char* strcpy( char* destination, char* source ) {
char* src = source;
char* dst = destination;
while(*src) *dst++ = *src++;

View File

@ -16,11 +16,11 @@ void testChar() {
signed char s = -14;
print_str("char: ");
print_byte(u);
print_u8(u);
print_char(' ');
print_byte(n);
print_u8(n);
print_char(' ');
print_sbyte(s);
print_s8(s);
print_ln();
}
@ -31,11 +31,11 @@ void testShort() {
signed short s = -1400;
print_str("short: ");
print_word(u);
print_uint(u);
print_char(' ');
print_sword(n);
print_sint(n);
print_char(' ');
print_sword(s);
print_sint(s);
print_ln();
}
@ -46,11 +46,11 @@ void testInt() {
signed int s = -1400;
print_str("int: ");
print_word(u);
print_uint(u);
print_char(' ');
print_sword(n);
print_sint(n);
print_char(' ');
print_sword(s);
print_sint(s);
print_ln();
}
@ -61,11 +61,11 @@ void testLong() {
signed long s = -140000;
print_str("long: ");
print_dword(u);
print_ulong(u);
print_char(' ');
print_sdword(n);
print_slong(n);
print_char(' ');
print_sdword(s);
print_slong(s);
print_ln();
}

View File

@ -15,6 +15,6 @@ void main() {
// Calculate the cycle count - 0x12 is the base usage of start/read
dword cyclecount = clock()-CLOCKS_PER_INIT;
// Print cycle count
print_dword_at(cyclecount, SCREEN);
print_ulong_at(cyclecount, SCREEN);
}
}

View File

@ -12,6 +12,6 @@ void main() {
clock_start();
// Continously print cycle count since timer start
while(true) {
print_dword_at(clock(), SCREEN);
print_ulong_at(clock(), SCREEN);
}
}

View File

@ -41,7 +41,7 @@ void main() {
screen_ref++;
}
}
print_word(diff_sum);
print_uint(diff_sum);
byte* col00 = COLS+12*40+19;
while(true) (*col00)++;
}

View File

@ -17,11 +17,11 @@ void main () {
}
void print_euclid(unsigned char a, unsigned char b) {
print_byte(a);
print_u8(a);
print_char(' ');
print_byte(b);
print_u8(b);
print_char(' ');
print_byte(euclid(a,b));
print_u8(euclid(a,b));
print_ln();
}

View File

@ -105,9 +105,9 @@ void debug_print_init() {
char* COLS = $d800;
char* at_cols = COLS+16*40;
for( char i: 0..7) {
print_sbyte_at(xs[i], at_line+40*0+c);
print_sbyte_at(ys[i], at_line+40*1+c);
print_sbyte_at(zs[i], at_line+40*2+c);
print_s8_at(xs[i], at_line+40*0+c);
print_s8_at(ys[i], at_line+40*1+c);
print_s8_at(zs[i], at_line+40*2+c);
for( char j: 0..3) {
char col = 8+i;
*(at_cols+40*0+c+j) = col;
@ -128,28 +128,28 @@ void debug_print_init() {
void debug_print() {
// angles
print_sbyte_pos(sx, 0, 37);
print_sbyte_pos(sy, 1, 37);
print_sbyte_pos(sz, 2, 37);
print_s8_pos(sx, 0, 37);
print_s8_pos(sy, 1, 37);
print_s8_pos(sz, 2, 37);
// rotation matrix
print_sbyte_pos(rotation_matrix[0], 4, 29);
print_sbyte_pos(rotation_matrix[1], 4, 33);
print_sbyte_pos(rotation_matrix[2], 4, 37);
print_sbyte_pos(rotation_matrix[3], 5, 29);
print_sbyte_pos(rotation_matrix[4], 5, 33);
print_sbyte_pos(rotation_matrix[5], 5, 37);
print_sbyte_pos(rotation_matrix[6], 6, 29);
print_sbyte_pos(rotation_matrix[7], 6, 33);
print_sbyte_pos(rotation_matrix[8], 6, 37);
print_s8_pos(rotation_matrix[0], 4, 29);
print_s8_pos(rotation_matrix[1], 4, 33);
print_s8_pos(rotation_matrix[2], 4, 37);
print_s8_pos(rotation_matrix[3], 5, 29);
print_s8_pos(rotation_matrix[4], 5, 33);
print_s8_pos(rotation_matrix[5], 5, 37);
print_s8_pos(rotation_matrix[6], 6, 29);
print_s8_pos(rotation_matrix[7], 6, 33);
print_s8_pos(rotation_matrix[8], 6, 37);
char* at_line = SCREEN+19*40;
char c = 4;
for( char i: 0..7) {
print_sbyte_at(xrs[i], at_line+40*0+c);
print_sbyte_at(yrs[i], at_line+40*1+c);
print_sbyte_at(zrs[i], at_line+40*2+c);
print_sbyte_at(pps[i], at_line+40*3+c);
print_sbyte_at(xps[i], at_line+40*4+c);
print_sbyte_at(yps[i], at_line+40*5+c);
print_s8_at(xrs[i], at_line+40*0+c);
print_s8_at(yrs[i], at_line+40*1+c);
print_s8_at(zrs[i], at_line+40*2+c);
print_s8_at(pps[i], at_line+40*3+c);
print_s8_at(xps[i], at_line+40*4+c);
print_s8_at(yps[i], at_line+40*5+c);
c += 4;
}
}

View File

@ -38,16 +38,16 @@ void main() {
void do_perspective(signed char x, signed char y, signed char z) {
print_str("(");
print_sbyte(x);
print_s8(x);
print_str(",");
print_sbyte(y);
print_s8(y);
print_str(",");
print_sbyte(z);
print_s8(z);
print_str(") -> (");
perspective(x, y, z);
print_byte((byte)*xr);
print_u8((byte)*xr);
print_str(",");
print_byte((byte)*yr);
print_u8((byte)*yr);
print_str(")");
print_ln();
}

View File

@ -15,17 +15,17 @@ void main() {
char* at_line = $400;
char* at = at_line+4;
for(char k: 0..8) {
print_sbyte_at(vals[k], at);
print_s8_at(vals[k], at);
at += 4;
}
for(char i: 0..8) {
at_line +=40;
at = at_line;
print_sbyte_at(vals[i], at);
print_s8_at(vals[i], at);
for(char j: 0..8) {
at += 4;
signed char r = fmul8(vals[i], vals[j]);
print_sbyte_at(r, at);
print_s8_at(r, at);
}
}
}

View File

@ -70,7 +70,7 @@ void anim() {
// Calculate the cycle count - 0x12 is the base usage of start/read
unsigned long cyclecount = clock()-CLOCKS_PER_INIT;
// Print cycle count
print_dword_at(cyclecount, SCREEN);
print_ulong_at(cyclecount, SCREEN);
*BORDERCOL = LIGHT_BLUE;
}
}

View File

@ -34,21 +34,21 @@ void main() {
void print_mulf8u127(unsigned char a, unsigned char b) {
unsigned word c = mulf8u127(a,b);
print_byte(a);
print_u8(a);
print_char('*');
print_byte(b);
print_u8(b);
print_char('=');
print_word(c);
print_uint(c);
print_ln();
}
void print_mulf8s127(signed char a, signed char b) {
signed word c = mulf8s127(a,b);
print_sbyte(a);
print_s8(a);
print_char('*');
print_sbyte(b);
print_s8(b);
print_char('=');
print_sword(c);
print_sint(c);
print_ln();
}

View File

@ -12,28 +12,28 @@ void main() {
lin16u_gen(0, $6488, lintab3, 20);
print_cls();
print_str(" ");
print_word(557);
print_uint(557);
print_str(" ");
print_word(31179);
print_uint(31179);
print_str(" ");
print_word(0);
print_uint(0);
print_ln();
for(byte i=0; i<20; i++) {
print_byte(i);
print_u8(i);
print_str(" ");
print_word(lintab1[i]);
print_uint(lintab1[i]);
print_str(" ");
print_word(lintab2[i]);
print_uint(lintab2[i]);
print_str(" ");
print_word(lintab3[i]);
print_uint(lintab3[i]);
print_ln();
}
print_str(" ");
print_word(29793);
print_uint(29793);
print_str(" ");
print_word(63361);
print_uint(63361);
print_str(" ");
print_word($6488);
print_uint($6488);
print_ln();
}

View File

@ -20,7 +20,7 @@ void end(void) {
start();
last_time -= Ticks;
Ticks = last_time;
print_word(Ticks);
print_uint(Ticks);
print_ln();
}

View File

@ -32,7 +32,7 @@ int main (void)
unsigned int i;
start();
for(i=0;i<6;i++) {
print_word_decimal(sum());
print_uint_decimal(sum());
print_ln();
}
end();

View File

@ -14,7 +14,7 @@ void main() {
(*BORDERCOL)++;
dword r = mulf16u(a, b);
(*BORDERCOL)--;
print_dword(r);
print_ulong(r);
print_set_screen(SCREEN);
}
}

View File

@ -44,7 +44,7 @@ void testWritethrough(char* name, char* address) {
print_str(name);
print_str(" ");
print_word((unsigned int)address);
print_uint((unsigned int)address);
print_str(" ");
if(ramValue==IO_VALUE)
print_str("yes");

View File

@ -70,20 +70,20 @@ void testProcport(char ddr, char port, char ddr2) {
*PROCPORT = port;
*PROCPORT_DDR = ddr2;
print_str(" ");
print_byte(ddr);
print_u8(ddr);
print_str(" ");
print_byte(port);
print_u8(port);
print_str(" ");
print_byte(ddr2);
print_u8(ddr2);
print_str(" ");
print_byte(*PROCPORT_DDR);
print_u8(*PROCPORT_DDR);
print_str(" ");
print_byte(*PROCPORT);
print_u8(*PROCPORT);
print_str(" ");
print_byte(*BASIC_ROM);
print_u8(*BASIC_ROM);
print_str(" ");
print_byte(*IO_RAM);
print_u8(*IO_RAM);
print_str(" ");
print_byte(*KERNAL_ROM);
print_u8(*KERNAL_ROM);
print_ln();
}

View File

@ -19,7 +19,7 @@ void main() {
clock_t cyclecount = clock()-CLOCKS_PER_INIT;
byte* BASE_SCREEN = 0x0400;
byte* BASE_CHARSET = 0x1000;
print_dword_at(cyclecount, BASE_SCREEN);
print_ulong_at(cyclecount, BASE_SCREEN);
*D018 = toD018(BASE_SCREEN, BASE_CHARSET);
}

View File

@ -20,7 +20,7 @@ void main() {
clock_t cyclecount = clock()-CLOCKS_PER_INIT;
byte* BASE_SCREEN = 0x0400;
byte* BASE_CHARSET = 0x1000;
print_dword_at(cyclecount, BASE_SCREEN);
print_ulong_at(cyclecount, BASE_SCREEN);
*D018 = toD018(BASE_SCREEN, BASE_CHARSET);
}

View File

@ -55,9 +55,9 @@ void print_points() {
print_cls();
for(byte i: 0..NUM_POINTS-1) {
byte* point = getPoint(i);
print_byte(*pointXpos(point));
print_u8(*pointXpos(point));
print_str(" ");
print_byte(*pointYpos(point));
print_u8(*pointYpos(point));
print_ln();
}
}

View File

@ -143,43 +143,43 @@ void initEntry(byte* entry, byte n) {
// Print the contents of a file entry
void printEntry(byte* entry) {
print_str("bufdisk ");
print_word((word)*entryBufDisk(entry));
print_uint((word)*entryBufDisk(entry));
print_ln();
print_str("bufedit ");
print_word((word)*entryBufEdit(entry));
print_uint((word)*entryBufEdit(entry));
print_ln();
print_str("tslen ");
print_word(*entryTsLen(entry));
print_uint(*entryTsLen(entry));
print_ln();
print_str("tsorder ");
print_word((word)*entryTsOrder(entry));
print_uint((word)*entryTsOrder(entry));
print_ln();
print_str("tlastlink ");
print_byte(*entryTLastLink(entry));
print_u8(*entryTLastLink(entry));
print_ln();
print_str("slastlink ");
print_byte(*entrySLastLink(entry));
print_u8(*entrySLastLink(entry));
print_ln();
print_str("bflag ");
print_byte(*entryBFlag(entry));
print_u8(*entryBFlag(entry));
print_ln();
print_str("berror ");
print_byte(*entryBError(entry));
print_u8(*entryBError(entry));
print_ln();
print_str("ucross ");
print_word(*entryUCross(entry));
print_uint(*entryUCross(entry));
print_ln();
print_str("baddrlo ");
print_byte(*entryBAddrLo(entry));
print_u8(*entryBAddrLo(entry));
print_ln();
print_str("baddrhi ");
print_byte(*entryBAddrHi(entry));
print_u8(*entryBAddrHi(entry));
print_ln();
print_str("thi ");
print_byte(*entryTHi(entry));
print_u8(*entryTHi(entry));
print_ln();
print_str("tlo ");
print_byte(*entryTLo(entry));
print_u8(*entryTLo(entry));
print_ln();
}

View File

@ -30,7 +30,7 @@ void main (void) {
}
for (i = 2; i < 0x04c7; ++i)
if (!sieve[i]) {
print_word(i);
print_uint(i);
print_char(' ');
}
while(true) { (*(SCREEN+999))++; }

View File

@ -19,7 +19,7 @@ void main (void) {
print_str("Sieve benchmark - calculating primes");
print_ln();
print_str("between 2 and ");
print_word_decimal(COUNT);
print_uint_decimal(COUNT);
print_ln();
// Fill sieve with zeros
@ -48,13 +48,13 @@ void main (void) {
unsigned int sec100s = (unsigned int)div32u16u(cyclecount, (unsigned int)(CLOCKS_PER_SEC/100));
print_str("100ths seconds used: ");
print_word_decimal(sec100s);
print_uint_decimal(sec100s);
print_str(" cycles: ");
print_dword_decimal(cyclecount);
print_ulong_decimal(cyclecount);
print_ln();
for (i = 2; i < 1300; ++i)
if (!sieve[i]) {
print_word_decimal(i);
print_uint_decimal(i);
print_char(' ');
}
print_str("...");

View File

@ -13,7 +13,7 @@ void main() {
}
print_cls();
for(byte j: 0..8) {
print_sword(words[j]);
print_sint(words[j]);
print_ln();
}

View File

@ -17,7 +17,7 @@ void main() {
sinFAC();
mulFACbyMEM(f_127);
addMEMtoFAC(f_127);
print_word(getFAC());
print_uint(getFAC());
print_ln();
}
}

View File

@ -12,7 +12,7 @@ void main() {
if(sw>=0) {
print_str(" ");
}
print_sword(sw);
print_sint(sw);
print_str(" ");
}
}

View File

@ -17,7 +17,7 @@ void main() {
if(sw>=0) {
print_str(" ");
}
print_sword(sw);
print_sint(sw);
print_str(" ");
st1++;
st2++;

View File

@ -24,7 +24,7 @@ void main() {
print_cls();
for(byte i: 0..191) {
signed byte sb = sintab2[i]-(signed byte)sintabref[i];
print_sbyte(sb);
print_s8(sb);
print_str(" ");
}
}

View File

@ -12,7 +12,7 @@ void main() {
signed byte sb = sintabb[i];
signed word sw = *(sintabw+(word)i);
signed byte sd = sb-(signed byte)>sw;
print_sbyte(sd);
print_s8(sd);
print_str(" ");
}
}

View File

@ -14,7 +14,7 @@ void main() {
if(sb>=0) {
print_str(" ");
}
print_sbyte(sb);
print_s8(sb);
print_str(" ");
}
*/
@ -33,15 +33,15 @@ void sin8u_table(byte* sintab, word tabsize, byte min, byte max) {
// u[4.28] step = PI*2/wavelength
word step = div16u(PI2_u4f12, tabsize); // u[4.12]
print_str("step:");
print_word(step);
print_uint(step);
print_str(" min:");
print_byte(min);
print_u8(min);
print_str(" max:");
print_byte(max);
print_u8(max);
print_str(" ampl:");
print_byte(amplitude);
print_u8(amplitude);
print_str(" mid:");
print_byte(mid);
print_u8(mid);
print_ln();
// Iterate over the table
word x = 0; // u[4.12]
@ -51,13 +51,13 @@ void sin8u_table(byte* sintab, word tabsize, byte min, byte max) {
byte sinx_tr = mid+>sinx_sc;
*sintab++ = sinx_tr;
print_str("x: ");
print_word(x);
print_uint(x);
print_str(" sin: ");
print_sbyte(sinx);
print_s8(sinx);
print_str(" scaled: ");
print_sword(sinx_sc);
print_sint(sinx_sc);
print_str(" trans: ");
print_byte(sinx_tr);
print_u8(sinx_tr);
print_ln();
x = x + step;
}

View File

@ -19,7 +19,7 @@ int main(void) {
file->bufEdit[3] = 0xAA; // writes address 0x0000 (wrong!)
((char *)file->bufEdit)[4] = 0xCC; // writes address 0x4004 (right!)
print_cls();
print_str("$0000="); print_byte(*(char *)0x0000); print_ln();
print_str("$4004="); print_byte(*(char *)0x4004); print_ln();
print_str("$0000="); print_u8(*(char *)0x0000); print_ln();
print_str("$4004="); print_u8(*(char *)0x4004); print_ln();
return 0;
}

View File

@ -14,5 +14,5 @@ void main(){
file->bufEdit = 4;
word* ptrw = (WORD *)(file->bufEdit + 30);
uSize = *ptrw;
print_word(uSize);
print_uint(uSize);
}

View File

@ -67,9 +67,9 @@ void compare(signed word w1, signed word w2, byte op) {
if(w1!=w2) r = TT;
ops = "!=";
}
print_sword(w1);
print_sint(w1);
print_str(ops);
print_sword(w2);
print_sint(w2);
print_char(r);
}

View File

@ -65,9 +65,9 @@ void compare(word w1, word w2, byte op) {
if(w1!=w2) r = TT;
ops = "!=";
}
print_word(w1);
print_uint(w1);
print_str(ops);
print_word(w2);
print_uint(w2);
print_char(r);
print_char(' ');
}

View File

@ -42,9 +42,9 @@ void main() {
void printu(byte a, byte* op, byte b, byte res) {
print_char(' ');
print_byte(a);
print_u8(a);
print_str(op);
print_byte(b);
print_u8(b);
print_char(' ');
print_char(res);
}

View File

@ -18,13 +18,13 @@ void test_8u() {
byte dividend = dividends[i];
byte divisor = divisors[i];
byte res = div8u(dividend, divisor);
print_byte(dividend);
print_u8(dividend);
print_str(" / ");
print_byte(divisor);
print_u8(divisor);
print_str(" = ");
print_byte(res);
print_u8(res);
print_str(" ");
print_byte(rem8u);
print_u8(rem8u);
print_ln();
}
}
@ -36,13 +36,13 @@ void test_16u() {
word dividend = dividends[i];
word divisor = divisors[i];
word res = div16u(dividend, divisor);
print_word(dividend);
print_uint(dividend);
print_str(" / ");
print_word(divisor);
print_uint(divisor);
print_str(" = ");
print_word(res);
print_uint(res);
print_str(" ");
print_word(rem16u);
print_uint(rem16u);
print_ln();
}
}
@ -54,13 +54,13 @@ void test_8s() {
signed byte dividend = dividends[i];
signed byte divisor = divisors[i];
signed byte res = div8s(dividend, divisor);
print_sbyte(dividend);
print_s8(dividend);
print_str(" / ");
print_sbyte(divisor);
print_s8(divisor);
print_str(" = ");
print_sbyte(res);
print_s8(res);
print_str(" ");
print_sbyte(rem8s);
print_s8(rem8s);
print_ln();
}
}
@ -72,13 +72,13 @@ void test_16s() {
signed word dividend = dividends[i];
signed word divisor = divisors[i];
signed word res = div16s(dividend, divisor);
print_sword(dividend);
print_sint(dividend);
print_str(" / ");
print_sword(divisor);
print_sint(divisor);
print_str(" = ");
print_sword(res);
print_sint(res);
print_str(" ");
print_sword(rem16s);
print_sint(rem16s);
print_ln();
}
}

View File

@ -6,19 +6,19 @@ void main() {
dword dw2 = dw;
>dw2 = (>dw) + $1111; // Test set/get high word of dword
<dw2 = (<dw) + $1111; // Test set/get low word of dword
print_dword(dw2);
print_ulong(dw2);
print_char(' ');
print_word(>dw2); // Test get high word of dword
print_uint(>dw2); // Test get high word of dword
print_char(' ');
print_word(<dw2); // Test get low word of dword
print_uint(<dw2); // Test get low word of dword
print_char(' ');
print_byte(> >dw2); // Test get high high byte of dword
print_u8(> >dw2); // Test get high high byte of dword
print_char(' ');
print_byte(< >dw2); // Test get low high byte of dword
print_u8(< >dw2); // Test get low high byte of dword
print_char(' ');
print_byte(> <dw2); // Test get high low byte of dword
print_u8(> <dw2); // Test get high low byte of dword
print_char(' ');
print_byte(< <dw2); // Test get low low byte of dword
print_u8(< <dw2); // Test get low low byte of dword
print_ln();
}
}

View File

@ -74,15 +74,15 @@ void mul16u_compare() {
void mul16u_error(word a, word b, dword ms, dword mn, dword mf) {
print_str("multiply mismatch ");
print_word(a);
print_uint(a);
print_str("*");
print_word(b);
print_uint(b);
print_str(" slow:");
print_dword(ms);
print_ulong(ms);
print_str(" / normal:");
print_dword(mn);
print_ulong(mn);
print_str(" / fast:");
print_dword(mf);
print_ulong(mf);
print_ln();
}
@ -119,14 +119,14 @@ void mul16s_compare() {
void mul16s_error(signed word a, signed word b, signed dword ms, signed dword mn, signed dword mf) {
print_str("signed word multiply mismatch ");
print_sword(a);
print_sint(a);
print_str("*");
print_sword(b);
print_sint(b);
print_str(" slow:");
print_sdword(ms);
print_slong(ms);
print_str(" / normal:");
print_sdword(mn);
print_slong(mn);
print_str(" / fast:");
print_sdword(mf);
print_slong(mf);
print_ln();
}

View File

@ -111,9 +111,9 @@ void mulf_tables_cmp() {
if(*kc_sqr != *asm_sqr) {
*BGCOL = 2;
print_str("multiply table mismatch at ");
print_word((word)asm_sqr);
print_uint((word)asm_sqr);
print_str(" / ");
print_word((word)kc_sqr);
print_uint((word)kc_sqr);
return;
}
asm_sqr++;
@ -149,15 +149,15 @@ void mul8u_compare() {
void mul8u_error(byte a, byte b, word ms, word mn, word mf) {
print_str("multiply mismatch ");
print_byte(a);
print_u8(a);
print_str("*");
print_byte(b);
print_u8(b);
print_str(" slow:");
print_word(ms);
print_uint(ms);
print_str(" / normal:");
print_word(mn);
print_uint(mn);
print_str(" / fast:");
print_word(mf);
print_uint(mf);
print_ln();
}
@ -188,15 +188,15 @@ void mul8s_compare() {
void mul8s_error(signed byte a, signed byte b, signed word ms, signed word mn, signed word mf) {
print_str("signed multiply mismatch ");
print_sbyte(a);
print_s8(a);
print_str("*");
print_sbyte(b);
print_s8(b);
print_str(" slow:");
print_sword(ms);
print_sint(ms);
print_str(" / normal:");
print_sword(mn);
print_sint(mn);
print_str(" / fast:");
print_sword(mf);
print_sint(mf);
print_ln();
}

View File

@ -9,9 +9,9 @@ void main() {
for( byte i: 0..10 ) {
signed word w2 = w1 - 91;
w1 = w2 - 41;
print_sword(w1);
print_sint(w1);
print_char(' ');
print_sword(w2);
print_sint(w2);
print_ln();
}

View File

@ -8,9 +8,9 @@ void main() {
for( byte i : 0..5 ) {
a += -7;
b += 321;
print_sword(a);
print_sint(a);
print_char(' ');
print_word(b);
print_uint(b);
print_ln();
}

View File

@ -326,7 +326,7 @@ init_screen: {
bitmap_clear: {
.label bitmap = 7
.label y = 6
// (byte*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// (char*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
lda bitmap_plot_xlo
sta.z bitmap
lda bitmap_plot_xhi
@ -345,11 +345,11 @@ bitmap_clear: {
bne !+
inc.z bitmap+1
!:
// for( byte x: 0..199 )
// for( char x: 0..199 )
inx
cpx #$c8
bne __b2
// for( byte y: 0..39 )
// for( char y: 0..39 )
inc.z y
lda #$28
cmp.z y
@ -384,7 +384,7 @@ bitmap_init: {
bne __b2
ldy #$80
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
inx
cpx #0
bne __b1
@ -419,7 +419,7 @@ bitmap_init: {
adc #>$28*8
sta.z yoffs+1
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
inx
cpx #0
bne __b3

View File

@ -5266,7 +5266,7 @@ init_screen: {
bitmap_clear: {
.label bitmap = 7
.label y = 6
// (byte*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// (char*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// [99] (word) bitmap_clear::bitmap#0 ← *((const to_nomodify byte*) bitmap_plot_xhi) w= *((const to_nomodify byte*) bitmap_plot_xlo) -- vwuz1=_deref_pbuc1_word__deref_pbuc2
lda bitmap_plot_xlo
sta.z bitmap
@ -5303,14 +5303,14 @@ bitmap_clear: {
bne !+
inc.z bitmap+1
!:
// for( byte x: 0..199 )
// for( char x: 0..199 )
// [105] (byte) bitmap_clear::x#1 ← ++ (byte) bitmap_clear::x#2 -- vbuxx=_inc_vbuxx
inx
// [106] if((byte) bitmap_clear::x#1!=(byte) $c8) goto bitmap_clear::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #$c8
bne __b2
// bitmap_clear::@3
// for( byte y: 0..39 )
// for( char y: 0..39 )
// [107] (byte) bitmap_clear::y#1 ← ++ (byte) bitmap_clear::y#4 -- vbuz1=_inc_vbuz1
inc.z y
// [108] if((byte) bitmap_clear::y#1!=(byte) $28) goto bitmap_clear::@1 -- vbuz1_neq_vbuc1_then_la1
@ -5370,7 +5370,7 @@ bitmap_init: {
// [119] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@6->bitmap_init::@2#0] -- register_copy
// bitmap_init::@2
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
// [120] (byte) bitmap_init::x#1 ← ++ (byte) bitmap_init::x#2 -- vbuxx=_inc_vbuxx
inx
// [121] if((byte) bitmap_init::x#1!=(byte) 0) goto bitmap_init::@1 -- vbuxx_neq_0_then_la1
@ -5426,7 +5426,7 @@ bitmap_init: {
// [131] phi (byte*) bitmap_init::yoffs#4 = (byte*) bitmap_init::yoffs#2 [phi:bitmap_init::@3/bitmap_init::@5->bitmap_init::@4#0] -- register_copy
// bitmap_init::@4
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
// [132] (byte) bitmap_init::y#1 ← ++ (byte) bitmap_init::y#2 -- vbuxx=_inc_vbuxx
inx
// [133] if((byte) bitmap_init::y#1!=(byte) 0) goto bitmap_init::@3 -- vbuxx_neq_0_then_la1

View File

@ -147,7 +147,7 @@ bitmap_line: {
lda #>y1
sta.z y+1
__b6:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
lda.z y
tax
jsr bitmap_plot
@ -200,7 +200,7 @@ bitmap_line: {
cmp #<y2
bne __b6
__b3:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
lda.z y
tax
jsr bitmap_plot
@ -223,7 +223,7 @@ bitmap_line: {
lda #>y1
sta.z y+1
__b9:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
lda.z y
tax
jsr bitmap_plot
@ -277,7 +277,7 @@ bitmap_line: {
bne __b9
jmp __b3
__b4:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
lda #<x1
sta.z bitmap_plot.x
lda #>x1
@ -292,7 +292,7 @@ bitmap_plot: {
.label __1 = $16
.label plotter = $14
.label x = $e
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
lda bitmap_plot_yhi,x
sta.z plotter+1
lda bitmap_plot_ylo,x
@ -462,7 +462,7 @@ bitmap_init: {
bne __b2
lda #$80
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
inx
cpx #0
bne __b1
@ -498,7 +498,7 @@ bitmap_init: {
adc #>$28*8
sta.z yoffs+1
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
inx
cpx #0
bne __b3

View File

@ -4709,7 +4709,7 @@ bitmap_line: {
// [36] phi (word) bitmap_line::y#4 = (word) bitmap_line::y#1 [phi:bitmap_line::@7->bitmap_line::@6#2] -- register_copy
// bitmap_line::@6
__b6:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
// [37] (byte) bitmap_plot::y#1 ← (byte)(word) bitmap_line::y#4 -- vbuxx=_byte_vwuz1
lda.z y
tax
@ -4784,7 +4784,7 @@ bitmap_line: {
// [47] phi (word) bitmap_line::y#7 = (word) bitmap_line::y#13 [phi:bitmap_line::@10/bitmap_line::@7->bitmap_line::@3#1] -- register_copy
// bitmap_line::@3
__b3:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
// [48] (byte) bitmap_plot::y#2 ← (byte)(word) bitmap_line::y#7 -- vbuxx=_byte_vwuz1
lda.z y
tax
@ -4826,7 +4826,7 @@ bitmap_line: {
// [53] phi (word) bitmap_line::y#15 = (word) bitmap_line::y#13 [phi:bitmap_line::@10->bitmap_line::@9#2] -- register_copy
// bitmap_line::@9
__b9:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
// [54] (byte) bitmap_plot::y#3 ← (byte)(word) bitmap_line::y#15 -- vbuxx=_byte_vwuz1
lda.z y
tax
@ -4900,7 +4900,7 @@ bitmap_line: {
// [64] phi from bitmap_line::@18 to bitmap_line::@4 [phi:bitmap_line::@18->bitmap_line::@4]
// bitmap_line::@4
__b4:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
// [65] call bitmap_plot
// [66] phi from bitmap_line::@4 to bitmap_plot [phi:bitmap_line::@4->bitmap_plot]
// [66] phi (word) bitmap_plot::x#4 = (const word) bitmap_line::x1#0 [phi:bitmap_line::@4->bitmap_plot#0] -- vwuz1=vwuc1
@ -4920,7 +4920,7 @@ bitmap_plot: {
.label __1 = $16
.label plotter = $14
.label x = $e
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// [67] (word) bitmap_plot::plotter#0 ← *((const to_nomodify byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#4) w= *((const to_nomodify byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#4) -- vwuz1=pbuc1_derefidx_vbuxx_word_pbuc2_derefidx_vbuxx
lda bitmap_plot_yhi,x
sta.z plotter+1
@ -5166,7 +5166,7 @@ bitmap_init: {
// [107] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@6->bitmap_init::@2#0] -- register_copy
// bitmap_init::@2
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
// [108] (byte) bitmap_init::x#1 ← ++ (byte) bitmap_init::x#2 -- vbuxx=_inc_vbuxx
inx
// [109] if((byte) bitmap_init::x#1!=(byte) 0) goto bitmap_init::@1 -- vbuxx_neq_0_then_la1
@ -5223,7 +5223,7 @@ bitmap_init: {
// [119] phi (byte*) bitmap_init::yoffs#4 = (byte*) bitmap_init::yoffs#2 [phi:bitmap_init::@3/bitmap_init::@5->bitmap_init::@4#0] -- register_copy
// bitmap_init::@4
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
// [120] (byte) bitmap_init::y#1 ← ++ (byte) bitmap_init::y#2 -- vbuxx=_inc_vbuxx
inx
// [121] if((byte) bitmap_init::y#1!=(byte) 0) goto bitmap_init::@3 -- vbuxx_neq_0_then_la1

View File

@ -135,7 +135,7 @@ bitmap_plot: {
.label __1 = $b
.label plotter = 9
.label x = 2
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
lda bitmap_plot_yhi,x
sta.z plotter+1
lda bitmap_plot_ylo,x
@ -293,7 +293,7 @@ bitmap_init: {
bne __b2
lda #$80
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
inx
cpx #0
bne __b1
@ -329,7 +329,7 @@ bitmap_init: {
adc #>$28*8
sta.z yoffs+1
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
inx
cpx #0
bne __b3

View File

@ -3351,7 +3351,7 @@ bitmap_plot: {
.label __1 = $b
.label plotter = 9
.label x = 2
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// [28] (word) bitmap_plot::plotter#0 ← *((const to_nomodify byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#0) w= *((const to_nomodify byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#0) -- vwuz1=pbuc1_derefidx_vbuxx_word_pbuc2_derefidx_vbuxx
lda bitmap_plot_yhi,x
sta.z plotter+1
@ -3575,7 +3575,7 @@ bitmap_init: {
// [64] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@6->bitmap_init::@2#0] -- register_copy
// bitmap_init::@2
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
// [65] (byte) bitmap_init::x#1 ← ++ (byte) bitmap_init::x#2 -- vbuxx=_inc_vbuxx
inx
// [66] if((byte) bitmap_init::x#1!=(byte) 0) goto bitmap_init::@1 -- vbuxx_neq_0_then_la1
@ -3632,7 +3632,7 @@ bitmap_init: {
// [76] phi (byte*) bitmap_init::yoffs#4 = (byte*) bitmap_init::yoffs#2 [phi:bitmap_init::@3/bitmap_init::@5->bitmap_init::@4#0] -- register_copy
// bitmap_init::@4
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
// [77] (byte) bitmap_init::y#1 ← ++ (byte) bitmap_init::y#2 -- vbuxx=_inc_vbuxx
inx
// [78] if((byte) bitmap_init::y#1!=(byte) 0) goto bitmap_init::@3 -- vbuxx_neq_0_then_la1

View File

@ -248,7 +248,7 @@ bitmap_plot: {
.label __1 = $1d
.label plotter = $1b
.label x = $17
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
lda bitmap_plot_yhi,x
sta.z plotter+1
lda bitmap_plot_ylo,x
@ -278,7 +278,7 @@ bitmap_plot: {
// }
rts
}
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
// mul16s(signed word zp($1b) a, signed word zp(6) b)
mul16s: {
@ -290,7 +290,7 @@ mul16s: {
.label return = 8
.label a = $1b
.label b = 6
// mul16u((word)a, (word) b)
// mul16u((unsigned int)a, (unsigned int) b)
lda.z a
sta.z mul16u.a
lda.z a+1
@ -300,8 +300,8 @@ mul16s: {
lda.z b+1
sta.z mul16u.b+1
jsr mul16u
// mul16u((word)a, (word) b)
// m = mul16u((word)a, (word) b)
// mul16u((unsigned int)a, (unsigned int) b)
// m = mul16u((unsigned int)a, (unsigned int) b)
// if(a<0)
lda.z a+1
bpl __b1
@ -310,7 +310,7 @@ mul16s: {
sta.z __9
lda.z m+3
sta.z __9+1
// >m = (>m)-(word)b
// >m = (>m)-(unsigned int)b
lda.z __16
sec
sbc.z b
@ -331,7 +331,7 @@ mul16s: {
sta.z __13
lda.z m+3
sta.z __13+1
// >m = (>m)-(word)a
// >m = (>m)-(unsigned int)a
lda.z __13
sec
sbc.z __17
@ -344,11 +344,11 @@ mul16s: {
lda.z __17+1
sta.z m+3
__b2:
// (signed dword)m
// (signed long)m
// }
rts
}
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
// mul16u(word zp($24) a, word zp($1d) b)
mul16u: {
.label mb = $10
@ -538,7 +538,7 @@ bitmap_init: {
bne __b2
lda #$80
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
inx
cpx #0
bne __b1
@ -574,14 +574,14 @@ bitmap_init: {
adc #>$28*8
sta.z yoffs+1
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
inx
cpx #0
bne __b3
// }
rts
}
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
// sin16s_gen2(signed word* zp($19) sintab)
@ -618,7 +618,7 @@ sin16s_gen2: {
sta.z i+1
// u[4.28]
__b1:
// for( word i=0; i<wavelength; i++)
// for( unsigned int i=0; i<wavelength; i++)
lda.z i+1
cmp #>wavelength
bcc __b2
@ -652,14 +652,14 @@ sin16s_gen2: {
sta.z __9
lda.z __6+3
sta.z __9+1
// *sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl)
// *sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl)
ldy #0
lda.z __9
sta (sintab),y
iny
lda.z __9+1
sta (sintab),y
// *sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl);
// *sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl);
lda #SIZEOF_SIGNED_WORD
clc
adc.z sintab
@ -681,16 +681,16 @@ sin16s_gen2: {
lda.z x+3
adc.z step+3
sta.z x+3
// for( word i=0; i<wavelength; i++)
// for( unsigned int i=0; i<wavelength; i++)
inc.z i
bne !+
inc.z i+1
!:
jmp __b1
}
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
// sin16s(dword zp($10) x)
sin16s: {
.label __4 = $26
@ -888,7 +888,7 @@ sin16s: {
// if(isUpper!=0)
cpy #0
beq __b3
// sinx = -(signed word)usinx
// sinx = -(signed int)usinx
sec
lda #0
sbc.z sinx
@ -900,7 +900,7 @@ sin16s: {
// }
rts
}
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
// mulu16_sel(word zp($14) v1, word zp($1d) v2, byte register(X) select)
mulu16_sel: {
@ -936,8 +936,8 @@ mulu16_sel: {
// }
rts
}
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
div32u16u: {
.label quotient_hi = $2c
.label quotient_lo = $1d
@ -977,7 +977,7 @@ div32u16u: {
// }
rts
}
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
@ -1036,7 +1036,7 @@ divr16u: {
sbc #>sin16s_gen2.wavelength
sta.z rem+1
__b3:
// for( byte i : 0..15)
// for( char i : 0..15)
inx
cpx #$10
bne __b1

View File

@ -4242,7 +4242,7 @@ bitmap_plot: {
rts
}
// mul16s
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
// mul16s(signed word zp(6) a, signed word zp(8) b)
mul16s: {
@ -4372,7 +4372,7 @@ mul16s: {
rts
}
// mul16u
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
// mul16u(word zp($10) a, word zp($e) b)
mul16u: {
.label __1 = $88
@ -4756,7 +4756,7 @@ bitmap_init: {
rts
}
// sin16s_gen2
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
// sin16s_gen2(signed word* zp($2c) sintab)
@ -4941,9 +4941,9 @@ sin16s_gen2: {
jmp __b1
}
// sin16s
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
// sin16s(dword zp($2f) x)
sin16s: {
.label __4 = $a3
@ -5304,7 +5304,7 @@ sin16s: {
jmp __b3_from___b12
}
// mulu16_sel
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
// mulu16_sel(word zp($35) v1, word zp($37) v2, byte zp($39) select)
mulu16_sel: {
@ -5387,8 +5387,8 @@ mulu16_sel: {
rts
}
// div32u16u
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
div32u16u: {
.label quotient_hi = $d3
.label quotient_lo = $d7
@ -5465,7 +5465,7 @@ div32u16u: {
rts
}
// divr16u
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
@ -6525,7 +6525,7 @@ bitmap_plot: {
rts
}
// mul16s
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
// mul16s(signed word zp($1b) a, signed word zp(6) b)
mul16s: {
@ -6628,7 +6628,7 @@ mul16s: {
rts
}
// mul16u
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
// mul16u(word zp($24) a, word zp($1d) b)
mul16u: {
.label mb = $10
@ -6977,7 +6977,7 @@ bitmap_init: {
rts
}
// sin16s_gen2
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
// sin16s_gen2(signed word* zp($19) sintab)
@ -7122,9 +7122,9 @@ sin16s_gen2: {
jmp __b1
}
// sin16s
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
// sin16s(dword zp($10) x)
sin16s: {
.label __4 = $26
@ -7421,7 +7421,7 @@ sin16s: {
jmp __b3_from___b12
}
// mulu16_sel
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
// mulu16_sel(word zp($14) v1, word zp($1d) v2, byte register(X) select)
mulu16_sel: {
@ -7471,8 +7471,8 @@ mulu16_sel: {
rts
}
// div32u16u
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
div32u16u: {
.label quotient_hi = $2c
.label quotient_lo = $1d
@ -7532,7 +7532,7 @@ div32u16u: {
rts
}
// divr16u
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
@ -8680,7 +8680,7 @@ bitmap_plot: {
.label __1 = $1d
.label plotter = $1b
.label x = $17
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// [48] (word) bitmap_plot::plotter#0 ← *((const to_nomodify byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#0) w= *((const to_nomodify byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#0) -- vwuz1=pbuc1_derefidx_vbuxx_word_pbuc2_derefidx_vbuxx
lda bitmap_plot_yhi,x
sta.z plotter+1
@ -8718,7 +8718,7 @@ bitmap_plot: {
rts
}
// mul16s
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
// mul16s(signed word zp($1b) a, signed word zp(6) b)
mul16s: {
@ -8730,7 +8730,7 @@ mul16s: {
.label return = 8
.label a = $1b
.label b = 6
// mul16u((word)a, (word) b)
// mul16u((unsigned int)a, (unsigned int) b)
// [55] (word) mul16u::a#1 ← (word)(signed word) mul16s::a#3 -- vwuz1=vwuz2
lda.z a
sta.z mul16u.a
@ -8746,10 +8746,10 @@ mul16s: {
// [72] phi (word) mul16u::a#6 = (word) mul16u::a#1 [phi:mul16s->mul16u#0] -- register_copy
// [72] phi (word) mul16u::b#2 = (word) mul16u::b#0 [phi:mul16s->mul16u#1] -- register_copy
jsr mul16u
// mul16u((word)a, (word) b)
// mul16u((unsigned int)a, (unsigned int) b)
// [58] (dword) mul16u::return#2 ← (dword) mul16u::res#2
// mul16s::@5
// m = mul16u((word)a, (word) b)
// m = mul16u((unsigned int)a, (unsigned int) b)
// [59] (dword) mul16s::m#0 ← (dword) mul16u::return#2
// if(a<0)
// [60] if((signed word) mul16s::a#3>=(signed byte) 0) goto mul16s::@1 -- vwsz1_ge_0_then_la1
@ -8762,7 +8762,7 @@ mul16s: {
sta.z __9
lda.z m+3
sta.z __9+1
// >m = (>m)-(word)b
// >m = (>m)-(unsigned int)b
// [62] (word~) mul16s::$16 ← (word~) mul16s::$9 - (word)(signed word) mul16s::b#3 -- vwuz1=vwuz1_minus_vwuz2
lda.z __16
sec
@ -8791,7 +8791,7 @@ mul16s: {
sta.z __13
lda.z m+3
sta.z __13+1
// >m = (>m)-(word)a
// >m = (>m)-(unsigned int)a
// [67] (word~) mul16s::$17 ← (word~) mul16s::$13 - (word)(signed word) mul16s::a#3 -- vwuz1=vwuz2_minus_vwuz1
lda.z __13
sec
@ -8809,7 +8809,7 @@ mul16s: {
// [69] phi (dword) mul16s::m#4 = (dword) mul16s::m#5 [phi:mul16s::@1/mul16s::@4->mul16s::@2#0] -- register_copy
// mul16s::@2
__b2:
// (signed dword)m
// (signed long)m
// [70] (signed dword) mul16s::return#0 ← (signed dword)(dword) mul16s::m#4
// mul16s::@return
// }
@ -8817,7 +8817,7 @@ mul16s: {
rts
}
// mul16u
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
// mul16u(word zp($24) a, word zp($1d) b)
mul16u: {
.label mb = $10
@ -9089,7 +9089,7 @@ bitmap_init: {
// [113] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@6->bitmap_init::@2#0] -- register_copy
// bitmap_init::@2
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
// [114] (byte) bitmap_init::x#1 ← ++ (byte) bitmap_init::x#2 -- vbuxx=_inc_vbuxx
inx
// [115] if((byte) bitmap_init::x#1!=(byte) 0) goto bitmap_init::@1 -- vbuxx_neq_0_then_la1
@ -9146,7 +9146,7 @@ bitmap_init: {
// [125] phi (byte*) bitmap_init::yoffs#4 = (byte*) bitmap_init::yoffs#2 [phi:bitmap_init::@3/bitmap_init::@5->bitmap_init::@4#0] -- register_copy
// bitmap_init::@4
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
// [126] (byte) bitmap_init::y#1 ← ++ (byte) bitmap_init::y#2 -- vbuxx=_inc_vbuxx
inx
// [127] if((byte) bitmap_init::y#1!=(byte) 0) goto bitmap_init::@3 -- vbuxx_neq_0_then_la1
@ -9158,7 +9158,7 @@ bitmap_init: {
rts
}
// sin16s_gen2
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
// sin16s_gen2(signed word* zp($19) sintab)
@ -9205,7 +9205,7 @@ sin16s_gen2: {
// u[4.28]
// sin16s_gen2::@1
__b1:
// for( word i=0; i<wavelength; i++)
// for( unsigned int i=0; i<wavelength; i++)
// [134] if((word) sin16s_gen2::i#2<(const word) sin16s_gen2::wavelength#0) goto sin16s_gen2::@2 -- vwuz1_lt_vwuc1_then_la1
lda.z i+1
cmp #>wavelength
@ -9256,7 +9256,7 @@ sin16s_gen2: {
sta.z __9
lda.z __6+3
sta.z __9+1
// *sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl)
// *sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl)
// [144] *((signed word*) sin16s_gen2::sintab#2) ← (signed word)(word~) sin16s_gen2::$9 -- _deref_pwsz1=vwsz2
ldy #0
lda.z __9
@ -9264,7 +9264,7 @@ sin16s_gen2: {
iny
lda.z __9+1
sta (sintab),y
// *sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl);
// *sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl);
// [145] (signed word*) sin16s_gen2::sintab#0 ← (signed word*) sin16s_gen2::sintab#2 + (const byte) SIZEOF_SIGNED_WORD -- pwsz1=pwsz1_plus_vbuc1
lda #SIZEOF_SIGNED_WORD
clc
@ -9288,7 +9288,7 @@ sin16s_gen2: {
lda.z x+3
adc.z step+3
sta.z x+3
// for( word i=0; i<wavelength; i++)
// for( unsigned int i=0; i<wavelength; i++)
// [147] (word) sin16s_gen2::i#1 ← ++ (word) sin16s_gen2::i#2 -- vwuz1=_inc_vwuz1
inc.z i
bne !+
@ -9301,9 +9301,9 @@ sin16s_gen2: {
jmp __b1
}
// sin16s
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
// sin16s(dword zp($10) x)
sin16s: {
.label __4 = $26
@ -9573,7 +9573,7 @@ sin16s: {
cpy #0
beq __b3
// sin16s::@6
// sinx = -(signed word)usinx
// sinx = -(signed int)usinx
// [184] (signed word) sin16s::sinx#1 ← - (signed word)(word) sin16s::usinx#1 -- vwsz1=_neg_vwsz1
sec
lda #0
@ -9594,7 +9594,7 @@ sin16s: {
// [187] (signed word) sin16s::return#5 ← (signed word)(word) sin16s::usinx#1
}
// mulu16_sel
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
// mulu16_sel(word zp($14) v1, word zp($1d) v2, byte register(X) select)
mulu16_sel: {
@ -9644,8 +9644,8 @@ mulu16_sel: {
rts
}
// div32u16u
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
div32u16u: {
.label quotient_hi = $2c
.label quotient_lo = $1d
@ -9704,7 +9704,7 @@ div32u16u: {
rts
}
// divr16u
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
@ -9793,7 +9793,7 @@ divr16u: {
// [220] phi (word) divr16u::rem#11 = (word) divr16u::rem#6 [phi:divr16u::@2/divr16u::@5->divr16u::@3#1] -- register_copy
// divr16u::@3
__b3:
// for( byte i : 0..15)
// for( char i : 0..15)
// [221] (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2 -- vbuxx=_inc_vbuxx
inx
// [222] if((byte) divr16u::i#1!=(byte) $10) goto divr16u::@1 -- vbuxx_neq_vbuc1_then_la1

View File

@ -285,7 +285,7 @@ bitmap_plot: {
.label __1 = $2b
.label plotter = $25
.label x = $1c
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
lda bitmap_plot_yhi,x
sta.z plotter+1
lda bitmap_plot_ylo,x
@ -315,7 +315,7 @@ bitmap_plot: {
// }
rts
}
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
// mul16s(signed word zp(4) a, signed word zp(9) b)
mul16s: {
@ -327,7 +327,7 @@ mul16s: {
.label return = $b
.label a = 4
.label b = 9
// mul16u((word)a, (word) b)
// mul16u((unsigned int)a, (unsigned int) b)
lda.z a
sta.z mul16u.a
lda.z a+1
@ -337,8 +337,8 @@ mul16s: {
lda.z b+1
sta.z mul16u.b+1
jsr mul16u
// mul16u((word)a, (word) b)
// m = mul16u((word)a, (word) b)
// mul16u((unsigned int)a, (unsigned int) b)
// m = mul16u((unsigned int)a, (unsigned int) b)
// if(a<0)
lda.z a+1
bpl __b1
@ -347,7 +347,7 @@ mul16s: {
sta.z __9
lda.z m+3
sta.z __9+1
// >m = (>m)-(word)b
// >m = (>m)-(unsigned int)b
lda.z __16
sec
sbc.z b
@ -368,7 +368,7 @@ mul16s: {
sta.z __13
lda.z m+3
sta.z __13+1
// >m = (>m)-(word)a
// >m = (>m)-(unsigned int)a
lda.z __17
sec
sbc.z a
@ -381,11 +381,11 @@ mul16s: {
lda.z __17+1
sta.z m+3
__b2:
// (signed dword)m
// (signed long)m
// }
rts
}
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
// mul16u(word zp($25) a, word zp($1e) b)
mul16u: {
.label mb = $15
@ -575,7 +575,7 @@ bitmap_init: {
bne __b2
lda #$80
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
inx
cpx #0
bne __b1
@ -611,14 +611,14 @@ bitmap_init: {
adc #>$28*8
sta.z yoffs+1
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
inx
cpx #0
bne __b3
// }
rts
}
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
// sin16s_gen2(signed word* zp($1c) sintab)
@ -655,7 +655,7 @@ sin16s_gen2: {
sta.z i+1
// u[4.28]
__b1:
// for( word i=0; i<wavelength; i++)
// for( unsigned int i=0; i<wavelength; i++)
lda.z i+1
cmp #>wavelength
bcc __b2
@ -689,14 +689,14 @@ sin16s_gen2: {
sta.z __9
lda.z __6+3
sta.z __9+1
// *sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl)
// *sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl)
ldy #0
lda.z __9
sta (sintab),y
iny
lda.z __9+1
sta (sintab),y
// *sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl);
// *sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl);
lda #SIZEOF_SIGNED_WORD
clc
adc.z sintab
@ -718,16 +718,16 @@ sin16s_gen2: {
lda.z x+3
adc.z step+3
sta.z x+3
// for( word i=0; i<wavelength; i++)
// for( unsigned int i=0; i<wavelength; i++)
inc.z i
bne !+
inc.z i+1
!:
jmp __b1
}
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
// sin16s(dword zp($15) x)
sin16s: {
.label __4 = $27
@ -925,7 +925,7 @@ sin16s: {
// if(isUpper!=0)
cpy #0
beq __b3
// sinx = -(signed word)usinx
// sinx = -(signed int)usinx
sec
lda #0
sbc.z sinx
@ -937,7 +937,7 @@ sin16s: {
// }
rts
}
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
// mulu16_sel(word zp($19) v1, word zp($1e) v2, byte register(X) select)
mulu16_sel: {
@ -973,8 +973,8 @@ mulu16_sel: {
// }
rts
}
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
div32u16u: {
.label quotient_hi = $2d
.label quotient_lo = $25
@ -1014,7 +1014,7 @@ div32u16u: {
// }
rts
}
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
@ -1073,7 +1073,7 @@ divr16u: {
sbc #>sin16s_gen2.wavelength
sta.z rem+1
__b3:
// for( byte i : 0..15)
// for( char i : 0..15)
inx
cpx #$10
bne __b1

View File

@ -4507,7 +4507,7 @@ bitmap_plot: {
rts
}
// mul16s
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
// mul16s(signed word zp(9) a, signed word zp($b) b)
mul16s: {
@ -4637,7 +4637,7 @@ mul16s: {
rts
}
// mul16u
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
// mul16u(word zp($13) a, word zp($11) b)
mul16u: {
.label __1 = $87
@ -5021,7 +5021,7 @@ bitmap_init: {
rts
}
// sin16s_gen2
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
// sin16s_gen2(signed word* zp($2f) sintab)
@ -5206,9 +5206,9 @@ sin16s_gen2: {
jmp __b1
}
// sin16s
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
// sin16s(dword zp($32) x)
sin16s: {
.label __4 = $a2
@ -5569,7 +5569,7 @@ sin16s: {
jmp __b3_from___b12
}
// mulu16_sel
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
// mulu16_sel(word zp($38) v1, word zp($3a) v2, byte zp($3c) select)
mulu16_sel: {
@ -5652,8 +5652,8 @@ mulu16_sel: {
rts
}
// div32u16u
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
div32u16u: {
.label quotient_hi = $d2
.label quotient_lo = $d6
@ -5730,7 +5730,7 @@ div32u16u: {
rts
}
// divr16u
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
@ -6877,7 +6877,7 @@ bitmap_plot: {
rts
}
// mul16s
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
// mul16s(signed word zp(4) a, signed word zp(9) b)
mul16s: {
@ -6980,7 +6980,7 @@ mul16s: {
rts
}
// mul16u
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
// mul16u(word zp($25) a, word zp($1e) b)
mul16u: {
.label mb = $15
@ -7329,7 +7329,7 @@ bitmap_init: {
rts
}
// sin16s_gen2
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
// sin16s_gen2(signed word* zp($1c) sintab)
@ -7474,9 +7474,9 @@ sin16s_gen2: {
jmp __b1
}
// sin16s
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
// sin16s(dword zp($15) x)
sin16s: {
.label __4 = $27
@ -7773,7 +7773,7 @@ sin16s: {
jmp __b3_from___b12
}
// mulu16_sel
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
// mulu16_sel(word zp($19) v1, word zp($1e) v2, byte register(X) select)
mulu16_sel: {
@ -7823,8 +7823,8 @@ mulu16_sel: {
rts
}
// div32u16u
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
div32u16u: {
.label quotient_hi = $2d
.label quotient_lo = $25
@ -7884,7 +7884,7 @@ div32u16u: {
rts
}
// divr16u
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
@ -9119,7 +9119,7 @@ bitmap_plot: {
.label __1 = $2b
.label plotter = $25
.label x = $1c
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// [57] (word) bitmap_plot::plotter#0 ← *((const to_nomodify byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#0) w= *((const to_nomodify byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#0) -- vwuz1=pbuc1_derefidx_vbuxx_word_pbuc2_derefidx_vbuxx
lda bitmap_plot_yhi,x
sta.z plotter+1
@ -9157,7 +9157,7 @@ bitmap_plot: {
rts
}
// mul16s
// Multiply of two signed words to a signed double word
// Multiply of two signed ints to a signed long
// Fixes offsets introduced by using unsigned multiplication
// mul16s(signed word zp(4) a, signed word zp(9) b)
mul16s: {
@ -9169,7 +9169,7 @@ mul16s: {
.label return = $b
.label a = 4
.label b = 9
// mul16u((word)a, (word) b)
// mul16u((unsigned int)a, (unsigned int) b)
// [64] (word) mul16u::a#1 ← (word)(signed word) mul16s::a#3 -- vwuz1=vwuz2
lda.z a
sta.z mul16u.a
@ -9185,10 +9185,10 @@ mul16s: {
// [81] phi (word) mul16u::a#6 = (word) mul16u::a#1 [phi:mul16s->mul16u#0] -- register_copy
// [81] phi (word) mul16u::b#2 = (word) mul16u::b#0 [phi:mul16s->mul16u#1] -- register_copy
jsr mul16u
// mul16u((word)a, (word) b)
// mul16u((unsigned int)a, (unsigned int) b)
// [67] (dword) mul16u::return#2 ← (dword) mul16u::res#2
// mul16s::@5
// m = mul16u((word)a, (word) b)
// m = mul16u((unsigned int)a, (unsigned int) b)
// [68] (dword) mul16s::m#0 ← (dword) mul16u::return#2
// if(a<0)
// [69] if((signed word) mul16s::a#3>=(signed byte) 0) goto mul16s::@1 -- vwsz1_ge_0_then_la1
@ -9201,7 +9201,7 @@ mul16s: {
sta.z __9
lda.z m+3
sta.z __9+1
// >m = (>m)-(word)b
// >m = (>m)-(unsigned int)b
// [71] (word~) mul16s::$16 ← (word~) mul16s::$9 - (word)(signed word) mul16s::b#3 -- vwuz1=vwuz1_minus_vwuz2
lda.z __16
sec
@ -9230,7 +9230,7 @@ mul16s: {
sta.z __13
lda.z m+3
sta.z __13+1
// >m = (>m)-(word)a
// >m = (>m)-(unsigned int)a
// [76] (word~) mul16s::$17 ← (word~) mul16s::$13 - (word)(signed word) mul16s::a#3 -- vwuz1=vwuz1_minus_vwuz2
lda.z __17
sec
@ -9248,7 +9248,7 @@ mul16s: {
// [78] phi (dword) mul16s::m#4 = (dword) mul16s::m#5 [phi:mul16s::@1/mul16s::@4->mul16s::@2#0] -- register_copy
// mul16s::@2
__b2:
// (signed dword)m
// (signed long)m
// [79] (signed dword) mul16s::return#0 ← (signed dword)(dword) mul16s::m#4
// mul16s::@return
// }
@ -9256,7 +9256,7 @@ mul16s: {
rts
}
// mul16u
// Perform binary multiplication of two unsigned 16-bit words into a 32-bit unsigned double word
// Perform binary multiplication of two unsigned 16-bit unsigned ints into a 32-bit unsigned long
// mul16u(word zp($25) a, word zp($1e) b)
mul16u: {
.label mb = $15
@ -9528,7 +9528,7 @@ bitmap_init: {
// [122] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@6->bitmap_init::@2#0] -- register_copy
// bitmap_init::@2
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
// [123] (byte) bitmap_init::x#1 ← ++ (byte) bitmap_init::x#2 -- vbuxx=_inc_vbuxx
inx
// [124] if((byte) bitmap_init::x#1!=(byte) 0) goto bitmap_init::@1 -- vbuxx_neq_0_then_la1
@ -9585,7 +9585,7 @@ bitmap_init: {
// [134] phi (byte*) bitmap_init::yoffs#4 = (byte*) bitmap_init::yoffs#2 [phi:bitmap_init::@3/bitmap_init::@5->bitmap_init::@4#0] -- register_copy
// bitmap_init::@4
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
// [135] (byte) bitmap_init::y#1 ← ++ (byte) bitmap_init::y#2 -- vbuxx=_inc_vbuxx
inx
// [136] if((byte) bitmap_init::y#1!=(byte) 0) goto bitmap_init::@3 -- vbuxx_neq_0_then_la1
@ -9597,7 +9597,7 @@ bitmap_init: {
rts
}
// sin16s_gen2
// Generate signed word sinus table - with values in the range min-max.
// Generate signed int sinus table - with values in the range min-max.
// sintab - the table to generate into
// wavelength - the number of sinus points in a total sinus wavelength (the size of the table)
// sin16s_gen2(signed word* zp($1c) sintab)
@ -9644,7 +9644,7 @@ sin16s_gen2: {
// u[4.28]
// sin16s_gen2::@1
__b1:
// for( word i=0; i<wavelength; i++)
// for( unsigned int i=0; i<wavelength; i++)
// [143] if((word) sin16s_gen2::i#2<(const word) sin16s_gen2::wavelength#0) goto sin16s_gen2::@2 -- vwuz1_lt_vwuc1_then_la1
lda.z i+1
cmp #>wavelength
@ -9695,7 +9695,7 @@ sin16s_gen2: {
sta.z __9
lda.z __6+3
sta.z __9+1
// *sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl)
// *sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl)
// [153] *((signed word*) sin16s_gen2::sintab#2) ← (signed word)(word~) sin16s_gen2::$9 -- _deref_pwsz1=vwsz2
ldy #0
lda.z __9
@ -9703,7 +9703,7 @@ sin16s_gen2: {
iny
lda.z __9+1
sta (sintab),y
// *sintab++ = offs + (signed word)>mul16s(sin16s(x), ampl);
// *sintab++ = offs + (signed int)>mul16s(sin16s(x), ampl);
// [154] (signed word*) sin16s_gen2::sintab#0 ← (signed word*) sin16s_gen2::sintab#2 + (const byte) SIZEOF_SIGNED_WORD -- pwsz1=pwsz1_plus_vbuc1
lda #SIZEOF_SIGNED_WORD
clc
@ -9727,7 +9727,7 @@ sin16s_gen2: {
lda.z x+3
adc.z step+3
sta.z x+3
// for( word i=0; i<wavelength; i++)
// for( unsigned int i=0; i<wavelength; i++)
// [156] (word) sin16s_gen2::i#1 ← ++ (word) sin16s_gen2::i#2 -- vwuz1=_inc_vwuz1
inc.z i
bne !+
@ -9740,9 +9740,9 @@ sin16s_gen2: {
jmp __b1
}
// sin16s
// Calculate signed word sinus sin(x)
// x: unsigned dword input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed word sin(x) s[0.15] - using the full range -$7fff - $7fff
// Calculate signed int sinus sin(x)
// x: unsigned long input u[4.28] in the interval $00000000 - PI2_u4f28
// result: signed int sin(x) s[0.15] - using the full range -$7fff - $7fff
// sin16s(dword zp($15) x)
sin16s: {
.label __4 = $27
@ -10012,7 +10012,7 @@ sin16s: {
cpy #0
beq __b3
// sin16s::@6
// sinx = -(signed word)usinx
// sinx = -(signed int)usinx
// [193] (signed word) sin16s::sinx#1 ← - (signed word)(word) sin16s::usinx#1 -- vwsz1=_neg_vwsz1
sec
lda #0
@ -10033,7 +10033,7 @@ sin16s: {
// [196] (signed word) sin16s::return#5 ← (signed word)(word) sin16s::usinx#1
}
// mulu16_sel
// Calculate val*val for two unsigned word values - the result is 16 selected bits of the 32-bit result.
// Calculate val*val for two unsigned int values - the result is 16 selected bits of the 32-bit result.
// The select parameter indicates how many of the highest bits of the 32-bit result to skip
// mulu16_sel(word zp($19) v1, word zp($1e) v2, byte register(X) select)
mulu16_sel: {
@ -10083,8 +10083,8 @@ mulu16_sel: {
rts
}
// div32u16u
// Divide unsigned 32-bit dword dividend with a 16-bit word divisor
// The 16-bit word remainder can be found in rem16u after the division
// Divide unsigned 32-bit unsigned long dividend with a 16-bit unsigned int divisor
// The 16-bit unsigned int remainder can be found in rem16u after the division
div32u16u: {
.label quotient_hi = $2d
.label quotient_lo = $25
@ -10143,7 +10143,7 @@ div32u16u: {
rts
}
// divr16u
// Performs division on two 16 bit unsigned words and an initial remainder
// Performs division on two 16 bit unsigned ints and an initial remainder
// Returns the quotient dividend/divisor.
// The final remainder will be set into the global variable rem16u
// Implemented using simple binary division
@ -10232,7 +10232,7 @@ divr16u: {
// [229] phi (word) divr16u::rem#11 = (word) divr16u::rem#6 [phi:divr16u::@2/divr16u::@5->divr16u::@3#1] -- register_copy
// divr16u::@3
__b3:
// for( byte i : 0..15)
// for( char i : 0..15)
// [230] (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2 -- vbuxx=_inc_vbuxx
inx
// [231] if((byte) divr16u::i#1!=(byte) $10) goto divr16u::@1 -- vbuxx_neq_vbuc1_then_la1

View File

@ -184,7 +184,7 @@ bitmap_line: {
ror
sta.z e
__b6:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
lda.z y
tax
jsr bitmap_plot
@ -237,7 +237,7 @@ bitmap_line: {
cmp.z y2
bne __b6
__b3:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
lda.z y
tax
jsr bitmap_plot
@ -252,7 +252,7 @@ bitmap_line: {
ror
sta.z e1
__b9:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
lda.z y
tax
jsr bitmap_plot
@ -306,7 +306,7 @@ bitmap_line: {
bne __b9
jmp __b3
__b4:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
lda.z y1
tax
jsr bitmap_plot
@ -318,7 +318,7 @@ bitmap_plot: {
.label __1 = $1a
.label plotter = $18
.label x = 4
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
lda bitmap_plot_yhi,x
sta.z plotter+1
lda bitmap_plot_ylo,x
@ -488,7 +488,7 @@ bitmap_init: {
bne __b2
lda #$80
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
inx
cpx #0
bne __b1
@ -524,7 +524,7 @@ bitmap_init: {
adc #>$28*8
sta.z yoffs+1
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
inx
cpx #0
bne __b3

View File

@ -5118,7 +5118,7 @@ bitmap_line: {
// [43] phi (word) bitmap_line::y#4 = (word) bitmap_line::y1#0 [phi:bitmap_line::@5/bitmap_line::@7->bitmap_line::@6#2] -- register_copy
// bitmap_line::@6
__b6:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
// [44] (byte) bitmap_plot::y#1 ← (byte)(word) bitmap_line::y#4 -- vbuxx=_byte_vwuz1
lda.z y
tax
@ -5193,7 +5193,7 @@ bitmap_line: {
// [54] phi (word) bitmap_line::y#7 = (word) bitmap_line::y#13 [phi:bitmap_line::@10/bitmap_line::@7->bitmap_line::@3#1] -- register_copy
// bitmap_line::@3
__b3:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
// [55] (byte) bitmap_plot::y#2 ← (byte)(word) bitmap_line::y#7 -- vbuxx=_byte_vwuz1
lda.z y
tax
@ -5223,7 +5223,7 @@ bitmap_line: {
// [60] phi (word) bitmap_line::y#15 = (word) bitmap_line::y#13 [phi:bitmap_line::@10/bitmap_line::@2->bitmap_line::@9#2] -- register_copy
// bitmap_line::@9
__b9:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
// [61] (byte) bitmap_plot::y#3 ← (byte)(word) bitmap_line::y#15 -- vbuxx=_byte_vwuz1
lda.z y
tax
@ -5296,7 +5296,7 @@ bitmap_line: {
jmp __b3
// bitmap_line::@4
__b4:
// bitmap_plot(x,(byte)y)
// bitmap_plot(x,(char)y)
// [71] (byte) bitmap_plot::y#0 ← (byte)(word) bitmap_line::y1#0 -- vbuxx=_byte_vwuz1
lda.z y1
tax
@ -5315,7 +5315,7 @@ bitmap_plot: {
.label __1 = $1a
.label plotter = $18
.label x = 4
// (byte*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// (char*) { bitmap_plot_yhi[y], bitmap_plot_ylo[y] }
// [75] (word) bitmap_plot::plotter#0 ← *((const to_nomodify byte*) bitmap_plot_yhi + (byte) bitmap_plot::y#4) w= *((const to_nomodify byte*) bitmap_plot_ylo + (byte) bitmap_plot::y#4) -- vwuz1=pbuc1_derefidx_vbuxx_word_pbuc2_derefidx_vbuxx
lda bitmap_plot_yhi,x
sta.z plotter+1
@ -5561,7 +5561,7 @@ bitmap_init: {
// [115] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@6->bitmap_init::@2#0] -- register_copy
// bitmap_init::@2
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
// [116] (byte) bitmap_init::x#1 ← ++ (byte) bitmap_init::x#2 -- vbuxx=_inc_vbuxx
inx
// [117] if((byte) bitmap_init::x#1!=(byte) 0) goto bitmap_init::@1 -- vbuxx_neq_0_then_la1
@ -5618,7 +5618,7 @@ bitmap_init: {
// [127] phi (byte*) bitmap_init::yoffs#4 = (byte*) bitmap_init::yoffs#2 [phi:bitmap_init::@3/bitmap_init::@5->bitmap_init::@4#0] -- register_copy
// bitmap_init::@4
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
// [128] (byte) bitmap_init::y#1 ← ++ (byte) bitmap_init::y#2 -- vbuxx=_inc_vbuxx
inx
// [129] if((byte) bitmap_init::y#1!=(byte) 0) goto bitmap_init::@3 -- vbuxx_neq_0_then_la1

View File

@ -32,42 +32,42 @@ testLong: {
lda #>str
sta.z print_str.str+1
jsr print_str
// print_dword(u)
// print_ulong(u)
lda #<u
sta.z print_dword.dw
sta.z print_ulong.dw
lda #>u
sta.z print_dword.dw+1
sta.z print_ulong.dw+1
lda #<u>>$10
sta.z print_dword.dw+2
sta.z print_ulong.dw+2
lda #>u>>$10
sta.z print_dword.dw+3
jsr print_dword
sta.z print_ulong.dw+3
jsr print_ulong
// print_char(' ')
lda #' '
jsr print_char
// print_sdword(n)
// print_slong(n)
lda #<n
sta.z print_sdword.dw
sta.z print_slong.dw
lda #>n
sta.z print_sdword.dw+1
sta.z print_slong.dw+1
lda #<n>>$10
sta.z print_sdword.dw+2
sta.z print_slong.dw+2
lda #>n>>$10
sta.z print_sdword.dw+3
jsr print_sdword
sta.z print_slong.dw+3
jsr print_slong
// print_char(' ')
lda #' '
jsr print_char
// print_sdword(s)
// print_slong(s)
lda #<s
sta.z print_sdword.dw
sta.z print_slong.dw
lda #>s
sta.z print_sdword.dw+1
sta.z print_slong.dw+1
lda #<s>>$10
sta.z print_sdword.dw+2
sta.z print_slong.dw+2
lda #>s>>$10
sta.z print_sdword.dw+3
jsr print_sdword
sta.z print_slong.dw+3
jsr print_slong
// print_ln()
jsr print_ln
// }
@ -98,9 +98,9 @@ print_ln: {
// }
rts
}
// Print a signed dword as HEX
// print_sdword(signed dword zp(4) dw)
print_sdword: {
// Print a signed long as HEX
// print_slong(signed dword zp(4) dw)
print_slong: {
.label dw = 4
// if(dw<0)
lda.z dw+3
@ -109,8 +109,8 @@ print_sdword: {
lda #' '
jsr print_char
__b2:
// print_dword((dword)dw)
jsr print_dword
// print_ulong((unsigned long)dw)
jsr print_ulong
// }
rts
__b1:
@ -151,41 +151,41 @@ print_char: {
// }
rts
}
// Print a dword as HEX
// print_dword(dword zp(4) dw)
print_dword: {
// Print a unsigned long as HEX
// print_ulong(dword zp(4) dw)
print_ulong: {
.label dw = 4
// print_word(>dw)
// print_uint(>dw)
lda.z dw+2
sta.z print_word.w
sta.z print_uint.w
lda.z dw+3
sta.z print_word.w+1
jsr print_word
// print_word(<dw)
sta.z print_uint.w+1
jsr print_uint
// print_uint(<dw)
lda.z dw
sta.z print_word.w
sta.z print_uint.w
lda.z dw+1
sta.z print_word.w+1
jsr print_word
sta.z print_uint.w+1
jsr print_uint
// }
rts
}
// Print a word as HEX
// print_word(word zp($a) w)
print_word: {
// Print a unsigned int as HEX
// print_uint(word zp($a) w)
print_uint: {
.label w = $a
// print_byte(>w)
// print_u8(>w)
ldx.z w+1
jsr print_byte
// print_byte(<w)
jsr print_u8
// print_u8(<w)
ldx.z w
jsr print_byte
jsr print_u8
// }
rts
}
// Print a byte as HEX
// print_byte(byte register(X) b)
print_byte: {
// Print a char as HEX
// print_u8(byte register(X) b)
print_u8: {
// b>>4
txa
lsr
@ -248,30 +248,30 @@ testInt: {
lda #>str
sta.z print_str.str+1
jsr print_str
// print_word(u)
// print_uint(u)
lda #<u
sta.z print_word.w
sta.z print_uint.w
lda #>u
sta.z print_word.w+1
jsr print_word
sta.z print_uint.w+1
jsr print_uint
// print_char(' ')
lda #' '
jsr print_char
// print_sword(n)
// print_sint(n)
lda #<n
sta.z print_sword.w
sta.z print_sint.w
lda #>n
sta.z print_sword.w+1
jsr print_sword
sta.z print_sint.w+1
jsr print_sint
// print_char(' ')
lda #' '
jsr print_char
// print_sword(s)
// print_sint(s)
lda #<s
sta.z print_sword.w
sta.z print_sint.w
lda #>s
sta.z print_sword.w+1
jsr print_sword
sta.z print_sint.w+1
jsr print_sint
// print_ln()
jsr print_ln
// }
@ -279,9 +279,9 @@ testInt: {
str: .text "int: "
.byte 0
}
// Print a signed word as HEX
// print_sword(signed word zp($a) w)
print_sword: {
// Print a signed int as HEX
// print_sint(signed word zp($a) w)
print_sint: {
.label w = $a
// if(w<0)
lda.z w+1
@ -290,8 +290,8 @@ print_sword: {
lda #' '
jsr print_char
__b2:
// print_word((word)w)
jsr print_word
// print_uint((unsigned int)w)
jsr print_uint
// }
rts
__b1:
@ -322,30 +322,30 @@ testShort: {
lda #>str
sta.z print_str.str+1
jsr print_str
// print_word(u)
// print_uint(u)
lda #<u
sta.z print_word.w
sta.z print_uint.w
lda #>u
sta.z print_word.w+1
jsr print_word
sta.z print_uint.w+1
jsr print_uint
// print_char(' ')
lda #' '
jsr print_char
// print_sword(n)
// print_sint(n)
lda #<n
sta.z print_sword.w
sta.z print_sint.w
lda #>n
sta.z print_sword.w+1
jsr print_sword
sta.z print_sint.w+1
jsr print_sint
// print_char(' ')
lda #' '
jsr print_char
// print_sword(s)
// print_sint(s)
lda #<s
sta.z print_sword.w
sta.z print_sint.w
lda #>s
sta.z print_sword.w+1
jsr print_sword
sta.z print_sint.w+1
jsr print_sint
// print_ln()
jsr print_ln
// }
@ -367,20 +367,20 @@ testChar: {
lda #>str
sta.z print_str.str+1
jsr print_str
// print_byte(u)
// print_u8(u)
ldx #u
jsr print_byte
jsr print_u8
// print_char(' ')
lda #' '
jsr print_char
// print_byte(n)
// print_u8(n)
ldx #n
jsr print_byte
jsr print_u8
// print_char(' ')
lda #' '
jsr print_char
// print_sbyte(s)
jsr print_sbyte
// print_s8(s)
jsr print_s8
// print_ln()
lda #<$400
sta.z print_line_cursor
@ -392,15 +392,15 @@ testChar: {
str: .text "char: "
.byte 0
}
// Print a signed byte as HEX
print_sbyte: {
// Print a signed char as HEX
print_s8: {
.const b = -testChar.s
// print_char('-')
lda #'-'
jsr print_char
// print_byte((byte)b)
// print_u8((char)b)
ldx #b
jsr print_byte
jsr print_u8
// }
rts
}

View File

@ -40,7 +40,7 @@ testLong: scope:[testLong] from main::@4
to:testLong::@1
testLong::@1: scope:[testLong] from testLong
[17] phi()
[18] call print_dword
[18] call print_ulong
to:testLong::@2
testLong::@2: scope:[testLong] from testLong::@1
[19] phi()
@ -48,7 +48,7 @@ testLong::@2: scope:[testLong] from testLong::@1
to:testLong::@3
testLong::@3: scope:[testLong] from testLong::@2
[21] phi()
[22] call print_sdword
[22] call print_slong
to:testLong::@4
testLong::@4: scope:[testLong] from testLong::@3
[23] phi()
@ -56,7 +56,7 @@ testLong::@4: scope:[testLong] from testLong::@3
to:testLong::@5
testLong::@5: scope:[testLong] from testLong::@4
[25] phi()
[26] call print_sdword
[26] call print_slong
to:testLong::@6
testLong::@6: scope:[testLong] from testLong::@5
[27] phi()
@ -79,35 +79,35 @@ print_ln::@return: scope:[print_ln] from print_ln::@1
[34] return
to:@return
(void()) print_sdword((signed dword) print_sdword::dw)
print_sdword: scope:[print_sdword] from testLong::@3 testLong::@5
[35] (signed dword) print_sdword::dw#3 ← phi( testLong::@3/(const signed dword) testLong::n testLong::@5/(const signed dword) testLong::s )
[36] if((signed dword) print_sdword::dw#3<(signed byte) 0) goto print_sdword::@1
to:print_sdword::@3
print_sdword::@3: scope:[print_sdword] from print_sdword
(void()) print_slong((signed dword) print_slong::dw)
print_slong: scope:[print_slong] from testLong::@3 testLong::@5
[35] (signed dword) print_slong::dw#3 ← phi( testLong::@3/(const signed dword) testLong::n testLong::@5/(const signed dword) testLong::s )
[36] if((signed dword) print_slong::dw#3<(signed byte) 0) goto print_slong::@1
to:print_slong::@3
print_slong::@3: scope:[print_slong] from print_slong
[37] phi()
[38] call print_char
to:print_sdword::@2
print_sdword::@2: scope:[print_sdword] from print_sdword::@3 print_sdword::@4
[39] (signed dword) print_sdword::dw#5 ← phi( print_sdword::@4/(signed dword) print_sdword::dw#0 print_sdword::@3/(signed dword) print_sdword::dw#3 )
[40] (dword) print_dword::dw#0 ← (dword)(signed dword) print_sdword::dw#5
[41] call print_dword
to:print_sdword::@return
print_sdword::@return: scope:[print_sdword] from print_sdword::@2
to:print_slong::@2
print_slong::@2: scope:[print_slong] from print_slong::@3 print_slong::@4
[39] (signed dword) print_slong::dw#5 ← phi( print_slong::@4/(signed dword) print_slong::dw#0 print_slong::@3/(signed dword) print_slong::dw#3 )
[40] (dword) print_ulong::dw#0 ← (dword)(signed dword) print_slong::dw#5
[41] call print_ulong
to:print_slong::@return
print_slong::@return: scope:[print_slong] from print_slong::@2
[42] return
to:@return
print_sdword::@1: scope:[print_sdword] from print_sdword
print_slong::@1: scope:[print_slong] from print_slong
[43] phi()
[44] call print_char
to:print_sdword::@4
print_sdword::@4: scope:[print_sdword] from print_sdword::@1
[45] (signed dword) print_sdword::dw#0 ← - (signed dword) print_sdword::dw#3
to:print_sdword::@2
to:print_slong::@4
print_slong::@4: scope:[print_slong] from print_slong::@1
[45] (signed dword) print_slong::dw#0 ← - (signed dword) print_slong::dw#3
to:print_slong::@2
(void()) print_char((byte) print_char::ch)
print_char: scope:[print_char] from print_byte print_byte::@1 print_sbyte::@1 print_sdword::@1 print_sdword::@3 print_sword::@1 print_sword::@3 testChar::@2 testChar::@4 testInt::@2 testInt::@4 testLong::@2 testLong::@4 testShort::@2 testShort::@4
[46] (byte*) print_char_cursor#94 ← phi( print_byte/(byte*) print_char_cursor#149 print_byte::@1/(byte*) print_char_cursor#26 print_sbyte::@1/(byte*) print_char_cursor#26 print_sdword::@1/(byte*) print_char_cursor#26 print_sdword::@3/(byte*) print_char_cursor#26 print_sword::@1/(byte*) print_char_cursor#26 print_sword::@3/(byte*) print_char_cursor#26 testChar::@2/(byte*) print_char_cursor#26 testChar::@4/(byte*) print_char_cursor#26 testInt::@2/(byte*) print_char_cursor#26 testInt::@4/(byte*) print_char_cursor#26 testLong::@2/(byte*) print_char_cursor#26 testLong::@4/(byte*) print_char_cursor#26 testShort::@2/(byte*) print_char_cursor#26 testShort::@4/(byte*) print_char_cursor#26 )
[46] (byte) print_char::ch#16 ← phi( print_byte/(byte) print_char::ch#6 print_byte::@1/(byte) print_char::ch#7 print_sbyte::@1/(byte) '-' print_sdword::@1/(byte) '-' print_sdword::@3/(byte) ' ' print_sword::@1/(byte) '-' print_sword::@3/(byte) ' ' testChar::@2/(byte) ' ' testChar::@4/(byte) ' ' testInt::@2/(byte) ' ' testInt::@4/(byte) ' ' testLong::@2/(byte) ' ' testLong::@4/(byte) ' ' testShort::@2/(byte) ' ' testShort::@4/(byte) ' ' )
print_char: scope:[print_char] from print_s8::@1 print_sint::@1 print_sint::@3 print_slong::@1 print_slong::@3 print_u8 print_u8::@1 testChar::@2 testChar::@4 testInt::@2 testInt::@4 testLong::@2 testLong::@4 testShort::@2 testShort::@4
[46] (byte*) print_char_cursor#94 ← phi( print_s8::@1/(byte*) print_char_cursor#26 print_sint::@1/(byte*) print_char_cursor#26 print_sint::@3/(byte*) print_char_cursor#26 print_slong::@1/(byte*) print_char_cursor#26 print_slong::@3/(byte*) print_char_cursor#26 print_u8/(byte*) print_char_cursor#149 print_u8::@1/(byte*) print_char_cursor#26 testChar::@2/(byte*) print_char_cursor#26 testChar::@4/(byte*) print_char_cursor#26 testInt::@2/(byte*) print_char_cursor#26 testInt::@4/(byte*) print_char_cursor#26 testLong::@2/(byte*) print_char_cursor#26 testLong::@4/(byte*) print_char_cursor#26 testShort::@2/(byte*) print_char_cursor#26 testShort::@4/(byte*) print_char_cursor#26 )
[46] (byte) print_char::ch#16 ← phi( print_s8::@1/(byte) '-' print_sint::@1/(byte) '-' print_sint::@3/(byte) ' ' print_slong::@1/(byte) '-' print_slong::@3/(byte) ' ' print_u8/(byte) print_char::ch#6 print_u8::@1/(byte) print_char::ch#7 testChar::@2/(byte) ' ' testChar::@4/(byte) ' ' testInt::@2/(byte) ' ' testInt::@4/(byte) ' ' testLong::@2/(byte) ' ' testLong::@4/(byte) ' ' testShort::@2/(byte) ' ' testShort::@4/(byte) ' ' )
[47] *((byte*) print_char_cursor#94) ← (byte) print_char::ch#16
[48] (byte*) print_char_cursor#26 ← ++ (byte*) print_char_cursor#94
to:print_char::@return
@ -115,50 +115,50 @@ print_char::@return: scope:[print_char] from print_char
[49] return
to:@return
(void()) print_dword((dword) print_dword::dw)
print_dword: scope:[print_dword] from print_sdword::@2 testLong::@1
[50] (byte*) print_char_cursor#145 ← phi( print_sdword::@2/(byte*) print_char_cursor#26 testLong::@1/(byte*) print_char_cursor#136 )
[50] (dword) print_dword::dw#2 ← phi( print_sdword::@2/(dword) print_dword::dw#0 testLong::@1/(const dword) testLong::u )
[51] (word) print_word::w#1 ← > (dword) print_dword::dw#2
[52] call print_word
to:print_dword::@1
print_dword::@1: scope:[print_dword] from print_dword
[53] (word) print_word::w#2 ← < (dword) print_dword::dw#2
[54] call print_word
to:print_dword::@return
print_dword::@return: scope:[print_dword] from print_dword::@1
(void()) print_ulong((dword) print_ulong::dw)
print_ulong: scope:[print_ulong] from print_slong::@2 testLong::@1
[50] (byte*) print_char_cursor#145 ← phi( print_slong::@2/(byte*) print_char_cursor#26 testLong::@1/(byte*) print_char_cursor#136 )
[50] (dword) print_ulong::dw#2 ← phi( print_slong::@2/(dword) print_ulong::dw#0 testLong::@1/(const dword) testLong::u )
[51] (word) print_uint::w#1 ← > (dword) print_ulong::dw#2
[52] call print_uint
to:print_ulong::@1
print_ulong::@1: scope:[print_ulong] from print_ulong
[53] (word) print_uint::w#2 ← < (dword) print_ulong::dw#2
[54] call print_uint
to:print_ulong::@return
print_ulong::@return: scope:[print_ulong] from print_ulong::@1
[55] return
to:@return
(void()) print_word((word) print_word::w)
print_word: scope:[print_word] from print_dword print_dword::@1 print_sword::@2 testInt::@1 testShort::@1
[56] (byte*) print_char_cursor#144 ← phi( print_dword/(byte*) print_char_cursor#145 print_dword::@1/(byte*) print_char_cursor#26 print_sword::@2/(byte*) print_char_cursor#26 testInt::@1/(byte*) print_char_cursor#136 testShort::@1/(byte*) print_char_cursor#136 )
[56] (word) print_word::w#5 ← phi( print_dword/(word) print_word::w#1 print_dword::@1/(word) print_word::w#2 print_sword::@2/(word) print_word::w#0 testInt::@1/(const word) testInt::u testShort::@1/(const word) testShort::u )
[57] (byte) print_byte::b#1 ← > (word) print_word::w#5
[58] call print_byte
to:print_word::@1
print_word::@1: scope:[print_word] from print_word
[59] (byte) print_byte::b#2 ← < (word) print_word::w#5
[60] call print_byte
to:print_word::@return
print_word::@return: scope:[print_word] from print_word::@1
(void()) print_uint((word) print_uint::w)
print_uint: scope:[print_uint] from print_sint::@2 print_ulong print_ulong::@1 testInt::@1 testShort::@1
[56] (byte*) print_char_cursor#144 ← phi( print_sint::@2/(byte*) print_char_cursor#26 print_ulong/(byte*) print_char_cursor#145 print_ulong::@1/(byte*) print_char_cursor#26 testInt::@1/(byte*) print_char_cursor#136 testShort::@1/(byte*) print_char_cursor#136 )
[56] (word) print_uint::w#5 ← phi( print_sint::@2/(word) print_uint::w#0 print_ulong/(word) print_uint::w#1 print_ulong::@1/(word) print_uint::w#2 testInt::@1/(const word) testInt::u testShort::@1/(const word) testShort::u )
[57] (byte) print_u8::b#1 ← > (word) print_uint::w#5
[58] call print_u8
to:print_uint::@1
print_uint::@1: scope:[print_uint] from print_uint
[59] (byte) print_u8::b#2 ← < (word) print_uint::w#5
[60] call print_u8
to:print_uint::@return
print_uint::@return: scope:[print_uint] from print_uint::@1
[61] return
to:@return
(void()) print_byte((byte) print_byte::b)
print_byte: scope:[print_byte] from print_sbyte::@2 print_word print_word::@1 testChar::@1 testChar::@3
[62] (byte*) print_char_cursor#149 ← phi( print_sbyte::@2/(byte*) print_char_cursor#26 print_word/(byte*) print_char_cursor#144 print_word::@1/(byte*) print_char_cursor#26 testChar::@1/(byte*) print_char_cursor#136 testChar::@3/(byte*) print_char_cursor#26 )
[62] (byte) print_byte::b#5 ← phi( print_sbyte::@2/(byte)(const signed byte) print_sbyte::b#0 print_word/(byte) print_byte::b#1 print_word::@1/(byte) print_byte::b#2 testChar::@1/(const byte) testChar::u testChar::@3/(const byte) testChar::n )
[63] (byte~) print_byte::$0 ← (byte) print_byte::b#5 >> (byte) 4
[64] (byte) print_char::ch#6 ← *((const to_nomodify byte*) print_hextab + (byte~) print_byte::$0)
(void()) print_u8((byte) print_u8::b)
print_u8: scope:[print_u8] from print_s8::@2 print_uint print_uint::@1 testChar::@1 testChar::@3
[62] (byte*) print_char_cursor#149 ← phi( print_s8::@2/(byte*) print_char_cursor#26 print_uint/(byte*) print_char_cursor#144 print_uint::@1/(byte*) print_char_cursor#26 testChar::@1/(byte*) print_char_cursor#136 testChar::@3/(byte*) print_char_cursor#26 )
[62] (byte) print_u8::b#5 ← phi( print_s8::@2/(byte)(const signed byte) print_s8::b#0 print_uint/(byte) print_u8::b#1 print_uint::@1/(byte) print_u8::b#2 testChar::@1/(const byte) testChar::u testChar::@3/(const byte) testChar::n )
[63] (byte~) print_u8::$0 ← (byte) print_u8::b#5 >> (byte) 4
[64] (byte) print_char::ch#6 ← *((const to_nomodify byte*) print_hextab + (byte~) print_u8::$0)
[65] call print_char
to:print_byte::@1
print_byte::@1: scope:[print_byte] from print_byte
[66] (byte~) print_byte::$2 ← (byte) print_byte::b#5 & (byte) $f
[67] (byte) print_char::ch#7 ← *((const to_nomodify byte*) print_hextab + (byte~) print_byte::$2)
to:print_u8::@1
print_u8::@1: scope:[print_u8] from print_u8
[66] (byte~) print_u8::$2 ← (byte) print_u8::b#5 & (byte) $f
[67] (byte) print_char::ch#7 ← *((const to_nomodify byte*) print_hextab + (byte~) print_u8::$2)
[68] call print_char
to:print_byte::@return
print_byte::@return: scope:[print_byte] from print_byte::@1
to:print_u8::@return
print_u8::@return: scope:[print_u8] from print_u8::@1
[69] return
to:@return
@ -188,7 +188,7 @@ testInt: scope:[testInt] from main::@3
to:testInt::@1
testInt::@1: scope:[testInt] from testInt
[79] phi()
[80] call print_word
[80] call print_uint
to:testInt::@2
testInt::@2: scope:[testInt] from testInt::@1
[81] phi()
@ -196,7 +196,7 @@ testInt::@2: scope:[testInt] from testInt::@1
to:testInt::@3
testInt::@3: scope:[testInt] from testInt::@2
[83] phi()
[84] call print_sword
[84] call print_sint
to:testInt::@4
testInt::@4: scope:[testInt] from testInt::@3
[85] phi()
@ -204,7 +204,7 @@ testInt::@4: scope:[testInt] from testInt::@3
to:testInt::@5
testInt::@5: scope:[testInt] from testInt::@4
[87] phi()
[88] call print_sword
[88] call print_sint
to:testInt::@6
testInt::@6: scope:[testInt] from testInt::@5
[89] phi()
@ -214,30 +214,30 @@ testInt::@return: scope:[testInt] from testInt::@6
[91] return
to:@return
(void()) print_sword((signed word) print_sword::w)
print_sword: scope:[print_sword] from testInt::@3 testInt::@5 testShort::@3 testShort::@5
[92] (signed word) print_sword::w#10 ← phi( testInt::@3/(const signed word) testInt::n testInt::@5/(const signed word) testInt::s testShort::@3/(const signed word) testShort::n testShort::@5/(const signed word) testShort::s )
[93] if((signed word) print_sword::w#10<(signed byte) 0) goto print_sword::@1
to:print_sword::@3
print_sword::@3: scope:[print_sword] from print_sword
(void()) print_sint((signed word) print_sint::w)
print_sint: scope:[print_sint] from testInt::@3 testInt::@5 testShort::@3 testShort::@5
[92] (signed word) print_sint::w#10 ← phi( testInt::@3/(const signed word) testInt::n testInt::@5/(const signed word) testInt::s testShort::@3/(const signed word) testShort::n testShort::@5/(const signed word) testShort::s )
[93] if((signed word) print_sint::w#10<(signed byte) 0) goto print_sint::@1
to:print_sint::@3
print_sint::@3: scope:[print_sint] from print_sint
[94] phi()
[95] call print_char
to:print_sword::@2
print_sword::@2: scope:[print_sword] from print_sword::@3 print_sword::@4
[96] (signed word) print_sword::w#7 ← phi( print_sword::@4/(signed word) print_sword::w#0 print_sword::@3/(signed word) print_sword::w#10 )
[97] (word) print_word::w#0 ← (word)(signed word) print_sword::w#7
[98] call print_word
to:print_sword::@return
print_sword::@return: scope:[print_sword] from print_sword::@2
to:print_sint::@2
print_sint::@2: scope:[print_sint] from print_sint::@3 print_sint::@4
[96] (signed word) print_sint::w#7 ← phi( print_sint::@4/(signed word) print_sint::w#0 print_sint::@3/(signed word) print_sint::w#10 )
[97] (word) print_uint::w#0 ← (word)(signed word) print_sint::w#7
[98] call print_uint
to:print_sint::@return
print_sint::@return: scope:[print_sint] from print_sint::@2
[99] return
to:@return
print_sword::@1: scope:[print_sword] from print_sword
print_sint::@1: scope:[print_sint] from print_sint
[100] phi()
[101] call print_char
to:print_sword::@4
print_sword::@4: scope:[print_sword] from print_sword::@1
[102] (signed word) print_sword::w#0 ← - (signed word) print_sword::w#10
to:print_sword::@2
to:print_sint::@4
print_sint::@4: scope:[print_sint] from print_sint::@1
[102] (signed word) print_sint::w#0 ← - (signed word) print_sint::w#10
to:print_sint::@2
(void()) testShort()
testShort: scope:[testShort] from main::@2
@ -246,7 +246,7 @@ testShort: scope:[testShort] from main::@2
to:testShort::@1
testShort::@1: scope:[testShort] from testShort
[105] phi()
[106] call print_word
[106] call print_uint
to:testShort::@2
testShort::@2: scope:[testShort] from testShort::@1
[107] phi()
@ -254,7 +254,7 @@ testShort::@2: scope:[testShort] from testShort::@1
to:testShort::@3
testShort::@3: scope:[testShort] from testShort::@2
[109] phi()
[110] call print_sword
[110] call print_sint
to:testShort::@4
testShort::@4: scope:[testShort] from testShort::@3
[111] phi()
@ -262,7 +262,7 @@ testShort::@4: scope:[testShort] from testShort::@3
to:testShort::@5
testShort::@5: scope:[testShort] from testShort::@4
[113] phi()
[114] call print_sword
[114] call print_sint
to:testShort::@6
testShort::@6: scope:[testShort] from testShort::@5
[115] phi()
@ -279,7 +279,7 @@ testChar: scope:[testChar] from main::@1
to:testChar::@1
testChar::@1: scope:[testChar] from testChar
[120] phi()
[121] call print_byte
[121] call print_u8
to:testChar::@2
testChar::@2: scope:[testChar] from testChar::@1
[122] phi()
@ -287,7 +287,7 @@ testChar::@2: scope:[testChar] from testChar::@1
to:testChar::@3
testChar::@3: scope:[testChar] from testChar::@2
[124] phi()
[125] call print_byte
[125] call print_u8
to:testChar::@4
testChar::@4: scope:[testChar] from testChar::@3
[126] phi()
@ -295,7 +295,7 @@ testChar::@4: scope:[testChar] from testChar::@3
to:testChar::@5
testChar::@5: scope:[testChar] from testChar::@4
[128] phi()
[129] call print_sbyte
[129] call print_s8
to:testChar::@6
testChar::@6: scope:[testChar] from testChar::@5
[130] phi()
@ -305,19 +305,19 @@ testChar::@return: scope:[testChar] from testChar::@6
[132] return
to:@return
(void()) print_sbyte((signed byte) print_sbyte::b)
print_sbyte: scope:[print_sbyte] from testChar::@5
(void()) print_s8((signed byte) print_s8::b)
print_s8: scope:[print_s8] from testChar::@5
[133] phi()
to:print_sbyte::@1
print_sbyte::@1: scope:[print_sbyte] from print_sbyte
to:print_s8::@1
print_s8::@1: scope:[print_s8] from print_s8
[134] phi()
[135] call print_char
to:print_sbyte::@2
print_sbyte::@2: scope:[print_sbyte] from print_sbyte::@1
to:print_s8::@2
print_s8::@2: scope:[print_s8] from print_s8::@1
[136] phi()
[137] call print_byte
to:print_sbyte::@return
print_sbyte::@return: scope:[print_sbyte] from print_sbyte::@2
[137] call print_u8
to:print_s8::@return
print_s8::@return: scope:[print_s8] from print_s8::@2
[138] return
to:@return

File diff suppressed because one or more lines are too long

View File

@ -27,15 +27,6 @@
(void*) memset::return
(void*) memset::str
(const void*) memset::str#0 str = (void*)(byte*) 1024
(void()) print_byte((byte) print_byte::b)
(byte~) print_byte::$0 reg byte a 2000002.0
(byte~) print_byte::$2 reg byte x 2000002.0
(label) print_byte::@1
(label) print_byte::@return
(byte) print_byte::b
(byte) print_byte::b#1 reg byte x 200002.0
(byte) print_byte::b#2 reg byte x 200002.0
(byte) print_byte::b#5 reg byte x 550001.0
(void()) print_char((byte) print_char::ch)
(label) print_char::@return
(byte) print_char::ch
@ -56,12 +47,6 @@
(byte*) print_char_cursor#94 print_char_cursor zp[2]:8 1.10029085E7
(void()) print_cls()
(label) print_cls::@return
(void()) print_dword((dword) print_dword::dw)
(label) print_dword::@1
(label) print_dword::@return
(dword) print_dword::dw
(dword) print_dword::dw#0 dw zp[4]:4 2002.0
(dword) print_dword::dw#2 dw zp[4]:4 7001.0
(const to_nomodify byte*) print_hextab[] = (byte*) "0123456789abcdef"z
(byte*) print_line_cursor
(byte*) print_line_cursor#1 print_line_cursor zp[2]:2 566.8333333333333
@ -70,23 +55,33 @@
(void()) print_ln()
(label) print_ln::@1
(label) print_ln::@return
(void()) print_sbyte((signed byte) print_sbyte::b)
(label) print_sbyte::@1
(label) print_sbyte::@2
(label) print_sbyte::@return
(signed byte) print_sbyte::b
(const signed byte) print_sbyte::b#0 b = -(const signed byte) testChar::s
(void()) print_s8((signed byte) print_s8::b)
(label) print_s8::@1
(label) print_s8::@2
(label) print_s8::@return
(signed byte) print_s8::b
(const signed byte) print_s8::b#0 b = -(const signed byte) testChar::s
(byte*) print_screen
(void()) print_sdword((signed dword) print_sdword::dw)
(label) print_sdword::@1
(label) print_sdword::@2
(label) print_sdword::@3
(label) print_sdword::@4
(label) print_sdword::@return
(signed dword) print_sdword::dw
(signed dword) print_sdword::dw#0 dw zp[4]:4 2002.0
(signed dword) print_sdword::dw#3 dw zp[4]:4 500.5
(signed dword) print_sdword::dw#5 dw zp[4]:4 2002.0
(void()) print_sint((signed word) print_sint::w)
(label) print_sint::@1
(label) print_sint::@2
(label) print_sint::@3
(label) print_sint::@4
(label) print_sint::@return
(signed word) print_sint::w
(signed word) print_sint::w#0 w zp[2]:10 2002.0
(signed word) print_sint::w#10 w zp[2]:10 500.5
(signed word) print_sint::w#7 w zp[2]:10 2002.0
(void()) print_slong((signed dword) print_slong::dw)
(label) print_slong::@1
(label) print_slong::@2
(label) print_slong::@3
(label) print_slong::@4
(label) print_slong::@return
(signed dword) print_slong::dw
(signed dword) print_slong::dw#0 dw zp[4]:4 2002.0
(signed dword) print_slong::dw#3 dw zp[4]:4 500.5
(signed dword) print_slong::dw#5 dw zp[4]:4 2002.0
(void()) print_str((byte*) print_str::str)
(label) print_str::@1
(label) print_str::@2
@ -95,24 +90,29 @@
(byte*) print_str::str#0 str zp[2]:10 20002.0
(byte*) print_str::str#5 str zp[2]:10 10251.25
(byte*) print_str::str#7 str zp[2]:10 1001.0
(void()) print_sword((signed word) print_sword::w)
(label) print_sword::@1
(label) print_sword::@2
(label) print_sword::@3
(label) print_sword::@4
(label) print_sword::@return
(signed word) print_sword::w
(signed word) print_sword::w#0 w zp[2]:10 2002.0
(signed word) print_sword::w#10 w zp[2]:10 500.5
(signed word) print_sword::w#7 w zp[2]:10 2002.0
(void()) print_word((word) print_word::w)
(label) print_word::@1
(label) print_word::@return
(word) print_word::w
(word) print_word::w#0 w zp[2]:10 2002.0
(word) print_word::w#1 w zp[2]:10 20002.0
(word) print_word::w#2 w zp[2]:10 20002.0
(word) print_word::w#5 w zp[2]:10 73668.33333333333
(void()) print_u8((byte) print_u8::b)
(byte~) print_u8::$0 reg byte a 2000002.0
(byte~) print_u8::$2 reg byte x 2000002.0
(label) print_u8::@1
(label) print_u8::@return
(byte) print_u8::b
(byte) print_u8::b#1 reg byte x 200002.0
(byte) print_u8::b#2 reg byte x 200002.0
(byte) print_u8::b#5 reg byte x 550001.0
(void()) print_uint((word) print_uint::w)
(label) print_uint::@1
(label) print_uint::@return
(word) print_uint::w
(word) print_uint::w#0 w zp[2]:10 2002.0
(word) print_uint::w#1 w zp[2]:10 20002.0
(word) print_uint::w#2 w zp[2]:10 20002.0
(word) print_uint::w#5 w zp[2]:10 73668.33333333333
(void()) print_ulong((dword) print_ulong::dw)
(label) print_ulong::@1
(label) print_ulong::@return
(dword) print_ulong::dw
(dword) print_ulong::dw#0 dw zp[4]:4 2002.0
(dword) print_ulong::dw#2 dw zp[4]:4 7001.0
(void()) testChar()
(label) testChar::@1
(label) testChar::@2
@ -163,10 +163,10 @@
(const word) testShort::u = (word) $578
zp[2]:2 [ print_line_cursor#20 print_line_cursor#39 print_line_cursor#1 ]
zp[4]:4 [ print_sdword::dw#5 print_sdword::dw#0 print_sdword::dw#3 print_dword::dw#2 print_dword::dw#0 ]
zp[4]:4 [ print_slong::dw#5 print_slong::dw#0 print_slong::dw#3 print_ulong::dw#2 print_ulong::dw#0 ]
reg byte a [ print_char::ch#16 print_char::ch#6 print_char::ch#7 ]
zp[2]:8 [ print_char_cursor#144 print_char_cursor#145 print_char_cursor#94 print_char_cursor#149 print_char_cursor#26 print_char_cursor#136 print_char_cursor#156 print_char_cursor#160 print_char_cursor#161 print_char_cursor#162 print_char_cursor#1 ]
reg byte x [ print_byte::b#5 print_byte::b#1 print_byte::b#2 ]
zp[2]:10 [ memset::dst#2 memset::dst#1 print_str::str#5 print_str::str#7 print_str::str#0 print_word::w#5 print_word::w#1 print_word::w#2 print_word::w#0 print_sword::w#7 print_sword::w#0 print_sword::w#10 ]
reg byte a [ print_byte::$0 ]
reg byte x [ print_byte::$2 ]
zp[2]:8 [ print_char_cursor#144 print_char_cursor#145 print_char_cursor#94 print_char_cursor#26 print_char_cursor#149 print_char_cursor#136 print_char_cursor#156 print_char_cursor#160 print_char_cursor#161 print_char_cursor#162 print_char_cursor#1 ]
reg byte x [ print_u8::b#5 print_u8::b#1 print_u8::b#2 ]
zp[2]:10 [ memset::dst#2 memset::dst#1 print_str::str#5 print_str::str#7 print_str::str#0 print_uint::w#5 print_uint::w#0 print_uint::w#1 print_uint::w#2 print_sint::w#7 print_sint::w#0 print_sint::w#10 ]
reg byte a [ print_u8::$0 ]
reg byte x [ print_u8::$2 ]

View File

@ -675,7 +675,7 @@ keyboard_event_scan: {
axs #-[8]
stx.z keycode
__b8:
// for(byte row : 0..7)
// for(char row : 0..7)
inc.z row
lda #8
cmp.z row
@ -767,7 +767,7 @@ keyboard_event_scan: {
__b10:
// keycode++;
inc.z keycode
// for(byte col : 0..7)
// for(char col : 0..7)
inx
cpx #8
bne __b9
@ -2765,7 +2765,7 @@ bitmap_line_ydxd: {
bitmap_clear: {
.label bitmap = $10
.label y = $16
// (byte*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// (char*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
lda bitmap_plot_xlo
sta.z bitmap
lda bitmap_plot_xhi
@ -2784,11 +2784,11 @@ bitmap_clear: {
bne !+
inc.z bitmap+1
!:
// for( byte x: 0..199 )
// for( char x: 0..199 )
inx
cpx #$c8
bne __b2
// for( byte y: 0..39 )
// for( char y: 0..39 )
inc.z y
lda #$28
cmp.z y
@ -2823,7 +2823,7 @@ bitmap_init: {
bne __b2
ldy #$80
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
inx
cpx #0
bne __b1
@ -2858,7 +2858,7 @@ bitmap_init: {
adc #>$28*8
sta.z yoffs+1
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
inx
cpx #0
bne __b3

View File

@ -29200,7 +29200,7 @@ keyboard_event_scan: {
// [165] phi (byte) keyboard_event_scan::keycode#13 = (byte) keyboard_event_scan::keycode#14 [phi:keyboard_event_scan::@15/keyboard_event_scan::@16->keyboard_event_scan::@8#1] -- register_copy
// keyboard_event_scan::@8
__b8:
// for(byte row : 0..7)
// for(char row : 0..7)
// [166] (byte) keyboard_event_scan::row#1 ← ++ (byte) keyboard_event_scan::row#2 -- vbuz1=_inc_vbuz1
inc.z row
// [167] if((byte) keyboard_event_scan::row#1!=(byte) 8) goto keyboard_event_scan::@7 -- vbuz1_neq_vbuc1_then_la1
@ -29371,7 +29371,7 @@ keyboard_event_scan: {
// keycode++;
// [204] (byte) keyboard_event_scan::keycode#14 ← ++ (byte) keyboard_event_scan::keycode#10 -- vbuz1=_inc_vbuz1
inc.z keycode
// for(byte col : 0..7)
// for(char col : 0..7)
// [205] (byte) keyboard_event_scan::col#1 ← ++ (byte) keyboard_event_scan::col#2 -- vbuxx=_inc_vbuxx
inx
// [206] if((byte) keyboard_event_scan::col#1!=(byte) 8) goto keyboard_event_scan::@9 -- vbuxx_neq_vbuc1_then_la1
@ -32525,7 +32525,7 @@ bitmap_line_ydxd: {
bitmap_clear: {
.label bitmap = $10
.label y = $16
// (byte*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// (char*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// [747] (word) bitmap_clear::bitmap#0 ← *((const to_nomodify byte*) bitmap_plot_xhi) w= *((const to_nomodify byte*) bitmap_plot_xlo) -- vwuz1=_deref_pbuc1_word__deref_pbuc2
lda bitmap_plot_xlo
sta.z bitmap
@ -32562,14 +32562,14 @@ bitmap_clear: {
bne !+
inc.z bitmap+1
!:
// for( byte x: 0..199 )
// for( char x: 0..199 )
// [753] (byte) bitmap_clear::x#1 ← ++ (byte) bitmap_clear::x#2 -- vbuxx=_inc_vbuxx
inx
// [754] if((byte) bitmap_clear::x#1!=(byte) $c8) goto bitmap_clear::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #$c8
bne __b2
// bitmap_clear::@3
// for( byte y: 0..39 )
// for( char y: 0..39 )
// [755] (byte) bitmap_clear::y#1 ← ++ (byte) bitmap_clear::y#4 -- vbuz1=_inc_vbuz1
inc.z y
// [756] if((byte) bitmap_clear::y#1!=(byte) $28) goto bitmap_clear::@1 -- vbuz1_neq_vbuc1_then_la1
@ -32629,7 +32629,7 @@ bitmap_init: {
// [767] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@6->bitmap_init::@2#0] -- register_copy
// bitmap_init::@2
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
// [768] (byte) bitmap_init::x#1 ← ++ (byte) bitmap_init::x#2 -- vbuxx=_inc_vbuxx
inx
// [769] if((byte) bitmap_init::x#1!=(byte) 0) goto bitmap_init::@1 -- vbuxx_neq_0_then_la1
@ -32685,7 +32685,7 @@ bitmap_init: {
// [779] phi (byte*) bitmap_init::yoffs#4 = (byte*) bitmap_init::yoffs#2 [phi:bitmap_init::@3/bitmap_init::@5->bitmap_init::@4#0] -- register_copy
// bitmap_init::@4
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
// [780] (byte) bitmap_init::y#1 ← ++ (byte) bitmap_init::y#2 -- vbuxx=_inc_vbuxx
inx
// [781] if((byte) bitmap_init::y#1!=(byte) 0) goto bitmap_init::@3 -- vbuxx_neq_0_then_la1

View File

@ -2327,7 +2327,7 @@ bitmap_line_ydxd: {
bitmap_clear: {
.label bitmap = 4
.label y = $b
// (byte*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// (char*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
lda bitmap_plot_xlo
sta.z bitmap
lda bitmap_plot_xhi
@ -2346,11 +2346,11 @@ bitmap_clear: {
bne !+
inc.z bitmap+1
!:
// for( byte x: 0..199 )
// for( char x: 0..199 )
inx
cpx #$c8
bne __b2
// for( byte y: 0..39 )
// for( char y: 0..39 )
inc.z y
lda #$28
cmp.z y
@ -2385,7 +2385,7 @@ bitmap_init: {
bne __b2
ldy #$80
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
inx
cpx #0
bne __b1
@ -2420,7 +2420,7 @@ bitmap_init: {
adc #>$28*8
sta.z yoffs+1
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
inx
cpx #0
bne __b3

View File

@ -29549,7 +29549,7 @@ bitmap_line_ydxd: {
bitmap_clear: {
.label bitmap = 4
.label y = $b
// (byte*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// (char*) { bitmap_plot_xhi[0], bitmap_plot_xlo[0] }
// [721] (word) bitmap_clear::bitmap#0 ← *((const to_nomodify byte*) bitmap_plot_xhi) w= *((const to_nomodify byte*) bitmap_plot_xlo) -- vwuz1=_deref_pbuc1_word__deref_pbuc2
lda bitmap_plot_xlo
sta.z bitmap
@ -29586,14 +29586,14 @@ bitmap_clear: {
bne !+
inc.z bitmap+1
!:
// for( byte x: 0..199 )
// for( char x: 0..199 )
// [727] (byte) bitmap_clear::x#1 ← ++ (byte) bitmap_clear::x#2 -- vbuxx=_inc_vbuxx
inx
// [728] if((byte) bitmap_clear::x#1!=(byte) $c8) goto bitmap_clear::@2 -- vbuxx_neq_vbuc1_then_la1
cpx #$c8
bne __b2
// bitmap_clear::@3
// for( byte y: 0..39 )
// for( char y: 0..39 )
// [729] (byte) bitmap_clear::y#1 ← ++ (byte) bitmap_clear::y#4 -- vbuz1=_inc_vbuz1
inc.z y
// [730] if((byte) bitmap_clear::y#1!=(byte) $28) goto bitmap_clear::@1 -- vbuz1_neq_vbuc1_then_la1
@ -29653,7 +29653,7 @@ bitmap_init: {
// [741] phi (byte) bitmap_init::bits#4 = (byte) bitmap_init::bits#1 [phi:bitmap_init::@6->bitmap_init::@2#0] -- register_copy
// bitmap_init::@2
__b2:
// for(byte x : 0..255)
// for(char x : 0..255)
// [742] (byte) bitmap_init::x#1 ← ++ (byte) bitmap_init::x#2 -- vbuxx=_inc_vbuxx
inx
// [743] if((byte) bitmap_init::x#1!=(byte) 0) goto bitmap_init::@1 -- vbuxx_neq_0_then_la1
@ -29709,7 +29709,7 @@ bitmap_init: {
// [753] phi (byte*) bitmap_init::yoffs#4 = (byte*) bitmap_init::yoffs#2 [phi:bitmap_init::@3/bitmap_init::@5->bitmap_init::@4#0] -- register_copy
// bitmap_init::@4
__b4:
// for(byte y : 0..255)
// for(char y : 0..255)
// [754] (byte) bitmap_init::y#1 ← ++ (byte) bitmap_init::y#2 -- vbuxx=_inc_vbuxx
inx
// [755] if((byte) bitmap_init::y#1!=(byte) 0) goto bitmap_init::@3 -- vbuxx_neq_0_then_la1

View File

@ -41,64 +41,64 @@ main: {
lda.z cyclecount+3
sbc #>CLOCKS_PER_INIT>>$10
sta.z cyclecount+3
// print_dword_at(cyclecount, SCREEN)
// print_ulong_at(cyclecount, SCREEN)
// Print cycle count
jsr print_dword_at
jsr print_ulong_at
jmp __b1
}
// Print a dword as HEX at a specific position
// print_dword_at(dword zp(9) dw)
print_dword_at: {
// Print a unsigned long as HEX at a specific position
// print_ulong_at(dword zp(9) dw)
print_ulong_at: {
.label dw = 9
// print_word_at(>dw, at)
// print_uint_at(>dw, at)
lda.z dw+2
sta.z print_word_at.w
sta.z print_uint_at.w
lda.z dw+3
sta.z print_word_at.w+1
sta.z print_uint_at.w+1
lda #<SCREEN
sta.z print_word_at.at
sta.z print_uint_at.at
lda #>SCREEN
sta.z print_word_at.at+1
jsr print_word_at
// print_word_at(<dw, at+4)
sta.z print_uint_at.at+1
jsr print_uint_at
// print_uint_at(<dw, at+4)
lda.z dw
sta.z print_word_at.w
sta.z print_uint_at.w
lda.z dw+1
sta.z print_word_at.w+1
sta.z print_uint_at.w+1
lda #<SCREEN+4
sta.z print_word_at.at
sta.z print_uint_at.at
lda #>SCREEN+4
sta.z print_word_at.at+1
jsr print_word_at
sta.z print_uint_at.at+1
jsr print_uint_at
// }
rts
}
// Print a word as HEX at a specific position
// print_word_at(word zp(2) w, byte* zp(4) at)
print_word_at: {
// Print a unsigned int as HEX at a specific position
// print_uint_at(word zp(2) w, byte* zp(4) at)
print_uint_at: {
.label w = 2
.label at = 4
// print_byte_at(>w, at)
// print_u8_at(>w, at)
lda.z w+1
sta.z print_byte_at.b
jsr print_byte_at
// print_byte_at(<w, at+2)
sta.z print_u8_at.b
jsr print_u8_at
// print_u8_at(<w, at+2)
lda.z w
sta.z print_byte_at.b
sta.z print_u8_at.b
lda #2
clc
adc.z print_byte_at.at
sta.z print_byte_at.at
adc.z print_u8_at.at
sta.z print_u8_at.at
bcc !+
inc.z print_byte_at.at+1
inc.z print_u8_at.at+1
!:
jsr print_byte_at
jsr print_u8_at
// }
rts
}
// Print a byte as HEX at a specific position
// print_byte_at(byte zp(6) b, byte* zp(4) at)
print_byte_at: {
// Print a char as HEX at a specific position
// print_u8_at(byte zp(6) b, byte* zp(4) at)
print_u8_at: {
.label b = 6
.label at = 4
// b>>4

View File

@ -24,63 +24,63 @@ main::@2: scope:[main] from main::@1
main::@3: scope:[main] from main::@2
[10] (dword~) main::$1 ← (dword) clock::return#2
[11] (dword) main::cyclecount#0 ← (dword~) main::$1 - (const nomodify dword) CLOCKS_PER_INIT
[12] (dword) print_dword_at::dw#0 ← (dword) main::cyclecount#0
[13] call print_dword_at
[12] (dword) print_ulong_at::dw#0 ← (dword) main::cyclecount#0
[13] call print_ulong_at
to:main::@1
(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at)
print_dword_at: scope:[print_dword_at] from main::@3
[14] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0
[15] call print_word_at
to:print_dword_at::@1
print_dword_at::@1: scope:[print_dword_at] from print_dword_at
[16] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0
[17] call print_word_at
to:print_dword_at::@return
print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@1
(void()) print_ulong_at((dword) print_ulong_at::dw , (byte*) print_ulong_at::at)
print_ulong_at: scope:[print_ulong_at] from main::@3
[14] (word) print_uint_at::w#0 ← > (dword) print_ulong_at::dw#0
[15] call print_uint_at
to:print_ulong_at::@1
print_ulong_at::@1: scope:[print_ulong_at] from print_ulong_at
[16] (word) print_uint_at::w#1 ← < (dword) print_ulong_at::dw#0
[17] call print_uint_at
to:print_ulong_at::@return
print_ulong_at::@return: scope:[print_ulong_at] from print_ulong_at::@1
[18] return
to:@return
(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at)
print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1
[19] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const nomodify byte*) SCREEN print_dword_at::@1/(const nomodify byte*) SCREEN+(byte) 4 )
[19] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 )
[20] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2
[21] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2
[22] call print_byte_at
to:print_word_at::@1
print_word_at::@1: scope:[print_word_at] from print_word_at
[23] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2
[24] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2
[25] call print_byte_at
to:print_word_at::@return
print_word_at::@return: scope:[print_word_at] from print_word_at::@1
(void()) print_uint_at((word) print_uint_at::w , (byte*) print_uint_at::at)
print_uint_at: scope:[print_uint_at] from print_ulong_at print_ulong_at::@1
[19] (byte*) print_uint_at::at#2 ← phi( print_ulong_at/(const nomodify byte*) SCREEN print_ulong_at::@1/(const nomodify byte*) SCREEN+(byte) 4 )
[19] (word) print_uint_at::w#2 ← phi( print_ulong_at/(word) print_uint_at::w#0 print_ulong_at::@1/(word) print_uint_at::w#1 )
[20] (byte) print_u8_at::b#0 ← > (word) print_uint_at::w#2
[21] (byte*) print_u8_at::at#0 ← (byte*) print_uint_at::at#2
[22] call print_u8_at
to:print_uint_at::@1
print_uint_at::@1: scope:[print_uint_at] from print_uint_at
[23] (byte) print_u8_at::b#1 ← < (word) print_uint_at::w#2
[24] (byte*) print_u8_at::at#1 ← (byte*) print_uint_at::at#2 + (byte) 2
[25] call print_u8_at
to:print_uint_at::@return
print_uint_at::@return: scope:[print_uint_at] from print_uint_at::@1
[26] return
to:@return
(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at)
print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1
[27] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 )
[27] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 )
[28] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4
[29] (byte) print_char_at::ch#0 ← *((const to_nomodify byte*) print_hextab + (byte~) print_byte_at::$0)
[30] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2
(void()) print_u8_at((byte) print_u8_at::b , (byte*) print_u8_at::at)
print_u8_at: scope:[print_u8_at] from print_uint_at print_uint_at::@1
[27] (byte*) print_u8_at::at#2 ← phi( print_uint_at/(byte*) print_u8_at::at#0 print_uint_at::@1/(byte*) print_u8_at::at#1 )
[27] (byte) print_u8_at::b#2 ← phi( print_uint_at/(byte) print_u8_at::b#0 print_uint_at::@1/(byte) print_u8_at::b#1 )
[28] (byte~) print_u8_at::$0 ← (byte) print_u8_at::b#2 >> (byte) 4
[29] (byte) print_char_at::ch#0 ← *((const to_nomodify byte*) print_hextab + (byte~) print_u8_at::$0)
[30] (byte*) print_char_at::at#0 ← (byte*) print_u8_at::at#2
[31] call print_char_at
to:print_byte_at::@1
print_byte_at::@1: scope:[print_byte_at] from print_byte_at
[32] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f
[33] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1
[34] (byte) print_char_at::ch#1 ← *((const to_nomodify byte*) print_hextab + (byte~) print_byte_at::$2)
to:print_u8_at::@1
print_u8_at::@1: scope:[print_u8_at] from print_u8_at
[32] (byte~) print_u8_at::$2 ← (byte) print_u8_at::b#2 & (byte) $f
[33] (byte*) print_char_at::at#1 ← (byte*) print_u8_at::at#2 + (byte) 1
[34] (byte) print_char_at::ch#1 ← *((const to_nomodify byte*) print_hextab + (byte~) print_u8_at::$2)
[35] call print_char_at
to:print_byte_at::@return
print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1
to:print_u8_at::@return
print_u8_at::@return: scope:[print_u8_at] from print_u8_at::@1
[36] return
to:@return
(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at)
print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1
[37] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 )
[37] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 )
print_char_at: scope:[print_char_at] from print_u8_at print_u8_at::@1
[37] (byte*) print_char_at::at#2 ← phi( print_u8_at/(byte*) print_char_at::at#0 print_u8_at::@1/(byte*) print_char_at::at#1 )
[37] (byte) print_char_at::ch#2 ← phi( print_u8_at/(byte) print_char_at::ch#0 print_u8_at::@1/(byte) print_char_at::ch#1 )
[38] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2
to:print_char_at::@return
print_char_at::@return: scope:[print_char_at] from print_char_at

File diff suppressed because it is too large Load Diff

View File

@ -26,19 +26,6 @@
(label) main::@3
(dword) main::cyclecount
(dword) main::cyclecount#0 cyclecount zp[4]:9 202.0
(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at)
(byte~) print_byte_at::$0 reg byte a 200002.0
(byte~) print_byte_at::$2 reg byte y 100001.0
(label) print_byte_at::@1
(label) print_byte_at::@return
(byte*) print_byte_at::at
(byte*) print_byte_at::at#0 at zp[2]:4 20002.0
(byte*) print_byte_at::at#1 at zp[2]:4 20002.0
(byte*) print_byte_at::at#2 at zp[2]:4 36667.33333333333
(byte) print_byte_at::b
(byte) print_byte_at::b#0 b zp[1]:6 10001.0
(byte) print_byte_at::b#1 b zp[1]:6 10001.0
(byte) print_byte_at::b#2 b zp[1]:6 44000.8
(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at)
(label) print_char_at::@return
(byte*) print_char_at::at
@ -49,28 +36,41 @@
(byte) print_char_at::ch#0 reg byte x 100001.0
(byte) print_char_at::ch#1 reg byte x 200002.0
(byte) print_char_at::ch#2 reg byte x 1200003.0
(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at)
(label) print_dword_at::@1
(label) print_dword_at::@return
(byte*) print_dword_at::at
(dword) print_dword_at::dw
(dword) print_dword_at::dw#0 dw zp[4]:9 701.0
(const to_nomodify byte*) print_hextab[] = (byte*) "0123456789abcdef"z
(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at)
(label) print_word_at::@1
(label) print_word_at::@return
(byte*) print_word_at::at
(byte*) print_word_at::at#2 at zp[2]:4 4000.4
(word) print_word_at::w
(word) print_word_at::w#0 w zp[2]:2 2002.0
(word) print_word_at::w#1 w zp[2]:2 2002.0
(word) print_word_at::w#2 w zp[2]:2 5501.0
(void()) print_u8_at((byte) print_u8_at::b , (byte*) print_u8_at::at)
(byte~) print_u8_at::$0 reg byte a 200002.0
(byte~) print_u8_at::$2 reg byte y 100001.0
(label) print_u8_at::@1
(label) print_u8_at::@return
(byte*) print_u8_at::at
(byte*) print_u8_at::at#0 at zp[2]:4 20002.0
(byte*) print_u8_at::at#1 at zp[2]:4 20002.0
(byte*) print_u8_at::at#2 at zp[2]:4 36667.33333333333
(byte) print_u8_at::b
(byte) print_u8_at::b#0 b zp[1]:6 10001.0
(byte) print_u8_at::b#1 b zp[1]:6 10001.0
(byte) print_u8_at::b#2 b zp[1]:6 44000.8
(void()) print_uint_at((word) print_uint_at::w , (byte*) print_uint_at::at)
(label) print_uint_at::@1
(label) print_uint_at::@return
(byte*) print_uint_at::at
(byte*) print_uint_at::at#2 at zp[2]:4 4000.4
(word) print_uint_at::w
(word) print_uint_at::w#0 w zp[2]:2 2002.0
(word) print_uint_at::w#1 w zp[2]:2 2002.0
(word) print_uint_at::w#2 w zp[2]:2 5501.0
(void()) print_ulong_at((dword) print_ulong_at::dw , (byte*) print_ulong_at::at)
(label) print_ulong_at::@1
(label) print_ulong_at::@return
(byte*) print_ulong_at::at
(dword) print_ulong_at::dw
(dword) print_ulong_at::dw#0 dw zp[4]:9 701.0
zp[2]:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ]
zp[2]:4 [ print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ]
zp[1]:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ]
zp[2]:2 [ print_uint_at::w#2 print_uint_at::w#0 print_uint_at::w#1 ]
zp[2]:4 [ print_uint_at::at#2 print_u8_at::at#2 print_u8_at::at#0 print_u8_at::at#1 ]
zp[1]:6 [ print_u8_at::b#2 print_u8_at::b#0 print_u8_at::b#1 ]
reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ]
zp[2]:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ]
zp[4]:9 [ clock::return#2 main::$1 clock::return#0 main::cyclecount#0 print_dword_at::dw#0 ]
reg byte a [ print_byte_at::$0 ]
reg byte y [ print_byte_at::$2 ]
zp[4]:9 [ clock::return#2 main::$1 clock::return#0 main::cyclecount#0 print_ulong_at::dw#0 ]
reg byte a [ print_u8_at::$0 ]
reg byte y [ print_u8_at::$2 ]

View File

@ -20,63 +20,63 @@ main: {
__b1:
// clock()
jsr clock
// print_dword_at(clock(), SCREEN)
jsr print_dword_at
// print_ulong_at(clock(), SCREEN)
jsr print_ulong_at
jmp __b1
}
// Print a dword as HEX at a specific position
// print_dword_at(dword zp(9) dw)
print_dword_at: {
// Print a unsigned long as HEX at a specific position
// print_ulong_at(dword zp(9) dw)
print_ulong_at: {
.label dw = 9
// print_word_at(>dw, at)
// print_uint_at(>dw, at)
lda.z dw+2
sta.z print_word_at.w
sta.z print_uint_at.w
lda.z dw+3
sta.z print_word_at.w+1
sta.z print_uint_at.w+1
lda #<SCREEN
sta.z print_word_at.at
sta.z print_uint_at.at
lda #>SCREEN
sta.z print_word_at.at+1
jsr print_word_at
// print_word_at(<dw, at+4)
sta.z print_uint_at.at+1
jsr print_uint_at
// print_uint_at(<dw, at+4)
lda.z dw
sta.z print_word_at.w
sta.z print_uint_at.w
lda.z dw+1
sta.z print_word_at.w+1
sta.z print_uint_at.w+1
lda #<SCREEN+4
sta.z print_word_at.at
sta.z print_uint_at.at
lda #>SCREEN+4
sta.z print_word_at.at+1
jsr print_word_at
sta.z print_uint_at.at+1
jsr print_uint_at
// }
rts
}
// Print a word as HEX at a specific position
// print_word_at(word zp(2) w, byte* zp(4) at)
print_word_at: {
// Print a unsigned int as HEX at a specific position
// print_uint_at(word zp(2) w, byte* zp(4) at)
print_uint_at: {
.label w = 2
.label at = 4
// print_byte_at(>w, at)
// print_u8_at(>w, at)
lda.z w+1
sta.z print_byte_at.b
jsr print_byte_at
// print_byte_at(<w, at+2)
sta.z print_u8_at.b
jsr print_u8_at
// print_u8_at(<w, at+2)
lda.z w
sta.z print_byte_at.b
sta.z print_u8_at.b
lda #2
clc
adc.z print_byte_at.at
sta.z print_byte_at.at
adc.z print_u8_at.at
sta.z print_u8_at.at
bcc !+
inc.z print_byte_at.at+1
inc.z print_u8_at.at+1
!:
jsr print_byte_at
jsr print_u8_at
// }
rts
}
// Print a byte as HEX at a specific position
// print_byte_at(byte zp(6) b, byte* zp(4) at)
print_byte_at: {
// Print a char as HEX at a specific position
// print_u8_at(byte zp(6) b, byte* zp(4) at)
print_u8_at: {
.label b = 6
.label at = 4
// b>>4

View File

@ -19,63 +19,63 @@ main::@1: scope:[main] from main main::@2
[8] (dword) clock::return#2 ← (dword) clock::return#0
to:main::@2
main::@2: scope:[main] from main::@1
[9] (dword) print_dword_at::dw#0 ← (dword) clock::return#2
[10] call print_dword_at
[9] (dword) print_ulong_at::dw#0 ← (dword) clock::return#2
[10] call print_ulong_at
to:main::@1
(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at)
print_dword_at: scope:[print_dword_at] from main::@2
[11] (word) print_word_at::w#0 ← > (dword) print_dword_at::dw#0
[12] call print_word_at
to:print_dword_at::@1
print_dword_at::@1: scope:[print_dword_at] from print_dword_at
[13] (word) print_word_at::w#1 ← < (dword) print_dword_at::dw#0
[14] call print_word_at
to:print_dword_at::@return
print_dword_at::@return: scope:[print_dword_at] from print_dword_at::@1
(void()) print_ulong_at((dword) print_ulong_at::dw , (byte*) print_ulong_at::at)
print_ulong_at: scope:[print_ulong_at] from main::@2
[11] (word) print_uint_at::w#0 ← > (dword) print_ulong_at::dw#0
[12] call print_uint_at
to:print_ulong_at::@1
print_ulong_at::@1: scope:[print_ulong_at] from print_ulong_at
[13] (word) print_uint_at::w#1 ← < (dword) print_ulong_at::dw#0
[14] call print_uint_at
to:print_ulong_at::@return
print_ulong_at::@return: scope:[print_ulong_at] from print_ulong_at::@1
[15] return
to:@return
(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at)
print_word_at: scope:[print_word_at] from print_dword_at print_dword_at::@1
[16] (byte*) print_word_at::at#2 ← phi( print_dword_at/(const nomodify byte*) SCREEN print_dword_at::@1/(const nomodify byte*) SCREEN+(byte) 4 )
[16] (word) print_word_at::w#2 ← phi( print_dword_at/(word) print_word_at::w#0 print_dword_at::@1/(word) print_word_at::w#1 )
[17] (byte) print_byte_at::b#0 ← > (word) print_word_at::w#2
[18] (byte*) print_byte_at::at#0 ← (byte*) print_word_at::at#2
[19] call print_byte_at
to:print_word_at::@1
print_word_at::@1: scope:[print_word_at] from print_word_at
[20] (byte) print_byte_at::b#1 ← < (word) print_word_at::w#2
[21] (byte*) print_byte_at::at#1 ← (byte*) print_word_at::at#2 + (byte) 2
[22] call print_byte_at
to:print_word_at::@return
print_word_at::@return: scope:[print_word_at] from print_word_at::@1
(void()) print_uint_at((word) print_uint_at::w , (byte*) print_uint_at::at)
print_uint_at: scope:[print_uint_at] from print_ulong_at print_ulong_at::@1
[16] (byte*) print_uint_at::at#2 ← phi( print_ulong_at/(const nomodify byte*) SCREEN print_ulong_at::@1/(const nomodify byte*) SCREEN+(byte) 4 )
[16] (word) print_uint_at::w#2 ← phi( print_ulong_at/(word) print_uint_at::w#0 print_ulong_at::@1/(word) print_uint_at::w#1 )
[17] (byte) print_u8_at::b#0 ← > (word) print_uint_at::w#2
[18] (byte*) print_u8_at::at#0 ← (byte*) print_uint_at::at#2
[19] call print_u8_at
to:print_uint_at::@1
print_uint_at::@1: scope:[print_uint_at] from print_uint_at
[20] (byte) print_u8_at::b#1 ← < (word) print_uint_at::w#2
[21] (byte*) print_u8_at::at#1 ← (byte*) print_uint_at::at#2 + (byte) 2
[22] call print_u8_at
to:print_uint_at::@return
print_uint_at::@return: scope:[print_uint_at] from print_uint_at::@1
[23] return
to:@return
(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at)
print_byte_at: scope:[print_byte_at] from print_word_at print_word_at::@1
[24] (byte*) print_byte_at::at#2 ← phi( print_word_at/(byte*) print_byte_at::at#0 print_word_at::@1/(byte*) print_byte_at::at#1 )
[24] (byte) print_byte_at::b#2 ← phi( print_word_at/(byte) print_byte_at::b#0 print_word_at::@1/(byte) print_byte_at::b#1 )
[25] (byte~) print_byte_at::$0 ← (byte) print_byte_at::b#2 >> (byte) 4
[26] (byte) print_char_at::ch#0 ← *((const to_nomodify byte*) print_hextab + (byte~) print_byte_at::$0)
[27] (byte*) print_char_at::at#0 ← (byte*) print_byte_at::at#2
(void()) print_u8_at((byte) print_u8_at::b , (byte*) print_u8_at::at)
print_u8_at: scope:[print_u8_at] from print_uint_at print_uint_at::@1
[24] (byte*) print_u8_at::at#2 ← phi( print_uint_at/(byte*) print_u8_at::at#0 print_uint_at::@1/(byte*) print_u8_at::at#1 )
[24] (byte) print_u8_at::b#2 ← phi( print_uint_at/(byte) print_u8_at::b#0 print_uint_at::@1/(byte) print_u8_at::b#1 )
[25] (byte~) print_u8_at::$0 ← (byte) print_u8_at::b#2 >> (byte) 4
[26] (byte) print_char_at::ch#0 ← *((const to_nomodify byte*) print_hextab + (byte~) print_u8_at::$0)
[27] (byte*) print_char_at::at#0 ← (byte*) print_u8_at::at#2
[28] call print_char_at
to:print_byte_at::@1
print_byte_at::@1: scope:[print_byte_at] from print_byte_at
[29] (byte~) print_byte_at::$2 ← (byte) print_byte_at::b#2 & (byte) $f
[30] (byte*) print_char_at::at#1 ← (byte*) print_byte_at::at#2 + (byte) 1
[31] (byte) print_char_at::ch#1 ← *((const to_nomodify byte*) print_hextab + (byte~) print_byte_at::$2)
to:print_u8_at::@1
print_u8_at::@1: scope:[print_u8_at] from print_u8_at
[29] (byte~) print_u8_at::$2 ← (byte) print_u8_at::b#2 & (byte) $f
[30] (byte*) print_char_at::at#1 ← (byte*) print_u8_at::at#2 + (byte) 1
[31] (byte) print_char_at::ch#1 ← *((const to_nomodify byte*) print_hextab + (byte~) print_u8_at::$2)
[32] call print_char_at
to:print_byte_at::@return
print_byte_at::@return: scope:[print_byte_at] from print_byte_at::@1
to:print_u8_at::@return
print_u8_at::@return: scope:[print_u8_at] from print_u8_at::@1
[33] return
to:@return
(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at)
print_char_at: scope:[print_char_at] from print_byte_at print_byte_at::@1
[34] (byte*) print_char_at::at#2 ← phi( print_byte_at/(byte*) print_char_at::at#0 print_byte_at::@1/(byte*) print_char_at::at#1 )
[34] (byte) print_char_at::ch#2 ← phi( print_byte_at/(byte) print_char_at::ch#0 print_byte_at::@1/(byte) print_char_at::ch#1 )
print_char_at: scope:[print_char_at] from print_u8_at print_u8_at::@1
[34] (byte*) print_char_at::at#2 ← phi( print_u8_at/(byte*) print_char_at::at#0 print_u8_at::@1/(byte*) print_char_at::at#1 )
[34] (byte) print_char_at::ch#2 ← phi( print_u8_at/(byte) print_char_at::ch#0 print_u8_at::@1/(byte) print_char_at::ch#1 )
[35] *((byte*) print_char_at::at#2) ← (byte) print_char_at::ch#2
to:print_char_at::@return
print_char_at::@return: scope:[print_char_at] from print_char_at

File diff suppressed because it is too large Load Diff

View File

@ -21,19 +21,6 @@
(void()) main()
(label) main::@1
(label) main::@2
(void()) print_byte_at((byte) print_byte_at::b , (byte*) print_byte_at::at)
(byte~) print_byte_at::$0 reg byte a 200002.0
(byte~) print_byte_at::$2 reg byte y 100001.0
(label) print_byte_at::@1
(label) print_byte_at::@return
(byte*) print_byte_at::at
(byte*) print_byte_at::at#0 at zp[2]:4 20002.0
(byte*) print_byte_at::at#1 at zp[2]:4 20002.0
(byte*) print_byte_at::at#2 at zp[2]:4 36667.33333333333
(byte) print_byte_at::b
(byte) print_byte_at::b#0 b zp[1]:6 10001.0
(byte) print_byte_at::b#1 b zp[1]:6 10001.0
(byte) print_byte_at::b#2 b zp[1]:6 44000.8
(void()) print_char_at((byte) print_char_at::ch , (byte*) print_char_at::at)
(label) print_char_at::@return
(byte*) print_char_at::at
@ -44,28 +31,41 @@
(byte) print_char_at::ch#0 reg byte x 100001.0
(byte) print_char_at::ch#1 reg byte x 200002.0
(byte) print_char_at::ch#2 reg byte x 1200003.0
(void()) print_dword_at((dword) print_dword_at::dw , (byte*) print_dword_at::at)
(label) print_dword_at::@1
(label) print_dword_at::@return
(byte*) print_dword_at::at
(dword) print_dword_at::dw
(dword) print_dword_at::dw#0 dw zp[4]:9 701.0
(const to_nomodify byte*) print_hextab[] = (byte*) "0123456789abcdef"z
(void()) print_word_at((word) print_word_at::w , (byte*) print_word_at::at)
(label) print_word_at::@1
(label) print_word_at::@return
(byte*) print_word_at::at
(byte*) print_word_at::at#2 at zp[2]:4 4000.4
(word) print_word_at::w
(word) print_word_at::w#0 w zp[2]:2 2002.0
(word) print_word_at::w#1 w zp[2]:2 2002.0
(word) print_word_at::w#2 w zp[2]:2 5501.0
(void()) print_u8_at((byte) print_u8_at::b , (byte*) print_u8_at::at)
(byte~) print_u8_at::$0 reg byte a 200002.0
(byte~) print_u8_at::$2 reg byte y 100001.0
(label) print_u8_at::@1
(label) print_u8_at::@return
(byte*) print_u8_at::at
(byte*) print_u8_at::at#0 at zp[2]:4 20002.0
(byte*) print_u8_at::at#1 at zp[2]:4 20002.0
(byte*) print_u8_at::at#2 at zp[2]:4 36667.33333333333
(byte) print_u8_at::b
(byte) print_u8_at::b#0 b zp[1]:6 10001.0
(byte) print_u8_at::b#1 b zp[1]:6 10001.0
(byte) print_u8_at::b#2 b zp[1]:6 44000.8
(void()) print_uint_at((word) print_uint_at::w , (byte*) print_uint_at::at)
(label) print_uint_at::@1
(label) print_uint_at::@return
(byte*) print_uint_at::at
(byte*) print_uint_at::at#2 at zp[2]:4 4000.4
(word) print_uint_at::w
(word) print_uint_at::w#0 w zp[2]:2 2002.0
(word) print_uint_at::w#1 w zp[2]:2 2002.0
(word) print_uint_at::w#2 w zp[2]:2 5501.0
(void()) print_ulong_at((dword) print_ulong_at::dw , (byte*) print_ulong_at::at)
(label) print_ulong_at::@1
(label) print_ulong_at::@return
(byte*) print_ulong_at::at
(dword) print_ulong_at::dw
(dword) print_ulong_at::dw#0 dw zp[4]:9 701.0
zp[2]:2 [ print_word_at::w#2 print_word_at::w#0 print_word_at::w#1 ]
zp[2]:4 [ print_word_at::at#2 print_byte_at::at#2 print_byte_at::at#0 print_byte_at::at#1 ]
zp[1]:6 [ print_byte_at::b#2 print_byte_at::b#0 print_byte_at::b#1 ]
zp[2]:2 [ print_uint_at::w#2 print_uint_at::w#0 print_uint_at::w#1 ]
zp[2]:4 [ print_uint_at::at#2 print_u8_at::at#2 print_u8_at::at#0 print_u8_at::at#1 ]
zp[1]:6 [ print_u8_at::b#2 print_u8_at::b#0 print_u8_at::b#1 ]
reg byte x [ print_char_at::ch#2 print_char_at::ch#0 print_char_at::ch#1 ]
zp[2]:7 [ print_char_at::at#2 print_char_at::at#0 print_char_at::at#1 ]
zp[4]:9 [ clock::return#2 print_dword_at::dw#0 clock::return#0 ]
reg byte a [ print_byte_at::$0 ]
reg byte y [ print_byte_at::$2 ]
zp[4]:9 [ clock::return#2 print_ulong_at::dw#0 clock::return#0 ]
reg byte a [ print_u8_at::$0 ]
reg byte y [ print_u8_at::$2 ]

View File

@ -1007,7 +1007,7 @@ atan2_16: {
sbc CORDIC_ATAN2_ANGLES_16+1,y
sta.z angle+1
__b19:
// for( byte i: 0..CORDIC_ITERATIONS_16-1)
// for( char i: 0..CORDIC_ITERATIONS_16-1)
inx
cpx #CORDIC_ITERATIONS_16-1+1
bne !__b12+
@ -1081,7 +1081,7 @@ atan2_16: {
sta.z yi+1
jmp __b3
}
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// Allocates a block of size chars of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
malloc: {
.label mem = $e

View File

@ -6262,7 +6262,7 @@ atan2_16: {
jmp __b3_from___b1
}
// malloc
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// Allocates a block of size chars of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
malloc: {
.label mem = $9e
@ -9084,7 +9084,7 @@ atan2_16: {
jmp __b3_from___b1
}
// malloc
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// Allocates a block of size chars of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
malloc: {
.label mem = $e
@ -11789,7 +11789,7 @@ atan2_16: {
// [223] phi (signed word) atan2_16::yi#8 = (signed word) atan2_16::yi#1 [phi:atan2_16::@18/atan2_16::@20->atan2_16::@19#2] -- register_copy
// atan2_16::@19
__b19:
// for( byte i: 0..CORDIC_ITERATIONS_16-1)
// for( char i: 0..CORDIC_ITERATIONS_16-1)
// [224] (byte) atan2_16::i#1 ← ++ (byte) atan2_16::i#2 -- vbuxx=_inc_vbuxx
inx
// [225] if((byte) atan2_16::i#1==(const nomodify byte) CORDIC_ITERATIONS_16-(byte) 1+(byte) 1) goto atan2_16::@12 -- vbuxx_eq_vbuc1_then_la1
@ -11884,7 +11884,7 @@ atan2_16: {
jmp __b3
}
// malloc
// Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.
// Allocates a block of size chars of memory, returning a pointer to the beginning of the block.
// The content of the newly allocated block of memory is not initialized, remaining with indeterminate values.
malloc: {
.label mem = $e

Some files were not shown because too many files have changed in this diff Show More