├── Binaries ├── v1.0 │ ├── gui64.d64 │ └── gui64.prg └── v1.81 │ ├── gui64.d64 │ └── gui64.prg ├── Code ├── v1.0 │ ├── Constants.asm │ ├── ControlFunctions.asm │ ├── ControlPaintFunctions.asm │ ├── Data.asm │ ├── DialogFunctions.asm │ ├── DiskOperations.asm │ ├── DriveWindow.asm │ ├── Events.asm │ ├── GUI64.asm │ ├── GUI64.c64 │ ├── GUI64.s64 │ ├── Graphics.asm │ ├── IRQ.asm │ ├── Macros.asm │ ├── Math.asm │ ├── MemoryManagement.asm │ ├── MenuFunctions.asm │ ├── MouseJoy.asm │ ├── NoGUI.asm │ ├── PaintFunctions.asm │ ├── SettingsWindow.asm │ ├── Sprites.asm │ ├── StdWindowProc.asm │ ├── StringRoutines.asm │ ├── StringsAndControls.asm │ ├── TaskBar.asm │ ├── TaskbarChars5.bin │ ├── WindowFunctions.asm │ ├── WindowManagement.asm │ └── chars26.bin └── v1.81 │ ├── Constants.asm │ ├── ControlFunctions.asm │ ├── ControlPaintFunctions.asm │ ├── Data.asm │ ├── DialogProcs.asm │ ├── DiskOperations.asm │ ├── DriveWindow.asm │ ├── Events.asm │ ├── GUI64.asm │ ├── GUI64.c64 │ ├── GUI64.s64 │ ├── Graphics.asm │ ├── IRQ.asm │ ├── KeyMouseJoy.asm │ ├── Macros.asm │ ├── Math.asm │ ├── MemoryManagement.asm │ ├── MenuFunctions.asm │ ├── NoGUI.asm │ ├── PaintFunctions.asm │ ├── SD2IEC.asm │ ├── SettingsWindow.asm │ ├── ShowDialogs.asm │ ├── Sprites.asm │ ├── StdWindowProc.asm │ ├── StringRoutines.asm │ ├── StringsAndControls.asm │ ├── TaskBar.asm │ ├── TaskbarChars6.bin │ ├── ViewerWindow.asm │ ├── WindowFunctions.asm │ ├── WindowManagement.asm │ └── chars39.bin ├── GUI64.png ├── GUI64_Documentation.txt ├── License.txt └── README.md /Binaries/v1.0/gui64.d64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Binaries/v1.0/gui64.d64 -------------------------------------------------------------------------------- /Binaries/v1.0/gui64.prg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Binaries/v1.0/gui64.prg -------------------------------------------------------------------------------- /Binaries/v1.81/gui64.d64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Binaries/v1.81/gui64.d64 -------------------------------------------------------------------------------- /Binaries/v1.81/gui64.prg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Binaries/v1.81/gui64.prg -------------------------------------------------------------------------------- /Code/v1.0/Constants.asm: -------------------------------------------------------------------------------- 1 | ; Addresses 2 | VICBANK = $4000 3 | CLRMEM = $d800 4 | std_irq = $ea31 5 | VIC = $d000 6 | SID = $d400 7 | BASIC_ERR_START = $a19e 8 | ; 9 | FREEMEM = CHARBASE - $0100 10 | CHARBASE = $5800 11 | TASKCHARBASE = $6000 12 | SPRITEBASE = $6400 13 | SCRMEM = $6c00 14 | CLRMEM_MINUS_SCRMEM = CLRMEM - SCRMEM 15 | ; 16 | WND_HEAP = $7000; 16 wnd structs, must be $xx00 !!! 17 | CONTROL_HEAP = $7100; 7 * 16 = 112 control structs 18 | SCR_BUF = $7800 19 | TASKBAR_BUF = $7b70 20 | CLR_BUF = SCR_BUF + $0400 21 | STRING_LIST_DRIVE8 = $8000 22 | STRING_LIST_DRIVE9 = $9000 23 | ; 24 | ; For quickly changing the char set 25 | MAINCHARSHI = (>(CHARBASE - VICBANK))/4 26 | TASKCHARSHI = (>(CHARBASE + $0800 - VICBANK))/4 27 | ; Application 28 | MAX_WND_NUMBER = 16 29 | MAXED = 255 30 | DRVWND_HEIGHT = 13 31 | ; 32 | ; Cursors 33 | CUR_DEFAULT = 0 34 | CUR_RESIZENWSE = 1 35 | CUR_RESIZENS = 2 36 | CUR_RESIZEWE = 3 37 | CUR_CARRET = 4 38 | ; Window struct members 39 | WNDSTRUCT_HANDLE = 0 40 | WNDSTRUCT_TYPE = 1 41 | WNDSTRUCT_COLOR = 2 42 | WNDSTRUCT_BITS = 3 43 | WNDSTRUCT_POSX = 4 44 | WNDSTRUCT_POSY = 5 45 | WNDSTRUCT_WIDTH = 6 46 | WNDSTRUCT_HEIGHT = 7 47 | WNDSTRUCT_TITLESTRING = 8 ; ptr 48 | WNDSTRUCT_FIRSTCONTROL = 10 ; ptr 49 | WNDSTRUCT_NUMCONTROLS = 12 50 | WNDSTRUCT_FOCUSED_CTRL = 13 51 | ; Window Bits 52 | BIT_WND_HASMENU = %00000001 53 | BIT_WND_RESIZABLE = %00000010 54 | BIT_WND_FIXEDWIDTH = %00000100 55 | BIT_WND_FIXEDHEIGHT = %00001000 56 | BIT_WND_CANMAXIMIZE = %00010000 57 | BIT_WND_CANMINIMIZE = %00100000 58 | BIT_WND_ISMINIMIZED = %01000000 59 | BIT_WND_ISMAXIMIZED = %10000000 60 | ;---------------------------------- 61 | ; Control struct members 62 | ; 63 | CTRLSTRUCT_PARENT = 0 64 | CTRLSTRUCT_INDEX = 1 65 | CTRLSTRUCT_TYPE = 2 66 | CTRLSTRUCT_COLOR = 3 67 | CTRLSTRUCT_POSX = 4 68 | CTRLSTRUCT_POSY = 5 69 | CTRLSTRUCT_WIDTH = 6 70 | CTRLSTRUCT_HEIGHT = 7 71 | CTRLSTRUCT_BITS = 8 72 | CTRLSTRUCT_HIGHLIGHTED_INDEX = 9 73 | CTRLSTRUCT_TOP_INDEX = 10 74 | CTRLSTRUCT_NUMSTRINGS = 11 75 | CTRLSTRUCT_STRINGS = 12 76 | CTRLSTRUCT_ID = 14 77 | ; 78 | ; For Menubar control 79 | CTRLSTRUCT_MENULIST = 4 80 | ; For UpDown control 81 | CTRLSTRUCT_LOWERLIMIT = 8 82 | CTRLSTRUCT_UPPERLIMIT = 9 83 | CTRLSTRUCT_DIGIT_LO = 10 84 | CTRLSTRUCT_DIGIT_HI = 11 85 | ; For Progressbar control 86 | CTRLSTRUCT_MAX_LO = 10 87 | CTRLSTRUCT_MAX_HI = 11 88 | CTRLSTRUCT_VAL_LO = 12 89 | CTRLSTRUCT_VAL_HI = 13 90 | ; For Edit_SL control 91 | CTRLSTRUCT_CARRETPOS = 9 92 | CTRLSTRUCT_MAX_STRLEN = 10 93 | CTRLSTRUCT_FORBIDDEN = 14; ptr to forbidden chars 94 | ;---------------------------------- 95 | ; Control Bits 96 | BIT_CTRL_ISMAXIMIZED = %00000001 97 | BIT_CTRL_ISPRESSED = %00000010 98 | BIT_CTRL_UPPERCASE = %00000100 99 | ; Window Types (do not start with 0!!!) 100 | WT_DRIVE_8 = 1 101 | WT_DRIVE_9 = 2 102 | WT_SETTINGS = 3 103 | WT_DLG = 32 ; dummy - must be overwritten 104 | WT_DLG_INFO = 33 105 | WT_DLG_CLOCK = 34 106 | WT_DLG_YESNO = 35 107 | WT_DLG_RENAME = 36 108 | WT_DLG_FORMAT = 37 109 | WT_DLG_DISKINFO = 38 110 | WT_DLG_COPYFILE = 39 111 | WT_TEST = 255 112 | ; Control Types (must not be zero!!!) 113 | CT_MENUBAR = 255 114 | CT_BUTTON = 1 115 | CT_LISTBOX = 2 116 | CT_FILELISTSCROLLBOX = 3 117 | CT_LABEL = 4 118 | CT_EDIT_SL = 5 119 | CT_EDIT_ML = 6 120 | CT_FRAME = 7 121 | CT_COLORPICKER = 8 122 | CT_RADIOBUTTONGROUP = 9 123 | CT_LABEL_ML = 10 124 | CT_UPDOWN = 11 125 | CT_PROGRESSBAR = 12 126 | CT_COLBOXLABEL = 13 127 | ; Control IDs 128 | ID_BTN_CANCEL = 1 129 | ID_BTN_APPLY = 2 130 | ID_BTN_OK = 3 131 | ID_BTN_SET = 4 132 | ID_BTN_YES = 5 133 | ID_BTN_NO = 6 134 | ; Menu (and MenuItem) IDs 135 | ID_MENU_START = 0 136 | ID_MENU_COLORPICKER = 1 137 | ID_MENU_DISK = 2 138 | ID_MENU_FILE = 3 139 | ID_MI_DISKREFRESH = 0 140 | ID_MI_DISKINFO = 1 141 | ID_MI_DISKFORMAT = 2 142 | ID_MI_DISKRENAME = 3 143 | ID_MI_DISKCLOSE = 4 144 | ID_MI_FILECUT = 0 145 | ID_MI_FILECOPY = 1 146 | ID_MI_FILEPASTE = 2 147 | ID_MI_FILEDELETE = 3 148 | ID_MI_FILERENAME = 4 149 | ID_MI_FILERUN = 5 150 | ID_MI_FILEBOOT = 6 151 | ; Menu types 152 | MT_NORMAL = 0 153 | MT_COLORPICKER = 1 154 | ; VIC Addresses 155 | xPos0 = VIC 156 | yPos0 = VIC+1 157 | xPos1 = VIC+2 158 | yPos1 = VIC+3 159 | xPos2 = VIC+4 160 | yPos2 = VIC+5 161 | xPos3 = VIC+6 162 | yPos3 = VIC+7 163 | xPos4 = VIC+8 164 | yPos4 = VIC+9 165 | xPos5 = VIC+10 166 | yPos5 = VIC+11 167 | xPos6 = VIC+12 168 | yPos6 = VIC+13 169 | xPos7 = VIC+14 170 | yPos7 = VIC+15 171 | xposmsb = VIC+16 172 | SPR_VIS = VIC+21 173 | SPR_STRETCH_VERT = VIC+23 174 | SPR_PRIORITY = VIC+27 175 | SPR_STRETCH_HORZ = VIC+29 176 | FRAMECOLOR = VIC+32 177 | BKGCOLOR = VIC+33 178 | MULTICOLOR1 = VIC+34 179 | MULTICOLOR2 = VIC+35 180 | col0 = VIC+39 181 | col1 = VIC+40 182 | col2 = VIC+41 183 | col3 = VIC+42 184 | col4 = VIC+43 185 | col5 = VIC+44 186 | col6 = VIC+45 187 | col7 = VIC+46 188 | CL_BLACK = 0 189 | CL_WHITE = 1 190 | CL_RED = 2 191 | CL_CYAN = 3 192 | CL_MAGENTA = 4 193 | CL_DARKGREEN = 5 194 | CL_DARKBLUE = 6 195 | CL_YELLOW = 7 196 | CL_ORANGE = 8 197 | CL_BROWN = 9 198 | CL_ROSE = 10 199 | CL_DARKGRAY = 11 200 | CL_MIDGRAY = 12 201 | CL_LIGHTGREEN = 13 202 | CL_LIGHTBLUE = 14 203 | CL_LIGHTGRAY = 15 204 | SPRPTR_0 = SCRMEM+1016 205 | SPRPTR_1 = SCRMEM+1017 206 | SPRPTR_2 = SCRMEM+1018 207 | SPRPTR_3 = SCRMEM+1019 208 | SPRPTR_4 = SCRMEM+1020 209 | SPRPTR_5 = SCRMEM+1021 210 | SPRPTR_6 = SCRMEM+1022 211 | SPRPTR_7 = SCRMEM+1023 212 | ; Dialog Modes 213 | DM_RESET = 0 214 | ; Game Modes 215 | GM_NORMAL = 0 216 | GM_MENU = 1 217 | GM_DIALOG = 255 218 | ; Exit Codes 219 | EC_RBTNPRESS = 1 220 | EC_RBTNRELEASE = 2 221 | EC_LBTNPRESS = 3 222 | EC_LBTNRELEASE = 4 223 | EC_MOUSEMOVE = 5 224 | EC_GAMEEXIT = 6 225 | EC_DBLCLICK = 7 226 | EC_SCROLLDOWN = 8 227 | EC_SCROLLUP = 9 228 | EC_KEYPRESS = 10 229 | EC_LLBTNPRESS = 11 230 | EC_RUNFILE = 12 231 | EC_BOOTFILE = 13 232 | ; Other 233 | StartMenuWidth = 10 234 | StartMenuHeight = 5 235 | StartMenuItems = 2 236 | TB_Reserved_Char = 118 237 | TB_Reserved = TaskbarChars+TB_Reserved_Char*8 238 | DT_Reserved_Char = 240 239 | DT_Reserved = Chars+DT_Reserved_Char*8 240 | ;Sprite Blocks 241 | SP_Mouse0 = Mousepointer0/64 242 | SP_Mouse1 = Mousepointer1/64 243 | SP_Commodore1 = Commodore1/64 244 | SP_Commodore2 = Commodore2/64 245 | SP_StartBtnUL = StartBtnUL/64 246 | SP_StartBtnLR = StartBtnLR/64 247 | SP_Balken = Balken/64 248 | SP_BalkenSchmal = BalkenSchmal/64 249 | SP_ResizeCursorNWSE0 = ResizeCursorNWSE0/64 250 | SP_ResizeCursorNWSE1 = ResizeCursorNWSE1/64 251 | SP_ResizeCursorNS0 = ResizeCursorNS0/64 252 | SP_ResizeCursorNS1 = ResizeCursorNS1/64 253 | SP_ResizeCursorWE0 = ResizeCursorWE0/64 254 | SP_ResizeCursorWE1 = ResizeCursorWE1/64 255 | SP_CarretCursor = CarretCursor/64 256 | 257 | ; Routines in Kernal ROM and BASIC ROM 258 | STATUS = $90 ; status register 259 | STROUT = $AB1E ; Prints string in A (lo) and Y (hi) to output file defined by CHKOUT 260 | CLRSCR = $E544 ; Clears the screen 261 | RESTOR = $FF8A ; Restores the standard kernal vectors in the extended zero page 262 | LSTNSA = $FF93 ; Send LISTEN secondary address to serial bus. (Must call LISTEN beforehands.) 263 | ; Input: A = Secondary address.; Output: –; Used registers: A. 264 | TALKSA = $FF96 ; Send TALK secondary address to serial bus. (Must call TALK beforehands.) 265 | ; Input: A = Secondary address; Output: –; Used registers: A. 266 | IECIN = $FFA5 ; Read byte from serial bus. (Must call TALK and TALKSA beforehands.) 267 | ; Input: –; Output: A = Byte read; Used registers: A. 268 | IECOUT = $FFA8 ; Write byte to serial bus. (Must call LISTEN and LSTNSA beforehands.) 269 | ; Input: A = Byte to write.; Output: –; Used registers: – 270 | UNTALK = $FFAB ; Send UNTALK command to serial bus. Input: –; Output: –; Used registers: A. 271 | UNLSTN = $FFAE ; Send UNLISTEN command to serial bus. Input: –; Output: –; Used registers: A. 272 | LISTEN = $FFB1 ; Sends LISTEN command to serial bus. Input: A = Device number. 273 | ; Output: –; Used registers: A. 274 | TALK = $FFB4 ; Send TALK command to serial bus. Input: A = Device number; Output: –; Used registers: A. 275 | READST = $FFB7 ; Fetch status of current input/output device, value of ST variable. (For RS232, status is cleared.) 276 | ; Input: –; Output: A = Device status; Used registers: A. 277 | SETLFS = $FFBA ; Set file parameters. Input: A = Logical number; X = Device number; Y = Secondary address. 278 | ; Output: –; Used registers: – 279 | SETNAM = $FFBD ; Set file name parameters. Input: A = File name length; X/Y = Pointer to file name. 280 | ; Output: –; Used registers: – 281 | OPEN = $FFC0 ; Open file. (Must call SETLFS and SETNAM beforehands.); Input: – 282 | ; Output: –; Used registers: A, X, Y. 283 | CLOSE = $FFC3 ; Close file. Input: A = Logical number. 284 | ; Output: –; Used registers: A, X, Y. 285 | CHKIN = $FFC6 ; Define file as default input. (Must call OPEN beforehands.) 286 | ; Input: X = Logical number; Output: –; Used registers: A, X. 287 | CHKOUT = $FFC9 ; Define file as default output. (Must call OPEN beforehands.) 288 | ; Input: X = Logical number; Output: –; Used registers: A, X. 289 | CLRCHN = $FFCC ; Close default input/output files (for serial bus, send UNTALK and/or UNLISTEN); restore default input/output to keyboard/screen. 290 | ; Input: –; Output: –; Used registers: A, X. 291 | CHRIN = $FFCF ; Read byte from default input (for keyboard, read a line from the screen). (If not keyboard, must call OPEN and CHKIN beforehands.) 292 | ; Input: –; Output: A = Byte read; Used registers: A, Y. 293 | CHROUT = $FFD2 ; Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.) 294 | ; Input: A = Byte to write; Output: –; Used registers: – 295 | LOAD = $FFD5 ; Load or verify file. (Must call SETLFS and SETNAM beforehands.); 296 | ; Input: A: 0 = Load, 1-255 = Verify; X/Y = Load address (if secondary address = 0). 297 | ; Output: Carry: 0 = No errors, 1 = Error; A = KERNAL error code (if Carry = 1); X/Y = Address of last byte loaded/verified (if Carry = 0) 298 | ; Used registers: A, X, Y. 299 | GETIN = $FFE4 ; Read byte from default input. (If not keyboard, must call OPEN and CHKIN beforehands.) 300 | ; Input: –; Output: A = Byte read; Used registers: A, X, Y. -------------------------------------------------------------------------------- /Code/v1.0/Data.asm: -------------------------------------------------------------------------------- 1 | dummy !byte 0,0 2 | Param !byte 0,0 3 | Clock !byte 0,0,0,0 4 | StartBtnPushed !byte 0 5 | MenuItem !byte 0 6 | OldMenuItem !byte 255 7 | MayHighlight !byte 0 8 | MouseInfo !byte 0,0,0,0,0;MouseInfo: xScr,yScr,x,y,xHiByte 9 | GameMode !byte GM_NORMAL; 0: normal, 1: menu, 255: dialog 10 | exit_code !byte 0 11 | res !byte 0 ;return value for various functions 12 | DialogResult !byte 0 13 | ModalAddress !byte 0,0 14 | MapWidth !byte 0 15 | MapHeight !byte 0 16 | GapFrom !byte 0 17 | GapTo !byte 0 18 | WndAddressInBuf !byte 0,0 19 | BufWidth !byte 0 20 | BufHeight !byte 0 21 | CurrentCursor !byte 0 22 | PressedPoint !byte 0,0 23 | Point !byte 0,0 24 | DriveSprites !byte %00001111 25 | NewDriveSprites !byte 0 26 | MousePosInWndX !byte 0 27 | MousePosInWndY !byte 0 28 | StringWidth !byte 0 29 | StringHeight !byte 0 30 | DeviceNumber !byte 0 31 | ControlPressed !byte 0 32 | ; Copy info -------------------- 33 | CanCopy !byte 0 34 | IsCut !byte 0 35 | DiskToCopyFrom !byte 0 36 | DiskToCopyTo !byte 0 37 | ; FileName is in Str_FileName 38 | FileSizeHex !byte 0,0 39 | ; Task bar --------------------- 40 | TaskBtnPos !byte 0 41 | TaskBtnWidth !byte 0 42 | TaskBtnPressed !byte 0 43 | ;---- Window dragging----------- 44 | MayDragWnd !byte 0 45 | IsWndDragging !byte 0 46 | DragType !byte 0 47 | DragWndAnchorX !byte 0 48 | DragWndAnchorY !byte 0 49 | OldPosX !byte 0 50 | NewPosX !byte 0 51 | NewPosY !byte 0 52 | NewHeight !byte 0 53 | ;---- Changable values -------- 54 | CSTM_ActiveClr !byte CL_ORANGE 55 | CSTM_DeactiveClr!byte CL_MIDGRAY 56 | CSTM_SelectClr !byte CL_LIGHTGREEN 57 | CSTM_WindowClr !byte CL_LIGHTGRAY 58 | CSTM_DesktopClr !byte CL_LIGHTBLUE 59 | ; If you change it, also change SP_DriveBkgFull, SP_DriveBkgLeft, 60 | ; and the first char in _taskbar chars_ 61 | CSTM_DeskPattern!byte 0; 0 for solid, 1 for dotted 62 | SP_DriveBkgFull !byte 0;<(DriveBkgSolidFull/64) 63 | SP_DriveBkgLeft !byte 0;<(DriveBkgSolidLeft/64) 64 | ;---- Window data ------------- 65 | WindowOnHeap !byte 0,0 66 | ; Complete window struct for current window 67 | CurrentWindow !byte 255 ; Index/handle of current window (0-15) 68 | WindowType !byte 0 69 | WindowAttribute !byte 0 70 | WindowBits !byte 0; see constants for documentation 71 | WindowPosX !byte 0 72 | WindowPosY !byte 0 73 | WindowWidth !byte 0 74 | WindowHeight !byte 0 75 | WindowTitleStr !byte 0,0 76 | WindowCtrlPtr !byte 0,0 77 | WindowNumCtrls !byte 0 78 | WindowFocCtrl !byte 0 79 | WindowProc !byte 0,0 80 | ;------------------------------ 81 | AllocedWindows !byte 0 82 | MinableWindows !byte 0 83 | VisibleWindows !byte 0 84 | ;------------------------------ 85 | window_counter !byte 0 86 | control_counter !byte 0 87 | ;---- Control data ------------ 88 | ControlOnHeap !byte 0,0 89 | ; Complete control struct for current control 90 | ControlParent !byte 0 91 | ControlIndex !byte 0 92 | ControlType !byte 0 93 | ControlColor !byte 0 94 | ControlPosX !byte 0 95 | ControlPosY !byte 0 96 | ControlWidth !byte 0 97 | ControlHeight !byte 0 98 | ControlBits !byte 0 99 | ControlHilIndex !byte 0 100 | ControlTopIndex !byte 0 101 | ControlNumStr !byte 0 102 | ControlStrings !byte 0,0 103 | ControlID !byte 0 104 | ControlReserved !byte 0 105 | ;------------------------------ 106 | ; Menu info 107 | CurrentMenu !byte 0,0 ; ptr to cur menu 108 | CurMenuType !byte 0 109 | CurMenuID !byte 0 110 | CurMenuPosX !byte 0 111 | CurMenuPosY !byte 0 112 | CurMenuWidth !byte 0 113 | CurMenuHeight !byte 0 114 | CurMenuItem !byte $ff 115 | ;------------------------------ 116 | EofWndHeap !word WND_HEAP ; next free address on window heap 117 | EofCtrlsHeap !word CONTROL_HEAP ; next free address on controls heap 118 | ;------------------------------ 119 | ; Tables 120 | WndPriorityList !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 121 | WndDefWidth !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 122 | WndDefHeight !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 123 | ScrTabLo !byte $00,$28,$50,$78,$a0,$c8,$f0,$18,$40,$68,$90,$b8 124 | !byte $e0,$08,$30,$58,$80,$a8,$d0,$f8,$20,$48,$70,$98,$c0 125 | ScrTabHi !byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 126 | !byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 127 | ClrTabHi !byte $d8,$d8,$d8,$d8,$d8,$d8,$d8,$d9,$d9,$d9,$d9,$d9 128 | !byte $d9,$da,$da,$da,$da,$da,$da,$da,$db,$db,$db,$db,$db 129 | BufScrTabHi !byte $04,$04,$04,$04,$04,$04,$04,$05,$05,$05,$05,$05 130 | !byte $05,$06,$06,$06,$06,$06,$06,$06,$07,$07,$07,$07,$07 131 | BufClrTabHi !byte $d8,$d8,$d8,$d8,$d8,$d8,$d8,$d9,$d9,$d9,$d9,$d9 132 | !byte $d9,$da,$da,$da,$da,$da,$da,$da,$db,$db,$db,$db,$db 133 | TaskBtnWidths !byte 0,11,11,10,7,6,5,4 134 | TaskBtnHandles !byte 0,0,0,0,0,0,0 135 | ; For drives 8 and 9 136 | StringListDrvLo !byte STRING_LIST_DRIVE8, >STRING_LIST_DRIVE9 138 | Str_Title_DrvLo !byte Str_Title_Drive8, >Str_Title_Drive9 140 | BlocksFreeHexLo !byte 0,0 141 | BlocksFreeHexHi !byte 0,0 142 | DiskSizeHexLo !byte 0,0 143 | DiskSizeHexHi !byte 0,0 144 | WriteProtected !byte 0,0 145 | FileListBoxesLo !byte 0,0 146 | FileListBoxesHi !byte 0,0 147 | DrvSymLeft !byte 41,2 148 | DrvSymRight !byte 37,3 149 | ; DiskInfo #8 150 | Str_DriveType8 !pet "0000" 151 | Str_DiskSize8 !pet "0000" 152 | Str_Occupied8 !pet "0000" 153 | Str_BlocksFree8 !pet "1111" 154 | Str_NumFiles8 !pet "2222" 155 | ; DiskInfo #9 156 | Str_DriveType9 !pet "0000" 157 | Str_DiskSize9 !pet "0000" 158 | Str_Occupied9 !pet "0000" 159 | Str_BlocksFree9 !pet "1111" 160 | Str_NumFiles9 !pet "2222" 161 | ;------------------------------ 162 | ; Custom error strings beyond 1-29 (BASIC errors) 163 | CustomErrorsLO !byte Str_Err_WritProt, >Str_Err_NA 165 | ; Variable strings 166 | Str_FileName !pet "0123456789abcdef",0 167 | Str_FilenameEdit!pet "0123456789abcdef",0 -------------------------------------------------------------------------------- /Code/v1.0/DriveWindow.asm: -------------------------------------------------------------------------------- 1 | ; Creates a drive wnd with type in A 2 | CreateDriveWnd cmp #WT_DRIVE_8 3 | bne + 4 | +CreateWindowByData Wnd_Drive8 5 | lda res 6 | beq +++ 7 | lda #8 8 | jmp ++ 9 | + +CreateWindowByData Wnd_Drive9 10 | lda res 11 | beq +++ 12 | lda #9 13 | ++ ; 14 | sta DeviceNumber 15 | +AddControl Ctrl_Drv_Menubar 16 | +ControlSetStringList Str_DriveMenubar, 2 17 | +MenubarAddMenuList DriveMenus 18 | ; 19 | +AddControl Ctrl_Drv_FLB 20 | lda #BIT_CTRL_ISMAXIMIZED 21 | sta ControlBits 22 | +ControlSetColorVal CL_WHITE 23 | lda DeviceNumber 24 | sec 25 | sbc #8 26 | tax 27 | lda ControlOnHeap 28 | sta FileListBoxesLo,x 29 | lda ControlOnHeap+1 30 | sta FileListBoxesHi,x 31 | +++ rts 32 | 33 | ; Needs wndParam filled with exit code 34 | DriveWndProc jsr StdWndProc 35 | ; 36 | lda wndParam+1 37 | beq DriveWnd_NM 38 | bmi DriveWnd_DM 39 | ; In menu mode 40 | lda wndParam 41 | cmp #EC_LBTNPRESS 42 | bne ++ 43 | ; Mouse btn pressed in MM 44 | jsr IsInCurMenu 45 | lda res 46 | beq ++ 47 | lda CurMenuID 48 | cmp #ID_MENU_DISK 49 | beq + 50 | ; Clicked in File menu 51 | jmp FileMenuClicked 52 | + ; Clicked in Disk menu 53 | jsr DiskMenuClicked 54 | ++ rts 55 | DriveWnd_DM rts 56 | DriveWnd_NM lda wndParam 57 | cmp #EC_DBLCLICK 58 | bne + 59 | +SelectControl 1 60 | jsr IsInCurControl 61 | lda res 62 | beq + 63 | jsr GetMousePosInWnd 64 | ldx MousePosInWndX 65 | inx 66 | cpx ControlWidth 67 | beq + 68 | ldx MousePosInWndY 69 | beq + 70 | inx 71 | cpx ControlHeight 72 | bcs + 73 | lda #EC_RUNFILE 74 | sta exit_code 75 | + rts 76 | 77 | FileMenuClicked lda CurMenuItem 78 | cmp #ID_MI_FILECUT 79 | bne ++ 80 | ; Clicked on "Cut" 81 | jsr ActionCopyFile 82 | lda CanCopy 83 | beq + 84 | sta IsCut 85 | + rts 86 | ++ cmp #ID_MI_FILECOPY 87 | bne + 88 | ; Clicked on "Copy" 89 | jmp ActionCopyFile 90 | + cmp #ID_MI_FILEPASTE 91 | bne + 92 | ; Clicked on "Paste" 93 | jmp ActionPasteFile 94 | + cmp #ID_MI_FILEDELETE 95 | bne + 96 | ; Clicked on "Delete" 97 | jmp ActionDelete 98 | + cmp #ID_MI_FILERENAME 99 | bne + 100 | ; Clicked on "Rename" 101 | jmp ActionRenamFile 102 | + cmp #ID_MI_FILERUN 103 | bne + 104 | ; Clicked on "Run" 105 | lda #EC_RUNFILE 106 | sta exit_code 107 | + cmp #ID_MI_FILEBOOT 108 | bne + 109 | ; Clicked on "Boot" 110 | lda #EC_BOOTFILE 111 | sta exit_code 112 | + rts 113 | 114 | DiskMenuClicked lda CurMenuItem 115 | cmp #ID_MI_DISKREFRESH 116 | bne + 117 | ; Clicked on "Refresh" 118 | jmp ShowDirectory 119 | + cmp #ID_MI_DISKINFO 120 | bne + 121 | ; Clicked on "Info" 122 | jmp ShowDiskInfoDlg 123 | + cmp #ID_MI_DISKFORMAT 124 | bne + 125 | ; Clicked on "Format" 126 | jmp ShowFormatDlg 127 | + cmp #ID_MI_DISKRENAME 128 | bne + 129 | ; Clicked on "Rename" 130 | jmp ActionRenamDisk 131 | + cmp #ID_MI_DISKCLOSE 132 | bne + 133 | ; Clicked on "Close" 134 | jsr KillCurWindow 135 | jsr RepaintAll 136 | jsr PaintTaskbar 137 | + rts 138 | 139 | ThrowSpaceError +ShowMessage Str_Mess_NoSpace 140 | rts 141 | 142 | ActionPasteFile lda CanCopy 143 | bne + 144 | rts 145 | + jsr GetDeviceNumber 146 | lda DeviceNumber 147 | sta DiskToCopyTo 148 | cmp DiskToCopyFrom 149 | bne + 150 | +ShowMessage Str_Mess_NoSameDisk 151 | rts 152 | + lda DiskToCopyFrom 153 | cmp #8 154 | bne + 155 | ; From 8 to 9 156 | lda BlocksFreeHexLo+1 157 | sta dummy 158 | lda BlocksFreeHexHi+1 159 | sta dummy+1 160 | jmp ++ 161 | + ; From 9 to 8 162 | lda BlocksFreeHexLo 163 | sta dummy 164 | lda BlocksFreeHexHi 165 | sta dummy+1 166 | ++ ; Check if there is enough space on disk 167 | lda dummy+1 168 | cmp FileSizeHex+1 169 | bcc ThrowSpaceError 170 | bne ++ 171 | lda dummy 172 | cmp FileSizeHex 173 | bcc ThrowSpaceError 174 | ++ ; Do paste 175 | jsr ShowCopyFileDlg 176 | jsr CopyPasteFile 177 | jsr KillCurWindow; kills dialog 178 | lda error_code 179 | beq + 180 | ; Error 181 | jsr ShowDiskError 182 | lda #0 183 | sta WindowAttribute 184 | jsr UpdateWindow 185 | jsr bttr 186 | jmp InstallIRQ 187 | + lda IsCut 188 | beq ++ 189 | lda DiskToCopyFrom 190 | sta DeviceNumber 191 | jsr deletefile 192 | lda DeviceNumber 193 | sec 194 | sbc #8 195 | tax 196 | lda StringListDrvLo,x 197 | sta $fb 198 | lda StringListDrvHi,x 199 | sta $fc 200 | stx dummy 201 | jsr LoadDir 202 | jsr ManipulStrList 203 | ldx dummy 204 | lda FileListBoxesLo,x 205 | sta $fb 206 | lda FileListBoxesHi,x 207 | sta $fc 208 | ldy #CTRLSTRUCT_NUMSTRINGS 209 | lda num_files 210 | sta ($fb),y 211 | jsr GetDiskValues 212 | ++ jsr bttr 213 | jsr RepaintAll 214 | jmp ShowDirectory 215 | 216 | bttr lda #0 217 | sta CanCopy 218 | sta IsCut 219 | lda #GM_NORMAL 220 | sta GameMode 221 | rts 222 | 223 | ActionCopyFile lda #0 224 | sta CanCopy 225 | sta IsCut 226 | +SelectControl 1 227 | lda ControlHilIndex 228 | cmp ControlNumStr 229 | bcs + 230 | jsr GetFileName 231 | ; Get first letter of file type 232 | ldy #18 233 | lda ($fb),y 234 | sta write_appendix+1 235 | ; 236 | jsr GetDeviceNumber 237 | lda DeviceNumber 238 | sta DiskToCopyFrom 239 | lda #1 240 | sta CanCopy 241 | + rts 242 | 243 | ActionRenamDisk jsr GetDeviceNumber 244 | lda DeviceNumber 245 | sec 246 | sbc #8 247 | tax 248 | lda Str_Title_DrvLo,x 249 | sta $fb 250 | lda Str_Title_DrvHi,x 251 | sta $fc 252 | lda #2 253 | jsr AddToFB 254 | ;+AddValToFB 2 255 | ldy #15 256 | - lda ($fb),y 257 | sta Str_FileName,y 258 | dey 259 | bpl - 260 | lda #0 261 | jmp ShowRenameDlg 262 | 263 | ActionRenamFile +SelectControl 1 264 | lda ControlHilIndex 265 | cmp ControlNumStr 266 | bcs ++ 267 | jsr GetFileName 268 | lda #1 269 | jsr ShowRenameDlg 270 | ++ rts 271 | 272 | ActionDelete +SelectControl 1 273 | lda ControlHilIndex 274 | cmp ControlNumStr 275 | bcs ++ 276 | jsr GetDeviceNumber 277 | lda #Str_Dlg_Delete 280 | sta $fe 281 | lda #mod_res1 284 | sta ModalAddress+1 285 | jmp ShowAreYouSureDlg 286 | mod_res1 lda DialogResult 287 | cmp #1 288 | bne ++ 289 | jsr DeleteFile 290 | lda error_code 291 | beq + 292 | jmp ShowDiskError 293 | + jsr ShowDirectory 294 | ++ rts -------------------------------------------------------------------------------- /Code/v1.0/GUI64.c64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Code/v1.0/GUI64.c64 -------------------------------------------------------------------------------- /Code/v1.0/GUI64.s64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Code/v1.0/GUI64.s64 -------------------------------------------------------------------------------- /Code/v1.0/IRQ.asm: -------------------------------------------------------------------------------- 1 | RasterIRQ pha 2 | txa 3 | pha 4 | tya 5 | pha 6 | ; 7 | lda #$ff 8 | sta $d019 9 | lda $d012 10 | cmp #150 11 | bcc L_0 12 | 13 | ;L_150 14 | jsr Highlight 15 | sei 16 | lda #Raster226 19 | sta $ffff 20 | lda #226 21 | sta $d012 22 | cli 23 | return_irq pla 24 | tay 25 | pla 26 | tax 27 | pla 28 | rti 29 | 30 | L_0 lda #CL_BLACK 31 | sta BKGCOLOR 32 | jsr MultiColorOff 33 | jsr DisplayClock 34 | ; Set char set 35 | lda $d018 36 | and #%11110001 37 | ora #MAINCHARSHI 38 | sta $d018 39 | and #%11110001 40 | ora #TASKCHARSHI 41 | sta byte 42 | ; 43 | ; Drive icons 44 | jsr DrawDriveSprites 45 | ; Process joystick and mouse input 46 | jsr Joystick ; in port #2 47 | jsr Mouse ; in port #1 48 | lda #150 49 | sta $d012 50 | jmp return_irq 51 | 52 | byte !byte 0 53 | dummy_irq !byte 0 54 | 55 | Raster226 pha 56 | txa 57 | pha 58 | tya 59 | pha 60 | ; Prepare Multicolor 61 | lda $d016 62 | ora #%00010000 63 | tax 64 | ; Prepare char set 65 | lda byte 66 | ; Write into registers 67 | nop 68 | nop 69 | nop 70 | nop 71 | nop 72 | nop 73 | nop 74 | nop 75 | sta $d018 76 | stx $d016 77 | ldy CSTM_WindowClr 78 | sty BKGCOLOR 79 | ; Acknowledge IRQ 80 | lda #$ff 81 | sta $d019 82 | ; 83 | lda StartBtnPushed 84 | beq + 85 | jsr DrawSpritesDown 86 | jmp ++ 87 | + jsr DrawSpritesUp 88 | ++ sei 89 | lda #RasterIRQ 92 | sta $ffff 93 | lda #0 94 | sta $d012 95 | cli 96 | ; Process keyboard input 97 | jsr Keyboard 98 | jmp return_irq 99 | 100 | InstallIRQ sei 101 | lda #53 102 | sta $01 103 | lda #RasterIRQ 106 | sta $ffff 107 | ; Raster IRQ at y=0 108 | lda #0 109 | sta $d012 110 | lda $d011 111 | and #%01111111 112 | sta $d011 113 | ; Enable raster IRQ 114 | lda $d01a 115 | ora #%00000001 116 | sta $d01a 117 | ; Disable CIA IRQ: Bit 7 sets the value, Bit 0...4 selects the bits to be set 118 | lda #%01111111 119 | sta $dc0d 120 | sta $dd0d 121 | ; Acknowledge any pending CIA irq 122 | lda $dc0d 123 | lda $dd0d 124 | lda #$ff 125 | sta $d019 126 | cli 127 | rts 128 | 129 | DeinstallIRQ sei 130 | lda #54 ; RAM / IO / Kernal 131 | sta $01 132 | lda #$31 133 | sta $0314 134 | lda #$ea 135 | sta $0315 136 | ; Disable raster IRQ 137 | lda $d01a 138 | and #%11111110 139 | sta $d01a 140 | ; Enable CIA IRQ 141 | lda #%11111111 142 | sta $dc0d 143 | lda $dc0d 144 | cli 145 | rts -------------------------------------------------------------------------------- /Code/v1.0/Macros.asm: -------------------------------------------------------------------------------- 1 | !macro EditSetCarretInfo carretpos, max_strlen 2 | lda #carretpos 3 | sta ControlParent+CTRLSTRUCT_CARRETPOS 4 | lda #max_strlen 5 | sta ControlParent+CTRLSTRUCT_MAX_STRLEN 6 | jsr UpdateControl 7 | !end 8 | 9 | !macro ShowMessage lo,hi 10 | lda #lo 11 | sta $fb 12 | lda #hi 13 | sta $fc 14 | jsr ShowMessage 15 | !end 16 | 17 | !macro ShowErrorMsg lo,hi 18 | lda #lo 19 | sta $fb 20 | lda #hi 21 | sta $fc 22 | jsr ShowErrorMsg 23 | !end 24 | 25 | !macro SetCursor cur 26 | lda #cur 27 | sta Param 28 | jsr SetCursor 29 | !end 30 | 31 | !macro MenubarAddMenuList lo, hi 32 | ; Misused struct entries for menu bar 33 | lda #lo 34 | sta ControlPosX 35 | lda #hi 36 | sta ControlPosY 37 | jsr UpdateControl 38 | !end 39 | 40 | !macro ControlSetNumStr byte 41 | lda byte 42 | sta ControlNumStr 43 | jsr UpdateControl 44 | !end 45 | 46 | !macro ControlSetPosXPosY xi,y 47 | lda xi 48 | sta ControlPosX 49 | lda y 50 | sta ControlPosY 51 | jsr UpdateControl 52 | !end 53 | 54 | !macro ControlSetWidthHeight w,h 55 | lda w 56 | sta ControlWidth 57 | lda h 58 | sta ControlHeight 59 | jsr UpdateControl 60 | !end 61 | 62 | !macro ControlSetID id 63 | lda #id 64 | sta ControlID 65 | jsr UpdateControl 66 | !end 67 | 68 | !macro ControlSetColorByte byte 69 | lda byte 70 | sta ControlColor 71 | jsr UpdateControl 72 | !end 73 | 74 | !macro ControlSetColorVal val 75 | lda #val 76 | sta ControlColor 77 | jsr UpdateControl 78 | !end 79 | 80 | !macro ControlSetTopIndex val 81 | lda #val 82 | sta ControlTopIndex 83 | jsr UpdateControl 84 | !end 85 | 86 | !macro ControlSetHilIndexVal val 87 | lda #val 88 | sta ControlHilIndex 89 | jsr UpdateControl 90 | !end 91 | 92 | !macro ControlSetHilIndex byte 93 | lda byte 94 | sta ControlHilIndex 95 | jsr UpdateControl 96 | !end 97 | 98 | !macro ControlSetStringList lo,hi,num 99 | lda #lo 100 | sta ControlStrings 101 | lda #hi 102 | sta ControlStrings+1 103 | lda #num 104 | sta ControlNumStr 105 | jsr UpdateControl 106 | !end 107 | 108 | !macro ControlSetStringListByte lo,hi,b_num 109 | lda #lo 110 | sta ControlStrings 111 | lda #hi 112 | sta ControlStrings+1 113 | lda b_num 114 | sta ControlNumStr 115 | jsr UpdateControl 116 | !end 117 | 118 | !macro ControlSetString lo, hi, ind 119 | lda #lo 120 | sta $02 121 | lda #hi 122 | sta $03 123 | lda #ind 124 | sta Param 125 | jsr SetCtrlString 126 | !end 127 | 128 | !macro SelectControl index 129 | lda #index 130 | jsr SelectControl 131 | !end 132 | 133 | !macro SetCurWndAttribute val 134 | lda #val 135 | sta WindowAttribute 136 | jsr UpdateWindow 137 | !end 138 | 139 | !macro SetCurWndAttributeByte byte 140 | lda byte 141 | sta WindowAttribute 142 | jsr UpdateWindow 143 | !end 144 | 145 | !macro SetCurWndProc lo, hi 146 | lda #lo 147 | sta WindowProc 148 | lda #hi 149 | sta WindowProc+1 150 | jsr UpdateWindow 151 | !end 152 | 153 | !macro SetCurWndType type 154 | lda #type 155 | sta WindowType 156 | jsr UpdateWindow 157 | !end 158 | 159 | !macro SetCurWndTitle lo, hi 160 | lda #lo 161 | sta WindowTitleStr 162 | lda #hi 163 | sta WindowTitleStr+1 164 | jsr UpdateWindow 165 | !end 166 | 167 | !macro SetCurWndTitleByte lo, hi 168 | lda lo 169 | sta WindowTitleStr 170 | lda hi 171 | sta WindowTitleStr+1 172 | jsr UpdateWindow 173 | !end 174 | 175 | !macro SetCurWndGeometry xi,y,w,h 176 | lda #xi 177 | sta WindowPosX 178 | lda #y 179 | sta WindowPosY 180 | lda #w 181 | sta WindowWidth 182 | lda #h 183 | sta WindowHeight 184 | jsr UpdateWindow 185 | !end 186 | 187 | !macro CreateWindowByData lo, hi 188 | ldx #lo 189 | ldy #hi 190 | stx $fb 191 | sty $fc 192 | jsr CreateWindowByData 193 | !end 194 | 195 | !macro AddControl lo, hi 196 | lda #lo 197 | sta $fb 198 | lda #hi 199 | sta $fc 200 | jsr AddControl 201 | !end 202 | 203 | !macro AddValToFB val 204 | lda $fb 205 | clc 206 | adc #val 207 | sta $fb 208 | bcc .quitme 209 | inc $fc 210 | .quitme 211 | !end 212 | 213 | !macro AddValTo06 val 214 | lda $06 215 | clc 216 | adc #val 217 | sta $06 218 | bcc .quitme 219 | inc $07 220 | .quitme 221 | !end 222 | 223 | !macro AddValTo0c val 224 | lda $0c 225 | clc 226 | adc #val 227 | sta $0c 228 | bcc .quitme 229 | inc $0d 230 | .quitme 231 | !end 232 | 233 | ;!macro SubValFromFB val 234 | ; lda $fb 235 | ; sec 236 | ; sbc #val 237 | ; sta $fb 238 | ; lda $fc 239 | ; sbc #0 240 | ; sta $fc 241 | ;!end 242 | 243 | !macro SubValFromFD val 244 | lda $fd 245 | sec 246 | sbc #val 247 | sta $fd 248 | lda $fe 249 | sbc #0 250 | sta $fe 251 | !end 252 | 253 | !macro AddValToFD val 254 | lda $fd 255 | clc 256 | adc #val 257 | sta $fd 258 | bcc .quitme 259 | inc $fe 260 | .quitme 261 | !end 262 | 263 | !macro AddByteTo02 ByteInAddr 264 | lda $02 265 | clc 266 | adc ByteInAddr 267 | sta $02 268 | bcc .quitme 269 | inc $03 270 | .quitme 271 | !end 272 | 273 | !macro AddByteTo04 ByteInAddr 274 | lda $04 275 | clc 276 | adc ByteInAddr 277 | sta $04 278 | bcc .quitme 279 | inc $05 280 | .quitme 281 | !end 282 | 283 | !macro AddValTo02 val 284 | lda $02 285 | clc 286 | adc #val 287 | sta $02 288 | bcc .quitme 289 | inc $03 290 | .quitme 291 | !end 292 | 293 | !macro AddByteToFB ByteInAddr 294 | lda $fb 295 | clc 296 | adc ByteInAddr 297 | sta $fb 298 | bcc .quitme 299 | inc $fc 300 | .quitme 301 | !end 302 | 303 | !macro AddByteToFD ByteInAddr 304 | lda $fd 305 | clc 306 | adc ByteInAddr 307 | sta $fd 308 | bcc .quitme 309 | inc $fe 310 | .quitme 311 | !end 312 | 313 | !macro AddWordToFB lo,hi 314 | lda $fb 315 | clc 316 | adc lo 317 | sta $fb 318 | lda $fc 319 | adc hi 320 | sta $fc 321 | !end 322 | 323 | !macro AddWordToFD lo,hi 324 | lda $fd 325 | clc 326 | adc lo 327 | sta $fd 328 | lda $fe 329 | adc hi 330 | sta $fe 331 | !end 332 | 333 | !macro txy 334 | pha 335 | txa 336 | tay 337 | pla 338 | !end -------------------------------------------------------------------------------- /Code/v1.0/Math.asm: -------------------------------------------------------------------------------- 1 | ; Divides FD by FC 2 | ; Result: FD with fractional part in FE 3 | DivideFDbyFC ASL $FD 4 | LDA #$00 5 | ROL 6 | LDX #$08 7 | - CMP $FC 8 | BCC + 9 | SBC $FC 10 | + ROL $FD 11 | ROL 12 | DEX 13 | BNE - 14 | LDX #$08 15 | - CMP $FC 16 | BCC + 17 | SBC $FC 18 | + ROL $FE 19 | ASL 20 | DEX 21 | BNE - 22 | rts 23 | 24 | ; Multiplies FD with FE 25 | ; Result in A (hi byte) and X (lo byte) 26 | MultiplyFDbyFE lda #$00 27 | ldx #$08 28 | clc 29 | - bcc + 30 | clc 31 | adc $fe 32 | + ror 33 | ror $fd 34 | dex 35 | bpl - 36 | ldx $fd 37 | rts 38 | 39 | multiplier = $f7 ; $f8 40 | multiplicand = $f9 ; $fa 41 | product = $fb ; $fc, $fd, $fe 42 | 43 | Mult16 lda #$00 44 | sta product+2 ; clear upper bits of product 45 | sta product+3 46 | ldx #$10 ; set binary count to 16 47 | shift_r lsr multiplier+1 ; divide multiplier by 2 48 | ror multiplier 49 | bcc rotate_r 50 | lda product+2 ; get upper half of product and add multiplicand 51 | clc 52 | adc multiplicand 53 | sta product+2 54 | lda product+3 55 | adc multiplicand+1 56 | rotate_r ror ; rotate partial product 57 | sta product+3 58 | ror product+2 59 | ror product+1 60 | ror product 61 | dex 62 | bne shift_r 63 | rts 64 | 65 | ; divident / divisor 66 | divisor = $58 ;$59 used for hi-byte 67 | dividend = $fb ;$fc used for hi-byte 68 | remainder = $fd ;$fe used for hi-byte 69 | result = dividend ;save memory by reusing divident to store the result 70 | 71 | ; Divides $FB/FC by $58/59 72 | ; Result in divident = $FBFC 73 | Divide16Bit lda #0 ;preset remainder to 0 74 | sta remainder 75 | sta remainder+1 76 | ldx #16 ;repeat for each bit: ... 77 | 78 | divloop asl dividend ;dividend lb & hb*2, msb -> Carry 79 | rol dividend+1 80 | rol remainder ;remainder lb & hb * 2 + msb from carry 81 | rol remainder+1 82 | lda remainder 83 | sec 84 | sbc divisor ;subtract divisor to see if it fits in 85 | tay ;lb result -> Y, for we may need it later 86 | lda remainder+1 87 | sbc divisor+1 88 | bcc skip ;if carry=0 then divisor didn't fit in yet 89 | 90 | sta remainder+1 ;else save substraction result as new remainder, 91 | sty remainder 92 | inc result ;and INCrement result cause divisor fit in 1 times 93 | 94 | skip dex 95 | bne divloop 96 | rts -------------------------------------------------------------------------------- /Code/v1.0/MemoryManagement.asm: -------------------------------------------------------------------------------- 1 | ; Structure of FREMEM: 2 | ; FREMEM_HEAD ($xxff): number of entries (1 byte) 3 | ; FREMEM_HEAD+1: 16 memory addresses 4 | ; FREMEM: data 5 | 6 | EofFrememHeap !byte 0,0 7 | 8 | ; Allocates a new memory block 9 | ; Param: how many bytes 10 | AllocMemory ldy FREMEM_HEAD 11 | cpy #16 12 | bcc + 13 | rts 14 | + tya 15 | asl 16 | tay 17 | lda #<(FREMEM_HEAD+1) 18 | sta $fb 19 | lda #>(FREMEM_HEAD+1) 20 | sta $fc 21 | lda EofFrememHeap 22 | sta ($fb),y 23 | iny 24 | lda EofFrememHeap+1 25 | sta ($fb),y 26 | ; 27 | inc FREMEM_HEAD 28 | lda EofFrememHeap 29 | clc 30 | adc Param 31 | sta EofFrememHeap 32 | lda EofFrememHeap+1 33 | adc #0 34 | sta EofFrememHeap+1 35 | rts 36 | 37 | ; 38 | FreeMemory ; 39 | rts -------------------------------------------------------------------------------- /Code/v1.0/MenuFunctions.asm: -------------------------------------------------------------------------------- 1 | ; Expects Param filled with item 2 | SelectMenuItem lda Param 3 | bmi ++ 4 | cmp CurMenuItem 5 | beq ++ 6 | sta CurMenuItem 7 | jsr Menubar_ShowMenu 8 | ; 9 | ldx Param 10 | inx 11 | jsr SelectMenuLine 12 | ldx Param 13 | bne + 14 | jsr SelectMenuLine 15 | + inx 16 | inx 17 | inx 18 | cpx CurMenuHeight 19 | bne ++ 20 | dex 21 | jsr SelectMenuLine 22 | ++ rts 23 | 24 | ; Selects menu line at y pos in X 25 | SelectMenuLine txa 26 | pha 27 | ldy CurMenuPosX 28 | txa 29 | clc 30 | adc CurMenuPosY 31 | tax 32 | jsr PosToClrMem 33 | ; 34 | ldy CurMenuWidth 35 | dey 36 | lda CSTM_ActiveClr 37 | - sta ($fd),y 38 | dey 39 | bpl - 40 | pla 41 | tax 42 | rts 43 | 44 | ; Expects mouse in cur menu 45 | ; Writes result into res 46 | GetMenuItem jsr GetMouseInfo 47 | lda MouseInfo+1 48 | sec 49 | sbc CurMenuPosY 50 | tax 51 | beq ++ 52 | inx 53 | cpx CurMenuHeight 54 | bne + 55 | dex 56 | + dex 57 | dex 58 | ++ stx res 59 | rts 60 | 61 | IsInCurMenu lda #0 62 | sta res 63 | jsr GetMouseInfo 64 | lda MouseInfo 65 | cmp CurMenuPosX 66 | bcc + 67 | sec 68 | sbc CurMenuPosX 69 | cmp CurMenuWidth 70 | bcs + 71 | lda MouseInfo+1 72 | cmp CurMenuPosY 73 | bcc + 74 | sec 75 | sbc CurMenuPosY 76 | cmp CurMenuHeight 77 | bcs + 78 | lda #1 79 | sta res 80 | + rts 81 | 82 | ; Expects menu ptr in FBFC 83 | PaintMenuToBuf ldy #0 84 | lda ($fb),y 85 | sta CurMenuID 86 | iny 87 | lda ($fb),y 88 | clc 89 | adc #2 90 | sta BoxWidth 91 | sta BufWidth 92 | sta CurMenuWidth 93 | iny 94 | lda ($fb),y 95 | clc 96 | adc #2 97 | sta BoxHeight 98 | sta BufHeight 99 | sta CurMenuHeight 100 | lda CSTM_WindowClr 101 | sta BoxColor 102 | lda #SCR_BUF 105 | sta $fe 106 | lda #CLR_BUF 109 | sta $03 110 | jsr PaintBoxToFD02; changes FD 111 | ; Fill menu with items 112 | ; 113 | ldx BufWidth 114 | inx 115 | stx dummy 116 | lda #SCR_BUF 121 | adc #0 122 | sta $fe 123 | ; Get number of items in X 124 | ldy #2 125 | lda ($fb),y 126 | tax 127 | ; Set ptr to string list 128 | lda #3 129 | jsr AddToFB 130 | ;+AddValToFB 3 131 | ; Now buf ptr is in FDFE, and string list is in FBFC 132 | - jsr PrintStringLC 133 | ; Y is str len 134 | iny 135 | sty dummy 136 | tya 137 | jsr AddToFB 138 | ;+AddByteToFB dummy 139 | jsr AddBufWidthToFD 140 | ;+AddByteToFD BufWidth 141 | dex 142 | bne - 143 | rts 144 | 145 | ; Paints menu of selected menubar item into 146 | ; buffer 147 | Menubar_ShowMenu 148 | ; Get pointer to menu list 149 | lda ControlPosX 150 | sta $fd 151 | lda ControlPosY 152 | sta $fe 153 | ; Get pointer to menu (in FBFC) 154 | ; 155 | lda ControlHilIndex 156 | asl 157 | tay 158 | lda ($fd),y 159 | sta $fb 160 | sta CurrentMenu 161 | iny 162 | lda ($fd),y 163 | sta $fc 164 | sta CurrentMenu+1 165 | ; Paint menu box to buffer 166 | jsr PaintMenuToBuf 167 | ; Set menu pos on screen ---- 168 | ; 169 | lda WindowPosX 170 | clc 171 | adc offsetL 172 | sta CurMenuPosX 173 | ldx WindowPosY 174 | inx 175 | inx 176 | stx CurMenuPosY 177 | lda #MT_NORMAL 178 | sta CurMenuType 179 | ; Correction if necessary 180 | lda #40 181 | sta dummy 182 | ; check Y 183 | lda CurMenuPosY 184 | clc 185 | adc CurMenuHeight 186 | cmp #23 187 | bcc + 188 | sec 189 | sbc #22 190 | sbc CurMenuPosY 191 | jsr minus 192 | stx CurMenuPosY 193 | lda offsetR 194 | sec 195 | sbc offsetL 196 | tax 197 | inx 198 | stx dummy 199 | txa 200 | clc 201 | adc CurMenuPosX 202 | sta CurMenuPosX 203 | sec 204 | sbc dummy 205 | sta dummy 206 | + ; check X 207 | lda CurMenuPosX 208 | clc 209 | adc CurMenuWidth 210 | cmp #41 211 | bcc + 212 | sbc dummy;#40 213 | sbc CurMenuPosX 214 | jsr minus 215 | txa 216 | ;sec 217 | ;sbc dummy 218 | sta CurMenuPosX 219 | + ; Bring buffer to screen ---- 220 | ; 221 | ldx CurMenuPosY 222 | ldy CurMenuPosX 223 | jsr PosToScrMemFB 224 | jmp BufToScreen 225 | 226 | ; Expects menubar in local control struct 227 | ; Returns selected menubar index 228 | SelMenubarEntry lda ControlStrings 229 | sta $fd 230 | lda ControlStrings+1 231 | sta $fe 232 | lda #0 233 | sta offsetL 234 | ldx #0 235 | ; 236 | - jsr NextString 237 | ldy res 238 | iny 239 | tya 240 | clc 241 | adc offsetL 242 | sta offsetR 243 | ; 244 | lda MousePosInWndX 245 | cmp offsetL 246 | bcc + 247 | lda offsetR 248 | cmp MousePosInWndX 249 | bcc + 250 | ; Mouse is in item X 251 | stx ControlHilIndex 252 | txa 253 | pha 254 | jsr UpdateControl 255 | jsr PaintMenuBar 256 | jsr WindowToScreen 257 | pla 258 | sta res 259 | rts 260 | ; 261 | + ldy res 262 | iny 263 | iny 264 | tya 265 | clc 266 | adc offsetL 267 | sta offsetL 268 | inx 269 | cpx ControlNumStr 270 | bcc - 271 | ; Mouse is not in any item 272 | lda #$ff 273 | sta res 274 | rts -------------------------------------------------------------------------------- /Code/v1.0/NoGUI.asm: -------------------------------------------------------------------------------- 1 | ; Puts -A into X 2 | minus eor #%11111111 3 | tax 4 | inx 5 | rts 6 | 7 | ; Adds value in A to FBFC 8 | AddToFB clc 9 | adc $fb 10 | sta $fb 11 | bcc + 12 | inc $fc 13 | + rts 14 | 15 | ; Adds value in A to FDFE 16 | AddToFD clc 17 | adc $fd 18 | sta $fd 19 | bcc + 20 | inc $fe 21 | + rts 22 | 23 | Val !byte 0 24 | SubValFromFD lda $fd 25 | sec 26 | sbc Val 27 | sta $fd 28 | bcs + 29 | dec $fe 30 | + rts 31 | 32 | ; Adds value in A to 0203 33 | AddTo02 clc 34 | adc $02 35 | sta $02 36 | bcc + 37 | inc $03 38 | + rts 39 | 40 | ; Adds BufWidth to FDFE 41 | AddBufWidthToFD lda BufWidth 42 | clc 43 | adc $fd 44 | sta $fd 45 | bcc + 46 | inc $fe 47 | + rts 48 | 49 | ; Adds BufWidth to 0203 50 | AddBufWidthTo02 lda BufWidth 51 | clc 52 | adc $02 53 | sta $02 54 | bcc + 55 | inc $03 56 | + rts 57 | 58 | ;Once called, never changes 59 | SetGlobals ; Install mouse pointer sprites 60 | lda #SCRMEM 88 | sta ScrTabHi,x 89 | lda #>SCR_BUF 90 | sta BufScrTabHi,x 91 | lda #>CLR_BUF 92 | sta BufClrTabHi,x 93 | - lda ScrTabLo,x 94 | clc 95 | adc #40 96 | inx 97 | sta ScrTabLo,x 98 | ; 99 | dex 100 | lda ScrTabHi,x 101 | inx 102 | sta ScrTabHi,x 103 | dex 104 | lda BufScrTabHi,x 105 | inx 106 | sta BufScrTabHi,x 107 | dex 108 | lda BufClrTabHi,x 109 | inx 110 | sta BufClrTabHi,x 111 | bcc + 112 | inc ScrTabHi,x 113 | inc BufScrTabHi,x 114 | inc BufClrTabHi,x 115 | + cpx #24 116 | bcc - 117 | 118 | ; Set initial values 119 | lda #0 120 | sta GameMode 121 | sta AllocedWindows 122 | sta VisibleWindows 123 | ; 124 | lda #WND_HEAP 127 | sta EofWndHeap+1 128 | ; 129 | lda #CONTROL_HEAP 132 | sta EofCtrlsHeap+1 133 | rts 134 | 135 | ;--------------------------------------------------------------- 136 | ; TIME FUNCTIONS 137 | ;--------------------------------------------------------------- 138 | 139 | TODInit lda $01 ;Save $01 140 | pha ; on stack 141 | lda #INT_NMI ; 144 | sta $fffb ; 145 | lda #$35 ;Bank out KERNAL 146 | sta $01 ; so new NMI vector is active 147 | 148 | lda #0 149 | sta $d011 ;Turn off display to disable badlines 150 | sta $dc0e ;Set TOD Clock Frequency to 60Hz 151 | sta $dc0f ;Enable Set-TOD-Clock 152 | sta $dc0b ;Set TOD-Clock to 0 (hours) 153 | sta $dc0a ;- (minutes) 154 | sta $dc09 ;- (seconds) 155 | sta $dc08 ;- (deciseconds) 156 | 157 | lda $dc08 ; 158 | - cmp $dc08 ;Sync raster to TOD Clock Frequency 159 | beq - 160 | 161 | ldx #0 ;Prep X and Y for 16 bit 162 | ldy #0 ; counter operation 163 | lda $dc08 ;Read deciseconds 164 | - inx ;2 -+ 165 | bne + ;2/3 | Do 16 bit count up on 166 | iny ;2 | X(lo) and Y(hi) regs in a 167 | jmp ++ ;3 | fixed cycle manner 168 | + nop ;2 | 169 | nop ;2 -+ 170 | ++ cmp $dc08 ;4 - Did 1 decisecond pass? 171 | beq - ;3 - If not, loop-di-doop 172 | ;Each loop = 16 cycles 173 | ;If less than 118230 cycles passed, TOD is 174 | ;clocked at 60Hz. If 118230 or more cycles 175 | ;passed, TOD is clocked at 50Hz. 176 | ;It might be a good idea to account for a bit 177 | ;of slack and since every loop is 16 cycles, 178 | ;28*256 loops = 114688 cycles, which seems to be 179 | ;acceptable. That means we need to check for 180 | ;a Y value of 28. 181 | 182 | cpy #28 ;Did 114688 cycles or less go by? 183 | bcc + ;- Then we already have correct 60Hz $dc0e value 184 | lda #$80 ;Otherwise, we need to set it to 50Hz 185 | sta $dc0e 186 | + 187 | lda #$1b ;Enable the display again 188 | sta $d011 189 | 190 | pla ;Restore old $01 value 191 | sta $01 ; and potentially old NMI vector 192 | rts 193 | INT_NMI rti 194 | 195 | SetTOD lda $dc0f 196 | and #%01111111 197 | sta $dc0f 198 | ; 199 | lda Clock+2 200 | asl 201 | asl 202 | asl 203 | asl 204 | ora Clock+3 205 | sta $dc0a 206 | ; 207 | lda Clock 208 | asl 209 | asl 210 | asl 211 | asl 212 | ora Clock+1 213 | ; 214 | bne + 215 | lda #$92; actually $12 216 | sta $dc0b 217 | jmp ++ 218 | + cmp #$12 219 | bcs + 220 | sta $dc0b 221 | jmp ++ 222 | + bne + 223 | sta $dc0b 224 | jmp ++ 225 | + sed 226 | sec 227 | sbc #$12 228 | cld 229 | ora #%10000000 230 | sta $dc0b 231 | ++ lda #0 232 | sta $dc08 233 | sta $dc09 234 | rts 235 | 236 | DisplayClock lda #':' 237 | sta SCRMEM+23*40+34+2 238 | 239 | lda $dc0a 240 | tax 241 | lsr 242 | lsr 243 | lsr 244 | lsr 245 | sta Clock+2 246 | ora #$30 247 | sta SCRMEM+23*40+37 248 | txa 249 | and #%00001111 250 | sta Clock+3 251 | ora #$30 252 | sta SCRMEM+23*40+38 253 | 254 | lda $dc0b 255 | ldx $dc08 256 | tax 257 | and #%01111111 258 | cmp #$12 259 | bne + 260 | 261 | ; 12 pm = noon or 12 am = midnight 262 | txa 263 | and #%10000000 264 | tax 265 | 266 | + txa 267 | and #%10000000 268 | beq am 269 | ; pm 270 | txa 271 | and #%01111111 272 | sed 273 | clc 274 | adc #$12 275 | cld 276 | tax 277 | jmp + 278 | am txa 279 | and #%01111111 280 | + lsr 281 | lsr 282 | lsr 283 | lsr 284 | sta Clock 285 | ora #$30 286 | sta SCRMEM+23*40+34 287 | txa 288 | and #%00001111 289 | sta Clock+1 290 | ora #$30 291 | sta SCRMEM+23*40+35 292 | rts -------------------------------------------------------------------------------- /Code/v1.0/PaintFunctions.asm: -------------------------------------------------------------------------------- 1 | ; Draws a title bar for current window 2 | ; Expects 0 or 1 in Param (deactivated/activated) 3 | PaintTitleBar lda Param 4 | pha 5 | lda WndAddressInBuf 6 | sta $fd 7 | lda WndAddressInBuf+1 8 | sta $fe 9 | ; Draw logo, Maximize, Minimize, and Close symbols 10 | ldy #0 11 | sty Param 12 | lda #47 13 | sta ($fd),y 14 | ldy WindowWidth 15 | dey 16 | lda #44 17 | sta ($fd),y 18 | ldx WindowBits 19 | txa 20 | and #BIT_WND_CANMAXIMIZE 21 | beq ++ 22 | inc Param 23 | dey 24 | txa ; window bits 25 | and #BIT_WND_ISMAXIMIZED 26 | beq + 27 | lda #64 28 | jmp store 29 | + lda #45 30 | store sta ($fd),y 31 | ++ ; No maximize button 32 | lda WindowBits 33 | and #BIT_WND_CANMINIMIZE 34 | beq + 35 | inc Param 36 | dey 37 | lda #46 38 | sta ($fd),y 39 | + dey 40 | lda #4 41 | - sta ($fd),y 42 | dey 43 | bne - 44 | ; Draw Title string 45 | lda WindowTitleStr 46 | sta $fb 47 | lda WindowTitleStr+1 48 | beq +++ ; if no title string is specified 49 | sta $fc 50 | lda #2 51 | jsr AddToFD 52 | ;+AddValToFD 2 53 | lda WindowType 54 | cmp #WT_DRIVE_8 55 | beq + 56 | cmp #WT_DRIVE_9 57 | beq + 58 | lda WindowWidth 59 | sec 60 | sbc #4 61 | sbc Param 62 | sta Param 63 | jsr PrintStrMaxLen 64 | jmp ++ 65 | + jsr PrintStringUC 66 | ++ lda #2 67 | sta Val 68 | jsr SubValFromFD 69 | ;+SubValFromFD 2 70 | +++ ; Fill Color 71 | lda $fe 72 | clc 73 | adc #$04 74 | sta $fe 75 | ldy WindowWidth 76 | dey 77 | pla ; previous Param (act/deact) 78 | bne + 79 | lda CSTM_DeactiveClr 80 | jmp loop 81 | + lda CSTM_ActiveClr 82 | loop sta ($fd),y 83 | dey 84 | bpl loop 85 | rts 86 | 87 | ; Deactivate curr wnd (changes titlebar color) 88 | DeactivateWnd lda VisibleWindows 89 | bne + 90 | rts 91 | + ldx WindowPosY 92 | lda ScrTabLo,x 93 | sta $04 94 | lda ClrTabHi,x 95 | sta $05 96 | +AddByteTo04 WindowPosX 97 | ; Fill Color 98 | ldy WindowWidth 99 | dey 100 | lda CSTM_DeactiveClr 101 | - sta ($04),y 102 | dey 103 | bpl - 104 | rts 105 | 106 | ; Expects window in buffer SCR_BUF/CLR_BUF 107 | WindowToScreen lda WindowWidth 108 | sta BufWidth 109 | lda WindowHeight 110 | sta BufHeight 111 | clc 112 | adc WindowPosY 113 | cmp #23 114 | bcc + 115 | sec 116 | lda #22 117 | sec 118 | sbc WindowPosY 119 | sta BufHeight 120 | + ldx WindowPosY 121 | lda ScrTabLo,x 122 | sta $fb 123 | sta $fd 124 | lda ScrTabHi,x 125 | sta $fc 126 | lda ClrTabHi,x 127 | sta $fe 128 | lda WindowPosX 129 | jsr AddToFB 130 | ;+AddByteToFB WindowPosX 131 | lda WindowPosX 132 | jsr AddToFD 133 | ;+AddByteToFD WindowPosX 134 | jmp BufToScreen 135 | 136 | ; Paints buffer to screen 137 | ; Expects: 138 | ; SCR dest coords in $FBFC 139 | ; BufWidth and BufHeight filled 140 | BufToScreen lda #40 141 | sta GapTo 142 | lda BufWidth 143 | sta GapFrom 144 | sta MapWidth 145 | lda BufHeight 146 | sta MapHeight 147 | lda $fb 148 | sta SMC_ScrTo 149 | sta SMC_ClrTo 150 | lda $fc 151 | sta SMC_ScrTo+1 152 | clc 153 | adc #>CLRMEM_MINUS_SCRMEM 154 | sta SMC_ClrTo+1 155 | lda #SCR_BUF 159 | sta SMC_ScrFrom+1 160 | clc 161 | adc #$04 162 | sta SMC_ClrFrom+1 163 | - lda $d012 164 | cmp #100 165 | bne - 166 | lda $d011 167 | and #%10000000 168 | bne- 169 | jmp CpyScrClrInfo 170 | 171 | ; Positions in buffer 172 | BoxPosX !byte 0 173 | BoxPosY !byte 0 174 | BoxWidth !byte 0 175 | BoxHeight !byte 0 176 | BoxColor !byte 0 177 | ; Paints box to buffer 178 | ; Expects BufWidth and BoxPosX,...,BoxHeight and BoxColor filled 179 | PaintBoxToBuf ; Find pos in buffers 180 | lda WndAddressInBuf 181 | sta $fd 182 | sta $02 183 | lda WndAddressInBuf+1 184 | sta $fe 185 | clc 186 | adc #$04 187 | sta $03 188 | ldx BoxPosY 189 | beq + 190 | dex 191 | - jsr AddBufWidthToFD 192 | ;+AddByteToFD BufWidth 193 | jsr AddBufWidthTo02 194 | ;+AddByteTo02 BufWidth 195 | dex 196 | bpl - 197 | + lda BoxPosX 198 | jsr AddToFD 199 | ;+AddByteToFD BoxPosX 200 | lda BoxPosX 201 | jsr AddTo02 202 | ;+AddByteTo02 BoxPosX 203 | PaintBoxToFD02 ; First line 204 | ldy BoxWidth 205 | cpy #2 206 | bcs + 207 | rts 208 | + dey 209 | lda #40 210 | sta ($fd),y 211 | dey 212 | lda #36 213 | - sta ($fd),y 214 | dey 215 | bne - 216 | lda #35 217 | sta ($fd),y 218 | ; Intermediate lines 219 | ldx BoxHeight 220 | cpx #2 221 | beq + 222 | dex 223 | dex 224 | -- jsr AddBufWidthToFD 225 | ;+AddByteToFD BufWidth 226 | ldy BoxWidth 227 | dey 228 | lda #41 229 | sta ($fd),y 230 | dey 231 | lda #4 232 | - sta ($fd),y 233 | dey 234 | bne - 235 | lda #37 236 | sta ($fd),y 237 | dex 238 | bne -- 239 | + ; Last line 240 | jsr AddBufWidthToFD 241 | ;+AddByteToFD BufWidth 242 | ldy BoxWidth 243 | dey 244 | lda #42 245 | sta ($fd),y 246 | dey 247 | lda #39 248 | - sta ($fd),y 249 | dey 250 | bne - 251 | lda #38 252 | sta ($fd),y 253 | ; Fill box with color 254 | ldx BoxHeight 255 | dex 256 | -- ldy BoxWidth 257 | dey 258 | lda BoxColor 259 | - sta ($02),y 260 | dey 261 | bpl - 262 | jsr AddBufWidthTo02 263 | ;+AddByteTo02 BufWidth 264 | dex 265 | bpl -- 266 | rts 267 | 268 | ; Paints cur wnd (active) to SCR/CLR_BUF 269 | PaintCurWindow lda CurrentWindow 270 | bpl + 271 | rts 272 | + lda #SCR_BUF 275 | sta WndAddressInBuf+1 276 | lda WindowWidth 277 | sta BufWidth 278 | lda #1 279 | sta Param 280 | jsr UpdateDrvSprites 281 | ; Paints cur wnd into buffers 282 | ; Expects: Param filled with 0 (inactive) or 1 (active) 283 | ; BufWidth and BufHeight filled 284 | PaintWndToBuf jsr PaintTitleBar 285 | lda #0 286 | sta BoxPosX 287 | ldx #1 288 | lda WindowBits 289 | and #BIT_WND_HASMENU 290 | beq + 291 | ldx #2 292 | + stx BoxPosY 293 | lda WindowWidth 294 | sta BoxWidth 295 | ldx WindowHeight 296 | dex 297 | lda WindowBits 298 | and #BIT_WND_HASMENU 299 | beq + 300 | dex 301 | + stx BoxHeight 302 | lda CSTM_WindowClr 303 | sta BoxColor 304 | jsr PaintBoxToBuf 305 | jsr PaintControls 306 | ; Resize symbol in lower right corner 307 | lda WindowBits 308 | and #BIT_WND_RESIZABLE 309 | beq + 310 | lda WndAddressInBuf 311 | sta $fb 312 | lda WndAddressInBuf+1 313 | sta $fc 314 | ldx WindowWidth 315 | dex 316 | stx dummy 317 | txa 318 | jsr AddToFB 319 | ;+AddByteToFB dummy 320 | ldx WindowHeight 321 | dex 322 | - lda BufWidth 323 | jsr AddToFB 324 | ;+AddByteToFB BufWidth 325 | dex 326 | bne - 327 | lda #43 328 | ldy #0 329 | sta ($fb),y 330 | + rts -------------------------------------------------------------------------------- /Code/v1.0/SettingsWindow.asm: -------------------------------------------------------------------------------- 1 | CreateSettingsWindow 2 | lda #Wnd_Settings 5 | sta $fc 6 | jsr CreateWindow 7 | ; 8 | ldx #4 9 | - ;stx Param 10 | txa 11 | jsr SelectControl 12 | lda CSTM_ActiveClr,x 13 | sta ControlColor 14 | jsr UpdateControl 15 | dex 16 | bpl - 17 | +SelectControl 5 18 | +ControlSetStringList Str_Settings_RBG, 2 19 | +ControlSetHilIndex CSTM_DeskPattern 20 | +SelectControl 13 21 | +ControlSetID ID_BTN_APPLY 22 | +SelectControl 14 23 | +ControlSetID ID_BTN_OK 24 | rts 25 | 26 | ; Needs wndParam filled with exit code 27 | SettingsWndProc jsr StdWndProc 28 | ; 29 | lda wndParam 30 | cmp #EC_LBTNRELEASE 31 | bne ++ 32 | jsr IsInCurControl 33 | lda res 34 | beq ++ 35 | ; Mouse button released 36 | lda ControlID 37 | cmp #ID_BTN_OK 38 | bne + 39 | ; "OK" was pressed 40 | jsr ApplySettings 41 | jsr KillCurWindow 42 | jsr RepaintAll 43 | jmp PaintTaskbar 44 | + cmp #ID_BTN_APPLY 45 | bne ++ 46 | ApplySettings ; "Apply" was pressed 47 | ; Set colors 48 | lda WindowCtrlPtr 49 | sta $fb 50 | lda WindowCtrlPtr+1 51 | sta $fc 52 | ldx #0 53 | ldy #CTRLSTRUCT_COLOR 54 | ; 55 | - lda ($fb),y 56 | sta CSTM_ActiveClr,x 57 | tya 58 | clc 59 | adc #16 60 | tay 61 | inx 62 | cpx #5 63 | bcc - 64 | ; Set desktop pattern 65 | tya 66 | clc 67 | adc #6 68 | tay 69 | lda ($fb),y 70 | sta CSTM_DeskPattern 71 | jsr SetBkgPattern 72 | ; 73 | jsr RepaintAll 74 | ++ rts -------------------------------------------------------------------------------- /Code/v1.0/Sprites.asm: -------------------------------------------------------------------------------- 1 | Mousepointer0 2 | !byte $c0,$00,$00,$a0,$00,$00,$90,$00 3 | !byte $00,$88,$00,$00,$84,$00,$00,$82 4 | !byte $00,$00,$84,$00,$00,$88,$00,$00 5 | !byte $a4,$00,$00,$d4,$00,$00,$12,$00 6 | !byte $00,$0a,$00,$00,$0c,$00,$00,$00 7 | !byte $00,$00,$00,$00,$00,$00,$00,$00 8 | !byte $00,$00,$00,$00,$00,$00,$00,$00 9 | !byte $00,$00,$00,$00,$00,$00,$00,$00 10 | 11 | Mousepointer1 12 | !byte $00,$00,$00,$40,$00,$00,$60,$00 13 | !byte $00,$70,$00,$00,$78,$00,$00,$7c 14 | !byte $00,$00,$78,$00,$00,$70,$00,$00 15 | !byte $58,$00,$00,$08,$00,$00,$0c,$00 16 | !byte $00,$04,$00,$00,$00,$00,$00,$00 17 | !byte $00,$00,$00,$00,$00,$00,$00,$00 18 | !byte $00,$00,$00,$00,$00,$00,$00,$00 19 | !byte $00,$00,$00,$00,$00,$00,$00,$00 20 | 21 | ResizeCursorNWSE0 22 | !byte $fe,$00,$00,$84,$00,$00,$88,$00 23 | !byte $00,$84,$00,$00,$a2,$20,$00,$d1 24 | !byte $60,$00,$88,$a0,$00,$04,$20,$00 25 | !byte $02,$20,$00,$04,$20,$00,$0f,$e0 26 | !byte $00,$00,$00,$00,$00,$00,$00,$00 27 | !byte $00,$00,$00,$00,$00,$00,$00,$00 28 | !byte $00,$00,$00,$00,$00,$00,$00,$00 29 | !byte $00,$00,$00,$00,$00,$00,$00,$00 30 | 31 | ResizeCursorNWSE1 32 | !byte $00,$00,$00,$78,$00,$00,$70,$00 33 | !byte $00,$78,$00,$00,$5c,$00,$00,$0e 34 | !byte $00,$00,$07,$40,$00,$03,$c0,$00 35 | !byte $01,$c0,$00,$03,$c0,$00,$00,$00 36 | !byte $00,$00,$00,$00,$00,$00,$00,$00 37 | !byte $00,$00,$00,$00,$00,$00,$00,$00 38 | !byte $00,$00,$00,$00,$00,$00,$00,$00 39 | !byte $00,$00,$00,$00,$00,$00,$00,$01 40 | 41 | ResizeCursorNS0 42 | !byte $10,$00,$00,$28,$00,$00,$44,$00 43 | !byte $00,$82,$00,$00,$ee,$00,$00,$28 44 | !byte $00,$00,$28,$00,$00,$28,$00,$00 45 | !byte $28,$00,$00,$ee,$00,$00,$82,$00 46 | !byte $00,$44,$00,$00,$28,$00,$00,$10 47 | !byte $00,$00,$00,$00,$00,$00,$00,$00 48 | !byte $00,$00,$00,$00,$00,$00,$00,$00 49 | !byte $00,$00,$00,$00,$00,$00,$00,$00 50 | 51 | ResizeCursorNS1 52 | !byte $00,$00,$00,$10,$00,$00,$38,$00 53 | !byte $00,$7c,$00,$00,$10,$00,$00,$10 54 | !byte $00,$00,$10,$00,$00,$10,$00,$00 55 | !byte $10,$00,$00,$10,$00,$00,$7c,$00 56 | !byte $00,$38,$00,$00,$10,$00,$00,$00 57 | !byte $00,$00,$00,$00,$00,$00,$00,$00 58 | !byte $00,$00,$00,$00,$00,$00,$00,$00 59 | !byte $00,$00,$00,$00,$00,$00,$00,$01 60 | 61 | ResizeCursorWE0 62 | !byte $00,$00,$00,$18,$60,$00,$28,$50 63 | !byte $00,$4f,$c8,$00,$80,$04,$00,$4f 64 | !byte $c8,$00,$28,$50,$00,$18,$60,$00 65 | !byte $00,$00,$00,$00,$00,$00,$00,$00 66 | !byte $00,$00,$00,$00,$00,$00,$00,$00 67 | !byte $00,$00,$00,$00,$00,$00,$00,$00 68 | !byte $00,$00,$00,$00,$00,$00,$00,$00 69 | !byte $00,$00,$00,$00,$00,$00,$00,$00 70 | 71 | ResizeCursorWE1 72 | !byte $00,$00,$00,$00,$00,$00,$10,$20 73 | !byte $00,$30,$30,$00,$7f,$f8,$00,$30 74 | !byte $30,$00,$10,$20,$00,$00,$00,$00 75 | !byte $00,$00,$00,$00,$00,$00,$00,$00 76 | !byte $00,$00,$00,$00,$00,$00,$00,$00 77 | !byte $00,$00,$00,$00,$00,$00,$00,$00 78 | !byte $00,$00,$00,$00,$00,$00,$00,$00 79 | !byte $00,$00,$00,$00,$00,$00,$00,$01 80 | 81 | CarretCursor 82 | !byte $f8,$00,$00,$20,$00,$00,$20,$00 83 | !byte $00,$20,$00,$00,$20,$00,$00,$20 84 | !byte $00,$00,$20,$00,$00,$f8,$00,$00 85 | !byte $00,$00,$00,$00,$00,$00,$00,$00 86 | !byte $00,$00,$00,$00,$00,$00,$00,$00 87 | !byte $00,$00,$00,$00,$00,$00,$00,$00 88 | !byte $00,$00,$00,$00,$00,$00,$00,$00 89 | !byte $00,$00,$00,$00,$00,$00,$00,$00 90 | 91 | StartBtnUL 92 | !byte $ff,$ff,$fc,$80,$00,$00,$80,$00 93 | !byte $00,$80,$00,$00,$80,$00,$00,$80 94 | !byte $00,$00,$80,$00,$00,$80,$00,$00 95 | !byte $80,$00,$00,$80,$00,$00,$80,$00 96 | !byte $00,$80,$00,$00,$80,$00,$00,$80 97 | !byte $00,$00,$80,$00,$00,$80,$00,$00 98 | !byte $80,$00,$00,$80,$00,$00,$00,$00 99 | !byte $00,$00,$00,$00,$00,$00,$00,$01 100 | 101 | StartBtnLR 102 | !byte $00,$00,$00,$00,$00,$04,$00,$00 103 | !byte $04,$00,$00,$04,$00,$00,$04,$00 104 | !byte $00,$04,$00,$00,$04,$00,$00,$04 105 | !byte $00,$00,$04,$00,$00,$04,$00,$00 106 | !byte $04,$00,$00,$04,$00,$00,$04,$00 107 | !byte $00,$04,$00,$00,$04,$00,$00,$04 108 | !byte $00,$00,$04,$00,$00,$04,$ff,$ff 109 | !byte $fc,$00,$00,$00,$00,$00,$00,$00 110 | 111 | Commodore1 112 | !byte $07,$80,$00,$1f,$e0,$00,$3f,$e0 113 | !byte $00,$3c,$60,$00,$78,$1e,$00,$70 114 | !byte $1c,$00,$70,$00,$00,$70,$00,$00 115 | !byte $78,$00,$00,$3c,$60,$00,$3f,$e0 116 | !byte $00,$1f,$e0,$00,$07,$80,$00,$00 117 | !byte $00,$00,$00,$00,$00,$00,$00,$00 118 | !byte $00,$00,$00,$00,$00,$00,$00,$00 119 | !byte $00,$00,$00,$00,$00,$00,$00,$06 120 | 121 | Commodore2 122 | !byte $00,$00,$00,$00,$00,$00,$00,$00 123 | !byte $00,$00,$00,$00,$00,$00,$00,$00 124 | !byte $00,$00,$00,$00,$00,$00,$1c,$00 125 | !byte $00,$1e,$00,$00,$00,$00,$00,$00 126 | !byte $00,$00,$00,$00,$00,$00,$00,$00 127 | !byte $00,$00,$00,$00,$00,$00,$00,$00 128 | !byte $00,$00,$00,$00,$00,$00,$00,$00 129 | !byte $00,$00,$00,$00,$00,$00,$00,$02 130 | 131 | 132 | DriveBkgDottedFull 133 | !byte $00,$00,$00,$00,$00,$00,$00,$00 134 | !byte $00,$00,$00,$00,$00,$00,$00,$00 135 | !byte $00,$00,$00,$00,$00,$00,$00,$00 136 | !byte $80,$02,$00,$40,$01,$00,$80,$02 137 | !byte $00,$00,$01,$00,$80,$00,$00,$00 138 | !byte $01,$00,$00,$00,$00,$00,$00,$00 139 | !byte $00,$00,$00,$00,$00,$00,$00,$00 140 | !byte $00,$00,$00,$00,$00,$00,$00,$01 141 | 142 | DriveBkgDottedLeft 143 | !byte $00,$00,$00,$00,$00,$00,$00,$00 144 | !byte $00,$00,$00,$00,$00,$00,$00,$00 145 | !byte $00,$00,$00,$00,$00,$00,$00,$00 146 | !byte $80,$00,$00,$40,$00,$00,$80,$00 147 | !byte $00,$00,$00,$00,$80,$00,$00,$00 148 | !byte $00,$00,$00,$00,$00,$00,$00,$00 149 | !byte $00,$00,$00,$00,$00,$00,$00,$00 150 | !byte $00,$00,$00,$00,$00,$00,$00,$01 151 | 152 | DriveBkgSolidFull 153 | !byte $00,$00,$00,$00,$00,$00,$00,$00 154 | !byte $00,$00,$00,$00,$00,$00,$00,$00 155 | !byte $00,$00,$00,$00,$00,$00,$00,$00 156 | !byte $c0,$03,$00,$c0,$03,$00,$80,$01 157 | !byte $00,$80,$01,$00,$80,$01,$00,$00 158 | !byte $00,$00,$00,$00,$00,$00,$00,$00 159 | !byte $00,$00,$00,$00,$00,$00,$00,$00 160 | !byte $00,$00,$00,$00,$00,$00,$00,$01 161 | 162 | DriveBkgSolidLeft 163 | !byte $00,$00,$00,$00,$00,$00,$00,$00 164 | !byte $00,$00,$00,$00,$00,$00,$00,$00 165 | !byte $00,$00,$00,$00,$00,$00,$00,$00 166 | !byte $c0,$00,$00,$c0,$00,$00,$80,$00 167 | !byte $00,$80,$00,$00,$80,$00,$00,$00 168 | !byte $00,$00,$00,$00,$00,$00,$00,$00 169 | !byte $00,$00,$00,$00,$00,$00,$00,$00 170 | !byte $00,$00,$00,$00,$00,$00,$00,$01 171 | 172 | Balken 173 | !byte $00,$00,$00,$00,$00,$00,$00,$00 174 | !byte $00,$00,$00,$00,$00,$00,$00,$ff 175 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 176 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 177 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 178 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 179 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 180 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$00 181 | 182 | BalkenSchmal 183 | !byte $00,$00,$00,$00,$00,$00,$00,$00 184 | !byte $00,$00,$00,$00,$00,$00,$00,$00 185 | !byte $00,$00,$00,$00,$00,$00,$00,$00 186 | !byte $00,$00,$00,$ff,$ff,$ff,$ff,$ff 187 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 188 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 189 | !byte $ff,$ff,$ff,$00,$00,$00,$00,$00 190 | !byte $00,$00,$00,$00,$00,$00,$00,$00 -------------------------------------------------------------------------------- /Code/v1.0/StdWindowProc.asm: -------------------------------------------------------------------------------- 1 | wndParam !byte 0,0 2 | ;dumm !byte 0 3 | 4 | ; Needs wndParam filled with exit code 5 | StdWndProc jsr GetMousePosInWnd 6 | ; Checks event 7 | lda wndParam 8 | cmp #EC_LBTNPRESS 9 | beq StdW_LBPresProc 10 | cmp #EC_LBTNRELEASE 11 | beq StdW_LBRelProc 12 | cmp #EC_MOUSEMOVE 13 | beq StdW_MMoveProc 14 | cmp #EC_SCROLLDOWN 15 | beq StdW_ScrWhlProc 16 | cmp #EC_SCROLLUP 17 | beq StdW_ScrWhlProc 18 | cmp #EC_KEYPRESS 19 | beq StdW_KeyPrsProc 20 | cmp #EC_LLBTNPRESS 21 | beq StdW_LLBtnPress 22 | rts 23 | 24 | StdW_LBPresProc jmp StdWnd_LBPress 25 | StdW_LBRelProc jmp StdWnd_LBRel 26 | StdW_MMoveProc jmp StdWnd_MMove 27 | StdW_ScrWhlProc jmp StdW_ScrolWheel 28 | StdW_KeyPrsProc jmp StdW_KeyPress 29 | StdW_LLBtnPress jmp no_menu 30 | 31 | 32 | StdWnd_LBPress ; Left button pressed 33 | lda wndParam+1 34 | beq Std_ClickInNM 35 | bpl Std_ClickInMM 36 | rts 37 | Std_ClickInNM lda MousePosInWndY 38 | bpl no_menu 39 | ; Clicked in menu bar 40 | +SelectControl 0 41 | jsr SelMenubarEntry 42 | lda res 43 | bmi ++ 44 | jsr Menubar_ShowMenu 45 | lda #GM_MENU 46 | sta GameMode 47 | rts 48 | no_menu ; Not in menu bar 49 | jsr GetCtrlFromPos 50 | lda res 51 | bmi ++ 52 | lda ControlIndex 53 | sta WindowFocCtrl 54 | jsr UpdateWindow 55 | lda ControlType 56 | cmp #CT_BUTTON 57 | bne + 58 | lda #1 59 | sta ControlPressed 60 | + jsr ControlsProc 61 | ++ rts 62 | Std_ClickInMM lda ControlType 63 | cmp #CT_MENUBAR 64 | bne + 65 | lda #$ff 66 | sta ControlHilIndex 67 | jsr UpdateControl 68 | jmp ++ 69 | + lda ControlType 70 | cmp #CT_COLORPICKER 71 | bne ++ 72 | jsr ControlsProc 73 | ++ jsr RepaintAll 74 | lda #GM_NORMAL 75 | sta GameMode 76 | rts 77 | ;---------------------------------------------- 78 | StdW_ScrolWheel jsr GetCtrlFromPos 79 | lda res 80 | bmi + 81 | jsr SelectControl 82 | jsr ControlsProc 83 | + rts 84 | ;---------------------------------------------- 85 | StdW_KeyPress jmp ControlsProc 86 | ;---------------------------------------------- 87 | StdWnd_LBRel ; Left button released 88 | lda wndParam+1 89 | beq Std_RelInNM 90 | bpl Std_RelInMM 91 | jmp Std_RelInDM 92 | Std_RelInNM lda ControlPressed 93 | bne + 94 | ; No control pressed; 95 | rts 96 | + ; Some control is pressed 97 | lda #0 98 | sta ControlPressed 99 | jmp ControlsProc 100 | Std_RelInMM ; 101 | rts 102 | Std_RelInDM ; 103 | rts 104 | ;---------------------------------------------- 105 | StdWnd_MMove ; Mouse has moved 106 | lda wndParam+1 107 | beq Std_MovInNMDM 108 | bpl Std_MovInMM 109 | 110 | Std_MovInNMDM ; Moved in normal AND dialog mode 111 | lda ControlPressed 112 | beq +++ 113 | ; Control is pressed 114 | jsr IsInCurControl 115 | lda res 116 | beq + 117 | ; Is in cur ctrl 118 | lda ControlBits 119 | and #BIT_CTRL_ISPRESSED 120 | bne ++ 121 | ; and not pressed, then press 122 | lda ControlBits 123 | ora #BIT_CTRL_ISPRESSED 124 | sta ControlBits 125 | jsr UpdateControl 126 | jmp ControlsProc 127 | + ; Is not in cur ctrl 128 | lda ControlBits 129 | and #BIT_CTRL_ISPRESSED 130 | beq ++ 131 | ; and pressed, then release 132 | lda #BIT_CTRL_ISPRESSED 133 | eor #%11111111 134 | and ControlBits 135 | sta ControlBits 136 | jsr UpdateControl 137 | jmp ControlsProc 138 | ++ rts 139 | +++ ; Control is not pressed 140 | lda ControlIndex 141 | pha 142 | jsr GetCtrlFromPos 143 | lda res 144 | sta Param 145 | lda ControlType 146 | cmp #CT_EDIT_SL 147 | bne + 148 | jsr IsInCtrlMiddle 149 | lda res 150 | beq + 151 | +SetCursor CUR_CARRET 152 | + pla 153 | jmp SelectControl 154 | Std_MovInMM jsr IsInCurMenu 155 | lda res 156 | beq ++ 157 | ; In cur menu 158 | lda CurMenuID 159 | cmp #ID_MENU_COLORPICKER 160 | beq + 161 | ; Regular menu 162 | jsr GetMenuItem 163 | lda res 164 | sta Param 165 | jsr SelectMenuItem 166 | + rts 167 | ++ ; Not in cur menu 168 | lda CurMenuItem 169 | bmi + 170 | lda #$ff 171 | sta CurMenuItem 172 | lda CurMenuType 173 | bne + 174 | jsr Menubar_ShowMenu 175 | + rts -------------------------------------------------------------------------------- /Code/v1.0/StringsAndControls.asm: -------------------------------------------------------------------------------- 1 | ;------------------------------ 2 | ; Custom strings as PETSCII 3 | ; Lower/upper case 4 | Str_Settings !pet "Settings",0 5 | Str_Settings_RBG!pet "Solid",0,"Dotted",0 6 | Str_DriveMenubar!pet "Disk",0,"File",0 7 | Str_No !pet " No" 8 | Str_Yes !pet "Yes" 9 | ; Dialog titles 10 | Str_Dlg_Info !pet "Information",0 11 | Str_Dlg_Delete !pet "Delete",0 12 | Str_Dlg_Reset !pet "Reset",0 13 | Str_Dlg_Clock !pet "Clock",0 14 | Str_Dlg_Ren_File!pet "Rename File",0 15 | Str_Dlg_Ren_Disk!pet "Rename Disk",0 16 | Str_Dlg_For_Disk!pet "Format Disk",0 17 | Str_Dlg_DiskInfo!pet "Disk Info",0 18 | Str_Dlg_CopyFile!pet "Copy File",0 19 | Str_Dlg_Error !pet "Disk Error",0 20 | ; Dialog labels 21 | Str_Err_WritProt!pet "DISK WRITE PROTECTEd"; err code 30 22 | Str_Err_NA !pet "NOT AVAILABLe"; err code 31 23 | Str_Mess_Error !pet "Error code: xx\\Error message:\illegal device number",0 24 | Str_Mess_NoSpace!pet "There is not enough space\on this disk.",0 25 | Str_Mess_NoSameDisk !pet "Files cannot be copied\from a disk to itself.",0 26 | Str_Mess_MaxWnd !pet "The number of minimizable\windows is limited to 7.",0 27 | Str_Mess_Sure !pet "Are you sure?",0 28 | Str_Mess_OldFile!pet "Old filename:",0 29 | Str_Mess_NewFile!pet "New filename:",0 30 | Str_Mess_OldDisk!pet "Old diskname:",0 31 | Str_Mess_NewDisk!pet "New diskname:",0 32 | Str_Dlg_For_RBG !pet "Fast format",0,"Full format",0 33 | Str_Loading !pet "Loading...",0 34 | ;------------------------------ 35 | ; Custom strings as PETSCII 36 | ; Only upper case 37 | Str_Title_Drive8!pet "8-no disk ",0 38 | Str_Title_Drive9!pet "9-no disk ",0 39 | Str_LoadingUC !pet "loading... ",0 40 | ;============================== 41 | ; Window and controls data 42 | ;------------------------------ 43 | ; Drive window 44 | Wnd_Drive8 !byte WT_DRIVE_8, %00110110, 6, 1, 29, 7, Str_Title_Drive8, DriveWndProc 45 | Wnd_Drive9 !byte WT_DRIVE_9, %00110110, 9, 4, 29, 7, Str_Title_Drive9, DriveWndProc 46 | Ctrl_Drv_Menubar!byte CT_MENUBAR, 0, 0, 0, 0 47 | !pet 0 48 | Ctrl_Drv_FLB !byte CT_FILELISTSCROLLBOX, 0, 0, 27, 9 49 | !pet 0 50 | ;------------------------------ 51 | ; Settings window 52 | Wnd_Settings !byte WT_SETTINGS, %00101100, 9, 1, 21, 20, Str_Settings, SettingsWndProc 53 | !byte CT_COLORPICKER, 17, 3, 2, 1 54 | !pet 0 55 | !byte CT_COLORPICKER, 17, 4, 2, 1 56 | !pet 0 57 | !byte CT_COLORPICKER, 17, 5, 2, 1 58 | !pet 0 59 | !byte CT_COLORPICKER, 17, 6, 2, 1 60 | !pet 0 61 | !byte CT_COLORPICKER, 17, 7, 2, 1 62 | !pet 0 63 | !byte CT_RADIOBUTTONGROUP, 2, 12, 15, 2 64 | !pet 0 65 | !byte CT_FRAME, 1, 1, 19, 8 66 | !pet "Colors",0 67 | !byte CT_LABEL, 2, 3, 12, 1 68 | !pet "Title (act.)",0 69 | !byte CT_LABEL, 2, 4, 14, 1 70 | !pet "Title (inact.)",0 71 | !byte CT_LABEL, 2, 5, 14, 1 72 | !pet "Selection",0 73 | !byte CT_LABEL, 2, 6, 6, 1 74 | !pet "Window",0 75 | !byte CT_LABEL, 2, 7, 7, 1 76 | !pet "Desktop",0 77 | !byte CT_FRAME, 1, 10, 19, 5 78 | !pet "Desktop Pattern",0 79 | !byte CT_BUTTON, 8, 15, 7, 3 80 | !pet "Apply",0 81 | !byte CT_BUTTON, 16, 15, 4, 3 82 | !pet "OK",0 83 | ; Final zero byte 84 | !byte 0 85 | ;============================== 86 | ; Dialog and controls data 87 | ;------------------------------ 88 | ;------------------------------ 89 | ; Show Message 90 | Wnd_Dlg_ShowMess!byte WT_DLG_INFO, %00001100, 1, 1, 1, 1, Str_Dlg_Info, MessageDlgProc 91 | !byte CT_LABEL_ML, 1, 1, 1, 1 92 | !pet 0 93 | Ctrl_SM_OkBtn !byte CT_BUTTON, 1, 1, 4, 3 94 | !pet "OK",0 95 | ;------------------------------ 96 | ; YesNo Dialog 97 | Wnd_Dlg_YesNo !byte WT_DLG_YESNO, %00001100, 1, 1, 1, 1, 0, 0, YesNoDlgProc 98 | Ctrl_Dlg_Label !byte CT_LABEL_ML, 1, 1, 1, 1 99 | !pet 0 100 | Ctrl_YN_NoBtn !byte CT_BUTTON, 1, 1, 4, 3 101 | !pet "No",0 102 | Ctrl_YN_YesBtn !byte CT_BUTTON, 1, 1, 5, 3 103 | !pet "Yes",0 104 | ;------------------------------ 105 | ; Disk Info Dialog 106 | Wnd_Dlg_DiskInfo!byte WT_DLG_DISKINFO, %00001100, 10, 3, 20, 15, Str_Dlg_DiskInfo, DiskInfoDlgProc 107 | !byte CT_PROGRESSBAR, 1, 1, 18, 1, 0 108 | !byte CT_LABEL, 1, 8, 13, 1 109 | !pet "Drive Type",0 110 | !byte CT_LABEL, 1, 9, 13, 1 111 | !pet "Write protect",0 112 | !byte CT_LABEL, 1, 7, 13, 1 113 | !pet "Files",0 114 | !byte CT_LABEL, 1, 3, 13, 1 115 | !pet "Size (blocks)",0 116 | !byte CT_COLBOXLABEL, 1, 4, 11, 1 117 | !pet "Occupied",0 118 | !byte CT_COLBOXLABEL, 1, 5, 11, 1 119 | !pet "Available",0 120 | Ctrl_DI_Label6 !byte CT_LABEL, 15, 8, 4, 1; Type 121 | !pet "xxxx",0 122 | Ctrl_DI_Label7 !byte CT_LABEL, 16, 9, 3, 1; Write prot 123 | !pet "xxx",0 124 | Ctrl_DI_Label8 !byte CT_LABEL, 15, 7, 4, 1; Files 125 | !pet "xxxx",0 126 | Ctrl_DI_Label9 !byte CT_LABEL, 15, 3, 4, 1; Size 127 | !pet "xxxx",0 128 | Ctrl_DI_Label10 !byte CT_LABEL, 15, 4, 4, 1; Occupied 129 | !pet "xxxx",0 130 | Ctrl_DI_Label11 !byte CT_LABEL, 15, 5, 4, 1; Available 131 | !pet "xxxx",0 132 | !byte CT_BUTTON, 13, 10, 6, 3 133 | !pet " OK ",0 134 | ; Final zero byte 135 | !byte 0 136 | ;------------------------------ 137 | ; Format disk Dialog 138 | Wnd_Dlg_Format !byte WT_DLG_FORMAT, %00001100, 10, 5, 21, 13, Str_Dlg_For_Disk, FormatDlgProc 139 | !byte CT_LABEL, 2, 1, 9, 1 140 | !pet "Diskname:",0 141 | !byte CT_EDIT_SL, 1, 2, 19, 3 142 | !pet 0 143 | !byte CT_RADIOBUTTONGROUP, 2, 5, 13, 2 144 | !pet 0 145 | !byte CT_BUTTON, 6, 8, 8, 3 146 | !pet "Cancel",0 147 | !byte CT_BUTTON, 15, 8, 4, 3 148 | !pet "OK",0 149 | ; Final zero byte 150 | !byte 0 151 | ;------------------------------ 152 | ; Rename Dialog 153 | Wnd_Dlg_Rename !byte WT_DLG_RENAME, %00001100, 10, 4, 21, 14, 0, 0, RenameDlgProc 154 | !byte CT_LABEL, 1, 1, 13, 1 155 | !pet 0 156 | !byte CT_LABEL, 2, 3, 16, 1 157 | !pet 0 158 | !byte CT_LABEL, 1, 5, 13, 1 159 | !pet 0 160 | !byte CT_EDIT_SL, 1, 6, 19, 3 161 | !pet 0 162 | !byte CT_BUTTON, 6, 9, 8, 3 163 | !pet "Cancel",0 164 | !byte CT_BUTTON, 15, 9, 4, 3 165 | !pet "OK",0 166 | ; Final zero byte 167 | !byte 0 168 | ;------------------------------ 169 | ; Copy File Dialog 170 | Wnd_Dlg_CopyFile!byte WT_DLG_COPYFILE, %00001100, 11, 4, 18, 9, Str_Dlg_CopyFile, CopyFileDlgProc 171 | !byte CT_PROGRESSBAR, 1, 1, 16, 1, 0 172 | !byte CT_LABEL, 1, 3, 16, 1 173 | !pet 0 174 | Ctrl_CF_Label2 !byte CT_LABEL, 1, 5, 13, 1 175 | !pet "From #8 to #9",0; 11 and 17 176 | ; Final zero byte 177 | !byte 0 178 | ;------------------------------ 179 | ; Clock Dialog 180 | Wnd_Dlg_Clock !byte WT_DLG_CLOCK, %00001100, 31,13,9,9, Str_Dlg_Clock, ClockDlgProc 181 | !byte CT_UPDOWN, 0, 1, 5, 3 182 | !pet 0 183 | !byte CT_UPDOWN, 4, 1, 5, 3 184 | !pet 0 185 | !byte CT_BUTTON, 1, 4, 7, 3 186 | !pet " Set ",0 187 | ; Final zero byte 188 | !byte 0 189 | 190 | ; Menus 191 | ; Format: ID, max_str_len, item_count, StringList 192 | Menu_Start !pet ID_MENU_START,8,3,"Settings",0," ",0,"Reset ",0 193 | Menu_ColorPicker!pet ID_MENU_COLORPICKER,2,16,"0",0,"1",0,"2",0,"3",0,"4",0,"5",0,"6",0,"7",0,"8",0,"9",0,"A",0,"B",0,"C",0,"D",0,"E",0,"F",0 194 | Menu_Disk !pet ID_MENU_DISK,7,5,"Refresh",0,"Info",0,"Format",0,"Rename",0,"Close",0 195 | Menu_File !pet ID_MENU_FILE,6,7,"Cut",0,"Copy",0,"Paste",0,"Delete",0,"Rename",0,"Run",0, "Boot",0 196 | ; Menu lists 197 | DriveMenus !word Menu_Disk, Menu_File -------------------------------------------------------------------------------- /Code/v1.0/TaskBar.asm: -------------------------------------------------------------------------------- 1 | BlackTaskbar ldx #39 2 | lda #220 3 | - sta SCRMEM+880,x 4 | sta SCRMEM+880+40,x 5 | sta SCRMEM+880+80,x 6 | dex 7 | bpl - 8 | 9 | ; Gets task button index from mouse pos 10 | ; expects mouse in task buttons 11 | ; Return val in res. 12 | ; Returns $ff if there are no minimizable windows 13 | GetTaskBtnIndex lda #$ff 14 | sta res 15 | ldy MinableWindows 16 | beq + 17 | lda TaskBtnWidths,y 18 | sta TaskBtnWidth 19 | lda MouseInfo 20 | sec 21 | sbc #3 22 | sta window_counter 23 | ldx #$ff 24 | - inx 25 | lda window_counter 26 | sec 27 | sbc TaskBtnWidth 28 | sta window_counter 29 | bpl - 30 | cpx MinableWindows 31 | bcs + 32 | stx res 33 | + rts 34 | 35 | SetTaskbarColors 36 | ldx #39 37 | - lda #9 38 | sta $db70,x 39 | sta $db98,x 40 | sta $dbc0,x 41 | dex 42 | bpl - 43 | ; Adjust clock color to hires 44 | ldx #34 45 | lda #0 46 | - sta $db98,x 47 | inx 48 | cpx #39 49 | bcc - 50 | rts 51 | 52 | DrawClockButton ldx #33 53 | lda #98 54 | sta SCRMEM+$370,x 55 | lda #96 56 | sta SCRMEM+$370+40,x 57 | lda #97 58 | sta SCRMEM+$370+80,x 59 | inx 60 | ldy #5 61 | - lda #99 62 | sta SCRMEM+$370,x 63 | lda #101 64 | sta SCRMEM+$370+80,x 65 | inx 66 | dey 67 | bne - 68 | lda #100 69 | sta SCRMEM+$370,x 70 | lda #103 71 | sta SCRMEM+$370+40,x 72 | lda #102 73 | sta SCRMEM+$370+80,x 74 | rts 75 | 76 | tb_index !byte 0 77 | PaintTaskbar ; Paint taskbar without buttons 78 | ldx #32 79 | - lda #95 80 | sta TASKBAR_BUF,x 81 | lda #32 82 | sta TASKBAR_BUF+40,x 83 | sta TASKBAR_BUF+80,x 84 | dex 85 | bpl - 86 | ; Paint task buttons 87 | ldy MinableWindows 88 | beq ++ 89 | lda TaskBtnWidths,y 90 | sta TaskBtnWidth 91 | lda #0 92 | sta window_counter 93 | sta tb_index 94 | sta TaskBtnPos 95 | - lda #0 96 | ldx window_counter 97 | cpx CurrentWindow 98 | bne + 99 | lda #1 100 | + sta TaskBtnPressed 101 | lda window_counter 102 | sta Param 103 | jsr GetWindowAddr 104 | ldy #WNDSTRUCT_BITS 105 | lda ($fb),y 106 | and #BIT_WND_CANMINIMIZE 107 | beq + 108 | ldx tb_index 109 | lda window_counter 110 | sta TaskBtnHandles,x 111 | ldy #WNDSTRUCT_TITLESTRING 112 | lda ($fb),y 113 | sta $fd 114 | iny 115 | lda ($fb),y 116 | sta $fe 117 | jsr PaintTaskBtn 118 | inc tb_index 119 | lda TaskBtnPos 120 | clc 121 | adc TaskBtnWidth 122 | sta TaskBtnPos 123 | + inc window_counter 124 | lda tb_index 125 | cmp MinableWindows 126 | bcc - 127 | ++ ; To screen 128 | ldx #32;#119 129 | - lda TASKBAR_BUF,x 130 | sta SCRMEM+$370,x 131 | lda TASKBAR_BUF+40,x 132 | sta SCRMEM+$370+40,x 133 | lda TASKBAR_BUF+80,x 134 | sta SCRMEM+$370+80,x 135 | dex 136 | bpl - 137 | ; Clock 138 | jsr DrawClockButton 139 | jmp DisplayClock 140 | 141 | TB_offset !byte 0 142 | ; Expects TaskBtnPos, TaskBtnWidth, TaskBtnPressed and FDFE filled 143 | ; FDFE contains ptr to string 144 | ; FBFC is ptr to window in wndstruct memory 145 | PaintTaskBtn ldx TaskBtnPos 146 | inx 147 | inx 148 | inx 149 | stx TB_offset 150 | lda TaskBtnPressed 151 | beq ++ 152 | ; Task button is pressed 153 | lda #98 154 | sta TASKBAR_BUF,x 155 | lda #96 156 | sta TASKBAR_BUF+40,x 157 | lda #97 158 | sta TASKBAR_BUF+80,x 159 | inx 160 | ldy TaskBtnWidth 161 | dey 162 | dey 163 | beq + 164 | - lda #99 165 | sta TASKBAR_BUF,x 166 | lda #101 167 | sta TASKBAR_BUF+80,x 168 | inx 169 | dey 170 | bne - 171 | + lda #100 172 | sta TASKBAR_BUF,x 173 | lda #103 174 | sta TASKBAR_BUF+40,x 175 | lda #102 176 | sta TASKBAR_BUF+80,x 177 | jmp DisplayTBString 178 | ++ ; Task button is not pressed 179 | lda #106 180 | sta TASKBAR_BUF,x 181 | lda #104 182 | sta TASKBAR_BUF+40,x 183 | lda #105 184 | sta TASKBAR_BUF+80,x 185 | inx 186 | lda TaskBtnWidth 187 | tay 188 | dey 189 | dey 190 | beq + 191 | - lda #107 192 | sta TASKBAR_BUF,x 193 | lda #109 194 | sta TASKBAR_BUF+80,x 195 | inx 196 | dey 197 | bne - 198 | + lda #108 199 | sta TASKBAR_BUF,x 200 | lda #111 201 | sta TASKBAR_BUF+40,x 202 | lda #110 203 | sta TASKBAR_BUF+80,x 204 | DisplayTBString ; Prepare Param+1 for string display 205 | lda #0 206 | sta Param+1 207 | ldy #WNDSTRUCT_TYPE 208 | lda ($fb),y 209 | cmp #WT_DRIVE_8 210 | beq + 211 | cmp #WT_DRIVE_9 212 | beq + 213 | jmp ++ 214 | + lda #1 215 | sta Param+1 216 | ++ ; Adjust colors to hires and multicolor 217 | lda #$99 218 | clc 219 | adc TB_offset 220 | sta $fb 221 | lda #$db 222 | sta $fc 223 | ldy TaskBtnWidth 224 | dey 225 | dey 226 | dey 227 | lda #0 228 | - sta ($fb),y 229 | dey 230 | bpl - 231 | ; Multicolor 232 | lda #$98 233 | clc 234 | adc TB_offset 235 | sta $fb 236 | lda #$db 237 | sta $fc 238 | ldy #0 239 | lda #9 240 | sta ($fb),y 241 | ldy TaskBtnWidth 242 | dey 243 | sta ($fb),y 244 | ; Print string 245 | lda $fe 246 | bmi + 247 | lda #<(TASKBAR_BUF+41) 248 | sta $fb 249 | lda #>(TASKBAR_BUF+41) 250 | sta $fc 251 | lda TB_offset 252 | jsr AddToFB 253 | ;+AddByteToFB TB_offset 254 | ldx TaskBtnWidth 255 | dex 256 | dex 257 | stx Param 258 | jsr PrintStrTaskbar 259 | + rts -------------------------------------------------------------------------------- /Code/v1.0/TaskbarChars5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Code/v1.0/TaskbarChars5.bin -------------------------------------------------------------------------------- /Code/v1.0/WindowFunctions.asm: -------------------------------------------------------------------------------- 1 | ; Based on current window type, writes device no 2 | ; into DeviceNumber 3 | GetDeviceNumber lda #8 4 | sta DeviceNumber 5 | lda WindowType 6 | cmp #WT_DRIVE_9 7 | bne + 8 | lda #9 9 | sta DeviceNumber 10 | + rts 11 | 12 | ; Assumes mouse already in title bar 13 | ; Returns 0 if not; 1 if in close; 2 if in maximize; 3 if in minimize 14 | IsInMinMaxClose lda #0 15 | sta res 16 | lda WindowPosX 17 | clc 18 | adc WindowWidth 19 | tax 20 | ; Check first position 21 | dex 22 | cpx MouseInfo 23 | bne + 24 | lda #1 25 | sta res 26 | rts 27 | + ; Check second position 28 | dex 29 | cpx MouseInfo 30 | bne ++ 31 | lda WindowBits 32 | and #BIT_WND_CANMAXIMIZE 33 | beq + 34 | ; Maximize btn pressed 35 | lda #2 36 | sta res 37 | rts 38 | + lda WindowBits 39 | and #BIT_WND_CANMINIMIZE 40 | beq +++ 41 | lda #3 42 | sta res 43 | rts 44 | ++ ; Check third position 45 | dex 46 | cpx MouseInfo 47 | bne +++ 48 | lda WindowBits 49 | and #BIT_WND_CANMAXIMIZE 50 | beq +++ 51 | lda WindowBits 52 | and #BIT_WND_CANMINIMIZE 53 | beq +++ 54 | lda #3 55 | sta res 56 | +++ rts 57 | 58 | ; Writes cur wnd addr in buf to WndAddressInBuf 59 | GetWndAddrInBuf ldx WindowPosY 60 | lda ScrTabLo,x 61 | sta WndAddressInBuf 62 | lda BufScrTabHi,x 63 | sta WndAddressInBuf+1 64 | lda WndAddressInBuf 65 | clc 66 | adc WindowPosX 67 | sta WndAddressInBuf 68 | bcc + 69 | inc WndAddressInBuf+1 70 | + rts 71 | 72 | RepaintAll ; Set buffer bounds 73 | lda #40 74 | sta BufWidth 75 | lda #22 76 | sta BufHeight 77 | ; Paint desktop 78 | jsr PrepareScrBuf 79 | lda #%00001111 80 | sta DriveSprites 81 | ; Paints non-top windows 82 | lda VisibleWindows 83 | beq ++ 84 | sta window_counter 85 | dec window_counter 86 | beq + 87 | - ldx window_counter 88 | lda WndPriorityList,x 89 | sta Param 90 | jsr SelectWindow 91 | lda WindowBits 92 | and #BIT_WND_ISMINIMIZED 93 | beq is_visible 94 | jmp next_wnd 95 | is_visible jsr UpdateDrvSprites 96 | jsr GetWndAddrInBuf 97 | lda #0 98 | sta Param 99 | jsr PaintWndToBuf 100 | next_wnd dec window_counter 101 | bne - 102 | + ; Consider top window 103 | lda WndPriorityList 104 | sta Param 105 | jsr SelectWindow 106 | lda WindowBits 107 | and #BIT_WND_ISMINIMIZED 108 | beq + 109 | jmp ++ 110 | + jsr UpdateDrvSprites 111 | ; Paint top window 112 | lda #1 113 | sta Param 114 | jsr GetWndAddrInBuf 115 | jsr PaintWndToBuf 116 | ++ ; And paint buffer to screen 117 | lda #SCRMEM 120 | sta $fc 121 | jsr BufToScreen 122 | ; Redraw current window 123 | jmp PaintCurWindow 124 | 125 | ; Finds window which is clicked on (NOT! curr wnd) 126 | ; Returns wnd handle in res. Has wnd addr in $FB 127 | ; Uses dummy 128 | WindowFromPos ; Only if 2 or more alloced 129 | lda AllocedWindows 130 | and #%11111110 131 | bne + 132 | lda #$ff 133 | sta res 134 | rts 135 | + ; Skip through non-top windows 136 | ldx #1 137 | - lda WndPriorityList,x 138 | sta dummy 139 | asl 140 | asl 141 | asl 142 | asl 143 | sta $fb 144 | lda #>WND_HEAP 145 | sta $fc 146 | jsr IsInWnd 147 | lda res 148 | bne + 149 | inx 150 | cpx AllocedWindows 151 | bcs ++ 152 | jmp - 153 | + ; Put wnd handle in res 154 | lda dummy 155 | sta res 156 | rts 157 | ++ lda #$ff 158 | sta res 159 | rts 160 | 161 | ; Checks if mouse is in window pointed to by $FBFC in wnd heap 162 | ; Expects MouseInfo filled 163 | IsInWnd lda #0 164 | sta res 165 | ldy #WNDSTRUCT_POSX 166 | lda MouseInfo 167 | cmp ($fb),y 168 | bcc + 169 | sec 170 | sbc ($fb),y 171 | ldy #WNDSTRUCT_WIDTH 172 | cmp ($fb),y 173 | bcs + 174 | 175 | ldy #WNDSTRUCT_POSY 176 | lda MouseInfo+1 177 | cmp ($fb),y 178 | bcc + 179 | sec 180 | sbc ($fb),y 181 | ldy #WNDSTRUCT_HEIGHT 182 | cmp ($fb),y 183 | bcs + 184 | lda #1 185 | sta res 186 | + rts 187 | 188 | ; Expects mouse in cur wnd 189 | IsInTitleBar lda #0 190 | sta res 191 | lda WindowPosY 192 | cmp MouseInfo+1 193 | bne + 194 | lda #1 195 | sta res 196 | + rts 197 | 198 | IsInCurWnd lda #0 199 | sta res 200 | ; Check if there is any window at all 201 | lda VisibleWindows 202 | beq + 203 | ; Here we go 204 | lda MouseInfo 205 | cmp WindowPosX 206 | bcc + 207 | sec 208 | sbc WindowPosX 209 | cmp WindowWidth 210 | bcs + 211 | ; 212 | lda MouseInfo+1 213 | cmp WindowPosY 214 | bcc + 215 | sec 216 | sbc WindowPosY 217 | cmp WindowHeight 218 | bcs + 219 | ; 220 | lda #1 221 | sta res 222 | + rts 223 | 224 | ; Writes scr/clr buf positions of cur control to $fdfe/$0203 225 | ; Expects ControlPosX, ControlPosY filled 226 | GetCtrlBufPos lda WndAddressInBuf 227 | sta $fd 228 | lda WndAddressInBuf+1 229 | sta $fe 230 | jsr AddBufWidthToFD 231 | ;+AddByteToFD BufWidth 232 | lda WindowBits 233 | and #BIT_WND_HASMENU 234 | beq + 235 | jsr AddBufWidthToFD 236 | ;+AddByteToFD BufWidth 237 | + lda $fd 238 | sta $02 239 | lda $fe 240 | clc 241 | adc #4 242 | sta $03 243 | ldx ControlPosY 244 | beq + 245 | dex 246 | - jsr AddBufWidthToFD 247 | ;+AddByteToFD BufWidth 248 | jsr AddBufWidthTo02 249 | ;+AddByteTo02 BufWidth 250 | dex 251 | bpl - 252 | + lda ControlPosX 253 | jsr AddToFD 254 | lda ControlPosX 255 | jmp AddTo02 256 | 257 | ; Fills MousePosInWndX/Y 258 | ; It's the mouse pos relative to the area in which controls can be placed 259 | GetMousePosInWnd 260 | jsr GetMouseInfo 261 | ; Convert to wnd coords 262 | lda MouseInfo 263 | sec 264 | sbc WindowPosX 265 | sta MousePosInWndX 266 | lda MouseInfo+1 267 | sec 268 | sbc WindowPosY 269 | sta MousePosInWndY 270 | ; Subtract title bar 271 | dec MousePosInWndY 272 | ; Care for menu 273 | lda WindowBits 274 | and #BIT_WND_HASMENU 275 | beq + 276 | dec MousePosInWndY 277 | + rts -------------------------------------------------------------------------------- /Code/v1.0/chars26.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Code/v1.0/chars26.bin -------------------------------------------------------------------------------- /Code/v1.81/Data.asm: -------------------------------------------------------------------------------- 1 | CurDeviceInd !byte 0; 0 for drive A, 1 for drive B 2 | CurDeviceNo !byte 8 3 | ;------------------------------- 4 | bTooltipOn !byte 0 5 | dummy !byte 0,0 6 | Param !byte 0,0 7 | Clock !byte 0,0,0,0 8 | MayShowClock !byte 1 9 | StartBtnPushed !byte 0 10 | MenuItem !byte 0 11 | OldMenuItem !byte 255 12 | MayHighlight !byte 0 13 | MouseInfo !byte 0,0,0,0,0;MouseInfo: xScr,yScr,x,y,xHiByte 14 | ProgramMode !byte PM_NORMAL; 0: normal, 1: menu, 255: dialog 15 | exit_code !byte 0 16 | res !byte 0 ;return value for various functions 17 | DialogResult !byte 0 18 | ModalAddress !byte 0,0 19 | MapWidth !byte 0 20 | MapHeight !byte 0 21 | GapFrom !byte 0 22 | GapTo !byte 0 23 | WndAddressInBuf !byte 0,0 24 | BufWidth !byte 0 25 | BufHeight !byte 0 26 | CurrentCursor !byte 0 27 | Point !byte 0,0 28 | MousePosInWndX !byte 0 29 | MousePosInWndY !byte 0 30 | StringWidth !byte 0 31 | StringHeight !byte 0 32 | ControlPressed !byte 0 33 | ; Copy info -------------------- 34 | CanCopy !byte 0 35 | IsCut !byte 0 36 | DiskToCopyFrom !byte 0,0 ;DevNo, Ind 37 | DiskToCopyTo !byte 0,0 ;DevNo, Ind 38 | ; FileName is in Str_FileName 39 | FileSizeHex !byte 0,0 40 | ; Task bar --------------------- 41 | TaskBtnPos !byte 0 42 | TaskBtnWidth !byte 0 43 | TaskBtnPressed !byte 0 44 | ;---- Window dragging----------- 45 | MayDragWnd !byte 0 46 | IsWndDragging !byte 0 47 | DragType !byte 0 48 | DragWndAnchorX !byte 0 49 | DragWndAnchorY !byte 0 50 | OldPosX !byte 0 51 | NewPosX !byte 0 52 | NewPosY !byte 0 53 | NewHeight !byte 0 54 | ;---- Changable values -------- 55 | CSTM_ActiveClr !byte CL_ORANGE 56 | CSTM_DeactiveClr!byte CL_MIDGRAY 57 | CSTM_SelectClr !byte CL_LIGHTGREEN 58 | CSTM_MenuSelClr !byte CL_MIDGRAY 59 | CSTM_WindowClr !byte CL_LIGHTGRAY 60 | CSTM_DesktopClr !byte CL_LIGHTBLUE 61 | CSTM_DeskPattern!byte 0; 0 for solid, 1 for dotted 62 | ;---- Window data ------------- 63 | WindowOnHeap !byte 0,0 64 | ; Complete window struct for current window 65 | CurrentWindow !byte 255 ; Index/handle of current window (0-15) 66 | WindowType !byte 0 67 | WindowBitsEx !byte 0; see constants for documentation 68 | WindowBits !byte 0; see constants for documentation 69 | WindowPosX !byte 0 70 | WindowPosY !byte 0 71 | WindowWidth !byte 0 72 | WindowHeight !byte 0 73 | WindowTitleStr !byte 0,0 74 | WindowCtrlPtr !byte 0,0 75 | WindowNumCtrls !byte 0 76 | WindowFocCtrl !byte 0 77 | WindowProc !byte 0,0 78 | ;------------------------------ 79 | AllocedWindows !byte 0 80 | MinableWindows !byte 0 81 | VisibleWindows !byte 0 82 | ;------------------------------ 83 | window_counter !byte 0 84 | control_counter !byte 0 85 | ;---- Control data ------------ 86 | ControlOnHeap !byte 0,0 87 | ; Complete control struct for current control 88 | ControlIndex !byte 0 89 | ControlType !byte 0 90 | ControlColor !byte 0 91 | ControlPosX !byte 0 92 | ControlPosY !byte 0 93 | ControlWidth !byte 0 94 | ControlHeight !byte 0 95 | ControlBits !byte 0; see constants for documentation 96 | ControlHilIndex !byte 0 97 | ControlTopIndex !byte 0 98 | ControlNumStr !byte 0 99 | ControlStrings !byte 0,0 100 | ControlID !byte 0 101 | ControlBitsEx !byte 0; see constants for documentation 102 | ;------------------------------ 103 | ; Menu info 104 | CurrentMenu !byte 0,0 ; ptr to cur menu 105 | CurMenuType !byte 0 106 | CurMenuID !byte 0 107 | CurMenuPosX !byte 0 108 | CurMenuPosY !byte 0 109 | CurMenuWidth !byte 0 110 | CurMenuHeight !byte 0 111 | CurMenuItem !byte $ff 112 | ;------------------------------ 113 | EofWndHeap !word WND_HEAP ; next free address on window heap 114 | EofCtrlsHeap !word CONTROL_HEAP ; next free address on controls heap 115 | ;------------------------------ 116 | ; Tables 117 | WndPriorityList !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 118 | WndDefWidth !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 119 | WndDefHeight !byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 120 | ScrTabLo !byte $00,$28,$50,$78,$a0,$c8,$f0,$18,$40,$68,$90,$b8 121 | !byte $e0,$08,$30,$58,$80,$a8,$d0,$f8,$20,$48,$70,$98,$c0 122 | ScrTabHi !byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 123 | !byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 124 | ClrTabHi !byte $d8,$d8,$d8,$d8,$d8,$d8,$d8,$d9,$d9,$d9,$d9,$d9 125 | !byte $d9,$da,$da,$da,$da,$da,$da,$da,$db,$db,$db,$db,$db 126 | BufScrTabHi !byte $04,$04,$04,$04,$04,$04,$04,$05,$05,$05,$05,$05 127 | !byte $05,$06,$06,$06,$06,$06,$06,$06,$07,$07,$07,$07,$07 128 | BufClrTabHi !byte $d8,$d8,$d8,$d8,$d8,$d8,$d8,$d9,$d9,$d9,$d9,$d9 129 | !byte $d9,$da,$da,$da,$da,$da,$da,$da,$db,$db,$db,$db,$db 130 | TaskBtnWidths !byte 0,11,11,10,7,6,5,4 131 | TaskBtnHandles !byte 0,0,0,0,0,0,0 132 | ; For drives A and B 133 | StringListDrvLo !byte STRING_LIST_DRIVEA, >STRING_LIST_DRIVEB 135 | Str_Title_DrvLo !byte Str_Title_DrvA, >Str_Title_DrvB 137 | BlocksFreeHexLo !byte 0,0 138 | BlocksFreeHexHi !byte 0,0 139 | DiskSizeHexLo !byte 0,0 140 | DiskSizeHexHi !byte 0,0 141 | WriteProtected !byte 0,0 142 | ShowFileSizes !byte 0,0; BIT_EX_CTRL_SHOWSIZES, BIT_EX_CTRL_SHOWSIZES 143 | ShowLowerCase !byte 0,0 144 | Max_Fn_Len_Plus2!byte 0,0; (maximal filename length) + 2 145 | FileListBoxesLo !byte 0,0 146 | FileListBoxesHi !byte 0,0 147 | DrvSymLeft !byte 41,2 148 | DrvSymRight !byte 37,3 149 | DrvSymTop !byte 39,117 150 | DeviceNumbers !byte 8,9 151 | IsDiskDrive !byte 1,1; 0 for non-disk drives (SD2IEC etc.) 152 | IsDiskImage !byte 0,0 153 | DnpEndPosInPath !byte 0,0; if =0, then there is no dnp file in path 154 | PathLength !byte 0,0 155 | NumStrings !byte 0,0 156 | ; DiskInfo 157 | Str_DriveType !pet "0000","0000" 158 | Str_DiskSize !pet "0000","0000" 159 | Str_Occupied !pet "0000","0000" 160 | Str_BlocksFree !pet "1111","1111" 161 | Str_NumFiles !pet "2222","2222" 162 | ;------------------------------ 163 | ; Per device no (0 - 29) 164 | bMayRoot !byte 0,0,0,0,0,0,0,0 ; 0 - 7 not used 165 | !byte 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 166 | ;------------------------------ 167 | ; Custom error strings beyond 1-29 (BASIC errors) 168 | CustomErrorsLO !byte Str_Err_WritProt, >Str_Err_NA 170 | ; Variable strings 171 | Str_FileName !pet "0123456789abcdef",0 172 | Str_FileType !pet "x" 173 | Str_FilenameEdit!pet "0123456789abcdef",0 174 | Str_ImageEdit !pet "0123456789abcdef",0 -------------------------------------------------------------------------------- /Code/v1.81/DialogProcs.asm: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------- 2 | ; Dialog procs 3 | ; 4 | EmptyWndProc rts 5 | 6 | NewFileDlgProc jsr StdWndProc 7 | lda wndParam 8 | cmp #EC_LBTNRELEASE 9 | bne ++ 10 | ; LEFT BUTTON RELEASED 11 | jsr IsInCurControl 12 | bne + 13 | - rts 14 | + lda ControlID 15 | cmp #ID_BTN_OK 16 | bne check_cancel 17 | create_ok ; Pressed "OK" button 18 | +SelectControl 3 19 | lda ControlHilIndex 20 | bmi - 21 | bne + 22 | ; It's a directory 23 | jsr CreateDirectory 24 | jmp chk_create_err 25 | + ; It's an image 26 | jsr CreateImageFile 27 | chk_create_err lda error_code 28 | beq kill 29 | ; Error creating image/folder 30 | jsr KillDialog 31 | jsr InstallIRQ 32 | jmp ShowDiskError 33 | kill jsr KillDialog 34 | jmp ShowDirectory 35 | check_cancel cmp #ID_BTN_CANCEL 36 | bne ++++ 37 | ; Pressed "Cancel" button 38 | jmp CloseDlg 39 | ; 40 | ++ cmp #EC_LBTNPRESS 41 | bne +++ 42 | ; Button pressed (only process ListBox) 43 | jsr IsInCurControl 44 | beq ++++ 45 | lda ControlIndex 46 | cmp #3 47 | bne ++++ 48 | ; Pressed in Images ListBox 49 | ; Adjust size of edit box 50 | jsr ClearImageStr 51 | lda ControlHilIndex 52 | sta dummy 53 | +SelectControl 1 54 | ldx dummy; needed again below 55 | bmi ++++ 56 | bne + 57 | lda #21 58 | sta ControlWidth 59 | lda #0 60 | ldx #16 61 | jsr SetCarretInfo 62 | jmp ++ 63 | + lda #15 64 | sta ControlWidth 65 | lda #0 66 | ldx #12 67 | jsr SetCarretInfo 68 | ++ jsr UpdateControl 69 | ; Place file extension string 70 | ldx dummy 71 | inx 72 | txa 73 | asl 74 | asl 75 | tax 76 | dex 77 | ldy #3 78 | - lda Str_NewFile_Imgs,x 79 | sta Ctrl_NF_ImgType,y 80 | dex 81 | dey 82 | bpl - 83 | jsr PaintCurWindow 84 | jsr WindowToScreen 85 | +++ cmp #EC_KEYPRESS 86 | bne ++++ 87 | lda actkey 88 | cmp #$fc; return 89 | bne ++++ 90 | jmp create_ok 91 | ++++ rts 92 | 93 | DevNoDlgProc jsr StdWndProc 94 | lda wndParam 95 | cmp #EC_LBTNRELEASE 96 | bne +++ 97 | jsr IsInCurControl 98 | beq +++ 99 | lda ControlID 100 | cmp #ID_BTN_OK 101 | bne +++ 102 | ; Pressed "OK" in device number dialog 103 | +SelectControl 1 104 | ldx ControlIndex+CTRLSTRUCT_DIGIT_HI 105 | lda TimesTen,x 106 | sta dummy 107 | lda ControlIndex+CTRLSTRUCT_DIGIT_LO 108 | clc 109 | adc dummy 110 | sta dummy 111 | ; 112 | cmp CurDeviceNo 113 | beq ++ 114 | ; New dev no is different 115 | ldx CurDeviceInd 116 | stx old_dev_ind 117 | sta DeviceNumbers,x 118 | ; 119 | tax 120 | lda #1 121 | sta bMayRoot,x 122 | ; 123 | jsr CloseDlg 124 | ldx old_dev_ind 125 | inx 126 | stx Param 127 | ; If window is open ... 128 | jsr IsWndTypePresent 129 | beq +++ 130 | ; ... update it 131 | stx Param 132 | lda CurrentWindow 133 | sta old_cur_wnd 134 | jsr DeactivateWnd 135 | jsr SelectWindow 136 | jsr ShowDirectory 137 | lda ProgramMode 138 | bmi + 139 | lda old_cur_wnd 140 | sta CurrentWindow 141 | + jmp PaintTaskbar 142 | ++ jmp CloseDlg 143 | +++ rts 144 | 145 | TimesTen !byte 0,10,20 146 | old_dev_ind !byte 0 147 | old_cur_wnd !byte 0 148 | 149 | DiskInfoDlgProc jmp MessageDlgProc 150 | 151 | CopyFileDlgProc jmp StdWndProc 152 | 153 | FormatDlgProc jsr StdWndProc 154 | lda wndParam 155 | cmp #EC_LBTNRELEASE 156 | beq + 157 | cmp #EC_KEYPRESS 158 | bne +++ 159 | lda actkey 160 | cmp #$fc; return 161 | bne +++ 162 | jmp format_ok 163 | + jsr IsInCurControl 164 | beq +++ 165 | lda ControlID 166 | cmp #ID_BTN_OK 167 | bne ++ 168 | format_ok ; "OK" pressed 169 | jsr FormatDisk 170 | jsr KillCurWindow 171 | jsr RepaintAll 172 | lda #PM_NORMAL 173 | sta ProgramMode 174 | lda error_code 175 | beq + 176 | jsr InstallIRQ 177 | jmp ShowDiskError 178 | + jmp ShowDirectory 179 | ++ cmp #ID_BTN_CANCEL 180 | bne +++ 181 | ; "Cancel" pressed 182 | jmp CloseDlg 183 | +++ rts 184 | 185 | RenameDlgProc jsr StdWndProc 186 | lda wndParam 187 | cmp #EC_LBTNRELEASE 188 | beq + 189 | cmp #EC_KEYPRESS 190 | bne ++++ 191 | lda actkey 192 | cmp #$fc; return 193 | bne ++++ 194 | jmp rename_ok 195 | + ; LBTNRELEASE 196 | jsr IsInCurControl 197 | beq ++++ 198 | lda ControlID 199 | cmp #ID_BTN_OK 200 | bne +++ 201 | rename_ok ; "OK" pressed 202 | lda WindowBitsEx 203 | and #BIT_EX_WND_ISDISK 204 | bne ++ 205 | ; Rename file 206 | jsr RenameFile 207 | jmp after 208 | ++ ; Rename disk 209 | jsr RenameDisk 210 | lda error_code 211 | beq after 212 | ; Error rename disk 213 | jsr KillDialog 214 | jsr InstallIRQ 215 | jmp ShowDiskError 216 | after jsr KillDialog 217 | jmp ShowDirectory 218 | +++ cmp #ID_BTN_CANCEL 219 | bne ++++ 220 | jmp CloseDlg 221 | ++++ rts 222 | 223 | KillDialog jsr KillCurWindow 224 | jsr RepaintAll 225 | lda #PM_NORMAL 226 | sta ProgramMode 227 | rts 228 | 229 | MessageDlgProc jsr StdWndProc 230 | lda wndParam 231 | cmp #EC_LBTNRELEASE 232 | bne ++ 233 | jsr IsInCurControl 234 | beq ++ 235 | lda ControlID 236 | cmp #ID_BTN_OK 237 | bne ++ 238 | CloseDlg jsr KillDialog 239 | jsr PaintTaskbar 240 | ++ rts 241 | 242 | ClockDlgProc jsr StdWndProc 243 | lda wndParam 244 | cmp #EC_LBTNRELEASE 245 | bne + 246 | jsr IsInCurControl 247 | beq + 248 | lda ControlID 249 | cmp #ID_BTN_SET 250 | bne + 251 | ; Pressed "Set" in clock dialog 252 | +SelectControl 0 253 | lda ControlIndex+CTRLSTRUCT_DIGIT_HI 254 | sta Clock 255 | lda ControlIndex+CTRLSTRUCT_DIGIT_LO 256 | sta Clock+1 257 | +SelectControl 1 258 | lda ControlIndex+CTRLSTRUCT_DIGIT_HI 259 | sta Clock+2 260 | lda ControlIndex+CTRLSTRUCT_DIGIT_LO 261 | sta Clock+3 262 | jsr SetTOD 263 | jmp CloseDlg 264 | + rts 265 | 266 | YesNoDlgProc jsr StdWndProc 267 | lda wndParam 268 | cmp #EC_LBTNRELEASE 269 | bne +++ 270 | jsr IsInCurControl 271 | beq +++ 272 | lda ControlID 273 | cmp #ID_BTN_YES 274 | bne + 275 | ; Clicked on "Yes" 276 | lda #1 277 | jmp ++ 278 | + cmp #ID_BTN_NO 279 | bne +++ 280 | ; Clicked on "No" 281 | lda #0 282 | ++ sta DialogResult 283 | jsr CloseDlg 284 | jmp (ModalAddress) 285 | +++ rts -------------------------------------------------------------------------------- /Code/v1.81/GUI64.c64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Code/v1.81/GUI64.c64 -------------------------------------------------------------------------------- /Code/v1.81/GUI64.s64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Code/v1.81/GUI64.s64 -------------------------------------------------------------------------------- /Code/v1.81/IRQ.asm: -------------------------------------------------------------------------------- 1 | Old01_irq !byte 0 2 | 3 | RasterIRQ pha 4 | txa 5 | pha 6 | tya 7 | pha 8 | cld 9 | ; 10 | lda $01 11 | sta Old01_irq 12 | lda #$35 13 | sta $01 14 | ; 15 | lda #$ff 16 | sta $d019 17 | lda $d012 18 | cmp #150 19 | bcc L_0 20 | 21 | ;L_150 22 | jsr Highlight 23 | sei 24 | lda #Raster226 27 | sta $ffff 28 | lda #226 29 | sta $d012 30 | cli 31 | return_irq lda Old01_irq 32 | sta $01 33 | pla 34 | tay 35 | pla 36 | tax 37 | pla 38 | rti 39 | 40 | L_0 lda #CL_BLACK 41 | sta BKGCOLOR 42 | jsr MultiColorOff 43 | jsr DisplayClock 44 | lda desktop_d018 45 | sta $d018 46 | jsr Joystick ; in port #2 47 | jsr Mouse ; in port #1 48 | lda #150 49 | sta $d012 50 | jmp return_irq 51 | 52 | taskbar_d018 !byte 0 53 | desktop_d018 !byte 0 54 | dummy_irq !byte 0 55 | 56 | Raster226 pha 57 | txa 58 | pha 59 | tya 60 | pha 61 | cld 62 | ; 63 | lda $01 64 | sta Old01_irq 65 | lda #$35 66 | sta $01 67 | ; 68 | ; Prepare Multicolor 69 | lda $d016 70 | ora #%00010000 71 | tax 72 | ; Prepare char set 73 | lda taskbar_d018 74 | ; Write into registers 75 | nop 76 | nop 77 | sta $d018 78 | stx $d016 79 | ldy CSTM_WindowClr 80 | sty BKGCOLOR 81 | ; Acknowledge IRQ 82 | lda #$ff 83 | sta $d019 84 | ; 85 | lda StartBtnPushed 86 | beq + 87 | jsr DrawSpritesDown 88 | jmp ++ 89 | + jsr DrawSpritesUp 90 | ++ sei 91 | lda #RasterIRQ 94 | sta $ffff 95 | lda #0 96 | sta $d012 97 | cli 98 | ; Process keyboard input 99 | jsr Keyboard 100 | jmp return_irq 101 | 102 | Disable_CIA_IRQ sei 103 | lda #%01111111; Bit 7 sets the value, Bit 0...4 selects the bits to be set 104 | sta $dc0d 105 | sta $dd0d 106 | ; Acknowledge any pending CIA irq 107 | lda $dc0d 108 | lda $dd0d 109 | lda #$ff 110 | sta $d019 111 | cli 112 | rts 113 | 114 | InstallIRQ jsr SetTaskbarColors 115 | jsr PaintTaskbar 116 | lda #1 117 | sta MayShowClock 118 | sei 119 | lda #53 120 | sta $01 121 | lda #RasterIRQ 124 | sta $ffff 125 | ; Raster IRQ at y=0 126 | lda #0 127 | sta $d012 128 | lda $d011 129 | and #%01111111 130 | sta $d011 131 | ; Enable raster IRQ 132 | lda $d01a 133 | ora #%00000001 134 | sta $d01a 135 | cli 136 | rts 137 | 138 | DeinstallIRQ sei 139 | lda #54 ; RAM / IO / Kernal 140 | sta $01 141 | lda #$31 142 | sta $0314 143 | lda #$ea 144 | sta $0315 145 | ; Disable raster IRQ 146 | lda $d01a 147 | and #%11111110 148 | sta $d01a 149 | cli 150 | rts -------------------------------------------------------------------------------- /Code/v1.81/Macros.asm: -------------------------------------------------------------------------------- 1 | !macro EditSetCarretInfo carretpos, max_strlen 2 | lda #carretpos 3 | sta ControlIndex+CTRLSTRUCT_CARRETPOS 4 | lda #max_strlen 5 | sta ControlIndex+CTRLSTRUCT_MAX_STRLEN 6 | jsr UpdateControl 7 | !end 8 | 9 | !macro ShowMessage lo,hi 10 | lda #lo 11 | sta $fb 12 | lda #hi 13 | sta $fc 14 | jsr ShowMessage 15 | !end 16 | 17 | !macro JMPShowMessage lo,hi 18 | lda #lo 19 | sta $fb 20 | lda #hi 21 | sta $fc 22 | jmp ShowMessage 23 | !end 24 | 25 | !macro ShowErrorMsg lo,hi 26 | lda #lo 27 | sta $fb 28 | lda #hi 29 | sta $fc 30 | jsr ShowErrorMsg 31 | !end 32 | 33 | !macro SetCursor cur 34 | lda #cur 35 | sta Param 36 | jsr SetCursor 37 | !end 38 | 39 | !macro MenubarAddMenuList lo, hi 40 | ; Misused struct entries for menu bar 41 | lda #lo 42 | sta ControlPosX 43 | lda #hi 44 | sta ControlPosY 45 | jsr UpdateControl 46 | !end 47 | 48 | !macro ControlSetNumStr byte 49 | lda byte 50 | sta ControlNumStr 51 | jsr UpdateControl 52 | !end 53 | 54 | !macro ControlSetPosXPosY xi,y 55 | lda xi 56 | sta ControlPosX 57 | lda y 58 | sta ControlPosY 59 | jsr UpdateControl 60 | !end 61 | 62 | !macro ControlSetWidthHeight w,h 63 | lda w 64 | sta ControlWidth 65 | lda h 66 | sta ControlHeight 67 | jsr UpdateControl 68 | !end 69 | 70 | !macro ControlSetID id 71 | lda #id 72 | sta ControlID 73 | jsr UpdateControl 74 | !end 75 | 76 | !macro ControlSetColorByte byte 77 | lda byte 78 | sta ControlColor 79 | jsr UpdateControl 80 | !end 81 | 82 | !macro ControlSetColorVal val 83 | lda #val 84 | sta ControlColor 85 | jsr UpdateControl 86 | !end 87 | 88 | !macro ControlSetTopIndex val 89 | lda #val 90 | sta ControlTopIndex 91 | jsr UpdateControl 92 | !end 93 | 94 | !macro ControlSetHilIndexVal val 95 | lda #val 96 | sta ControlHilIndex 97 | jsr UpdateControl 98 | !end 99 | 100 | !macro ControlSetHilIndex byte 101 | lda byte 102 | sta ControlHilIndex 103 | jsr UpdateControl 104 | !end 105 | 106 | !macro ControlSetStringList lo,hi,num 107 | lda #lo 108 | sta ControlStrings 109 | lda #hi 110 | sta ControlStrings+1 111 | lda #num 112 | sta ControlNumStr 113 | jsr UpdateControl 114 | !end 115 | 116 | !macro ControlSetStringListByte lo,hi,b_num 117 | lda #lo 118 | sta ControlStrings 119 | lda #hi 120 | sta ControlStrings+1 121 | lda b_num 122 | sta ControlNumStr 123 | jsr UpdateControl 124 | !end 125 | 126 | !macro ControlSetString lo, hi, ind 127 | lda #lo 128 | sta $02 129 | lda #hi 130 | sta $03 131 | lda #ind 132 | sta Param 133 | jsr SetCtrlString 134 | !end 135 | 136 | !macro SelectControl index 137 | lda #index 138 | jsr SelectControl 139 | !end 140 | 141 | ;!macro SetCurWndAttribute val 142 | ; lda #val 143 | ; sta WindowAttribute 144 | ; jsr UpdateWindow 145 | ;!end 146 | !macro AddBitExToCurWnd val 147 | lda WindowBitsEx 148 | ora #val 149 | sta WindowBitsEx 150 | jsr UpdateWindow 151 | !end 152 | 153 | !macro DelBitExFromCurWnd val 154 | lda #val 155 | eor #%11111111 156 | and WindowBitsEx 157 | sta WindowBitsEx 158 | jsr UpdateWindow 159 | !end 160 | 161 | !macro SetCurWndAttributeByte byte 162 | lda byte 163 | sta WindowAttribute 164 | jsr UpdateWindow 165 | !end 166 | 167 | !macro SetCurWndProc lo, hi 168 | lda #lo 169 | sta WindowProc 170 | lda #hi 171 | sta WindowProc+1 172 | jsr UpdateWindow 173 | !end 174 | 175 | !macro SetCurWndType type 176 | lda #type 177 | sta WindowType 178 | jsr UpdateWindow 179 | !end 180 | 181 | !macro SetCurWndTitle lo, hi 182 | lda #lo 183 | sta WindowTitleStr 184 | lda #hi 185 | sta WindowTitleStr+1 186 | jsr UpdateWindow 187 | !end 188 | 189 | !macro SetCurWndTitleByte lo, hi 190 | lda lo 191 | sta WindowTitleStr 192 | lda hi 193 | sta WindowTitleStr+1 194 | jsr UpdateWindow 195 | !end 196 | 197 | !macro SetCurWndGeometry xi,y,w,h 198 | lda #xi 199 | sta WindowPosX 200 | lda #y 201 | sta WindowPosY 202 | lda #w 203 | sta WindowWidth 204 | lda #h 205 | sta WindowHeight 206 | jsr UpdateWindow 207 | !end 208 | 209 | !macro CreateWindowByData lo, hi 210 | ldx #lo 211 | ldy #hi 212 | stx $fb 213 | sty $fc 214 | jsr CreateWindowByData 215 | !end 216 | 217 | !macro AddControl lo, hi 218 | lda #lo 219 | sta $fb 220 | lda #hi 221 | sta $fc 222 | jsr AddControl 223 | !end 224 | 225 | !macro AddValToFB val 226 | lda $fb 227 | clc 228 | adc #val 229 | sta $fb 230 | bcc .quitme 231 | inc $fc 232 | .quitme 233 | !end 234 | 235 | !macro AddValTo06 val 236 | lda $06 237 | clc 238 | adc #val 239 | sta $06 240 | bcc .quitme 241 | inc $07 242 | .quitme 243 | !end 244 | 245 | !macro AddValTo0c val 246 | lda $0c 247 | clc 248 | adc #val 249 | sta $0c 250 | bcc .quitme 251 | inc $0d 252 | .quitme 253 | !end 254 | 255 | ;!macro SubValFromFB val 256 | ; lda $fb 257 | ; sec 258 | ; sbc #val 259 | ; sta $fb 260 | ; lda $fc 261 | ; sbc #0 262 | ; sta $fc 263 | ;!end 264 | 265 | !macro SubValFromFD val 266 | lda $fd 267 | sec 268 | sbc #val 269 | sta $fd 270 | lda $fe 271 | sbc #0 272 | sta $fe 273 | !end 274 | 275 | !macro AddValToFD val 276 | lda $fd 277 | clc 278 | adc #val 279 | sta $fd 280 | bcc .quitme 281 | inc $fe 282 | .quitme 283 | !end 284 | 285 | !macro AddByteTo02 ByteInAddr 286 | lda $02 287 | clc 288 | adc ByteInAddr 289 | sta $02 290 | bcc .quitme 291 | inc $03 292 | .quitme 293 | !end 294 | 295 | !macro AddByteTo04 ByteInAddr 296 | lda $04 297 | clc 298 | adc ByteInAddr 299 | sta $04 300 | bcc .quitme 301 | inc $05 302 | .quitme 303 | !end 304 | 305 | !macro AddValTo02 val 306 | lda $02 307 | clc 308 | adc #val 309 | sta $02 310 | bcc .quitme 311 | inc $03 312 | .quitme 313 | !end 314 | 315 | !macro AddByteToFB ByteInAddr 316 | lda $fb 317 | clc 318 | adc ByteInAddr 319 | sta $fb 320 | bcc .quitme 321 | inc $fc 322 | .quitme 323 | !end 324 | 325 | !macro AddByteToFD ByteInAddr 326 | lda $fd 327 | clc 328 | adc ByteInAddr 329 | sta $fd 330 | bcc .quitme 331 | inc $fe 332 | .quitme 333 | !end 334 | 335 | !macro AddWordToFB lo,hi 336 | lda $fb 337 | clc 338 | adc lo 339 | sta $fb 340 | lda $fc 341 | adc hi 342 | sta $fc 343 | !end 344 | 345 | !macro AddWordToFD lo,hi 346 | lda $fd 347 | clc 348 | adc lo 349 | sta $fd 350 | lda $fe 351 | adc hi 352 | sta $fe 353 | !end 354 | 355 | !macro txy 356 | pha 357 | txa 358 | tay 359 | pla 360 | !end -------------------------------------------------------------------------------- /Code/v1.81/Math.asm: -------------------------------------------------------------------------------- 1 | ; Divides FD by FC 2 | ; Result: FD with fractional part in FE 3 | DivideFDbyFC ASL $FD 4 | LDA #$00 5 | ROL 6 | 7 | LDX #$08 8 | - CMP $FC 9 | BCC + 10 | SBC $FC 11 | + ROL $FD 12 | ROL 13 | DEX 14 | BNE - 15 | 16 | LDX #$08 17 | - BCS + 18 | CMP $FC 19 | BCC ++ 20 | + SBC $FC 21 | SEC 22 | ++ ROL $FE 23 | ASL 24 | DEX 25 | BNE - 26 | 27 | rts 28 | 29 | ; Multiplies FD with FE 30 | ; Result in A (hi byte) and X (lo byte) 31 | MultiplyFDbyFE lda #$00 32 | ldx #$08 33 | clc 34 | - bcc + 35 | clc 36 | adc $fe 37 | + ror 38 | ror $fd 39 | dex 40 | bpl - 41 | ldx $fd 42 | rts 43 | 44 | multiplier = $f7 ; $f8 45 | multiplicand = $f9 ; $fa 46 | product = $fb ; $fc, $fd, $fe 47 | 48 | Mult16 lda #$00 49 | sta product+2 ; clear upper bits of product 50 | sta product+3 51 | ldx #$10 ; set binary count to 16 52 | shift_r lsr multiplier+1 ; divide multiplier by 2 53 | ror multiplier 54 | bcc rotate_r 55 | lda product+2 ; get upper half of product and add multiplicand 56 | clc 57 | adc multiplicand 58 | sta product+2 59 | lda product+3 60 | adc multiplicand+1 61 | rotate_r ror ; rotate partial product 62 | sta product+3 63 | ror product+2 64 | ror product+1 65 | ror product 66 | dex 67 | bne shift_r 68 | rts 69 | 70 | ; divident / divisor 71 | divisor = $58 ;$59 used for hi-byte 72 | dividend = $fb ;$fc used for hi-byte 73 | remainder = $fd ;$fe used for hi-byte 74 | result = dividend ;save memory by reusing divident to store the result 75 | 76 | ; Divides $FB/FC by $58/59 77 | ; Result in divident = $FBFC 78 | Divide16Bit lda #0 ;preset remainder to 0 79 | sta remainder 80 | sta remainder+1 81 | ldx #16 ;repeat for each bit: ... 82 | 83 | divloop asl dividend ;dividend lb & hb*2, msb -> Carry 84 | rol dividend+1 85 | rol remainder ;remainder lb & hb * 2 + msb from carry 86 | rol remainder+1 87 | lda remainder 88 | sec 89 | sbc divisor ;subtract divisor to see if it fits in 90 | tay ;lb result -> Y, for we may need it later 91 | lda remainder+1 92 | sbc divisor+1 93 | bcc skip ;if carry=0 then divisor didn't fit in yet 94 | 95 | sta remainder+1 ;else save substraction result as new remainder, 96 | sty remainder 97 | inc result ;and INCrement result cause divisor fit in 1 times 98 | 99 | skip dex 100 | bne divloop 101 | rts -------------------------------------------------------------------------------- /Code/v1.81/MemoryManagement.asm: -------------------------------------------------------------------------------- 1 | ; Structure of FREMEM: 2 | ; FREMEM_HEAD ($xxff): number of entries (1 byte) 3 | ; FREMEM_HEAD+1: 16 memory addresses 4 | ; FREMEM: data 5 | 6 | EofFrememHeap !byte 0,0 7 | 8 | ; Allocates a new memory block 9 | ; Param: how many bytes 10 | AllocMemory ldy FREMEM_HEAD 11 | cpy #16 12 | bcc + 13 | rts 14 | + tya 15 | asl 16 | tay 17 | lda #<(FREMEM_HEAD+1) 18 | sta $fb 19 | lda #>(FREMEM_HEAD+1) 20 | sta $fc 21 | lda EofFrememHeap 22 | sta ($fb),y 23 | iny 24 | lda EofFrememHeap+1 25 | sta ($fb),y 26 | ; 27 | inc FREMEM_HEAD 28 | lda EofFrememHeap 29 | clc 30 | adc Param 31 | sta EofFrememHeap 32 | lda EofFrememHeap+1 33 | adc #0 34 | sta EofFrememHeap+1 35 | rts 36 | 37 | ; 38 | FreeMemory ; 39 | rts -------------------------------------------------------------------------------- /Code/v1.81/MenuFunctions.asm: -------------------------------------------------------------------------------- 1 | ; Expects Param filled with item 2 | SelectMenuItem lda Param 3 | bmi ++ 4 | cmp CurMenuItem 5 | beq ++ 6 | sta CurMenuItem 7 | jsr Menubar_ShowMenu 8 | ; 9 | ldx Param 10 | inx 11 | jsr SelectMenuLine 12 | ldx Param 13 | bne + 14 | jsr SelectMenuLine 15 | + inx 16 | inx 17 | inx 18 | cpx CurMenuHeight 19 | bne ++ 20 | dex 21 | jsr SelectMenuLine 22 | ++ rts 23 | 24 | ; Selects menu line at y pos in X 25 | SelectMenuLine txa 26 | pha 27 | ldy CurMenuPosX 28 | txa 29 | clc 30 | adc CurMenuPosY 31 | tax 32 | jsr PosToClrMem02 33 | ; 34 | ldy CurMenuWidth 35 | dey 36 | lda CSTM_MenuSelClr 37 | - sta ($02),y 38 | dey 39 | bpl - 40 | pla 41 | tax 42 | rts 43 | 44 | ; Expects mouse in cur menu 45 | ; Writes result into res 46 | GetMenuItem jsr GetMouseInfo 47 | lda MouseInfo+1 48 | sec 49 | sbc CurMenuPosY 50 | tax 51 | beq ++ 52 | inx 53 | cpx CurMenuHeight 54 | bne + 55 | dex 56 | + dex 57 | dex 58 | ++ stx res 59 | rts 60 | 61 | IsInCurMenu jsr GetMouseInfo 62 | lda MouseInfo 63 | cmp CurMenuPosX 64 | bcc + 65 | sec 66 | sbc CurMenuPosX 67 | cmp CurMenuWidth 68 | bcs + 69 | lda MouseInfo+1 70 | cmp CurMenuPosY 71 | bcc + 72 | sec 73 | sbc CurMenuPosY 74 | cmp CurMenuHeight 75 | bcs + 76 | lda #1 77 | rts 78 | + lda #0 79 | rts 80 | 81 | ; Expects menu ptr in FBFC 82 | PaintMenuToBuf ldy #0 83 | lda ($fb),y 84 | sta CurMenuID 85 | iny 86 | lda ($fb),y 87 | clc 88 | adc #2 89 | sta BoxWidth 90 | sta BufWidth 91 | sta CurMenuWidth 92 | iny 93 | lda ($fb),y 94 | clc 95 | adc #2 96 | sta BoxHeight 97 | sta BufHeight 98 | sta CurMenuHeight 99 | lda CSTM_WindowClr 100 | sta BoxColor 101 | lda #SCR_BUF 104 | sta $fe 105 | lda #CLR_BUF 108 | sta $03 109 | jsr PaintBoxToFD02; changes FD 110 | ; Fill menu with items 111 | ; 112 | ldx BufWidth 113 | inx 114 | stx dummy 115 | lda #SCR_BUF 120 | adc #0 121 | sta $fe 122 | ; Get number of items in X 123 | ldy #2 124 | lda ($fb),y 125 | tax 126 | ; Set ptr to string list 127 | lda #3 128 | jsr AddToFB 129 | ; Now buf ptr is in FDFE, and string list is in FBFC 130 | - jsr PrintStringLC 131 | ; Y is str len 132 | iny 133 | tya 134 | jsr AddToFB 135 | jsr AddBufWidthToFD 136 | dex 137 | bne - 138 | rts 139 | 140 | ; Paints menu of selected menubar item into 141 | ; buffer 142 | Menubar_ShowMenu 143 | ; Get pointer to menu list 144 | lda ControlPosX 145 | sta $fd 146 | lda ControlPosY 147 | sta $fe 148 | ; Get pointer to menu (in FBFC) 149 | ; 150 | lda ControlHilIndex 151 | asl 152 | tay 153 | lda ($fd),y 154 | sta $fb 155 | sta CurrentMenu 156 | iny 157 | lda ($fd),y 158 | sta $fc 159 | sta CurrentMenu+1 160 | ; Paint menu box to buffer 161 | jsr PaintMenuToBuf 162 | ; Set menu pos on screen ---- 163 | ; 164 | lda WindowPosX 165 | clc 166 | adc offsetL 167 | sta CurMenuPosX 168 | ldx WindowPosY 169 | inx 170 | inx 171 | stx CurMenuPosY 172 | lda #MT_NORMAL 173 | sta CurMenuType 174 | ; Correction if necessary 175 | lda #40 176 | sta dummy 177 | ; check Y 178 | lda CurMenuPosY 179 | clc 180 | adc CurMenuHeight 181 | cmp #23 182 | bcc + 183 | sec 184 | sbc #22 185 | sbc CurMenuPosY 186 | jsr minus 187 | stx CurMenuPosY 188 | lda offsetR 189 | sec 190 | sbc offsetL 191 | tax 192 | inx 193 | stx dummy 194 | txa 195 | clc 196 | adc CurMenuPosX 197 | sta CurMenuPosX 198 | sec 199 | sbc dummy 200 | sta dummy 201 | + ; check X 202 | lda CurMenuPosX 203 | clc 204 | adc CurMenuWidth 205 | cmp #41 206 | bcc + 207 | sbc dummy 208 | sbc CurMenuPosX 209 | jsr minus 210 | txa 211 | sta CurMenuPosX 212 | + ; Bring buffer to screen ---- 213 | ; 214 | ldx CurMenuPosY 215 | ldy CurMenuPosX 216 | jsr PosToScrMemFB 217 | jmp BufToScreen 218 | 219 | ; Expects menubar in local control struct 220 | ; Returns selected menubar index in res 221 | SelMenubarEntry lda ControlStrings 222 | sta $fd 223 | lda ControlStrings+1 224 | sta $fe 225 | lda #0 226 | sta offsetL 227 | ldx #0 228 | ; 229 | - jsr NextString 230 | ldy res 231 | iny 232 | tya 233 | clc 234 | adc offsetL 235 | sta offsetR 236 | ; 237 | lda MousePosInWndX 238 | cmp offsetL 239 | bcc + 240 | lda offsetR 241 | cmp MousePosInWndX 242 | bcc + 243 | ; Mouse is in item X 244 | stx ControlHilIndex 245 | txa 246 | pha 247 | jsr UpdateControl 248 | jsr PaintMenuBar 249 | jsr WindowToScreen 250 | pla 251 | sta res 252 | rts 253 | ; 254 | + ldy res 255 | iny 256 | iny 257 | tya 258 | clc 259 | adc offsetL 260 | sta offsetL 261 | inx 262 | cpx ControlNumStr 263 | bcc - 264 | ; Mouse is not in any item 265 | lda #$ff 266 | sta res 267 | rts -------------------------------------------------------------------------------- /Code/v1.81/NoGUI.asm: -------------------------------------------------------------------------------- 1 | error_codeTo0 lda #0 2 | sta error_code 3 | rts 4 | 5 | CopyBlockFBtoFD ldy #0 6 | - lda ($fb),y 7 | sta ($fd),y 8 | dey 9 | bne - 10 | inc $fc 11 | inc $fe 12 | dex 13 | bne CopyBlockFBtoFD 14 | rts 15 | 16 | ; Puts -A into X 17 | minus eor #%11111111 18 | tax 19 | inx 20 | rts 21 | 22 | ; Adds value in A to FBFC 23 | AddToFB clc 24 | adc $fb 25 | sta $fb 26 | bcc + 27 | inc $fc 28 | + rts 29 | 30 | ; Adds value in A to FDFE 31 | AddToFD clc 32 | adc $fd 33 | sta $fd 34 | bcc + 35 | inc $fe 36 | + rts 37 | 38 | Val !byte 0 39 | SubValFromFD lda $fd 40 | sec 41 | sbc Val 42 | sta $fd 43 | bcs + 44 | dec $fe 45 | + rts 46 | 47 | ; Adds value in A to 0203 48 | AddTo02 clc 49 | adc $02 50 | sta $02 51 | bcc + 52 | inc $03 53 | + rts 54 | 55 | ; Adds BufWidth to FDFE 56 | AddBufWidthToFD lda BufWidth 57 | clc 58 | adc $fd 59 | sta $fd 60 | bcc + 61 | inc $fe 62 | + rts 63 | 64 | ; Adds BufWidth to 0203 65 | AddBufWidthTo02 lda BufWidth 66 | clc 67 | adc $02 68 | sta $02 69 | bcc + 70 | inc $03 71 | + rts 72 | 73 | ;Once called, never changes 74 | SetGlobals ; Install mouse pointer sprites 75 | lda #SCRMEM 103 | sta ScrTabHi,x 104 | lda #>SCR_BUF 105 | sta BufScrTabHi,x 106 | lda #>CLR_BUF 107 | sta BufClrTabHi,x 108 | - lda ScrTabLo,x 109 | clc 110 | adc #40 111 | inx 112 | sta ScrTabLo,x 113 | ; 114 | dex 115 | lda ScrTabHi,x 116 | inx 117 | sta ScrTabHi,x 118 | dex 119 | lda BufScrTabHi,x 120 | inx 121 | sta BufScrTabHi,x 122 | dex 123 | lda BufClrTabHi,x 124 | inx 125 | sta BufClrTabHi,x 126 | bcc + 127 | inc ScrTabHi,x 128 | inc BufScrTabHi,x 129 | inc BufClrTabHi,x 130 | + cpx #24 131 | bcc - 132 | 133 | ; Set initial values 134 | lda #0 135 | sta PATH_A 136 | sta PATH_A+1 137 | sta PATH_B 138 | sta PATH_B+1 139 | sta ProgramMode 140 | sta AllocedWindows 141 | sta VisibleWindows 142 | ; 143 | lda #WND_HEAP 146 | sta EofWndHeap+1 147 | ; 148 | lda #CONTROL_HEAP 151 | sta EofCtrlsHeap+1 152 | rts 153 | 154 | ;--------------------------------------------------------------- 155 | ; TIME FUNCTIONS 156 | ;--------------------------------------------------------------- 157 | 158 | TODInit lda $01 ;Save $01 159 | pha ; on stack 160 | lda #INT_NMI ; 163 | sta $fffb ; 164 | lda #$35 ;Bank out KERNAL 165 | sta $01 ; so new NMI vector is active 166 | 167 | lda #0 168 | sta $d011 ;Turn off display to disable badlines 169 | sta $dc0e ;Set TOD Clock Frequency to 60Hz 170 | sta $dc0f ;Enable Set-TOD-Clock 171 | sta $dc0b ;Set TOD-Clock to 0 (hours) 172 | sta $dc0a ;- (minutes) 173 | sta $dc09 ;- (seconds) 174 | sta $dc08 ;- (deciseconds) 175 | 176 | lda $dc08 ; 177 | - cmp $dc08 ;Sync raster to TOD Clock Frequency 178 | beq - 179 | 180 | ldx #0 ;Prep X and Y for 16 bit 181 | ldy #0 ; counter operation 182 | lda $dc08 ;Read deciseconds 183 | - inx ;2 -+ 184 | bne + ;2/3 | Do 16 bit count up on 185 | iny ;2 | X(lo) and Y(hi) regs in a 186 | jmp ++ ;3 | fixed cycle manner 187 | + nop ;2 | 188 | nop ;2 -+ 189 | ++ cmp $dc08 ;4 - Did 1 decisecond pass? 190 | beq - ;3 - If not, loop-di-doop 191 | ;Each loop = 16 cycles 192 | ;If less than 118230 cycles passed, TOD is 193 | ;clocked at 60Hz. If 118230 or more cycles 194 | ;passed, TOD is clocked at 50Hz. 195 | ;It might be a good idea to account for a bit 196 | ;of slack and since every loop is 16 cycles, 197 | ;28*256 loops = 114688 cycles, which seems to be 198 | ;acceptable. That means we need to check for 199 | ;a Y value of 28. 200 | 201 | cpy #28 ;Did 114688 cycles or less go by? 202 | bcc + ;- Then we already have correct 60Hz $dc0e value 203 | lda #$80 ;Otherwise, we need to set it to 50Hz 204 | sta $dc0e 205 | + lda #$1b ;Enable the display again 206 | sta $d011 207 | 208 | pla ;Restore old $01 value 209 | sta $01 ; and potentially old NMI vector 210 | rts 211 | INT_NMI rti 212 | 213 | SetTOD lda $dc0f 214 | and #%01111111 215 | sta $dc0f 216 | ; 217 | lda Clock+2 218 | asl 219 | asl 220 | asl 221 | asl 222 | ora Clock+3 223 | sta $dc0a 224 | ; 225 | lda Clock 226 | asl 227 | asl 228 | asl 229 | asl 230 | ora Clock+1 231 | ; 232 | bne + 233 | lda #$92; actually $12 234 | sta $dc0b 235 | jmp ++ 236 | + cmp #$12 237 | bcs + 238 | sta $dc0b 239 | jmp ++ 240 | + bne + 241 | sta $dc0b 242 | jmp ++ 243 | + sed 244 | sec 245 | sbc #$12 246 | cld 247 | ora #%10000000 248 | sta $dc0b 249 | ++ lda #0 250 | sta $dc08 251 | sta $dc09 252 | rts 253 | 254 | DisplayClock lda MayShowClock 255 | beq ++ 256 | lda #':' 257 | sta SCRMEM+23*40+34+2 258 | 259 | lda $dc0a 260 | tax 261 | lsr 262 | lsr 263 | lsr 264 | lsr 265 | sta Clock+2 266 | ora #$30 267 | sta SCRMEM+23*40+37 268 | txa 269 | and #%00001111 270 | sta Clock+3 271 | ora #$30 272 | sta SCRMEM+23*40+38 273 | 274 | lda $dc0b 275 | ldx $dc08 276 | tax 277 | and #%01111111 278 | cmp #$12 279 | bne + 280 | 281 | ; 12 pm = noon or 12 am = midnight 282 | txa 283 | and #%10000000 284 | tax 285 | 286 | + txa 287 | and #%10000000 288 | beq am 289 | ; pm 290 | txa 291 | and #%01111111 292 | sed 293 | clc 294 | adc #$12 295 | cld 296 | tax 297 | jmp + 298 | am txa 299 | and #%01111111 300 | + lsr 301 | lsr 302 | lsr 303 | lsr 304 | sta Clock 305 | ora #$30 306 | sta SCRMEM+23*40+34 307 | txa 308 | and #%00001111 309 | sta Clock+1 310 | ora #$30 311 | sta SCRMEM+23*40+35 312 | ++ rts -------------------------------------------------------------------------------- /Code/v1.81/SettingsWindow.asm: -------------------------------------------------------------------------------- 1 | CreateSettingsWindow 2 | lda #Wnd_Settings 5 | sta $fc 6 | jsr CreateWindow 7 | lda res 8 | bne + 9 | rts 10 | + ldx #5 11 | - txa 12 | jsr SelectControl 13 | lda CSTM_ActiveClr,x 14 | sta ControlColor 15 | jsr UpdateControl 16 | dex 17 | bpl - 18 | ; 19 | +SelectControl 6 20 | +ControlSetStringList Str_Settings_RBG, 2 21 | +ControlSetHilIndex CSTM_DeskPattern 22 | ; 23 | +SelectControl 10 24 | +ControlSetID ID_BTN_APPLY 25 | ; 26 | +SelectControl 11 27 | +ControlSetID ID_BTN_OK 28 | ; 29 | rts 30 | 31 | ; Needs wndParam filled with exit code 32 | SettingsWndProc jsr StdWndProc 33 | ; 34 | lda wndParam 35 | cmp #EC_LBTNRELEASE 36 | beq + 37 | - rts 38 | + jsr IsInCurControl 39 | beq - 40 | ; Mouse button released 41 | lda ControlID 42 | cmp #ID_BTN_OK 43 | bne + 44 | ; "OK" was pressed 45 | jsr ApplySettings 46 | jsr KillCurWindow 47 | jsr RepaintAll 48 | jmp PaintTaskbar 49 | + cmp #ID_BTN_APPLY 50 | bne - 51 | ApplySettings ; "Apply" was pressed 52 | ; Set custom colors (repaints at the end) 53 | lda WindowCtrlPtr 54 | sta $fb 55 | lda WindowCtrlPtr+1 56 | sta $fc 57 | ldx #0 58 | ldy #CTRLSTRUCT_COLOR 59 | - lda ($fb),y 60 | sta CSTM_ActiveClr,x 61 | tya 62 | clc 63 | adc #16 64 | tay 65 | inx 66 | cpx #6 67 | bcc - 68 | ; Set desktop pattern (repaints at the end) 69 | tya 70 | clc 71 | adc #6 72 | tay 73 | lda ($fb),y 74 | sta CSTM_DeskPattern 75 | ; 76 | jsr SetBkgPattern 77 | jmp RepaintAll -------------------------------------------------------------------------------- /Code/v1.81/Sprites.asm: -------------------------------------------------------------------------------- 1 | Mousepointer0 2 | !byte $c0,$00,$00,$a0,$00,$00,$90,$00 3 | !byte $00,$88,$00,$00,$84,$00,$00,$82 4 | !byte $00,$00,$84,$00,$00,$88,$00,$00 5 | !byte $a4,$00,$00,$d4,$00,$00,$12,$00 6 | !byte $00,$0a,$00,$00,$0c,$00,$00,$00 7 | !byte $00,$00,$00,$00,$00,$00,$00,$00 8 | !byte $00,$00,$00,$00,$00,$00,$00,$00 9 | !byte $00,$00,$00,$00,$00,$00,$00,$00 10 | 11 | Mousepointer1 12 | !byte $00,$00,$00,$40,$00,$00,$60,$00 13 | !byte $00,$70,$00,$00,$78,$00,$00,$7c 14 | !byte $00,$00,$78,$00,$00,$70,$00,$00 15 | !byte $58,$00,$00,$08,$00,$00,$0c,$00 16 | !byte $00,$04,$00,$00,$00,$00,$00,$00 17 | !byte $00,$00,$00,$00,$00,$00,$00,$00 18 | !byte $00,$00,$00,$00,$00,$00,$00,$00 19 | !byte $00,$00,$00,$00,$00,$00,$00,$00 20 | 21 | ResizeCursorNWSE0 22 | !byte $fe,$00,$00,$84,$00,$00,$88,$00 23 | !byte $00,$84,$00,$00,$a2,$20,$00,$d1 24 | !byte $60,$00,$88,$a0,$00,$04,$20,$00 25 | !byte $02,$20,$00,$04,$20,$00,$0f,$e0 26 | !byte $00,$00,$00,$00,$00,$00,$00,$00 27 | !byte $00,$00,$00,$00,$00,$00,$00,$00 28 | !byte $00,$00,$00,$00,$00,$00,$00,$00 29 | !byte $00,$00,$00,$00,$00,$00,$00,$00 30 | 31 | ResizeCursorNWSE1 32 | !byte $00,$00,$00,$78,$00,$00,$70,$00 33 | !byte $00,$78,$00,$00,$5c,$00,$00,$0e 34 | !byte $00,$00,$07,$40,$00,$03,$c0,$00 35 | !byte $01,$c0,$00,$03,$c0,$00,$00,$00 36 | !byte $00,$00,$00,$00,$00,$00,$00,$00 37 | !byte $00,$00,$00,$00,$00,$00,$00,$00 38 | !byte $00,$00,$00,$00,$00,$00,$00,$00 39 | !byte $00,$00,$00,$00,$00,$00,$00,$01 40 | 41 | ResizeCursorNS0 42 | !byte $10,$00,$00,$28,$00,$00,$44,$00 43 | !byte $00,$82,$00,$00,$ee,$00,$00,$28 44 | !byte $00,$00,$28,$00,$00,$28,$00,$00 45 | !byte $28,$00,$00,$ee,$00,$00,$82,$00 46 | !byte $00,$44,$00,$00,$28,$00,$00,$10 47 | !byte $00,$00,$00,$00,$00,$00,$00,$00 48 | !byte $00,$00,$00,$00,$00,$00,$00,$00 49 | !byte $00,$00,$00,$00,$00,$00,$00,$00 50 | 51 | ResizeCursorNS1 52 | !byte $00,$00,$00,$10,$00,$00,$38,$00 53 | !byte $00,$7c,$00,$00,$10,$00,$00,$10 54 | !byte $00,$00,$10,$00,$00,$10,$00,$00 55 | !byte $10,$00,$00,$10,$00,$00,$7c,$00 56 | !byte $00,$38,$00,$00,$10,$00,$00,$00 57 | !byte $00,$00,$00,$00,$00,$00,$00,$00 58 | !byte $00,$00,$00,$00,$00,$00,$00,$00 59 | !byte $00,$00,$00,$00,$00,$00,$00,$01 60 | 61 | ResizeCursorWE0 62 | !byte $00,$00,$00,$18,$60,$00,$28,$50 63 | !byte $00,$4f,$c8,$00,$80,$04,$00,$4f 64 | !byte $c8,$00,$28,$50,$00,$18,$60,$00 65 | !byte $00,$00,$00,$00,$00,$00,$00,$00 66 | !byte $00,$00,$00,$00,$00,$00,$00,$00 67 | !byte $00,$00,$00,$00,$00,$00,$00,$00 68 | !byte $00,$00,$00,$00,$00,$00,$00,$00 69 | !byte $00,$00,$00,$00,$00,$00,$00,$00 70 | 71 | ResizeCursorWE1 72 | !byte $00,$00,$00,$00,$00,$00,$10,$20 73 | !byte $00,$30,$30,$00,$7f,$f8,$00,$30 74 | !byte $30,$00,$10,$20,$00,$00,$00,$00 75 | !byte $00,$00,$00,$00,$00,$00,$00,$00 76 | !byte $00,$00,$00,$00,$00,$00,$00,$00 77 | !byte $00,$00,$00,$00,$00,$00,$00,$00 78 | !byte $00,$00,$00,$00,$00,$00,$00,$00 79 | !byte $00,$00,$00,$00,$00,$00,$00,$01 80 | 81 | CarretCursor 82 | !byte $f8,$00,$00,$20,$00,$00,$20,$00 83 | !byte $00,$20,$00,$00,$20,$00,$00,$20 84 | !byte $00,$00,$20,$00,$00,$f8,$00,$00 85 | !byte $00,$00,$00,$00,$00,$00,$00,$00 86 | !byte $00,$00,$00,$00,$00,$00,$00,$00 87 | !byte $00,$00,$00,$00,$00,$00,$00,$00 88 | !byte $00,$00,$00,$00,$00,$00,$00,$00 89 | !byte $00,$00,$00,$00,$00,$00,$00,$00 90 | 91 | StartBtnUL 92 | !byte $ff,$ff,$fc,$80,$00,$00,$80,$00 93 | !byte $00,$80,$00,$00,$80,$00,$00,$80 94 | !byte $00,$00,$80,$00,$00,$80,$00,$00 95 | !byte $80,$00,$00,$80,$00,$00,$80,$00 96 | !byte $00,$80,$00,$00,$80,$00,$00,$80 97 | !byte $00,$00,$80,$00,$00,$80,$00,$00 98 | !byte $80,$00,$00,$80,$00,$00,$00,$00 99 | !byte $00,$00,$00,$00,$00,$00,$00,$01 100 | 101 | StartBtnLR 102 | !byte $00,$00,$00,$00,$00,$04,$00,$00 103 | !byte $04,$00,$00,$04,$00,$00,$04,$00 104 | !byte $00,$04,$00,$00,$04,$00,$00,$04 105 | !byte $00,$00,$04,$00,$00,$04,$00,$00 106 | !byte $04,$00,$00,$04,$00,$00,$04,$00 107 | !byte $00,$04,$00,$00,$04,$00,$00,$04 108 | !byte $00,$00,$04,$00,$00,$04,$ff,$ff 109 | !byte $fc,$00,$00,$00,$00,$00,$00,$00 110 | 111 | Commodore1 112 | !byte $07,$80,$00,$1f,$e0,$00,$3f,$e0 113 | !byte $00,$3c,$60,$00,$78,$1e,$00,$70 114 | !byte $1c,$00,$70,$00,$00,$70,$00,$00 115 | !byte $78,$00,$00,$3c,$60,$00,$3f,$e0 116 | !byte $00,$1f,$e0,$00,$07,$80,$00,$00 117 | !byte $00,$00,$00,$00,$00,$00,$00,$00 118 | !byte $00,$00,$00,$00,$00,$00,$00,$00 119 | !byte $00,$00,$00,$00,$00,$00,$00,$06 120 | 121 | Commodore2 122 | !byte $00,$00,$00,$00,$00,$00,$00,$00 123 | !byte $00,$00,$00,$00,$00,$00,$00,$00 124 | !byte $00,$00,$00,$00,$00,$00,$1c,$00 125 | !byte $00,$1e,$00,$00,$00,$00,$00,$00 126 | !byte $00,$00,$00,$00,$00,$00,$00,$00 127 | !byte $00,$00,$00,$00,$00,$00,$00,$00 128 | !byte $00,$00,$00,$00,$00,$00,$00,$00 129 | !byte $00,$00,$00,$00,$00,$00,$00,$02 130 | 131 | Balken 132 | !byte $00,$00,$00,$00,$00,$00,$00,$00 133 | !byte $00,$00,$00,$00,$00,$00,$00,$ff 134 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 135 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 136 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 137 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 138 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 139 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$00 140 | 141 | BalkenSchmal 142 | !byte $00,$00,$00,$00,$00,$00,$00,$00 143 | !byte $00,$00,$00,$00,$00,$00,$00,$00 144 | !byte $00,$00,$00,$00,$00,$00,$00,$00 145 | !byte $00,$00,$00,$ff,$ff,$ff,$ff,$ff 146 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 147 | !byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff 148 | !byte $ff,$ff,$ff,$00,$00,$00,$00,$00 149 | !byte $00,$00,$00,$00,$00,$00,$00,$00 -------------------------------------------------------------------------------- /Code/v1.81/StdWindowProc.asm: -------------------------------------------------------------------------------- 1 | wndParam !byte 0,0 2 | dumm !byte 0 3 | 4 | ; Needs wndParam filled with exit code 5 | ; and wndParam+1 filled with ProgramMode 6 | StdWndProc jsr GetMousePosInWnd 7 | ; Checks event 8 | lda wndParam 9 | cmp #EC_LBTNPRESS 10 | beq StdW_LBPresProc 11 | cmp #EC_LBTNRELEASE 12 | beq StdW_LBRelProc 13 | cmp #EC_MOUSEMOVE 14 | beq StdW_MMoveProc 15 | cmp #EC_SCROLLWHEELDOWN 16 | beq StdW_ScrWhlProc 17 | cmp #EC_SCROLLWHEELUP 18 | beq StdW_ScrWhlProc 19 | cmp #EC_KEYPRESS 20 | beq StdW_KeyPrsProc 21 | cmp #EC_LLBTNPRESS 22 | beq StdW_LLBtnPress 23 | rts 24 | 25 | StdW_LBPresProc jmp StdWnd_LBPress 26 | StdW_LBRelProc jmp StdWnd_LBRel 27 | StdW_MMoveProc jmp StdWnd_MMove 28 | StdW_ScrWhlProc jmp StdW_ScrolWheel 29 | StdW_KeyPrsProc jmp StdW_KeyPress 30 | StdW_LLBtnPress jmp no_menu 31 | 32 | 33 | StdWnd_LBPress ; Left button pressed 34 | lda wndParam+1 35 | beq Std_ClickInNM 36 | bpl Std_ClickInMM 37 | rts 38 | Std_ClickInNM lda MousePosInWndY 39 | bpl no_menu 40 | ; Clicked in menu bar 41 | +SelectControl 0 42 | jsr SelMenubarEntry 43 | lda res 44 | bmi ++ 45 | jsr Menubar_ShowMenu 46 | lda #PM_MENU 47 | sta ProgramMode 48 | rts 49 | no_menu ; Not in menu bar 50 | jsr GetCtrlFromPos 51 | lda res 52 | bmi ++ 53 | lda ControlIndex 54 | sta WindowFocCtrl 55 | jsr UpdateWindow 56 | lda ControlType 57 | cmp #CT_BUTTON 58 | bne + 59 | lda #1 60 | sta ControlPressed 61 | + jsr ControlsProc 62 | ++ rts 63 | Std_ClickInMM lda ControlType 64 | cmp #CT_MENUBAR 65 | bne + 66 | lda #$ff 67 | sta ControlHilIndex 68 | jsr UpdateControl 69 | jmp ++ 70 | + lda ControlType 71 | cmp #CT_COLORPICKER 72 | bne ++ 73 | jsr ControlsProc 74 | ++ jsr RepaintAll 75 | lda #PM_NORMAL 76 | sta ProgramMode 77 | rts 78 | ;---------------------------------------------- 79 | StdW_ScrolWheel jsr GetCtrlFromPos 80 | lda res 81 | bmi + 82 | jsr SelectControl 83 | jsr ControlsProc 84 | + rts 85 | ;---------------------------------------------- 86 | StdW_KeyPress jmp ControlsProc 87 | ;---------------------------------------------- 88 | StdWnd_LBRel ; Left button released 89 | lda wndParam+1 90 | beq Std_RelInNM 91 | bpl Std_RelInMM 92 | jmp Std_RelInDM 93 | Std_RelInNM lda ControlPressed 94 | bne + 95 | ; No control pressed; 96 | rts 97 | + ; Some control is pressed 98 | lda #0 99 | sta ControlPressed 100 | jmp ControlsProc 101 | Std_RelInMM ; 102 | rts 103 | Std_RelInDM ; 104 | rts 105 | ;---------------------------------------------- 106 | StdWnd_MMove ; Mouse has moved 107 | lda wndParam+1 108 | beq Std_MovInNMDM 109 | bpl Std_MovInMM 110 | 111 | Std_MovInNMDM ; Moved in normal AND dialog mode 112 | lda ControlPressed 113 | beq +++ 114 | ; Control is pressed 115 | jsr IsInCurControl 116 | beq + 117 | ; Is in cur ctrl 118 | lda ControlBits 119 | and #BIT_CTRL_ISPRESSED 120 | bne ++ 121 | ; and not pressed, then press 122 | lda ControlBits 123 | ora #BIT_CTRL_ISPRESSED 124 | sta ControlBits 125 | jsr UpdateControl 126 | jmp ControlsProc 127 | + ; Is not in cur ctrl 128 | lda ControlBits 129 | and #BIT_CTRL_ISPRESSED 130 | beq ++ 131 | ; and pressed, then release 132 | lda #BIT_CTRL_ISPRESSED 133 | eor #%11111111 134 | and ControlBits 135 | sta ControlBits 136 | jsr UpdateControl 137 | jmp ControlsProc 138 | ++ rts 139 | +++ ; Control is not pressed 140 | lda ControlIndex 141 | pha 142 | jsr GetCtrlFromPos 143 | lda res 144 | sta Param 145 | lda ControlType 146 | cmp #CT_EDIT_SL 147 | bne + 148 | jsr IsInCtrlMiddle 149 | beq + 150 | +SetCursor CUR_CARRET 151 | + pla 152 | jmp SelectControl 153 | Std_MovInMM jsr IsInCurMenu 154 | beq ++ 155 | ; In cur menu 156 | lda CurMenuID 157 | cmp #ID_MENU_COLORPICKER 158 | beq + 159 | ; Regular menu 160 | jsr GetMenuItem 161 | lda res 162 | sta Param 163 | jsr SelectMenuItem 164 | + rts 165 | ++ ; Not in cur menu 166 | lda CurMenuItem 167 | bmi + 168 | lda #$ff 169 | sta CurMenuItem 170 | lda CurMenuType 171 | bne + 172 | jsr Menubar_ShowMenu 173 | + rts -------------------------------------------------------------------------------- /Code/v1.81/TaskBar.asm: -------------------------------------------------------------------------------- 1 | ; Paints taskbar during disk access altough IRQ is not running 2 | FakeTaskbar ; Make it solid 3 | lda #0 4 | sta MayShowClock 5 | ldx #39 6 | lda #160 7 | - sta SCRMEM+880+40,x 8 | sta SCRMEM+880+80,x 9 | dex 10 | bpl - 11 | ldx #39 12 | lda #36 13 | - sta SCRMEM+880,x 14 | dex 15 | bpl - 16 | ; Use color CSTM_WindowClr 17 | ldx #39 18 | lda CSTM_WindowClr 19 | - sta CLRMEM+880,x 20 | sta CLRMEM+880+40,x 21 | sta CLRMEM+880+80,x 22 | dex 23 | bpl - 24 | ; Add disk symbol in lower left 25 | ldx #220 26 | stx SCRMEM+880 27 | inx 28 | stx SCRMEM+881 29 | inx 30 | stx SCRMEM+880+40 31 | lda #223 32 | sta SCRMEM+880+41 33 | ldx #237 34 | stx SCRMEM+880+80 35 | inx 36 | stx SCRMEM+880+81 37 | lda #36 38 | sta SCRMEM+880+2 39 | sta SCRMEM+880+39 40 | rts 41 | 42 | ; Add box for motion/progress 43 | FakeTaskbarBox ldx #112 44 | stx SCRMEM+880+3 45 | ldx #37 46 | stx SCRMEM+880+40+3 47 | ldx #113 48 | stx SCRMEM+880+80+3 49 | ldx #115 50 | stx SCRMEM+880+38 51 | ldx #41 52 | stx SCRMEM+880+40+38 53 | ldx #116 54 | stx SCRMEM+880+80+38 55 | ldy #25 56 | ldx #33 57 | - lda #114 58 | sta SCRMEM+880+4,x 59 | tya 60 | sta SCRMEM+880+80+4,x 61 | dex 62 | bpl - 63 | rts 64 | 65 | ; Gets task button index from mouse pos 66 | ; expects mouse in task buttons 67 | ; Return val in res. 68 | ; Returns $ff if there are no minimizable windows 69 | GetTaskBtnIndex lda #$ff 70 | sta res 71 | ldy MinableWindows 72 | beq + 73 | lda TaskBtnWidths,y 74 | sta TaskBtnWidth 75 | lda MouseInfo 76 | sec 77 | sbc #3 78 | sta window_counter 79 | ldx #$ff 80 | - inx 81 | lda window_counter 82 | sec 83 | sbc TaskBtnWidth 84 | sta window_counter 85 | bpl - 86 | cpx MinableWindows 87 | bcs + 88 | stx res 89 | + rts 90 | 91 | ; Gets x-pos of task btn with index in X 92 | ; Requires TaskBtnWidth filled 93 | ; Result in A 94 | GetTaskBtnPos lda #0 95 | dex 96 | bmi + 97 | - clc 98 | adc TaskBtnWidth 99 | dex 100 | bpl - 101 | + clc 102 | adc #3 103 | rts 104 | 105 | SetTaskbarColors 106 | ldx #39 107 | - lda #8 108 | sta $db70,x 109 | sta $db98,x 110 | sta $dbc0,x 111 | dex 112 | bpl - 113 | ; Adjust clock color to hires 114 | ldx #34 115 | lda #0 116 | - sta $db98,x 117 | inx 118 | cpx #39 119 | bcc - 120 | rts 121 | 122 | DrawClockButton ldx #33 123 | lda #98 124 | sta SCRMEM+$370,x 125 | lda #96 126 | sta SCRMEM+$370+40,x 127 | lda #97 128 | sta SCRMEM+$370+80,x 129 | inx 130 | ldy #5 131 | - lda #99 132 | sta SCRMEM+$370,x 133 | lda #101 134 | sta SCRMEM+$370+80,x 135 | inx 136 | dey 137 | bne - 138 | lda #100 139 | sta SCRMEM+$370,x 140 | lda #103 141 | sta SCRMEM+$370+40,x 142 | lda #102 143 | sta SCRMEM+$370+80,x 144 | rts 145 | 146 | tb_index !byte 0 147 | PaintTaskbar ; Paint taskbar without buttons 148 | ldx #32 149 | - lda #95 150 | sta TASKBAR_BUF,x 151 | lda #32 152 | sta TASKBAR_BUF+40,x 153 | sta TASKBAR_BUF+80,x 154 | dex 155 | bpl - 156 | ; Paint task buttons 157 | ldy MinableWindows 158 | beq ++ 159 | lda TaskBtnWidths,y 160 | sta TaskBtnWidth 161 | lda #0 162 | sta window_counter 163 | sta tb_index 164 | sta TaskBtnPos 165 | ; Wait for line 250 to avoid nasty effects 166 | ; with reserved area in char set 167 | - lda $d012 168 | cmp #250 169 | bcc - 170 | - lda #0 171 | ldx window_counter 172 | cpx CurrentWindow 173 | bne + 174 | lda #1 175 | + sta TaskBtnPressed 176 | lda window_counter 177 | sta Param 178 | jsr GetWindowAddr 179 | ldy #WNDSTRUCT_BITS 180 | lda ($fb),y 181 | and #BIT_WND_CANMINIMIZE 182 | beq + 183 | ; Can minimize 184 | ldx tb_index 185 | lda window_counter 186 | sta TaskBtnHandles,x 187 | ldy #WNDSTRUCT_TITLESTRING 188 | lda ($fb),y 189 | sta $fd 190 | iny 191 | lda ($fb),y 192 | sta $fe 193 | jsr PaintTaskBtn 194 | inc tb_index 195 | lda TaskBtnPos 196 | clc 197 | adc TaskBtnWidth 198 | sta TaskBtnPos 199 | + inc window_counter 200 | lda tb_index 201 | cmp MinableWindows 202 | bcc - 203 | ++ ; To screen 204 | ldx #32 205 | - lda TASKBAR_BUF,x 206 | sta SCRMEM+$370,x 207 | lda TASKBAR_BUF+40,x 208 | sta SCRMEM+$370+40,x 209 | lda TASKBAR_BUF+80,x 210 | sta SCRMEM+$370+80,x 211 | dex 212 | bpl - 213 | ; Clock 214 | jmp DrawClockButton 215 | 216 | TB_offset !byte 0 217 | ; Expects TaskBtnPos, TaskBtnWidth, TaskBtnPressed and FDFE filled 218 | ; FDFE contains ptr to string 219 | ; FBFC is ptr to window in wndstruct memory 220 | PaintTaskBtn ldx TaskBtnPos 221 | inx 222 | inx 223 | inx 224 | stx TB_offset 225 | lda TaskBtnPressed 226 | beq ++ 227 | ; Task button is pressed 228 | lda #98 229 | sta TASKBAR_BUF,x 230 | lda #96 231 | sta TASKBAR_BUF+40,x 232 | lda #97 233 | sta TASKBAR_BUF+80,x 234 | inx 235 | ldy TaskBtnWidth 236 | dey 237 | dey 238 | beq + 239 | - lda #99 240 | sta TASKBAR_BUF,x 241 | lda #101 242 | sta TASKBAR_BUF+80,x 243 | inx 244 | dey 245 | bne - 246 | + lda #100 247 | sta TASKBAR_BUF,x 248 | lda #103 249 | sta TASKBAR_BUF+40,x 250 | lda #102 251 | sta TASKBAR_BUF+80,x 252 | jmp DisplayTBString 253 | ++ ; Task button is not pressed 254 | lda #106 255 | sta TASKBAR_BUF,x 256 | lda #104 257 | sta TASKBAR_BUF+40,x 258 | lda #105 259 | sta TASKBAR_BUF+80,x 260 | inx 261 | lda TaskBtnWidth 262 | tay 263 | dey 264 | dey 265 | beq + 266 | - lda #107 267 | sta TASKBAR_BUF,x 268 | lda #109 269 | sta TASKBAR_BUF+80,x 270 | inx 271 | dey 272 | bne - 273 | + lda #108 274 | sta TASKBAR_BUF,x 275 | lda #111 276 | sta TASKBAR_BUF+40,x 277 | lda #110 278 | sta TASKBAR_BUF+80,x 279 | DisplayTBString jsr IsDriveWindow 280 | sta Param+1 281 | ; Adjust colors 282 | ; HiRes for text 283 | lda #$99 284 | clc 285 | adc TB_offset 286 | sta $fb 287 | lda #$db 288 | sta $fc 289 | ldy TaskBtnWidth 290 | dey 291 | dey 292 | dey 293 | lda #0 294 | - sta ($fb),y 295 | dey 296 | bpl - 297 | ; Multicolor for edges 298 | lda #$98 299 | clc 300 | adc TB_offset 301 | sta $fb 302 | lda #$db 303 | sta $fc 304 | ldy #0 305 | lda #9 306 | sta ($fb),y 307 | ldy TaskBtnWidth 308 | dey 309 | sta ($fb),y 310 | ; Print string 311 | lda $fe 312 | bmi + 313 | lda #<(TASKBAR_BUF+41) 314 | sta $fb 315 | lda #>(TASKBAR_BUF+41) 316 | sta $fc 317 | lda TB_offset 318 | jsr AddToFB 319 | ldx TaskBtnWidth 320 | dex 321 | dex 322 | stx Param 323 | jsr PrintStrTaskbar 324 | + rts -------------------------------------------------------------------------------- /Code/v1.81/TaskbarChars6.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Code/v1.81/TaskbarChars6.bin -------------------------------------------------------------------------------- /Code/v1.81/ViewerWindow.asm: -------------------------------------------------------------------------------- 1 | ViewerEOF !word 0,0 2 | 3 | ; Creates fileviewer window 4 | CreateViewerWnd lda #WT_FILEVIEW 5 | sta Param 6 | jsr IsWndTypePresent 7 | bne +++ 8 | lda #Wnd_FileViewer 11 | sta $fc 12 | jsr CreateWindow 13 | lda res 14 | beq +++ 15 | ; Menu 16 | +SelectControl 0 17 | +ControlSetStringList Str_ViewMenubar, 1 18 | +MenubarAddMenuList ViewerMenubar 19 | ; File viewer box 20 | +SelectControl 1; 21 | lda #BIT_CTRL_ISMAXIMIZED 22 | ora #BIT_CTRL_UPPERCASE 23 | sta ControlBits 24 | lda #CL_WHITE 25 | sta ControlColor 26 | lda #1 27 | sta ControlIndex+CTRLSTRUCT_ISTEXT 28 | lda #FILEVIEWERBUF_START 31 | sta ControlIndex+CTRLSTRUCT_TOPHI 32 | +ControlSetString FILEVIEWERBUF_START, 0 33 | +++ rts 34 | 35 | ; Needs wndParam filled with exit code 36 | ViewerWndProc jsr StdWndProc 37 | ; 38 | lda wndParam+1 39 | beq ViewerWnd_NM 40 | bmi +; dialog mode 41 | ; In menu mode 42 | lda wndParam 43 | cmp #EC_LBTNPRESS 44 | bne + 45 | ; Mouse btn pressed in MM 46 | jsr IsInCurMenu 47 | beq + 48 | jmp ViewerMenuClicked 49 | + rts 50 | ViewerWnd_NM ; 51 | rts 52 | 53 | ViewerMenuClicked 54 | +SelectControl 1 55 | lda CurMenuItem 56 | cmp #ID_MI_VIEWTEXT_UC 57 | bne + 58 | ; Clicked on "View as text upper case" 59 | lda #1 60 | sta ControlIndex+CTRLSTRUCT_ISTEXT 61 | lda ControlBits 62 | ora #BIT_CTRL_UPPERCASE 63 | sta ControlBits 64 | jmp viewer_update 65 | ; 66 | + cmp #ID_MI_VIEWTEXT_LC 67 | bne + 68 | ; Clicked on "View as text lower case" 69 | lda #1 70 | sta ControlIndex+CTRLSTRUCT_ISTEXT 71 | lda #BIT_CTRL_UPPERCASE 72 | eor #%11111111 73 | and ControlBits 74 | sta ControlBits 75 | viewer_update jsr UpdateControl 76 | jsr PaintCurWindow 77 | jmp WindowToScreen 78 | ; 79 | + cmp #ID_MI_VIEWHEX 80 | bne + 81 | ; Clicked on "View as Hex" 82 | lda #0 83 | sta ControlIndex+CTRLSTRUCT_ISTEXT 84 | jmp viewer_update 85 | ; 86 | + cmp #ID_MI_VIEWCLOSE 87 | bne + 88 | ; Clicked on "Close" 89 | jsr KillCurWindow 90 | jsr RepaintAll 91 | jsr PaintTaskbar 92 | + rts -------------------------------------------------------------------------------- /Code/v1.81/WindowFunctions.asm: -------------------------------------------------------------------------------- 1 | ; Checks whether window in FB is a drive window 2 | ; Output in A and zero flag 3 | IsDriveWindow ldy #WNDSTRUCT_TYPE 4 | lda ($fb),y 5 | cmp #WT_DRIVE_A 6 | beq ++ 7 | cmp #WT_DRIVE_B 8 | beq ++ 9 | lda #0 10 | ++ tay 11 | rts 12 | 13 | ; Minimizes all minimizable windows 14 | MinimizeAll lda CurrentWindow 15 | bmi + 16 | jsr MinimizeCurWnd 17 | jmp MinimizeAll 18 | + rts 19 | 20 | ; Gets current device index (0 or 1), based on current window type 21 | ; Result: Current device index (0 or 1) in both X and CurDeviceInd 22 | GetCurDeviceInd lda #$ff 23 | sta CurDeviceInd 24 | ; 25 | ldx WindowType; 1 or 2 26 | dex 27 | cpx #2 28 | bcs + 29 | stx CurDeviceInd 30 | + rts 31 | 32 | ; Gets current device index and device no 33 | GetCurDeviceNo jsr GetCurDeviceInd 34 | ldx CurDeviceInd 35 | lda DeviceNumbers,x 36 | sta CurDeviceNo 37 | rts 38 | 39 | ; Assumes mouse already in title bar 40 | ; Returns 0 if not; 1 if in close; 2 if in maximize; 3 if in minimize 41 | IsInMinMaxClose lda WindowPosX 42 | clc 43 | adc WindowWidth 44 | tax 45 | ; Check first position 46 | dex 47 | cpx MouseInfo 48 | bne + 49 | lda #1 50 | rts 51 | + ; Check second position 52 | dex 53 | cpx MouseInfo 54 | bne ++ 55 | lda WindowBits 56 | and #BIT_WND_CANMAXIMIZE 57 | beq + 58 | ; Maximize btn pressed 59 | lda #2 60 | rts 61 | + lda WindowBits 62 | and #BIT_WND_CANMINIMIZE 63 | beq +++ 64 | - lda #3 65 | rts 66 | ++ ; Check third position 67 | dex 68 | cpx MouseInfo 69 | bne +++ 70 | lda WindowBits 71 | and #BIT_WND_CANMAXIMIZE 72 | beq +++ 73 | lda WindowBits 74 | and #BIT_WND_CANMINIMIZE 75 | beq +++ 76 | jmp - 77 | +++ lda #0 78 | rts 79 | 80 | ; Writes cur wnd addr in buf to WndAddressInBuf 81 | GetWndAddrInBuf ldx WindowPosY 82 | lda ScrTabLo,x 83 | sta WndAddressInBuf 84 | lda BufScrTabHi,x 85 | sta WndAddressInBuf+1 86 | lda WndAddressInBuf 87 | clc 88 | adc WindowPosX 89 | sta WndAddressInBuf 90 | bcc + 91 | inc WndAddressInBuf+1 92 | + rts 93 | 94 | ; Paints desktop and all windows to buffer 95 | ; and then to screen 96 | RepaintAll ; Set buffer bounds 97 | lda #40 98 | sta BufWidth 99 | lda #22 100 | sta BufHeight 101 | ; Paint desktop 102 | jsr PrepareScrBuf 103 | ; Paints non-top windows 104 | lda VisibleWindows 105 | beq ++ 106 | sta window_counter 107 | dec window_counter 108 | beq + 109 | - ldx window_counter 110 | lda WndPriorityList,x 111 | sta Param 112 | jsr SelectWindow 113 | lda WindowBits 114 | and #BIT_WND_ISMINIMIZED 115 | beq is_visible 116 | jmp next_wnd 117 | is_visible jsr GetWndAddrInBuf 118 | lda #0 119 | jsr PaintWndToBuf 120 | next_wnd dec window_counter 121 | bne - 122 | + ; Consider top window 123 | lda WndPriorityList 124 | sta Param 125 | jsr SelectWindow 126 | lda WindowBits 127 | and #BIT_WND_ISMINIMIZED 128 | beq + 129 | jmp ++ 130 | + ; Paint top window 131 | jsr GetWndAddrInBuf 132 | lda #1 133 | jsr PaintWndToBuf 134 | ++ ; And paint buffer to screen 135 | lda #SCRMEM 138 | sta $fc 139 | jsr BufToScreen 140 | ; Redraw current window 141 | jmp PaintCurWindow 142 | 143 | ; Finds window which is clicked on (NOT! curr wnd) 144 | ; Returns wnd handle in res. Has wnd addr in $FB 145 | ; Uses dummy 146 | WindowFromPos ; Only if 2 or more alloced 147 | lda AllocedWindows 148 | and #%11111110 149 | bne + 150 | lda #$ff 151 | sta res 152 | rts 153 | + ; Skip through non-top windows 154 | ldx #1 155 | - lda WndPriorityList,x 156 | sta dummy 157 | asl 158 | asl 159 | asl 160 | asl 161 | sta $fb 162 | lda #>WND_HEAP 163 | sta $fc 164 | jsr IsInWnd 165 | bne + 166 | inx 167 | cpx AllocedWindows 168 | bcs ++ 169 | jmp - 170 | + ; Put wnd handle in res 171 | lda dummy 172 | sta res 173 | rts 174 | ++ lda #$ff 175 | sta res 176 | rts 177 | 178 | ; Checks if mouse is in window pointed to by $FBFC in wnd heap 179 | ; Expects MouseInfo filled 180 | IsInWnd ldy #WNDSTRUCT_POSX 181 | lda MouseInfo 182 | cmp ($fb),y 183 | bcc + 184 | sec 185 | sbc ($fb),y 186 | ldy #WNDSTRUCT_WIDTH 187 | cmp ($fb),y 188 | bcs + 189 | 190 | ldy #WNDSTRUCT_POSY 191 | lda MouseInfo+1 192 | cmp ($fb),y 193 | bcc + 194 | sec 195 | sbc ($fb),y 196 | ldy #WNDSTRUCT_HEIGHT 197 | cmp ($fb),y 198 | bcs + 199 | lda #1 200 | rts 201 | + lda #0 202 | rts 203 | 204 | ; Expects mouse in cur wnd 205 | IsInTitleBar lda WindowPosY 206 | cmp MouseInfo+1 207 | bne + 208 | lda #1 209 | rts 210 | + lda #0 211 | rts 212 | 213 | ; requires MouseInfo filled 214 | IsInCurWnd ; Check if there is any window at all 215 | lda VisibleWindows 216 | beq + 217 | ; Here we go 218 | lda MouseInfo 219 | sta Point 220 | lda MouseInfo+1 221 | sta Point+1 222 | jmp IsInWndRect 223 | lda #1 224 | rts 225 | + lda #0 226 | rts 227 | 228 | ; Writes scr/clr buf positions of cur control to $fdfe/$0203 229 | ; Expects ControlPosX, ControlPosY filled 230 | GetCtrlBufPos lda WndAddressInBuf 231 | sta $fd 232 | lda WndAddressInBuf+1 233 | sta $fe 234 | jsr AddBufWidthToFD 235 | ;+AddByteToFD BufWidth 236 | lda WindowBits 237 | and #BIT_WND_HASMENU 238 | beq + 239 | jsr AddBufWidthToFD 240 | ;+AddByteToFD BufWidth 241 | + lda $fd 242 | sta $02 243 | lda $fe 244 | clc 245 | adc #4 246 | sta $03 247 | ldx ControlPosY 248 | beq + 249 | dex 250 | - jsr AddBufWidthToFD 251 | ;+AddByteToFD BufWidth 252 | jsr AddBufWidthTo02 253 | ;+AddByteTo02 BufWidth 254 | dex 255 | bpl - 256 | + lda ControlPosX 257 | jsr AddToFD 258 | lda ControlPosX 259 | jmp AddTo02 260 | 261 | ; Fills MousePosInWndX/Y 262 | ; It's the mouse pos relative to the area in which controls can be placed 263 | GetMousePosInWnd 264 | jsr GetMouseInfo 265 | ; Convert to wnd coords 266 | lda MouseInfo 267 | sec 268 | sbc WindowPosX 269 | sta MousePosInWndX 270 | lda MouseInfo+1 271 | sec 272 | sbc WindowPosY 273 | sta MousePosInWndY 274 | ; Subtract title bar 275 | dec MousePosInWndY 276 | ; Care for menu 277 | lda WindowBits 278 | and #BIT_WND_HASMENU 279 | beq + 280 | dec MousePosInWndY 281 | + rts -------------------------------------------------------------------------------- /Code/v1.81/chars39.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/Code/v1.81/chars39.bin -------------------------------------------------------------------------------- /GUI64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebFritzi/GUI64/3e61c0844e9eaa9284857d44e1847c82e2b7a7ce/GUI64.png -------------------------------------------------------------------------------- /GUI64_Documentation.txt: -------------------------------------------------------------------------------- 1 | ************************** 2 | *** GUI64 v1.9 *** 3 | *** Documentation File *** 4 | ************************** 5 | 6 | Developer: Friedrich Philipp (aka WebFritzi) 7 | 8 | 9 | Contents 10 | ======== 11 | 1 Description 12 | 2 Operation 13 | 3 Look and Feel (Visual Design) 14 | 3.1 Changing default values (device numbers, colors, and desktop pattern) 15 | 4 Elements on the Desktop and in the Taskbar 16 | 4.1 Drive Icons 17 | 4.2 Commodore Button 18 | 4.3 Time 19 | 5 Graphical Elements on the Desktop 20 | 5.1 Windows 21 | 5.2 Controls 22 | 6 Functionality 23 | 6.1 Running Programs 24 | 6.2 Opening Directories and Disk Images on SD2IEC Drives 25 | 6.3 Menus 26 | 6.3.1 The Disk Menu 27 | 6.3.2 The File Menu 28 | 6.3.3 The View Menu 29 | 7 Applications 30 | 8 Links 31 | 32 | 33 | 1. Description 34 | ============== 35 | GUI64 is a graphical user interface (GUI) for the C64, first released in November 2024. Although GUI64 may appear to be a standalone operating system, it is just a graphical layer running on top of the C64’s built-in ROM-based operating system, the KERNAL. GUI64 presents files and directories in freely movable windows, allowing for easy file management on floppy disks as well as on disk images stored on SD2IEC devices. 36 | 37 | 38 | 2. Operation 39 | ============ 40 | GUI64 can be operated using a mouse (such as the 1351 or compatible models) connected to Control Port #1, or with a joystick in Control Port #2 (right click with CBM key + fire). To enable support for the mouse wheel — e.g., for scrolling or in up/down controls (see below) — the Micromys adapter must be used. 41 | 42 | 43 | 3. Look and Feel (Visual Design) 44 | ================================ 45 | Visually, GUI64 is inspired by Windows 95-like interfaces. The GUI is window-based, with a taskbar at the bottom of the screen, featuring a "Commodore (CBM) button" embedded on the left and a recessed clock button on the right. The desktop itself is empty except for two drive icons in the upper-left corner, and — unlike other interfaces such as C64 OS or GEOS — does not support placing file icons directly on it. Instead, the desktop serves as a background for windows, which can be freely moved (dragged) and positioned. The custom colors and desktop pattern of GUI64 can be changed in the settings window (see 4.2). 46 | 47 | Unlike GEOS, for example, GUI64 does not use the VIC-II’s bitmap graphics mode, but operates in text mode. GUI64 is therefore character set–based. For instance, windows cannot be moved pixel-perfectly, but are instead aligned to the 8×8-pixel grid of the character display. The desktop consists of 22 rows and 40 columns of characters. 48 | 49 | 3.1 Changing default values (device numbers, colors, and desktop pattern) 50 | The default settings for the custom colors, the desktop pattern, and the device numbers are as follows: 51 | 52 | * Device Numbers: 8 and 9 53 | * Color "Active title bar" : orange (8 = $08) 54 | * Color "Inactive title bar" : mid gray (12 = $0C) 55 | * Color "Selection color": light green (13 = $0D) 56 | * Color "Menu selection color": mid gray (12 = $0C) 57 | * Color "Window color": light gray (15 = $0F) 58 | * Color "Desktop color": light blue (14 = $0E) 59 | * Desktop pattern: solid (0 = $00) 60 | 61 | To change these default values, open GUI64 in a Hex editor on your PC or Mac and look for the following sequence for colors and desktop pattern: "08 0C 0D 0C 0F 0E 00". Change the values as you like and save your GUI64 file for personal use. To change the default device numbers, look for the sequence "27 75 08 09" and change the last two numbers accordingly. 62 | 63 | 64 | 4. Elements on the Desktop and in the Taskbar 65 | ============================================= 66 | 4.1. Drive Icons 67 | By default, the two drive icons are assigned to device numbers 8 and 9, but this can be changed via right-click on the icons. A double-click on a drive icon opens a file browser window, see below. 68 | 69 | 4.2. Commodore Button 70 | Clicking the "Commodore button" opens a menu with two entries: "Settings" and "Reset." Selecting "Reset" returns the user to the familiar BASIC editor of the C64, while clicking "Settings" opens a configuration window where the visual appearance of GUI64 can be customized. 71 | 72 | 4.3. Time 73 | Double-clicking the clock opens a dialog for setting the time. By default, the clock is set to "00:00" when GUI64 starts. In future versions of GUI64, it is planned to support reading the time from the "Ultimate 1541 II" cartridge or from compatible SD2IEC devices. 74 | 75 | 76 | 5. Graphical Elements on the Desktop 77 | ==================================== 78 | 5.1. Windows 79 | The primary graphical elements that convey information in GUI64 are windows. Each window has a title bar at the top, with the window title on the left and various control buttons on the right. One of these buttons is always an X-icon (X) to close the window. If the window supports minimizing or maximizing, corresponding buttons for those actions are also present. A minimized window disappears from the desktop but remains accessible as a button in the taskbar. Clicking this button restores the window to the desktop. This helps keep the desktop organized and clutter-free. 80 | 81 | A special type of window is the dialog. While minimizable windows appear in the taskbar, dialogs cannot be minimized and always retain full focus. This means that user input is restricted to within the dialog window only. 82 | 83 | 5.2. Controls 84 | The graphical elements within windows are called controls. Each of these controls serves a specific function — even if that function is simply displaying text, as is the case with labels (see below). The controls of GUI64 are, in order: 85 | 86 | * Menu bar (always below title bar) 87 | * Button (clickable, with 3D-style effect) 88 | * Listbox (single-line selection list) 89 | * FileListScrollBox (scrollable file list with icons, names, and optional file size) 90 | * Label (single-line, non-editable text) 91 | * Multiline label (multi-line, non-editable text) 92 | * Frame (rectangular border for grouping elements) 93 | * Color Picker (displays menu of 16 colors to choose from) 94 | * Radio Button Group (mutually exclusive options, arranged in a list) 95 | * UpDown (displays numerical values, arrow buttons to change the value) 96 | * Singleline Edit (single-line input box for text entry) 97 | * Progress Bar (single-line box for displaying progress) 98 | * ColorBox Label (combination of a colored box and a label) 99 | * TextViewBox (box displaying non-editable text) 100 | 101 | 102 | 6. Functionality 103 | ================ 104 | GUI64 allows users to work with drives and files. The following drives are detected and supported: Commodore 1541 floppy drive, Commodore 1571 floppy drive, Commodore 1581 floppy drive, and SD2IEC devices. GUI64 may also work with hard drives and other storage devices; however, due to a lack of testing, reliable functionality for these cannot be guaranteed at this time. 105 | 106 | Double-clicking one of the drive icons on the desktop opens a file browser window, which — after loading—displays the contents of the medium (floppy disk, SD2IEC directory, or disk image within an SD2IEC directory). GUI64 can also handle dnp images. Files and directories are listed vertically within the window. Each entry shows the file type (as an icon), the file name, and, optionally, the file size (see the "View Menu" below). Entries can be selected by clicking on them. The list can be scrolled by either using the scrollbar on the right edge or the mouse wheel. 107 | 108 | 6.1 Running Programs 109 | To run programs (equivalent to LOAD"...",x and RUN), a double-click on the corresponding entry in the drive window is required. This will display a progress bar in the taskbar, showing the loading progress. Once the file is loaded into the C64's memory, the file will be executed. To load a pure machine code file, see "Boot" in the File menu. Note: GUI64 will not remain in the background after running a file and has to be loaded back into memory afterwards. 110 | 111 | 6.2 Opening Directories and Disk Images on SD2IEC Drives 112 | When the file browser window displays the contents of a directory on an SD2IEC drive, directories and disk images (if available) will also be shown. Directories are represented by a folder-like icon. A double-click on a directory or disk image initiates a loading process, after which the contents of the selected directory or disk image will be displayed in the browser window. 113 | 114 | 6.3 Menus 115 | Each file browser window in GUI64 has a menu consisting of the entries "Disk," "File," and "View." These menus provide the user with various options for manipulating drives, files, and directories. 116 | 117 | 6.3.1 The Disk Menu 118 | The 'Disk' menu in GUI64 allows users to manipulate floppy disks (or disk images) and view information about the drive at the corresponding device number. It has the following entries: 119 | 120 | Refresh The contents of the disk are reloaded (e.g., after changing the floppy disk) 121 | Device No Opens a dialog for changing the device number 122 | Info Opens a dialog to display information about the disk and the drive 123 | Format Opens a dialog to format the disk 124 | Rename Opens a dialog to rename the disk (currently only for 1541 drives) 125 | Close Closes the window 126 | 127 | 128 | 6.3.2 The File Menu 129 | The 'File' menu of GUI64 allows for copying or 'cutting' files, as well as deleting, renaming, viewing, booting files, and creating disk images. It has the following entries: 130 | 131 | New Opens a dialog to create new disk images (d64, d71, d81) or folders on an SD2IEC drive.* 132 | Cut GUI64 remembers the selected file for 'cutting' 133 | Copy GUI64 remembers the selected file for copying 134 | Paste Pastes the copied or 'cut' file onto the floppy disk, disk image, or into the directory 135 | Delete Opens a dialog to confirm the deletion of the selected file 136 | Rename Opens a dialog to rename the selected file 137 | View Opens a window to view the contents of the selected file in text or hex mode 138 | (currently only rudimentary implementation) 139 | Boot Loads the selected file to the memory address specified in the first two bytes of the file and 140 | instructs the processor to start the code from there (equivalent to LOAD"...",x,1: SYS xxxxx 141 | 142 | * Note: After creating a new image, the corresponding virtual disk needs to be formatted. For this, double click the image, click Format in the Disk menu and choose Full Format. 143 | 144 | 145 | 6.3.3 The View Menu 146 | With the entries in the 'View' menu, the display in the file browser window can be changed: 147 | 148 | File Sizes Displays file sizes in the file browser window (or not) 149 | Lower Case Switches to uppercase and lowercase display (or not) 150 | Sort by Name Sorts the directory and folder list by name 151 | Sort by Type Sorts the directory and folder list by file type 152 | Sort by Size Sorts the directory and folder list by file size 153 | GUI64 Info Opens an 'About' dialog with information about GUI64 154 | 155 | 156 | 7. Applications 157 | =============== 158 | Currently, there are no applications for GUI64. However, after the release of version 2.0, an interface for developers is planned, which will allow for the easy creation of applications for GUI64. 159 | 160 | 161 | 8. Links 162 | ======== 163 | * Github webpage of GUI64: https://github.com/WebFritzi/GUI64 164 | * Playlist about the development progress of GUI64 (YouTube): 165 | 166 | https://www.youtube.com/watch?v=iCAIbygV_Ac&list=PL0MXvn2FofiZXY7OWdk8VMvzWTT8VbzW2&pp=gAQB 167 | 168 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | GUI64 © 2025 by WebFritzi is licensed under CC BY-NC 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc/4.0/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![alt text](https://github.com/WebFritzi/GUI64/blob/main/GUI64.png) 2 | 3 | # GUI64 v1.9 4 | GUI64 is a graphical user interface for the Commodore 64 that allows you to run programs and games, as well as to manage files by cutting, copying, pasting, deleting, and renaming them. It moreover enables you to format and rename disks, browse your folders on your SD2IEC device, and create new disk images and folders. For detailed information on GUI64, check out the C64-Wiki page https://www.c64-wiki.com/wiki/GUI64. 5 | 6 | **Control:**
7 | Mouse in Port #1 (mouse wheel support with adapter Micromys)
8 | Joystick in Port #2 (right click with Commodore key + fire) 9 | 10 | # Binaries 11 | There are currently three options: the first is gui64.crt. This is a cartridge image with which you can enjoy GUI64 right after switching on your computer. The second option is gui64.prg which works great with a Kung Fu Flash cartridge. The third option is gui64.d64. Put in the disk and load GUI64 with 'LOAD"*",8,1'. 12 | 13 | # Code 14 | GUI64 was developed in 6502 assembly code (ACME syntax) with _C64 Studio_ which you can download here:
15 |

