diff --git a/Documentation.md b/Documentation.md index d7f156a..750f18c 100644 --- a/Documentation.md +++ b/Documentation.md @@ -3,7 +3,7 @@ WeeGUI WeeGUI is a lightweight library for creating graphical user interfaces in 80 column text mode on the Apple IIe Enhanced and Apple IIc family of computers. It supports both keyboard and mouse controls for your interface. It is designed to take minimal RAM (less than 6k), and can be used from assembly language or Applesoft BASIC programs under ProDOS. WeeGUI installs itself at the top of memory, using an area normally vacant in most BASIC and assembly programs. -You can use WeeGUI as a full-blown user interface system, or as a simple drawing library for ASCII art. Use as much or as little of its features as you wish. WeeGUI tries not to enforce any particular structure or use-case on your program. It is intended to be so easy to use that you'll choose it over rolling your own menuing system for whatever application you're building. +You can use WeeGUI as a full-blown user interface system, or as a simple drawing library for ASCII art. Use as much or as little of its features as you wish. WeeGUI tries not to enforce any particular structure or use-case on your program. It is intended to be so easy to use that you'll choose it over rolling your own menuing system for whatever application you're building. Whether you're building the next ProTERM, or just a quick-and-dirty interface for your Arduino project, WeeGUI can be your go-to library.
@@ -46,7 +46,7 @@ When using assembly language, you can install WeeGUI by loading the *WEEGUI* lib ldx #0 ldy #0 - @0: lda bloadCmdLine,x + @0: lda brunCmdLine,x beq @1 sta $0200,y inx @@ -54,7 +54,7 @@ When using assembly language, you can install WeeGUI by loading the *WEEGUI* lib bra @0 @1: jsr $be03 - bloadCmdLine: + brunCmdLine: .byte "BRUN WEEGUI",$8d,0 @@ -147,7 +147,7 @@ A typical assembly language run loop simply waits for keypresses and responds to ; Respond to keys as needed - jmp runLoop + bra runLoop If you want to support the mouse, WeeGUI has you covered. You just need to add one piece to your run loop: @@ -161,7 +161,7 @@ If you want to support the mouse, WeeGUI has you covered. You just need to add o ; Respond to keys as needed - jmp runLoop + bra runLoop Note the call to *WGPendingViewAction* on each pass through the loop. For the mouse, WeeGUI will make note of actions taken by the user, but won't act until you say so. It is up to your program to call *WGPendingViewAction* periodically to allow WeeGUI to handle these events. diff --git a/Makefile b/Makefile index b0da7de..ec09704 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ PGM=weegui DEMO=asmdemo all: $(DEMO) $(PGM) -#all: $(PGM) + $(DEMO): @PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --start-addr $(ADDRDEMO) -l$(DEMO).lst $(DEMO).s diff --git a/ReadMe.md b/ReadMe.md index bb888a8..726b864 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -2,14 +2,13 @@ Known issues ------------ -- Hitting Reset during a WeeGUI application will leave your Apple II in an unsafe state +- Hitting Reset during a WeeGUI application will leave your Apple II in an unsafe state. - Calling WGEraseView on a view that shares border rendering with other views will require manually redrawing those views. +- ProDOS reports NO BUFFERS AVAILABLE after three successive runs of ASMDEMO. Doing a CAT will restore normal operation. To Do: ------ -- Write sample code -- Update side effects in assembly API - Support for frameless views - Document final memory map - +- Remove references to ORG in docs (except in memory map) diff --git a/asmdemo.s b/asmdemo.s index 354ce31..d509f1b 100644 --- a/asmdemo.s +++ b/asmdemo.s @@ -1,9 +1,9 @@ ; -; guidemo.s +; asmdemo.s ; WeeGUI sample application ; ; Created by Quinn Dunki on 8/15/14. -; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved. +; Copyright (c) 2015 One Girl, One Laptop Productions. All rights reserved. ; @@ -18,17 +18,6 @@ KBD = $c000 KBDSTRB = $c010 -.macro WGCALL16 func,addr - lda #addr - sta PARAM1 - ldx #func - jsr WeeGUI -.endmacro - - -; Sample code main: ; BRUN the GUI library @@ -43,49 +32,19 @@ main: @1: jsr DOSCMD -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Show off some WeeGUI features - - jmp animateRects - - ldx #WGClearScreen - jsr WeeGUI - -keyLoop: - ldx #WGPendingViewAction - jsr WeeGUI - - lda KBD - bpl keyLoop - sta KBDSTRB - - and #%01111111 - cmp #113 - beq keyLoop_quit - - jmp keyLoop - -keyLoop_quit: - ldx #WGExit - jsr WeeGUI - rts - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; animateRects -; Strokes and paints rectangles of many different geometries +; Show off rendering speed with some snazzy rectangle painting ; ; Stack: ; Curr X ; Curr Y ; Curr Width ; Curr Height -animateRects: + ldx #WGClearScreen jsr WeeGUI -animateRectsEven: - +animateRects: lda #38 ; Initialize pha lda #11 @@ -110,7 +69,7 @@ animateRectsEvenLoop: inc sta $0100,x cmp #25 - bcs animateRectsEvenDone + bcs animateRects inx ; Load Width, then modify lda $0100,x @@ -137,7 +96,7 @@ animateRectsEvenLoop: dec sta $0100,x - ldy #'Q'+$80 + ldy #64 ldx #WGFillRect jsr WeeGUI ldx #WGStrokeRect @@ -146,84 +105,10 @@ animateRectsEvenLoop: jsr delayShort jsr delayShort jsr delayShort + jsr checkKbd - jmp animateRectsEvenLoop + bra animateRectsEvenLoop -animateRectsEvenDone: - pla - pla - pla - pla - -animateRectsOdd: - - lda #37 ; Initialize - pha - lda #11 - pha - lda #2 - pha - lda #2 - pha - -animateRectsOddLoop: - ldx #WGClearScreen - jsr WeeGUI - - tsx - inx - lda $0100,x ; Load Height, then modify - sta PARAM3 - inc - inc - sta $0100,x - cmp #25 - bcs animateRectsOddDone - - inx ; Load Width, then modify - lda $0100,x - sta PARAM2 - inc - inc - inc - inc - inc - inc - sta $0100,x - - inx ; Load Y, then modify - lda $0100,x - sta PARAM1 - dec - sta $0100,x - - inx ; Load X, then modify - lda $0100,x - sta PARAM0 - dec - dec - dec - sta $0100,x - - ldy #'Q'+$80 - ldx #WGFillRect - jsr WeeGUI - ldx #WGStrokeRect - jsr WeeGUI - - jsr delayShort - jsr delayShort - jsr delayShort - - jmp animateRectsOddLoop - -animateRectsOddDone: - pla - pla - pla - pla - - jmp animateRectsEven delayShort: ; ~1/30 sec pha @@ -251,34 +136,27 @@ delayShortInner: pla rts -delay: ; ~1 sec - pha - phx - phy +checkKbd: + lda KBD + bpl checkKbdDone + sta KBDSTRB - ldy #$ce ; Loop a bunch -delayOuter: - ldx #$ff -delayInner: - nop - nop - nop - nop - nop - nop - nop - dex - bne delayInner - dey - bne delayOuter + cmp #241 ; 'q' with high bit set + bne checkKbdDone - ply - plx + ldx #WGExit + jsr WeeGUI + pla ; Pull our own frame off the stack... pla + pla + pla + pla ; ...four local variables + return address... + pla + rts ; ...so we can quit to ProDOS from here + +checkKbdDone: rts - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; brunCmdLine: diff --git a/weegui.dsk b/weegui.dsk index f743e78..3e67638 100644 Binary files a/weegui.dsk and b/weegui.dsk differ diff --git a/weegui_backup.dsk b/weegui_backup.dsk new file mode 100644 index 0000000..4c6eb62 Binary files /dev/null and b/weegui_backup.dsk differ