ry755
Active member
Hi!! So I've been playing around with learning Macintosh Programmer's Workshop and 68k assembly, and I'm currently trying to just make a simple hello world application. Yet I can't even get a window to render properly for whatever reason. The application starts but it doesn't display anything. The `TryButton` loop works as expected though, clicking the mouse button causes the application to exit.
This code is based on multiple Macintosh programming books from the 80s (here on page 35 and here on page 65), so I'm pretty confused at to why this doesn't work. Does anyone here know what I'm doing wrong?
Here is the code:
This code is based on multiple Macintosh programming books from the 80s (here on page 35 and here on page 65), so I'm pretty confused at to why this doesn't work. Does anyone here know what I'm doing wrong?
Here is the code:
Code:
include 'Quickdraw.a'
include 'Windows.a'
qd ds QDGlobals
WindowSize dc.w 80,60,290,450
WindowName dc.b 'test'
WindowPtr dc.l 0
main
pea qd.thePort
_InitGraf
_InitFonts
_InitWindows
_InitMenus
_InitCursor
; create a new window
subq #4,sp ; space for the WindowPtr result
clr.l -(sp) ; allocate window record on the heap
pea WindowSize ; coords of window
pea WindowName ; window title
st -(sp) ; make window visible
move #documentProc,-(sp) ; document window
move.l #-1,-(sp) ; put window on top
st -(sp) ; make window have a GoAway box
clr.l -(sp) ; reference value
_NewWindow
; store the window pointer in WindowPtr
lea WindowPtr,a0
move.l (sp)+,(a0)
TryButton
; loop until the mouse button is pressed
_SystemTask
subq #2,sp
_Button
tst.b (sp)+
beq.s TryButton
_ExitToShell
end