Skip to content

Instantly share code, notes, and snippets.

@taylorza
taylorza / isodemo.asm
Created August 17, 2024 17:34
ZX Spectrum Next ISO Demo
;SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
DEVICE ZXSPECTRUMNEXT
CSPECTMAP "isodemo.map"
org $8000
ACTIVE_16K_BANK = 9
SHADOW_16K_BANK = 12
ACTIVE_8K_BANK = ACTIVE_16K_BANK*2
SHADOW_8K_BANK = SHADOW_16K_BANK*2
@taylorza
taylorza / disz80.asm
Created July 5, 2024 19:40 — forked from jblang/disz80.asm
John Kerr's DIS-Z80 with Comments
SECTION code_clib
PUBLIC disz80
PUBLIC _disz80
EXTERN fputc_cons
; This code is been found in a ZX Spectrum tool called UTILITY3 v1.3
@taylorza
taylorza / ANSI.md
Created March 26, 2023 17:37 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@taylorza
taylorza / mousetest.asm
Created October 15, 2022 20:44
ZX Spectrum Next - Mouse Example
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
DEVICE ZXSPECTRUMNEXT
CSPECTMAP "mousedemo.map"
org $8000
MouseMinX equ 0
MouseMaxX equ 319
MouseMinY equ 0
MouseMaxY equ 255
@taylorza
taylorza / ctctest.asm
Last active August 9, 2024 16:23
ZX Spectrum Next Samples
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
DEVICE ZXSPECTRUMNEXT
CSPECTMAP "ctctest.map"
org $8000
ctc0 equ $183b
main:
nextreg 7,0 ; set speed
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
DEVICE ZXSPECTRUMNEXT
CSPECTMAP "demo.map"
org $8000
macro farcall fn
ld a, $$fn
call farstub
dw fn
@taylorza
taylorza / z80_malloc.s
Created January 16, 2022 02:02 — forked from tomstorey/z80_malloc.s
malloc and free implementation in Z80 assembly
heap_start .equ 0x9000 ; Starting address of heap
heap_size .equ 0x0100 ; Number of bytes available in heap
.org 0
jp main
.org 0x100
main:
ld HL, 0x8100
# Enable Nested Virtualization
Set-VMProcessor -VMName <your-vm-name> -ExposeVirtualizationExtensions $true
# Set the network adapter for the nested VM by enabling mac address spoofing
Get-VMNetworkAdapter -VMName <your-vm-name> | Set-VMNetworkAdapter -MacAddressSpoofing On
@taylorza
taylorza / fixed32.go
Last active November 1, 2021 03:12
Example of fixed point
type fixed32 int32
func fromFloat32(f float32) fixed32 {
return fixed32((f * float32(1<<16)) + 0.5)
}
func (f fixed32) Float32() float32 {
return float32(f) / float32(1<<16)
}
@taylorza
taylorza / GO-Fillslice.md
Last active August 8, 2024 04:04
Golang - Fill slice/array with a pattern

Filling an array or slice with a repeated pattern

Looking for an efficient pure GO approach to copy repeating patterns into a slice, for a toy project, I ran a few tests and discovered a neat approach to significantly improve performance. For the toy project, I am using this to fill a background buffer with a specific RGB color pattern, so improving this performance significantly improved my acheivable framerate.

All the test were run with a buffer of 73437 bytes, allocated as follows

var bigSlice = make([]byte, 73437, 73437)

Fill the slice with the value 65 by looping through each element and setting the value