ORG CODE%ELITE SPRITESMACRO SPRITE2 pixel_row SPRITE2_BYTE MID$(pixel_row, 1, 8) SPRITE2_BYTE MID$(pixel_row, 9, 8) SPRITE2_BYTE MID$(pixel_row, 17, 8) ENDMACROName: SPRITE2 [Show more] Type: Macro Category: Sprites Summary: Macro definition for a two-colour sprite pixel rowContext: See this macro on its own page References: This macro is used as follows: * spritp uses SPRITE2
This macro inserts three bytes of a two-colour sprite pixel row, with eight pixels per byte (i.e. eight pixels per character block).
Arguments: pixel_row A string containing a row of 24 pixels, where each pixel is defined as follows: * X denotes colour 1 * Anything else denotes colour 0MACRO SPRITE2_BYTE pixel_byte bit7 = -(ASC(MID$(pixel_byte, 1, 1)) = ASC("X")) << 7 bit6 = -(ASC(MID$(pixel_byte, 2, 1)) = ASC("X")) << 6 bit5 = -(ASC(MID$(pixel_byte, 3, 1)) = ASC("X")) << 5 bit4 = -(ASC(MID$(pixel_byte, 4, 1)) = ASC("X")) << 4 bit3 = -(ASC(MID$(pixel_byte, 5, 1)) = ASC("X")) << 3 bit2 = -(ASC(MID$(pixel_byte, 6, 1)) = ASC("X")) << 2 bit1 = -(ASC(MID$(pixel_byte, 7, 1)) = ASC("X")) << 1 bit0 = -(ASC(MID$(pixel_byte, 8, 1)) = ASC("X")) << 0 EQUB bit7 + bit6 + bit5 + bit4 + bit3 + bit2 + bit1 + bit0 ENDMACROName: SPRITE2_BYTE [Show more] Type: Macro Category: Sprites Summary: Macro definition for a two-colour sprite pixel byteContext: See this macro on its own page References: No direct references to this macro in this source file
This macro inserts one byte of a two-colour sprite pixel row, with eight pixels per byte (i.e. eight pixels per character block). In BeebAsm, true statements evaluate to -1 while false statements evaluate to 0 (just as in BBC BASIC), so this statement: bit7 = -(ASC(MID$(pixel_byte, 1, 1)) = ASC("X")) << 7 does the same as this longer statement: IF ASC(MID$(pixel_byte, 1, 1)) = ASC("X") bit7 = 1 << 7 ELSE bit7 = 0 ENDIF In other words, bit7 gets set to 1 << 7 (i.e. %10000000) if character 1 of pixel_byte is "X", otherwise it gets set to 0.
Arguments: pixel_byte A string containing a row of 8 pixels, where each pixel is defined as follows: * "X" denotes colour 1 * Anything else (e.g. "." or "+") denotes colour 0MACRO SPRITE4 pixel_row SPRITE4_BYTE MID$(pixel_row, 1, 4) SPRITE4_BYTE MID$(pixel_row, 5, 4) SPRITE4_BYTE MID$(pixel_row, 9, 4) ENDMACROName: SPRITE4 [Show more] Type: Macro Category: Sprites Summary: Macro definition for a four-colour sprite pixel rowContext: See this macro on its own page References: This macro is used as follows: * spritp uses SPRITE4
This macro inserts three bytes of a four-colour sprite pixel row, with four pixels per byte (i.e. four pixels per character block).
Arguments: pixel_row A string containing a row of 12 pixels, where each pixel is defined as follows: * "/" denotes colour 1 * "*" denotes colour 2 * "@" denotes colour 3 * Anything else (e.g. ".") denotes colour 0MACRO SPRITE4_BYTE pixel_byte bit67_1 = (%01 * -(ASC(MID$(pixel_byte, 1, 1)) = ASC("/"))) << 6 bit67_2 = (%10 * -(ASC(MID$(pixel_byte, 1, 1)) = ASC("*"))) << 6 bit67_3 = (%11 * -(ASC(MID$(pixel_byte, 1, 1)) = ASC("@"))) << 6 bit45_1 = (%01 * -(ASC(MID$(pixel_byte, 2, 1)) = ASC("/"))) << 4 bit45_2 = (%10 * -(ASC(MID$(pixel_byte, 2, 1)) = ASC("*"))) << 4 bit45_3 = (%11 * -(ASC(MID$(pixel_byte, 2, 1)) = ASC("@"))) << 4 bit23_1 = (%01 * -(ASC(MID$(pixel_byte, 3, 1)) = ASC("/"))) << 2 bit23_2 = (%10 * -(ASC(MID$(pixel_byte, 3, 1)) = ASC("*"))) << 2 bit23_3 = (%11 * -(ASC(MID$(pixel_byte, 3, 1)) = ASC("@"))) << 2 bit01_1 = (%01 * -(ASC(MID$(pixel_byte, 4, 1)) = ASC("/"))) << 0 bit01_2 = (%10 * -(ASC(MID$(pixel_byte, 4, 1)) = ASC("*"))) << 0 bit01_3 = (%11 * -(ASC(MID$(pixel_byte, 4, 1)) = ASC("@"))) << 0 bit67 = bit67_1 + bit67_2 + bit67_3 bit45 = bit45_1 + bit45_2 + bit45_3 bit23 = bit23_1 + bit23_2 + bit23_3 bit01 = bit01_1 + bit01_2 + bit01_3 EQUB bit67 + bit45 + bit23 + bit01 ENDMACROName: SPRITE4_BYTE [Show more] Type: Macro Category: Sprites Summary: Macro definition for a four-colour sprite pixel byteContext: See this macro on its own page References: No direct references to this macro in this source file
This macro inserts one byte of a four-colour sprite pixel row, with four pixels per byte (i.e. four pixels per character block). In BeebAsm, true statements evaluate to -1 while false statements evaluate to 0 (just as in BBC BASIC), so this statement: bit67_1 = (%01 * -(ASC(MID$(pixel_byte, 1, 1)) = ASC("/"))) << 6 does the same as this longer statement: IF ASC(MID$(pixel_byte, 1, 1)) = ASC("/") bit67_1 = %01 << 6 ELSE bit67_1 = 0 ENDIF In other words, bit67_1 gets set to %01 << 6 (i.e. %01000000) if character 1 of pixel_byte is "/", otherwise it gets set to 0.
Arguments: pixel_byte A string containing a row of 4 pixels, where each pixel is defined as follows: * "/" denotes colour 1 * "*" denotes colour 2 * "@" denotes colour 3 * Anything else (e.g. ".") denotes colour 0.spritp SPRITE2 "........................" ; The laser sights for a pulse laser SPRITE2 "........................" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "..XXXXX....+....XXXXX..." SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "........................" SPRITE2 "........................" EQUB $3A ; This byte appears to be unused and just contains ; random workspace noise left over from the BBC Micro ; assembly process SPRITE2 "........................" ; The laser sights for a beam laser SPRITE2 "........................" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 ".....XXXXXXXXXXXXX......" SPRITE2 ".....X...........X......" SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "...........+............" SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "........................" SPRITE2 ".....X...........X......" SPRITE2 ".....XXXXXXXXXXXXX......" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "...........X............" SPRITE2 "........................" SPRITE2 "........................" EQUB $31 ; This byte appears to be unused and just contains ; random workspace noise left over from the BBC Micro ; assembly process SPRITE2 "........................" ; The laser sights for a military laser SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "........XXXXXXX........." SPRITE2 ".........X...X.........." SPRITE2 "..........X.X..........." SPRITE2 "...........X............" SPRITE2 "..XX...............XX..." SPRITE2 "..X.X.............X.X..." SPRITE2 "..X..X...........X..X..." SPRITE2 "..X...X....+....X...X..." SPRITE2 "..X..X...........X..X..." SPRITE2 "..X.X.............X.X..." SPRITE2 "..XX...............XX..." SPRITE2 "...........X............" SPRITE2 "..........X.X..........." SPRITE2 ".........X...X.........." SPRITE2 "........XXXXXXX........." SPRITE2 "........................" SPRITE2 "........................" SPRITE2 "........................" EQUB $45 ; This byte appears to be unused and just contains ; random workspace noise left over from the BBC Micro ; assembly process SPRITE2 "..XXXXXXXXXXXXXXXXXXX..." ; The laser sights for a mining laser SPRITE2 "..X........X........X..." SPRITE2 "..X.......XXX.......X..." SPRITE2 "....X......X......X....." SPRITE2 "XX...X....XXX....X...XX." SPRITE2 "X.....X....X....X.....X." SPRITE2 "X......X..XXX..X......X." SPRITE2 "X..........X..........X." SPRITE2 "X........XXXXX........X." SPRITE2 "X.X..XX..X...X..XX..X.X." SPRITE2 "XXXXXX.....X.....XXXXXX." SPRITE2 "X.X..XX..X...X..XX..X.X." SPRITE2 "X........XXXXX........X." SPRITE2 "X..........X..........X." SPRITE2 "X......X..XXX..X......X." SPRITE2 "X.....X....X....X.....X." SPRITE2 "XX...X....XXX....X...XX." SPRITE2 "....X......X......X....." SPRITE2 "..X.......XXX.......X..." SPRITE2 "..X........X........X..." SPRITE2 "..XXXXXXXXXXXXXXXXXXX..." EQUB $A3 ; This byte appears to be unused and just contains ; random workspace noise left over from the BBC Micro ; assembly process SPRITE2 "........................" ; The explosion cloud sprite SPRITE2 ".........X....XX........" SPRITE2 "...X....XX..X...X......." SPRITE2 ".....X....XX...XXX......" SPRITE2 "...X..XX.....X..XX..X..." SPRITE2 "....X.....X.XX....X..X.." SPRITE2 ".X.XX..X..X.XX.XXX..XX.." SPRITE2 "...X..XX.X.X.XX...XXX..." SPRITE2 "XX..X.X..XX.XXX....X.XX." SPRITE2 "....XXX..XX.XX.XX...X.XX" SPRITE2 "..X.....XX.XX.XXX..XX..." SPRITE2 ".....XX.XX..X.XXX.XX...." SPRITE2 "..X...XXX.X.X..XX...X.X." SPRITE2 "X...XXX..XX.XX.XX...X.XX" SPRITE2 "...X..XX..X..X..XX..X..." SPRITE2 "..XX..XX..X.XX.XX..X.X.." SPRITE2 "....X....XX...XXX...X..." SPRITE2 "...XX........X....X....." SPRITE2 "...XX...XX....X.....XX.." SPRITE2 "........XX..X...X......." SPRITE2 ".............XX........." EQUB $44 ; This byte appears to be unused and just contains ; random workspace noise left over from the BBC Micro ; assembly process SPRITE4 ".....***...." ; A Trumble looking to the right SPRITE4 "..*.*****..." SPRITE4 "..***/*/**.." SPRITE4 ".**********." SPRITE4 "..**********" SPRITE4 ".*/***/****." SPRITE4 "****/*******" SPRITE4 ".********/*." SPRITE4 "************" SPRITE4 "************" SPRITE4 ".**********." SPRITE4 "***@@***@@**" SPRITE4 "**@@@@*@@@@*" SPRITE4 "**@@*@*@@*@*" SPRITE4 "***@@***@@**" SPRITE4 ".**********." SPRITE4 "..********.." SPRITE4 "...******..." SPRITE4 "....*//*...." SPRITE4 ".....//....." SPRITE4 "............" EQUB $44 ; This byte appears to be unused and just contains ; random workspace noise left over from the BBC Micro ; assembly process SPRITE4 "............" ; A Trumble looking to the left SPRITE4 "............" SPRITE4 "......**...." SPRITE4 "..**.****..." SPRITE4 ".*****/***.." SPRITE4 ".**********." SPRITE4 "****/******." SPRITE4 ".**********." SPRITE4 "************" SPRITE4 "************" SPRITE4 ".**********." SPRITE4 "***@@***@@**" SPRITE4 "**@@@@*@@@@*" SPRITE4 "**@*@@*@*@@*" SPRITE4 "***@@***@@**" SPRITE4 ".**********." SPRITE4 "..********.." SPRITE4 ".../****/..." SPRITE4 "....*//*...." SPRITE4 ".....//....." SPRITE4 "............" EQUB $54 ; This byte appears to be unused and just contains ; random workspace noise left over from the BBC Micro ; assembly processName: spritp [Show more] Type: Variable Category: Sprites Summary: Sprite definitions for four laser sights, the explosion sprite and two TrumblesContext: See this variable on its own page References: No direct references to this variable in this source filePRINT "P% = ", ~P% PRINT "S.C.SPRITE ", ~CODE%, " +1C0" SAVE "3-assembled-output/SPRITE.bin", CODE%, P%, LOAD%Save SPRITE.bin
[X]
Macro SPRITE2 (category: Sprites)
Macro definition for a two-colour sprite pixel row
[X]
Macro SPRITE2_BYTE (category: Sprites)
Macro definition for a two-colour sprite pixel byte
[X]
Macro SPRITE4 (category: Sprites)
Macro definition for a four-colour sprite pixel row
[X]
Macro SPRITE4_BYTE (category: Sprites)
Macro definition for a four-colour sprite pixel byte
[X]
Configuration variable bit0 in macro SPRITE2_BYTE
[X]
Configuration variable bit01 in macro SPRITE4_BYTE
[X]
Configuration variable bit1 in macro SPRITE2_BYTE
[X]
Configuration variable bit2 in macro SPRITE2_BYTE
[X]
Configuration variable bit23 in macro SPRITE4_BYTE
[X]
Configuration variable bit3 in macro SPRITE2_BYTE
[X]
Configuration variable bit4 in macro SPRITE2_BYTE
[X]
Configuration variable bit45 in macro SPRITE4_BYTE
[X]
Configuration variable bit5 in macro SPRITE2_BYTE
[X]
Configuration variable bit6 in macro SPRITE2_BYTE
[X]
Configuration variable bit67 in macro SPRITE4_BYTE
[X]
Configuration variable bit7 in macro SPRITE2_BYTE