Skip to content

Instantly share code, notes, and snippets.

void CheckIfRunningOnServer() {
char* the_path; // edx
char* current_path; // ebp
char* time_string; // eax
FILE* f; // esi
int computer_name_buffer_len; // [esp+0h] [ebp-138h] BYREF
time_t the_clock; // [esp+8h] [ebp-130h] MAPDST BYREF
char* paths[6]; // [esp+Ch] [ebp-12Ch] BYREF
char computer_name[16]; // [esp+24h] [ebp-114h] BYREF
char current_directory[260]; // [esp+34h] [ebp-104h] BYREF
# Re-enables basic debug output in the retail Carmageddon windows95 binary by patching the empty dr_dprintf function.
# Original code: https://github.com/jeff-1amstudios/carmageddon-debug-output/blob/main/dr_dprintf.s
# jeff@1amstudios.com
###############################################################################
# Virtual address of useful functions in carma95 executable.
# These std lib functions are detected by IDA - thats how we know their addresses.
###############################################################################
fputs = 0x004EC550
fopen = 0x004EBF40
MEMORY SUMMARY
==============
*** AT ERROR TIME ***
BLOCKS: 7897 (+11)
BYTES USED: 4272500 (+5140)
SUMMARISED BY TYPE, IN DESCENDING ORDER OF SIZE:
-----------------------------------------------
.main_loop
jsr keyboard_read
jsr rs232_try_read_byte
cmp #0
bne .got_byte ; if we got a byte from serial conn, goto .got_byte...
jmp .main_loop ; ... otherwise, jump back to .main_loop
.got_byte
ldy flash_screen_on_data
beq .skip_screen_flash ; if screen flashing is not enabled, jump over flashing code
inc $d020 ; border_color++
@jeff-1amstudios
jeff-1amstudios / C64-sprite-animation.asm
Last active December 2, 2021 14:43
C64 sprite animation routine
FRAME_COUNT = 10 ; constant for the nbr of sprite frames you have
.frame_counter !byte .FRAME_COUNT ; variable to keep track of how far through the animation we are
SPRITE_INITIAL_DATA_POINTER = 128 ; sprite data will be read by VIC-II at 128*64 ($2000)
on_screen_refresh
dec .frame_counter ; frame_counter variable -= 1
bne .increment_sprite_pointer ; if frame_counter > 0, goto .increment_sprite_pointer...
lda #SPRITE_INITIAL_DATA_POINTER ; ... otherwise, we should reset to the start of the animation
sta $07f8 ; reset the sprite pointer to start of sprite data
ldx #FRAME_COUNT
@jeff-1amstudios
jeff-1amstudios / sprite-0-setup.asm
Last active July 6, 2016 14:58
C64 sprite initialization example
* = $2000 ; we store data at $2000 (8192 decimal)
!bin my-sprite-data.spr
* = $c000 ; code starts at $c0000
sprite_0_setup
lda #128 ; set A=128
sta $07f8 ; store 128 in sprite #0 data pointer, data will be read by VIC-II from memory location 128*64 ($2000)
lda $d015 ; $d015 is the sprite-enable register
ora #%00000001 ; enable sprite #0
sta $d015
@jeff-1amstudios
jeff-1amstudios / alphabet.asm
Last active August 29, 2015 14:10
c64 initial screen
ldx #0 ; X = 0
.loop
txa ; copy X to A
sta $0400, x ; put A at $0400+X
sta $d800, x ; put A as a color at $d800+x. Color RAM only considers the lower 4 bits,
; so even though A will be > 15, this will wrap nicely around the 16 available colors
inx ; X=X+1
cpx #27 ; have we written enough chars?
bne .loop
rts ; all done