2019-09-27 07:38:51 +00:00
|
|
|
;
|
2020-01-10 20:17:23 +00:00
|
|
|
; 2020-01-06, Greg King
|
2019-09-27 07:38:51 +00:00
|
|
|
;
|
2019-11-16 18:11:40 +00:00
|
|
|
; /* Video mode defines */
|
|
|
|
; #define VIDEOMODE_40x30 0x00
|
|
|
|
; #define VIDEOMODE_80x60 0x02
|
2020-01-10 20:17:23 +00:00
|
|
|
; #define VIDEOMODE_320x200 0x80
|
2019-11-16 18:11:40 +00:00
|
|
|
; #define VIDEOMODE_SWAP (-1)
|
|
|
|
;
|
|
|
|
; signed char __fastcall__ videomode (signed char Mode);
|
|
|
|
; /* Set the video mode, return the old mode.
|
|
|
|
; ** Return -1 if Mode isn't valid.
|
|
|
|
; ** Call with one of the VIDEOMODE_xx constants.
|
|
|
|
; */
|
2019-09-27 07:38:51 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
.export _videomode
|
|
|
|
|
2020-01-10 20:17:23 +00:00
|
|
|
.import SCREEN_SET_MODE
|
|
|
|
.include "cx16.inc"
|
2019-09-27 07:38:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
.proc _videomode
|
2020-01-10 20:17:23 +00:00
|
|
|
ldx SCREEN_MODE ; Get old mode
|
|
|
|
phx
|
2019-11-16 18:11:40 +00:00
|
|
|
|
2020-01-10 20:17:23 +00:00
|
|
|
jsr SCREEN_SET_MODE
|
2019-11-16 18:11:40 +00:00
|
|
|
|
|
|
|
pla ; Get back old mode
|
|
|
|
ldx #>$0000 ; Clear high byte
|
2020-01-10 20:17:23 +00:00
|
|
|
bcs @L1
|
2019-11-16 18:11:40 +00:00
|
|
|
rts
|
2019-09-27 07:38:51 +00:00
|
|
|
|
2020-01-10 20:17:23 +00:00
|
|
|
; The new mode is invalid. Go back to the old one. Return -1.
|
2019-09-27 07:38:51 +00:00
|
|
|
|
2020-01-10 20:17:23 +00:00
|
|
|
@L1: sta SCREEN_MODE
|
|
|
|
dex
|
|
|
|
txa
|
2019-09-27 07:38:51 +00:00
|
|
|
rts
|
|
|
|
.endproc
|