https://www.georg-rottensteiner.de/files/C64StudioRelease.zip

16 | To build GUI64, download the files in the "Code" folder and open C64 Studio. In C64 Studio, go to "File->Open->Solution or Project", choose GUI64.c64, and in the next file browser click on "Cancel". The main file is GUI64.asm.

17 | 18 | **Memory map of GUI64 v1.9** 19 | 20 | | Range of memory | Contents | 21 | | :---------------------- | :-------------------------------------- | 22 | | ``$033c - $6500`` | Program code | 23 | | ``$6500 - $6600`` | Path for drive A | 24 | | ``$6600 - $6700`` | Path for drive B | 25 | | ``$6700 - $6800`` | FREEMEM, used, e.g., for copying files | 26 | | ``$6800 - $9800`` | 12 KB free for one single GUI64 app | 27 | | ``$9800 - $9900`` | 16 window structs | 28 | | ``$9900 - $a000`` | 112 control structs | 29 | | ``$a000 - $a370`` | Buffer for desktop data | 30 | | ``$a370 - $a400`` | Buffer for taskbar data | 31 | | ``$a400 - $a800`` | Buffer for color data | 32 | | ``$a800 - $bc00`` | String list for drive A (255 entries) | 33 | | ``$bc00 - $d000`` | String list for drive B (255 entries) | 34 | | **Graphics elements in I/O area** | 35 | | ``$d000 - $d800`` | Char set (desktop) | 36 | | ``$d800 - $e000`` | Sprites (currently - $dbc0) | 37 | | ``$e000 - $e400`` | Char set (taskbar) | 38 | | ``$e400 - $e800`` | Screen memory | 39 | | ``$e800 - $ff00`` | 5.75 KB buffer for file viewer content | 40 | | ``$ff00 - $ffff`` | Jump tables | 41 | 42 | 43 | # Coming in Version 2.0 (Work in Progress) 44 | * File browser: Full implementation of file viewer (menu entry "View" in "File" menu) to examine files in text and hex mode 45 | * File browser: Copy files between SD2IEC directories; maybe even copying files between disks in the same drive via disk swap will be possible as well 46 | 47 | # Future Plans 48 | * Retrieve time from Ultimate 64 and SD2IECs with RealTimeClock 49 | * Application programming interface: program your app for GUI64 50 | 51 | # Thank You 52 | A huge THANK YOU to all the users on http://www.Forum64.de who have supported me in bringing this project to life. I'm truly grateful for their help. 53 | --------------------------------------------------------------------------------