Skip to content

Commit

Permalink
Merge pull request #55 from brad-colbert/atract_mode_redo_two
Browse files Browse the repository at this point in the history
v1.2.18: Atract mode redo two
  • Loading branch information
brad-colbert authored Mar 21, 2024
2 parents ab08d97 + 8a3f946 commit da640b3
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 13 deletions.
Binary file modified YAIL.XEX
Binary file not shown.
14 changes: 11 additions & 3 deletions server/yailsrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

bind_ip = '0.0.0.0'
bind_port = 5556
connections = 0

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
Expand Down Expand Up @@ -299,6 +300,10 @@ def handle_client_connection(client_socket):
# Set up a new event loop for this thread
#loop = asyncio.new_event_loop()
#asyncio.set_event_loop(loop)
global connections

connections = connections + 1
print('Starting Connection:', connections)

gfx_mode = GRAPHICS_9
try:
Expand Down Expand Up @@ -357,6 +362,9 @@ def handle_client_connection(client_socket):

finally:
client_socket.close()
print('Closing Connection:', connections)
connections = connections - 1

#loop.close() # Close the loop when done

import signal
Expand All @@ -367,7 +375,7 @@ def handler(signum, frame):
signal.signal(signal.SIGINT, handler)

def main():
threads = []
#threads = []
while True:
client_sock, address = server.accept()
print('Accepted connection from {}:{}'.format(address[0], address[1]))
Expand All @@ -377,8 +385,8 @@ def main():
)
client_handler.daemon = True
client_handler.start()
threads.append(client_handler)
print('Connections:', len(threads))
#threads.append(client_handler)
#print('Connections:', len(threads))
'''
try:
except KeyboardInterrupt:
Expand Down
19 changes: 14 additions & 5 deletions src/disable_atract_vbi.s
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
;; Simple VBI routine to disable the attract mode

.export _add_attract_disable_vbi
.export disable_atract
.export _remove_attract_disable_vbi

.segment "DATA"
.import _ORIG_VBII_SAVE

.segment "CODE"

Expand All @@ -14,7 +14,7 @@ SYSVBV = $E45F
ATRACT = $4D

; Disable ATRACT mode by setting the "register" to zero
.PROC disable_atract
.PROC disable_attract
pha
lda #0
sta ATRACT
Expand All @@ -25,8 +25,17 @@ ATRACT = $4D
_add_attract_disable_vbi:

lda #6 ; Immediate mode
ldy #<disable_atract ; hight byte of address
ldx #>disable_atract ; low byte of address
ldy #<disable_attract ; high byte of address
ldx #>disable_attract ; low byte of address
jsr SETVBV

rts

_remove_attract_disable_vbi:

lda #6 ; Immediate mode
ldy _ORIG_VBII_SAVE ; high byte of address
ldx _ORIG_VBII_SAVE+1 ; low byte of address
jsr SETVBV

rts
Expand Down
2 changes: 2 additions & 0 deletions src/imgload.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ char version[] = "YAIL (Yet Another Image Loader) v" TOSTR(MAJOR_VERSION) "." TO
byte buff[256]; // A block of memory to be used by all.
bool done = false;
extern Settings settings;
extern ushort ORIG_VBII_SAVE;

void help()
{
Expand Down Expand Up @@ -80,6 +81,7 @@ int main(int argc, char* argv[])
clearFrameBuffer();

// Stop the attract mode
ORIG_VBII_SAVE = OS.vvblki;
add_attract_disable_vbi();

// Show console on startup
Expand Down
9 changes: 7 additions & 2 deletions src/netimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ void show_error_and_close_network(const char* message)

char stream_image(char* args[])
{
byte ATRACT_MODE_SAVE = OS.atract;
const ushort bytes_per_line = 40;
const ushort lines = 220;
ushort buffer_start;
Expand Down Expand Up @@ -122,6 +121,10 @@ char stream_image(char* args[])
return 0x0;
}

// We are starting streaming so remove the attract mode disbale VBI becasue we will
// diable attract mode ourselves.
remove_attract_disable_vbi();

while(true)
{
buffer_start = (ushort)image.data;
Expand Down Expand Up @@ -202,7 +205,9 @@ char stream_image(char* args[])
network_close(settings.url);

OS.soundr = 3; // Restore SIO beeping sound
OS.atract = ATRACT_MODE_SAVE;

// We are no longer streaming so disable attract mode with a VBI
add_attract_disable_vbi();

return input;
}
10 changes: 8 additions & 2 deletions src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ uint8_t put_settings(byte select)
{
byte keylen = strlen(settings.url);

if (0 == sio_openkey(&data, 1, FN_URL_KEY_ID))
r = sio_openkey(&data, 1, FN_URL_KEY_ID);

if (1 == r)
return 1;

strncpy((char *)data.write.value, settings.url, MAX_APPKEY_LEN);
r = fn_io_appkey_write(keylen, &data.write);

Expand All @@ -121,8 +124,11 @@ uint8_t put_settings(byte select)
break;
case SETTINGS_GFX:
{
if (0 == sio_openkey(&data, 1, FN_GFX_KEY_ID))
r = sio_openkey(&data, 1, FN_GFX_KEY_ID);

if (1 == r)
return 1;

data.write.value[0] = settings.gfx_mode & ~GRAPHICS_CONSOLE_EN; // Don't capture the console bit
r = fn_io_appkey_write(1, &data.write);

Expand Down
4 changes: 4 additions & 0 deletions src/utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include <conio.h>
#include <stdbool.h>
#include <atari.h>

// Globals
ushort ORIG_VBII_SAVE;// = OS.vvblki;

void pause(const char* message)
{
Expand Down
1 change: 1 addition & 0 deletions src/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ void internal_to_atascii(char* buff, byte len);
void atascii_to_internal(char* buff, byte len);
void show_error(const char* message);
extern void add_attract_disable_vbi();
extern void remove_attract_disable_vbi();

#endif
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

#define MAJOR_VERSION 1
#define MINOR_VERSION 2
#define BUILD_VERSION 17
#define BUILD_VERSION 18

#endif // YAIL_VERSION_H

0 comments on commit da640b3

Please sign in to comment.